Files
cowrie/utils/convert32.py
desaster e0a478c3b9 Use a common 32bit little-endian format for ttylog. Existing logs on 64bit
systems will be incompatible).

Added a conversion script (convert32.py).


git-svn-id: https://kippo.googlecode.com/svn/trunk@167 951d7100-d841-11de-b865-b3884708a8e2
2010-08-16 16:15:18 +00:00

27 lines
682 B
Python
Executable File

#!/usr/bin/env python
#
# Convert tty logs to a standard 32-bit little-endian format
#
# Example of usage:
#
# ./convert64.py < input.log > output.log
#
# Before doing anything, backing up your old logs is a good idea!
import sys, struct
if __name__ == '__main__':
ssize = struct.calcsize('iLiiLL')
while 1:
try:
(op, tty, length, dir, sec, usec) = \
struct.unpack('iLiiLL', sys.stdin.read(ssize))
data = sys.stdin.read(length)
except struct.error:
break
sys.stdout.write(struct.pack('<iLiiLL',
op, tty, length, dir, sec, usec))
sys.stdout.write(data)
# vim: set sw=4 et: