scapy

Python scapy import error

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: If I include following line in my python source file from scapy.all import * I get this error from scapy.all import * ImportError: No module named all Which is true in Console and IDLE, but not eclipse. I am very much confused why this is happening. Can some one help me out? 回答1: I think this may be a problem with your version Depending on your version a simple from scapy import * is all that is required Hope that helps! 回答2: If scapy is not installed in your system, then you can use this command to install scapy: sudo apt-get install python

vscode import error: from scapy.all import IP

匿名 (未验证) 提交于 2019-12-03 01:09:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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(), symb_list=__all__) except Exception as e: log

scapy OSError: [Errno 9] Bad file descriptor

匿名 (未验证) 提交于 2019-12-03 01:06:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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? Please help. This is source code. import logging

Error writing scapy RTP packet with payload type to pcap

匿名 (未验证) 提交于 2019-12-03 01:06:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When I create an RTP packet in scapy with the following code, I get an error: "TypeError: clone_with() got multiple values for keyword argument 'payload'" from scapy.all import IP, UDP, RTP, Ether from scapy.utils import PcapWriter pktdump = PcapWriter("banana.pcap", append=False, sync=True) rtp = { "sequence": 1, "timestamp": 1, "marker": 1, "payload": 17 } pkt = Ether()/IP()/UDP(sport=12345,dport=12346)/RTP(**rtp) pktdump.write(pkt) but removing payload works. rtp = { "sequence": 1, "timestamp": 1, "marker": 1 } pkt = Ether()/IP()/UDP

PermissionError: [Errno 1] Operation not permitted

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am completely new to python, linux RPI and scapy. I am trying to send some packets using scapy. On Command Line (only if super user privileges are given to scapy) send(IP(dst="1.2.3.4")/ICMP()) This works perfectly, while running on python script. from scapy.all import * p=send(IP(dst="1.2.3.4")/ICMP()) Throws an error Traceback (most recent call last): File "<pyshell#19>", line 1, in <module> send(IP(dst="1.2.3.4")/ICMP()) File "/usr/local/lib/python3.4/dist-packages/scapy/sendrecv.py",line 255, in send __gen_send(conf.L3socket(*args, *

Scapy - retrieving RSSI from WiFi packets

匿名 (未验证) 提交于 2019-12-03 00:45:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to get RSSI or signal strength from WiFi packets. I want also RSSI from 'WiFi probe requests' (when somebody is searching for a WiFi hotspots). I managed to see it from kismet logs but that was only to make sure it is possible - I don't want to use kismet all the time. For 'full time scanning' I'm using scapy. Does anybody know where can I find the RSSI or signal strength (in dBm) from the packets sniffed with scapy? I don't know how is the whole packet built - and there are a lot of 'hex' values which I don't know how

Sending DHCP Discover using python scapy

吃可爱长大的小学妹 提交于 2019-12-03 00:28:32
I am new to python and learning some network programming, I wish to send an DHCP Packet through my tap interface to my DHCP server and expecting some response from it. I tried with several packet building techniques such a structs and ctypes and ended up with using scapy. Here I am able to send DHCP Packet but unable to get any response from the DHCP server(Analyzed using wireshark and tcpdump)..My packet looked like same as original DHCP packet but failed to get response. Here is my code import socket from scapy.all import * def main(): if len(sys.argv)<3: print " fewer arguments." sys.exit(1

Scapy 从入门到放弃

匿名 (未验证) 提交于 2019-12-03 00:11:01
0x00 前言 最近闲的没事,抽空了解下地表最强的嗅探和收发包的工具:scapy。scapy是一个python模块,使用简单,并且能灵活地构造各种数据包,是进行网络安全审计的好帮手。 0x01 安装 因为2020年python官方便不再支持python2,所以使用python3安装。 0x02 构造数据包 在构造数据包之前首先导入scapy模块: from scapy.all import * scapy构造数据包也非常简单,例如使用 IP() 就可以创建一个默认的数据包。使用 ls(IP()) 可以查看IP数据包可以有哪些参数。 其他数据包同理 使用IP(dst="114.114.114.114") 来创建一个目的地址是 114.114.114.114 的数据包,再使用 ls() 可以看到数据包的目的地址已经修改。 也可以使用 show 方法来查看数据包信息。 使用summary()方法查看概要信息。 使用hexdump(pkt)开查看数据包的字节信息 使用 '/' 操作符来给数据包加上一层。例如构造一个TCP数据包,在IP层指明数据包的目的地址。在TCP层可以设定数据包的目的端口等等。UDP数据包同理。 数据包的目标端口可以用范围来表示,发送的时候就会发送dport 不同的多个数据包。 如果设置了多个参数为范围的,最后发送的数据包就是笛卡尔积。 0x03 发送数据包

scapy模块

匿名 (未验证) 提交于 2019-12-03 00:02:01
scrapy环境安装 - scrapy,pyspider - 什么是框架?如何学习框架? - 就是一个集成了各种功能且具有很强通用性(可以被应用在各种不同的需求中)的一个项目模板. - 我们只需要学习框架中封装好的相关功能的使用即可 - scrapy集成了哪些功能: - 高性能的数据解析操作,持久化存储操作,高性能的数据下载的操作..... Linux安装:   pip3 install scrapy - whindows环境的安装: a. pip3 install wheel b. 下载twisted http://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted d. pip3 install pywin32 e. pip3 install scrapy 生成指定名字爬虫文件 它给我们创建的爬虫文件,里面创建了一个类,文件名加spider为类名。继承的是模块点爬虫类 开始urls可以放多个url,允许的域名做了限定那么只能访问这个域名下的。因为我们做的是爬虫,爬取很多链接,通常都专属允许的域名。下面还有个解析方法 - 执行工程:scrapy crawl spiderName 对两个url分别进行请求,每次请求都会调用parse方法,请求的响应数据在response里面。 爬取之前先请求这个文件,看我们是否有权限爬取 来源:博客园 作者:

scapy学习笔记

匿名 (未验证) 提交于 2019-12-02 23:40:02
1、ACK Scan >>>ans,unans=sr(IP(dst="www.baidu.com")/TCP(dport=[80,666],flags="A") 扫描后,若要找出未过虑的端口: for s,r in ans: if s[TCP].dport==r[TCP].sport: print str(s[TCP].dport)+"is unfiltered." 过滤过的: for s in unans: print str(s[TCP].dport)+"is filtered." 2、Xmas Scan >>>ans,unans=sr(IP(dst="192.168.1.1")/TCP(dport=666,flags="FPU")) RST表示端口关闭。 3、IP Scan >>> ans,unans=sr(IP(dst="192.168.1.1",proto=(0,255))/"SCAPY",retry=2) 4、ARP ping >>> ans,unans=srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst="192.168.1.0/24"),timeout=2) 结果显示: >>> ans.summary(lambda (s,r): r.sprintf("%Ether.src% %ARP.psrc%") ) 5、ICMP ping >