What do Cowrie's logs record, and how do you watch what an attacker did in a session?
cowrie.json records events (connections, login attempts with username and password, commands, downloads) as JSON lines; the full interactive session is stored as a binary TTY log that the playlog tool replays like a recording.
Cowrie keeps two kinds of records:
- Event log (
log/cowrie.json): one JSON object per event, with source IP, session ID, every login attempt with the username and password tried, success or failure, client version, commands entered and file download URLs. It is easy to ship into Elasticsearch or a SIEM.tail -fshows it live during the lab. - TTY logs (
tty/<session-id>): a binary recording of each terminal session, keystroke by keystroke, with timing, including typing mistakes and pauses. They are replayed with:
It is like watching over the attacker's shoulder.python3 ~/cowrie/bin/playlog ~/cowrie/tty/<file>
The lab's simulated attacker runs id (what privileges do I have?), ifconfig (which network am I in?), tries to send /etc/passwd away with ftp, and leaves a message file. This is the typical opening sequence of real intrusions: orient, check privileges, exfiltrate, persist. The most valuable thing to capture is what attackers try to download next (malware, backdoors, rootkits), because the source host and the files become new indicators to block.
Go deeper:
Cowrie: Output Event Code Reference — every event ID in
cowrie.jsonand the fields each one carries.Cowrie documentation — JSON logging, TTY logs and
playlogreplay as the project describes them.Cowrie on GitHub — the source, including
playlogand the output plugins that forward events to a SIEM.