Timestamp enabled
This commit is contained in:
13
wrapper.py
13
wrapper.py
@@ -2,6 +2,7 @@
|
||||
#from ctypes import *
|
||||
import ctypes
|
||||
import _ctypes
|
||||
from datetime import datetime
|
||||
import os
|
||||
|
||||
class LogData(ctypes.Structure):
|
||||
@@ -15,6 +16,7 @@ class LogData(ctypes.Structure):
|
||||
("dst_port", ctypes.c_char_p),
|
||||
("src_port", ctypes.c_char_p),
|
||||
("proto", ctypes.c_char_p),
|
||||
("tstamp", ctypes.c_char_p),
|
||||
("len", ctypes.c_char_p)
|
||||
]
|
||||
|
||||
@@ -86,18 +88,23 @@ def line_process():
|
||||
test_val = "HERRROOOO"
|
||||
|
||||
for line in p_lines:
|
||||
#print(line)
|
||||
print(line)
|
||||
parser_arg = line.encode('utf-8')
|
||||
call_lib = clibrary.line_parse(parser_arg)
|
||||
time_hr = datetime.fromisoformat(call_lib.contents.tstamp.decode('utf-8'))
|
||||
time_hr = time_hr.strftime("%d-%m-%Y %H:%M:%S (%Z)")
|
||||
print("-"*30)
|
||||
print("TSTAMP ",time_hr)
|
||||
print("SRC ",call_lib.contents.src_ip.decode('utf-8'))
|
||||
print("DST ",call_lib.contents.dst_ip.decode('utf-8'))
|
||||
print("LEN ",call_lib.contents.len.decode('utf-8'))
|
||||
|
||||
print("IFACE_IN ",call_lib.contents.iface_in.decode('utf-8'))
|
||||
print("IFACE_OUT ",call_lib.contents.iface_out.decode('utf-8'))
|
||||
#print("Source ",call_lib.contents.src_port.decode('utf-8'))
|
||||
#print("Source ",call_lib.contents.dst_port.decode('utf-8'))
|
||||
print("PROTO ",call_lib.contents.proto.decode('utf-8'))
|
||||
if (call_lib.contents.proto != b"ICMP"):
|
||||
print("SPT ",call_lib.contents.src_port.decode('utf-8'))
|
||||
print("DPT ",call_lib.contents.dst_port.decode('utf-8'))
|
||||
print()
|
||||
#_ctypes.dlclose(call_lib._handle)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user