customTheme | transition | highlightTheme | slideNumber | title | enableTitleFooter | logoImg |
---|---|---|---|---|---|---|
custom_night |
slide |
monokai |
false |
Hacking with Python |
false |
false |
![Python](/img/python.logo.png =250x)
![Scapy](img/scapy.logo.png =200x)
"Is a Python program that enables the user to send, sniff, dissect and forge network packets"
"In other words, is a powerful interactive packet manipulation program"
--
--
pkg = IP(dst="8.8.8.8")/ICMP(type=8)/"Payload Data"
pkg.show()
###[ IP ]###
version= 4
ihl= None
tos= 0x0
len= None
id= 1
flags=
frag= 0
ttl= 64
proto= icmp
chksum= None
src= 192.168.177.131
dst= 8.8.8.8
\options\
###[ ICMP ]###
type= echo-request
code= 0
chksum= None
id= 0x0
seq= 0x0
###[ Raw ]###
load= 'Payload Data'
--
- Send in layer 3: send, sr, sr1, srloop...
- Sendp in layer 2: sendp, srp, srp1, srploop...
--
- Just send some packages: send, sendp...
- Send some receive some: sr srp, srloop, srploop...
- Send some receive first: sr1, srp1...
--
pkg = IP(dst="8.8.8.8")/ICMP(type=8)/"Payload Data"
rec = sr1(pkg)
rec.show()
###[ IP ]###
version= 4
ihl= 5
tos= 0x0
len= 40
id= 25657
flags=
frag= 0
ttl= 128
proto= icmp
chksum= 0x5460
src= 8.8.8.8
dst= 192.168.177.131
\options\
###[ ICMP ]###
type= echo-reply
code= 0
chksum= 0xa9ed
id= 0x0
seq= 0x0
###[ Raw ]###
load= 'Payload Data'
###[ Padding ]###
load= '\x00\x00\x00\x00\x00\x00'
--
def arp_monitor_callback(pkt):
# Dissect
if ARP in pkt and pkt[ARP].op in (1,2): #who-has or is-at
return print(f"{pkt[ARP].hwsrc} {pkt[ARP].psrc}")
# And sniff
sniff(prn=arp_monitor_callback, filter="arp", store=0)
00:0c:29:ff:ff:ff 192.168.177.131
00:50:56:ff:ff:ff 192.168.177.2
--
![sounds good to me](/img/gif/sounds_good_to_me.gif =x500)
--
ping -c1 8.8.8.8
tcpdump arp
--
![cat board](/img/gif/cat_board.gif =x800)
--