Scapy: callback, no output with pkt.show()

Scapy: callback, no output with pkt.show()

Postby veek » Thu Jul 14, 2016 1:04 pm

Code: Select all
#!/usr/bin/python

import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import TCP, IP, sniff

def ip_callback(pkt):
    pkt.show()
    print 'IP', pkt.src, pkt.sport, '--->', pkt.dst, pkt.dport

def icmp_callback(pkt):
    print pkt.show()

def tcp_callback(pkt):
    pkt.show()
    print 'TCP', pkt.src, pkt.sport, '--->', pkt.dst, pkt.dport

def udp_callback(pkt):
    pkt.show()
    print 'UDP', pkt.src, pkt.sport, '--->', pkt.dst, pkt.dport

print 'hello'
sniff(filter='icmp', iface='ppp0', prn=icmp_callback)

it works flakily - why? ping -c 2 8.8.8.8 doesn't trigger a .show
Last edited by Yoriz on Thu Jul 14, 2016 2:45 pm, edited 1 time in total.
Reason: First post lock. Added code tags.
veek
 
Posts: 2
Joined: Thu Jul 14, 2016 11:58 am

Re: Scapy: callback, no output with pkt.show()

Postby veek » Fri Jul 15, 2016 12:57 am

duh - logging is suppressing it
(umm nope.. what's with this effing module!!) http://storage8.static.itmages.com/i/16 ... a5aac6.png
veek
 
Posts: 2
Joined: Thu Jul 14, 2016 11:58 am


Return to Networking

Who is online

Users browsing this forum: No registered users and 2 guests

cron