scapy

How to send UDP packet to specific UDP dst port in scapy?

百般思念 提交于 2020-03-21 15:09:47
问题 I would like to send my packet to a UDP dst port number and send it through eth0 interface (if scapy handles my layer2 directly, then eth0 does not need to be given as an argument) 回答1: Using the scapy documentation, we see that sending an UDP packet is as simple as: send(IP(dst="127.0.0.1")/UDP(dport=123)/Raw(load="abc")) 来源: https://stackoverflow.com/questions/28598330/how-to-send-udp-packet-to-specific-udp-dst-port-in-scapy

How to send UDP packet to specific UDP dst port in scapy?

穿精又带淫゛_ 提交于 2020-03-21 15:09:09
问题 I would like to send my packet to a UDP dst port number and send it through eth0 interface (if scapy handles my layer2 directly, then eth0 does not need to be given as an argument) 回答1: Using the scapy documentation, we see that sending an UDP packet is as simple as: send(IP(dst="127.0.0.1")/UDP(dport=123)/Raw(load="abc")) 来源: https://stackoverflow.com/questions/28598330/how-to-send-udp-packet-to-specific-udp-dst-port-in-scapy

win10使用scapy时报错,Import Error: cannot import name 'NPCAP_PATH' from 'scapy.arch.pcapdnet'

痴心易碎 提交于 2020-03-17 07:32:16
在win10上用pip安装的scapy pycharm导入scapy,运行报错 Import Error: cannot import name 'NPCAP_PATH' from 'scapy.arch.pcapdnet' (E:\Python\Python37\lib\site-packages\scapy\arch\pcapdnet.py) 下载 https://github.com/secdev/scapy 替换scapy目录即可 来源: CSDN 作者: 一只学渣狗 链接: https://blog.csdn.net/m0_46492988/article/details/104845654

使用Pyhton带你分析酒店里的针孔摄像头

北慕城南 提交于 2020-02-05 23:01:54
/1 前言/ 最近酒店被曝出隐藏摄像头的事情屡见不鲜,搞得大家人心惶惶,有图为证,如下图所示。 今天教大家一下如何用python分析出酒店里的针孔摄像头,让你放心住酒店。 /2 原理介绍/ 我们大家都知道,针孔摄像一般都很小,所以它不太可能含有存储设备,都是通过连接酒店房间内的无线网,远程传输给作案人,我们就从这方面入手,用Python的scapy模块扫描局域网内的所有设备,并通过爬虫找到该设备生产厂商,以厂商来判断该设备是否为摄像头。 所需环境:ubuntu、pyhton3.5、pycharm /3 操作步骤/ 实现步骤依赖环境较多,操作起来可能有些复杂,不过就当了解一下也是欧克的,具体的操作步骤如下。 1、用scapy模块的scapy函数模拟构造ARP广播包,代码如下图所示。 这个表示要向网段内的所有主机都询问一下,说的通俗一点就是“请问网段内都有谁在啊”。 2、模拟在局域网内发送。用scapy模块模拟发送ARP广播,代码如下图所示。 其中p是第一步构造的广播包,wifi是本机的网卡名称,timeout是发送时限。 3、返回的两个参数,ans包含两类数据包(ARP请求包和ARP返回信息),请求包是第一步构造的包,返回包是局域网内主机的回应,如下图所示。 包含该主机的ip地址和MAC地址,打码的就是MAC地址;unans返回True或者False,代表是否发送成功。 4

Talking to C socket with Scapy

﹥>﹥吖頭↗ 提交于 2020-02-02 04:08:12
问题 I have a UDP connection up and listening on a port (localhost) and I am trying to send a Scapy packet from localhost as well. For some reason, my C code never actually captures the packet, however I can see the packet show up in Wireshark just fine. It's been awhile since I've used sockets, but is there some special socket options I have to set or why would I be able to see the packet in Wireshark just fine but not by the C socket? Note: I was able to successfully catch a packet when I wrote

Scapy ARP function not giving proper output when running it

房东的猫 提交于 2020-01-25 02:54:31
问题 I have a simple script: import scapy.all as scapy def scan(ip): arg = scapy.ARP(pdst=ip) print(arg.summary()) scan("192.168.11.0/24") But when I run this script the output I get is: ARP who has ?? says ?? Normally the summary would give me 2 IP address's where the 2 question marks are but for some reason that is not the case. Also I have made a network scanner and It was working fine yesterday and returned to me all ip and mac address on the network but today I can't seem to pass in a range

Scapy verbose mode documentation [closed]

帅比萌擦擦* 提交于 2020-01-23 16:51:07
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I understand that: conf.verb = 0 Disables Scapy verbose mode but where is the documentation to confirm this? My googling has failed me. 回答1: Actually, conf 's docstring specifies that configuring conf.verb = 0 sets the level of verbosity to almost mute , which implies that it doesn't disable it altogether. The

Scapy packet sent cannot be received

风流意气都作罢 提交于 2020-01-22 20:11:29
问题 I'm trying to send UDP Packets with scapy with the following command: >> send(IP(dst="127.0.0.1",src="111.111.111.111")/UDP(dport=5005)/"Hello") . Sent 1 packets. And from tcpdump I can see: 22:02:58.384730 IP 111.111.111.111.domain > localhost.5005: [|domain] I'm trying to receive this packet with the following code: import socket UDP_IP = "127.0.0.1" UDP_PORT = 5005 sock = socket.socket(socket.AF_INET, # Internet socket.SOCK_DGRAM) # UDP sock.bind((UDP_IP, UDP_PORT)) while True: data, addr

python通过scapy编写arp扫描器

走远了吗. 提交于 2020-01-18 12:02:51
多网卡的情况下发送二层包需要配置网卡 三层包不需要配置接口 发包方法: sr() 发送三层数据包,等待接收一个或者多个数据包的响应 sr1() 发送三层数据包,只会接收一个数据包的响应 srp() 发送二层数据包,然后一直等待回应 srp1() 发送二层发送数据包,只返回第一个答案 send() 只发送三层数据包,系统自动处理路由和两层信息 sendp() 只发送二层数据包 带p字母的都是发送二层数据包,必须要写以太网头部Ether(),而且如果是多接口一定要指定接口 不带p字母都是发送三层数据包,不需要填Ether头部,不需要指定接口 hwdst表示硬件MAC verbose=False 表示关闭scapy自身的回显 通过Scapy看ARP结构: hwdst表示硬件MAC verbose=False 表示关闭scapy自身的回显 srp返回包结构分析: Demo: #!/usr/bin/python3 from scapy.all import * localmac = '00:0c:29:b6:6b:7d' localip = '192.168.64.128' destip = '192.168.64.129' intername ='eth0' result_raw = srp(Ether(src=localmac,dst='FF:FF:FF:FF:FF:FF')/ARP

How to create new layer or new protocol with scapy?

孤街醉人 提交于 2020-01-15 06:29:51
问题 i want to create a new layer using scapy,i created a new layer but when i sent it to another computer it got lost, wireshark also cant recognize it. how can i slove this problem? class OMER(Packet): name = "OMER" fields_desc = [StrLenField("Omer", "", None)] 回答1: When you create a new protocol or a new layer with scapy, other network tools like wireshark (and others) since they are not aware of your protocol's specifics will not be able to automatically parse it correctly. If you want to