scapy

iterate through pcap file packet for packet using python/scapy

断了今生、忘了曾经 提交于 2021-02-20 09:08:15
问题 I want to iterate through a pcap file packet for packet using python/scapy. The file has multiple protocols. Current the iteration is protocol-specific, so the iteration makes a "jump" if the next packet is from another protocol. I don't know why it goes like this at the moment. I want packet for packet, no matter what protocol. little example: data = 'new.pcap' zz = rdpcap(data) sessions = zz.sessions() for session in sessions: for packet in sessions[session]: eth_src = packet[Ether].src eth

iterate through pcap file packet for packet using python/scapy

不羁岁月 提交于 2021-02-20 09:04:33
问题 I want to iterate through a pcap file packet for packet using python/scapy. The file has multiple protocols. Current the iteration is protocol-specific, so the iteration makes a "jump" if the next packet is from another protocol. I don't know why it goes like this at the moment. I want packet for packet, no matter what protocol. little example: data = 'new.pcap' zz = rdpcap(data) sessions = zz.sessions() for session in sessions: for packet in sessions[session]: eth_src = packet[Ether].src eth

iterate through pcap file packet for packet using python/scapy

被刻印的时光 ゝ 提交于 2021-02-20 09:03:29
问题 I want to iterate through a pcap file packet for packet using python/scapy. The file has multiple protocols. Current the iteration is protocol-specific, so the iteration makes a "jump" if the next packet is from another protocol. I don't know why it goes like this at the moment. I want packet for packet, no matter what protocol. little example: data = 'new.pcap' zz = rdpcap(data) sessions = zz.sessions() for session in sessions: for packet in sessions[session]: eth_src = packet[Ether].src eth

Unknown pypcap network interface 'eth0' error with python2 scapy on windows 10 machine

有些话、适合烂在心里 提交于 2021-02-11 13:50:12
问题 I am trying to create a simple web monitoring app with scapy(2.4.3), python 2.7 on a windows 10 machine. I also have winpcap(5.0.9983.830) installed. This is the code I am trying to run: def http_header(packet): print packet sniff(iface='eth0', prn=http_header) And this is the error it throws: raise ValueError("Unknown pypcap network interface %r" % pcap_name) ValueError: Unknown pypcap network interface 'eth0' I also installed .Microsoft Visual C++ Compiler for Python 2.7 just to be safe, as

Configure STP protocol via scapy

夙愿已清 提交于 2021-02-11 13:42:00
问题 I need to generate and STP traffic using scapy and when I visualize it via wireshark I get an output similar to the caption shown below: when I run this code: from scapy.all import STP import scapy from scapy.all import * data='STP' sendp(Ether(dst="01:80:c2:00:00:00")/LLC(dsap=0xaa, ssap=0xaa)/STP(bpdutype=0x00, bpduflags=0x01, portid=0x8002)/data, iface="eth1", count=200) this is my wireshark output I don't know how to change the organization code to 00:00:0c, because I believe it's the one

FileNotFoundError: [Errno 2] No such file or directory: b'liblibc.a'

偶尔善良 提交于 2021-02-08 05:56:52
问题 import scapy.all as scapy def scan(ip): scapy.arping(ip) scan("192.168.196.0") Above error when using scapy for arping python version 3.9.1 回答1: cd /usr/lib/x86_64-linux-gnu/ ln -s -f libc.a liblibc.a This creates a symbolic link to accommodate for the renamed file in python 3.9. 来源: https://stackoverflow.com/questions/65410481/filenotfounderror-errno-2-no-such-file-or-directory-bliblibc-a

FileNotFoundError: [Errno 2] No such file or directory: b'liblibc.a'

試著忘記壹切 提交于 2021-02-08 05:55:45
问题 import scapy.all as scapy def scan(ip): scapy.arping(ip) scan("192.168.196.0") Above error when using scapy for arping python version 3.9.1 回答1: cd /usr/lib/x86_64-linux-gnu/ ln -s -f libc.a liblibc.a This creates a symbolic link to accommodate for the renamed file in python 3.9. 来源: https://stackoverflow.com/questions/65410481/filenotfounderror-errno-2-no-such-file-or-directory-bliblibc-a

Specifying packet length with scapy

耗尽温柔 提交于 2021-02-07 17:09:55
问题 I'm trying to send a specific packet size (100 bytes) with scapy but cant seem to get it. I'm using this to start. sr(IP(dst="192.168.1.1")/TCP(dport=443)) Looking at the docs / help I cant tell if I can use PacketLenField to specify the length of the packet. I can do it with NMAP & NSE but would like to do it outside of NMAP. Any ideas on this one? Thanks! 回答1: You can just add on the required number of bytes as a String when crafting the packet e.g.: payload = 'ZZZZZZZZZZZZZZZZZZZZZ' pkt =

Specifying packet length with scapy

∥☆過路亽.° 提交于 2021-02-07 17:08:01
问题 I'm trying to send a specific packet size (100 bytes) with scapy but cant seem to get it. I'm using this to start. sr(IP(dst="192.168.1.1")/TCP(dport=443)) Looking at the docs / help I cant tell if I can use PacketLenField to specify the length of the packet. I can do it with NMAP & NSE but would like to do it outside of NMAP. Any ideas on this one? Thanks! 回答1: You can just add on the required number of bytes as a String when crafting the packet e.g.: payload = 'ZZZZZZZZZZZZZZZZZZZZZ' pkt =

How to create a Scapy packet from raw bytes

隐身守侯 提交于 2021-02-07 11:30:15
问题 Using the python packet parsing/sniffing tool Scapy, I would like to create a packet from a raw byte-string. While the details of my specific use-case are more realistic, the following example illustrates my problem and my present attempt: # Get an example packet (we won't really have an offline file in production.) pkt = sniff(offline="./example_packets/example_packets2.pcap") # Convert it to raw bytes -- oddly __str__ does this. raw_packet = str(pkt) # Current, broken, attempt to construct