mirror of
https://github.com/autistic-symposium/sec-pentesting-toolkit.git
synced 2025-04-27 02:59:08 -04:00
some simple examples with scapy
This commit is contained in:
parent
a1bbf061c1
commit
ffb92e0614
13
Network_and_802.11/scapy/receive_packet.py
Normal file
13
Network_and_802.11/scapy/receive_packet.py
Normal file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__author__ = "bt3"
|
||||
|
||||
from scapy.all import *
|
||||
|
||||
|
||||
output=sr(IP(dst='google.com')/ICMP())
|
||||
print '\nOutput is:'
|
||||
print output
|
||||
result, unanswered=output
|
||||
print '\nResult is:'
|
||||
print result[0]
|
15
Network_and_802.11/scapy/route.py
Normal file
15
Network_and_802.11/scapy/route.py
Normal file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__author__ = "bt3"
|
||||
|
||||
from scapy.all import *
|
||||
|
||||
print conf.route
|
||||
|
||||
conf.route.add(host='192.168.118.2', gw='192.168.1.114')
|
||||
|
||||
print conf.route
|
||||
|
||||
conf.route.resync()
|
||||
|
||||
print conf.route
|
10
Network_and_802.11/scapy/send_packet.py
Normal file
10
Network_and_802.11/scapy/send_packet.py
Normal file
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__author__ = "bt3"
|
||||
|
||||
from scapy.all import *
|
||||
|
||||
packet = IP(dst="192.168.1.114")/ICMP()/"Helloooo!"
|
||||
#send(packet, loop=1)
|
||||
send(packet)
|
||||
packet.show()
|
4
Network_and_802.11/scapy/stealing_emails.py
Executable file
4
Network_and_802.11/scapy/stealing_emails.py
Executable file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__author__ = "bt3"
|
||||
|
@ -1,16 +1,31 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__author__ = "bt3"
|
||||
|
||||
from scapy.all import *
|
||||
hostname = "google.com"
|
||||
for i in range(1, 28):
|
||||
pkt = IP(dst=hostname, ttl=i) / UDP(dport=33434)
|
||||
# Send the packet and get a reply
|
||||
reply = sr1(pkt, verbose=0)
|
||||
if reply is None:
|
||||
# No reply =(
|
||||
break
|
||||
elif reply.type == 3:
|
||||
# We've reached our destination
|
||||
print "Done!", reply.src
|
||||
break
|
||||
else:
|
||||
# We're in the middle somewhere
|
||||
print "%d hops away: " % i , reply.src
|
||||
|
||||
HOST = "google.com"
|
||||
|
||||
def traceroute():
|
||||
for i in range(1, 28):
|
||||
|
||||
pkt = IP(dst=HOST, ttl=i) / UDP(dport=33434)
|
||||
# Send the packet and get a reply
|
||||
reply = sr1(pkt, verbose=0)
|
||||
|
||||
if reply is None:
|
||||
# No reply =(
|
||||
break
|
||||
|
||||
elif reply.type == 3:
|
||||
# We've reached our destination
|
||||
print "Done!", reply.src
|
||||
break
|
||||
|
||||
else:
|
||||
# We're in the middle somewhere
|
||||
print "%d hops away: " % i , reply.src
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
traceroute()
|
Loading…
x
Reference in New Issue
Block a user