Files
cowrie/core/ttylog.py
desaster 39c68ce598 A bunch of changes:
* filesystem has a new field A_REALFILE, which can be set to point to a real
  file within dl/ or honeyfs/ for use with cat or tar
* createfs.py update
* Added copyright texts & BSD license
* Command arguments are now parsed with shlex and passed to commands as a list
* new HoneyPotFilesystem methods: mkdir, realfile, update_realfile, is_dir
* New command: reboot
* Improved ls
* A local copy of env.commands is now kept for each session to allow dynamic
  changes
* New commands module: dice - contains random commands assigned to newly
  created files
* Improved tar - pretends to create real files now
* Something else I forgot



git-svn-id: https://kippo.googlecode.com/svn/trunk@34 951d7100-d841-11de-b865-b3884708a8e2
2009-11-20 15:48:45 +00:00

31 lines
915 B
Python

# Copyright (c) 2009 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
# Should be compatible with user mode linux
import struct, sys
OP_OPEN, OP_CLOSE, OP_WRITE, OP_EXEC = 1, 2, 3, 4
DIR_READ, DIR_WRITE = 1, 2
def ttylog_write(logfile, len, direction, stamp, data = None):
f = file(logfile, 'a')
sec, usec = int(stamp), int(1000000 * (stamp - int(stamp)))
f.write(struct.pack('iLiiLL', 3, 0, len, direction, sec, usec))
f.write(data)
f.close()
def ttylog_open(logfile, stamp):
f = file(logfile, 'a')
sec, usec = int(stamp), int(1000000 * (stamp - int(stamp)))
f.write(struct.pack('iLiiLL', 1, 0, 0, 0, sec, usec))
f.close()
def ttylog_close(logfile, stamp):
f = file(logfile, 'a')
sec, usec = int(stamp), int(1000000 * (stamp - int(stamp)))
f.write(struct.pack('iLiiLL', 2, 0, 0, 0, sec, usec))
f.close()
# vim: set sw=4 et: