scapy

How can I get IP of a specific hop for traceroute in python

丶灬走出姿态 提交于 2019-12-08 13:57:47
问题 addr = socket.gethostbyname('dalitstan.org') target = [addr] result, unans = traceroute(target,maxttl=32) I am doing this and getting the below output. Is there some way here to get the IP of specific hop in a variable. And also why some hop number are missing in the traceroute result? Begin emission: Finished to send 32 packets. ************************* Received 25 packets, got 25 answers, remaining 7 packets 185.53.178.6:tcp80 1 192.168.43.1 11 3 10.71.83.18 11 4 172.16.26.245 11 5 172.26

How to count ARP reply packet per minute?

元气小坏坏 提交于 2019-12-08 13:39:18
问题 i'm setting up a local topology using GNS3. So there im using HUB, so the scenario is. There is 5 computer in network(computer A,B,C,D,E) And computer A have to count ARP reply packet in the network. for example computer A can detect computer B send ARP reply packet to computer C 1/minute. Let's assume computer A is a analyzer host. Computer B has an Ip : 192.168.1.2 Computer C has an Ip :192.168.1.3 Computer D has an Ip : 192.168.1.4 Computer E has an Ip : 192.168.1.5 And i use list in

Can't send Scapy packet over a raw socket in python

我是研究僧i 提交于 2019-12-08 11:50:31
问题 A simple client-server raw socket where the client send a custom packet and it will be received from the server. Here's my code. Client.py #!/usr/bin/env python import socket import sys from scapy.all import * sock = socket.socket(socket.AF_PACKET, socket.SOCK_RAW) try: a=Ether(dst="90:**:**:**:**:75", src="90:**:**:**:**:96")/IP(src="192.168.240.5", dst="192.168.240.1")/TCP(sport=10000,dport=10000)/"HELLO" a.show() sendp(a) finally: print >>sys.stderr, 'closing socket' sock.close() Output: #

How do you Identify the interface of a packet while listening to network traffic on all devices?

≯℡__Kan透↙ 提交于 2019-12-08 10:54:43
I am writing a python program that needs to listening to traffic on all networking devices and identify packets based on their incoming interface. To listen on all interfaces I started my capture without specify a device, but I am unable to denote the interface of a particular packet. How is this done? Matt Ball I assume that the MAC address is sufficient information for you. The first 6 octets of a packet is the destination MAC address, which is immediately followed by the 6 octets of source MAC address. Source 来源: https://stackoverflow.com/questions/5845719/how-do-you-identify-the-interface

Do not receive echo-reply from ping request with scapy

断了今生、忘了曾经 提交于 2019-12-08 07:17:16
问题 I use scapy and try to make a ping and receive the reply. my_ping = Ether() / IP(dst='8.8.8.8') / ICMP() rep,no_rep = srp(my_ping) The problem is that I don't receive any answer. The ping 8.8.8.8 works well using the terminal. I've this problem on my Mac (OS X 10.10 Yosemite) and also on the Ubuntu VM installed on my Mac. However, those commands work on my AWS Ubuntu machine. If somebody has a clue... feel free to answer 来源: https://stackoverflow.com/questions/27167069/do-not-receive-echo

How to filter/sniff out web pages according to data(text) contained?

断了今生、忘了曾经 提交于 2019-12-08 05:37:42
I am looking for information useful for my little project that allows me to sniff web page received from a web server and before it appear in the browser I will test the content (text),then according to this test,my program blocks(or redirects) the page in case the test is false... I found a very complete library is scapy , he can sniff and forge all the traffic including http replies.. I found someone looking to do similar things , but the response suggested to develop a proxy.. my question is: Is what it takes make a proxy? or just scapy Smarty, To answer your question yes you can do this

Modify with scapy and netfilterqueue

随声附和 提交于 2019-12-08 04:54:52
问题 I'm running Debian with Python 2.7, and scapy/netfilterqueue. I've added the following in my iptables: iptables -A OUTPUT -p tcp --dport 5678 -j NFQUEUE --queue-num 1 And this is my code for getting HTTP packages and changing URL and PORT: #! /usr/bin/env python2.7 from scapy.all import * from netfilterqueue import NetfilterQueue def modify(packet): pkt = IP(packet.get_payload()) if pkt.haslayer(TCP) and pkt.getlayer(TCP).dport == 5678: pkt.dst = 'https://my-secure-domain.com' pkt.dport = 443

Scapy fails to send ipv6 packets

末鹿安然 提交于 2019-12-08 00:08:44
问题 Hello everyone i am new here so please be kind. I have been using scapy lately in order to send and recieve ipv6 packets to selected ipv6 enabled servers. The gist of the code is here: text = line[:-1] #destination=getIPv6Addr(line[:-1]) destination="2607:f1c0:1000:60e0:7992:97f7:61b2:2814" source="2001:630:d0:f105:5cfe:e988:421a:a7b7" syn = IPv6(dst=destination,src=source) / TCP(sport=555,dport=80,flags="S")#flag S is syn packet syn.show() syn_ack = sr1(syn,timeout=11) When i execute the

How can I edit a js file sent by the server before it gets to my browser?

为君一笑 提交于 2019-12-07 23:01:45
问题 During a normal browsing session I want to edit a specific javascript file before the browser receives since once it gets there it's impossible to edit. Is there are any tool for this? For what I need it I can't just save it and edit it on my disk. I'm ready to learn how to program it myself but if anyone can point out more or less what I have to do I'd be very grateful. I'd have to intercept the packets until I have the whole file while blocking the browser from receiving it any part of it,

scapy: error sending packets

瘦欲@ 提交于 2019-12-07 19:49:37
问题 I am new to scapy and I am following some online tutorial, but I am stuck at this problem. I am able to send packets through a wired connection but when I try this with wireless, I face this error. I tried searching google but it was of no help. I hope to find a solution. Thanks in advance. I am using windows 8.1, python 2.7 >>> p=IP(dst="192.168.1.1")/ICMP() >>> sr1(p) Begin emission: ERROR: --- Error sending packets Traceback (most recent call last): File "c:\Python27\lib\site-packages