I've built a webcrawler that uses the HTMLParser lib in Python. It goes on a page, and continues with the next one, linked on the loaded page, etc. It just collects the links. Now I need to protocoll the TCP/IP traffic between the hosts and my PC (packet sniffing). The result should be stored in a file.pcap. I've found an' example that seems to be useful for my purpose. Am I right?
Here the code of the answer I'm interested in:
from scapy.all import wrpcap, Ether, IP, UDP
packet = Ether() / IP(dst="1.2.3.4") / UDP(dport=123)
wrpcap('foo.pcap', [packet])
- Can this code be used for it? 2. If yes, how? 3. As parameters I've just the hostnames, but not dst(ip4-address) and the dport-data. It seems clear that 1.2.3.4 and 123 are just dummies to give an example.