From 013b37171d352d28a451013987be71ba4456ae60 Mon Sep 17 00:00:00 2001 From: Michel Oosterhof Date: Mon, 11 Jul 2016 19:22:48 +0400 Subject: [PATCH] fully commented --- cowrie/core/ttylog.py | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/cowrie/core/ttylog.py b/cowrie/core/ttylog.py index 92ee9d2b..1cc2ed6f 100644 --- a/cowrie/core/ttylog.py +++ b/cowrie/core/ttylog.py @@ -1,10 +1,10 @@ +# -*- test-case-name: cowrie.test.utils -*- # Copyright (c) 2009-2014 Upi Tamminen # See the COPYRIGHT file for more information -# Should be compatible with user mode linux """ -This module contains ... +Should be compatible with user mode linux """ import struct @@ -12,18 +12,13 @@ import struct OP_OPEN, OP_CLOSE, OP_WRITE, OP_EXEC = 1, 2, 3, 4 TYPE_INPUT, TYPE_OUTPUT, TYPE_INTERACT = 1, 2, 3 -def ttylog_write(logfile, len, direction, stamp, data=None): - """ - """ - with open(logfile, 'ab') as f: - sec, usec = int(stamp), int(1000000 * (stamp - int(stamp))) - f.write(struct.pack('