scapy

Scapy with Mininet

风格不统一 提交于 2019-12-26 05:04:22
问题 How can I run a scapy script inside mininet to generate custom packets? I know I could generate traffic using iperf ,netperf etc.But I need to customize the packets and then use them in mininet. Thanks, Regards, Sushmita 回答1: You can generate trafic from hosts. You can run cli commands using xterm. I think that using dpkg-name -v you can see what version is emulated by host. So, you can customize ping or whatever you want from the emulated host! Here you can see how to run commands in hosts

Scapy with Mininet

为君一笑 提交于 2019-12-26 05:04:09
问题 How can I run a scapy script inside mininet to generate custom packets? I know I could generate traffic using iperf ,netperf etc.But I need to customize the packets and then use them in mininet. Thanks, Regards, Sushmita 回答1: You can generate trafic from hosts. You can run cli commands using xterm. I think that using dpkg-name -v you can see what version is emulated by host. So, you can customize ping or whatever you want from the emulated host! Here you can see how to run commands in hosts

Scapy problems when importing modules

落花浮王杯 提交于 2019-12-25 05:26:10
问题 I recently started programming in python and scapy. But when i use from scapy.all import * it doesnt work and i get the exception ImportError: No module named 'base_classes'. So it is finding the folder all, but cannot find base_classes. I verified however that base_classes is actually in there. In extend, import scapy.all.base_classes finds that there are base_classes in there but when i execute it i stil get an error. What should i do? i verified my version of scapy and it is 2.x. Thank you

Scapy sniff() “an operation was performed on something that is not a socket”

笑着哭i 提交于 2019-12-25 04:08:16
问题 I recently installed scapy and was trying to start using it and I'm having trouble using the sniff() function. I've been able to install Scapy using the steps described in their docs. I'm running Windows 7 x64 and using Python 2.6. I'm able to use the send family of functions fine (confirmed with Wireshark) but sniff() is failing with the following stack trace: Traceback (most recent call last): File "sniffingStuff.py", line 11, in <module> sniff(filter="ip",prn=customAction) File "C:

Scapy - layer's length field

爷,独闯天下 提交于 2019-12-25 02:44:48
问题 I'm trying to build PTPv2 protocol using Scapy. There are few message types in this protocol, so I use ConditionalField to describe the different fields options: class PTPv2(Packet): name = "Precision Time Protocol V2" fields_desc = [ # Header BitField('transportSpecific', 1, 4), BitEnumField('messageType', 0, 4, Message_Types), ByteField('versionPTP', 2), LenField('messageLength', None), ByteField('subdomainNumber', 0), ByteField('empty1', 0), XShortField('flags', 0), LongField('correction',

Scapy DHCP retrieving offered IP address

﹥>﹥吖頭↗ 提交于 2019-12-25 01:49:17
问题 I've successfully created a DHCP discover, Offer and Request in Scapy. I was wondering if it is possible for me to retrieve the offer DHCP IP address, saving it to a variable where I will be able to request for it specifically in my DHCP Request using Scapy. I've tried using sniff but it doesn't seem to retrieve any IP address as follows : sniff(iface=myiface, filter="port 68 and port 67") Are there any methods to retrieve the offered IP? Thanks 回答1: I've solved this already. For anyone else

vscode import error: from scapy.all import IP

两盒软妹~` 提交于 2019-12-24 19:50:33
问题 vscode said can't find IP in scapy.all but from terminal, i can import it: could somebody tell my why? 回答1: I get exactly the same issue with my Scapy code in VS Code. I think it's to do with the way pylint is working. When you from scapy.all import IP , Python loads scapy/all.py , which includes the line from scapy.layers.all import * . scapy/layers/all.py includes this code: for _l in conf.load_layers: log_loading.debug("Loading layer %s" % _l) try: load_layer(_l, globals_dict=globals(),

How to get MAC address of connected Access point?

自闭症网瘾萝莉.ら 提交于 2019-12-24 19:19:42
问题 I am using Scapy to sniff access point(AP) beacon packets and also getting all AP beacon packets and it's MAC address nearby AP but I need exact MAC address of connected AP then How to sniff only connected AP beacon frame or How to filter connected AP beacon frame using scapy or any alternate idea. *I am doing it in python 2.7 回答1: Assuming the beacon frame is called pkt. pkt.addr1 is the destination MAC, pkt.addr2 is the source MAC and pkt.addr3 is the MAC address of the AP. You could write

Python Scapy --arp request and response

不问归期 提交于 2019-12-24 16:37:27
问题 I send a arp packet broadcast with this line: send(ARP(op=ARP.who_has, psrc="192.168.5.51", pdst=the_ip)) My question is: How can I view the response (in this case: the mac of the remote ip)? I know I can do: pkt = sniff(filter=arp , count=10) print (pkt.summary()) But I do not want to count the packets because I do not know when it will be printed (could be in the next 10 or 100 packets) Is there a way to while it is sniffing, to print the summary and thus, see the mac adress I am looking

scapy OSError: [Errno 9] Bad file descriptor

旧街凉风 提交于 2019-12-24 11:47:01
问题 I'm using python 2.7 and scapy-2.2.0 in windows xp. I'm trying dns spoofing and it works well in python. but when I make to .exe and execute it, I got this error Traceback (most recent call last): File "dns_spoof.py", line 17, in <module> File "scapy\arch\windows\__init__.pyc", line 523, in sniff File "dns_spoof.py", line 15, in dns_spoof File "scapy\sendrecv.pyc", line 251, in send File "scapy\sendrecv.pyc", line 237, in __gen_send OSError: [Errno 9] Bad file descriptor How can I fix it?