-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwwivpacket.py
executable file
·40 lines (34 loc) · 1.09 KB
/
wwivpacket.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python3
from struct import *
from time import *
from binascii import *
import sys
showmessage=0
strfile = "S60.NET"
# Defaults to reading S60.NET
if len(sys.argv) > 0:
strfile = sys.argv[1]
strformat = "<HHHHHHHIIH"
def readtest(f):
s=f.tell()
buffer = f.read(24)
tosys,touser,fromsys,fromuser,main_type,minor_type,list_len,daten,length,method=unpack(strformat,buffer)
if list_len > 0:
tolist = f.read(list_len * 2)
buffer = f.read(length)
e=f.tell()
print("chunk start-end: %d-%d/%d date: %s" % (s,e,L,ctime(daten)))
print("from: %d@%d -> %d@%d type: %d.%d length: %d list length: %d method: %d" % (fromuser,fromsys,touser,tosys,main_type,minor_type,length,list_len,method))
if showmessage:
print("Message:")
print(buffer)
print("")
with open(strfile,"br") as f:
print("\npacket name: %s" % (strfile))
f.seek(0,2)
L=f.tell()
f.seek(0)
while f.tell() < L:
readtest(f)
# a=input()
#\nfrom: %d@%d\ntype: %d.%d\nlist_len: %d\ndaten %d\nlength %d\nmethod %d\n" % tosys,touser,fromsys,fromuser,main_type,minor_type,list_len,daten,length,method)