def send_to_analyser(pkt):
if OSPF_LSUpd in pkt:
global pkt_num
pkt_num_field = struct.pack('h', pkt_num % 65535)
pkt_bytes = raw(pkt)
s.sendto(pkt_num_field + pkt_bytes, ('127.0.0.1', 9527))
def packet_capture():
print('[+] Starting sniffing the Link State Update packets of the target network...')
pkts = sniff(filter="proto ospf", iface=veth_list, prn=send_to_analyser)
def test_thread():
for i in range(1,10):
print("test thread " + str(i))
sleep(3)
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
Above is the reduced version of my code, I wanna run packet_capture() and test_thread() in parallel, how could I do that ?