Posts: 104
Threads: 36
Joined: Oct 2017
hello all ...
im try to learn scapy ... i need to run this commands from python how i can do it : ?
Quote:ARP Ping
The fastest way to discover hosts on a local ethernet network is to use the ARP Ping method:
>>> ans, unans = srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst="192.168.1.0/24"),timeout=2)
Answers can be reviewed with the following command:
>>> ans.summary(lambda (s,r): r.sprintf("%Ether.src% %ARP.psrc%") )
Posts: 4,220
Threads: 97
Joined: Sep 2016
Posts: 104
Threads: 36
Joined: Oct 2017
Sep-10-2018, 08:24 AM
(This post was last modified: Sep-10-2018, 08:24 AM by evilcode1.)
(Sep-09-2018, 12:42 PM)ichabod801 Wrote: Have you done the download and installation?
yes i already did what is the next step ?
note : i use python 2.7
Posts: 4,220
Threads: 97
Joined: Sep 2016
Well, the next section on that web page is usage. Full disclosure: I don't know anything about scapy.
Posts: 104
Threads: 36
Joined: Oct 2017
(Sep-10-2018, 01:08 PM)ichabod801 Wrote: Well, the next section on that web page is usage. Full disclosure: I don't know anything about scapy.
im not asking about usage i know how to use it ...
but i need to know how to run it from python .... when i try to import Quote:from scapy.all import *
via visual studio code i got this error :
Error: Traceback (most recent call last):
File "/root/Desktop/scapy.py", line 1, in <module>
from scapy.all import *
File "/root/Desktop/scapy.py", line 1, in <module>
from scapy.all import *
ImportError: No module named all
and the same for pycharm .... run it from python terminal it does not give me any error :
Posts: 4,220
Threads: 97
Joined: Sep 2016
Then it sounds like there is something wrong with your installation. Do you have two versions of Python? Could you have installed it for the one you're not importing from?
Posts: 104
Threads: 36
Joined: Oct 2017
(Sep-10-2018, 05:28 PM)ichabod801 Wrote: Then it sounds like there is something wrong with your installation. Do you have two versions of Python? Could you have installed it for the one you're not importing from?
i already remove python 3 and still the same problem :
this is my code :
from scapy.all import srp,Ether,ARP,conf
conf.verb=0
ans, unans = srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst="192.168.20.0/24"),timeout=2)
for snd,rcv in ans:
#print(rcv.sprintf("%Ether.src% - %ARP.psrc%"))
print(rcv.sprintf("%ARP.psrc%")) this is the error :
Error: Traceback (most recent call last):
File "/root/Desktop/scapy.py", line 1, in <module>
from scapy.all import srp,Ether,ARP,conf
File "/root/Desktop/scapy.py", line 1, in <module>
from scapy.all import srp,Ether,ARP,conf
ImportError: No module named all
Posts: 4,220
Threads: 97
Joined: Sep 2016
What happens if you just try import scapy .
Posts: 104
Threads: 36
Joined: Oct 2017
(Sep-11-2018, 12:23 PM)ichabod801 Wrote: What happens if you just try import scapy .
got this error :
Error: Traceback (most recent call last):
File "/root/Desktop/scapy.py", line 1, in <module>
import scapy
File "/root/Desktop/scapy.py", line 4, in <module>
ans, unans = srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst="192.168.20.0/24"),timeout=2)
NameError: name 'srp' is not defined
Posts: 8,154
Threads: 160
Joined: Sep 2016
it's because your file name is scapy.py. You import your own file, not scapy package. Rename your file.
|