Commit bea076fb authored by Eloy Degen's avatar Eloy Degen

add UDP traffic

parent 4f3b9e4a
......@@ -37,6 +37,22 @@ def insert_db(pkt):
connection.commit()
print(" IP src " + str(ip_src) + " TCP sport " + str(tcp_sport))
print(" IP dst " + str(ip_dst) + " TCP dport " + str(tcp_dport))
if UDP in pkt:
udp_sport=pkt[UDP].sport
udp_dport=pkt[UDP].dport
cursor = connection.cursor()
current_date = datetime.now()
format_string = {
'ip_src': str(ip_src),
'ip_dst': str(ip_dst),
'src_port': str(udp_sport),
'dst_port': str(udp_dport),
'content': "abc",
'rcv_date': current_date.strftime('%Y-%m-%d %H:%M:%S'),
}
query = '''INSERT INTO `detection_app_packet` (`src_ip`, `dst_ip`, `src_port`, `dst_port`, `content`, `rcv_date`) VALUES ("{ip_src}","{ip_dst}","{src_port}","{dst_port}","{content}","{rcv_date}");'''
print(" IP src " + str(ip_src) + " UDP sport " + str(udp_sport))
print(" IP dst " + str(ip_dst) + " UDP dport " + str(udp_dport))
sniff(filter="ip",prn=insert_db, store=0)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment