I was able to print the data onto the console. But what if i want to store it in a log file.
Here is my code:
def pkt_callback(pkt):
pkt_raw = raw(pkt)
print(" packet received ", pkt_raw)
**logger.info("Packet Received: %s",pkt_raw)**
self.P = sniff(
count = self.c,
filter="dst host %s or src host %s and udp and dport %s" % (self.dst, self.src, self.Port),
prn = pkt_callback
)
I was getting an error at the bolded part as:
ascii' codec can't decode byte 0xff in position 54: ordinal not in range(128)