python - print scapy sniff output to file -


i have created sniffer in scapy , want packets captured scapy written onto file further analysis?

def sniffer(ip):     filter_str = "icmp , host " + ip     packets=sniff(filter=filter_str,count=20)     f = open('log.txt',"a")     #f.write(packets) 

the last line of code not work. there way this?

f.write expects character buffer, supply sniffed object result of calling sniff. can, simply, following:

f.write(str(packets)) 

this should work. won't display information it. going have more work collecting information packets strings before write f.


Comments

Popular posts from this blog

Java sticky instances of class com.mysql.jdbc.Field aggregating -