commit two simple tools to grab packets from robot

This commit is contained in:
oroulet 2018-01-23 08:41:44 +01:00
parent 193577c0ef
commit 51b19de2ec
2 changed files with 37 additions and 0 deletions

14
tools/find_packet.py Normal file
View File

@ -0,0 +1,14 @@
from urx import ursecmon
if __name__ == "__main__":
f = open("packets.bin", "rb")
s = open("packet.bin", "wb")
data = f.read(99999)
parser = ursecmon.ParserUtils()
p, rest = parser.find_first_packet(data)
print(len(p))
p, rest = parser.find_first_packet(rest)
print(len(p))
s.write(p)
p, rest = parser.find_first_packet(rest)
print(len(p))

23
tools/grabber.py Normal file
View File

@ -0,0 +1,23 @@
import socket
import sys
if __name__ == "__main__":
host, port = "localhost", 30002
host, port = "192.168.1.8", 30002
if len(sys.argv) > 1:
host = sys.argv[1]
sock = socket.create_connection((host, port))
f = open("packets.bin", "wb")
try:
# Connect to server and send data
for i in range(0, 20):
data = sock.recv(1024)
f.write(data)
print("Got packet: ", i)
finally:
f.close()
sock.close()