Skip to content

Commit

Permalink
Lab 1 - Packet Sniffing and Spoffing Attack done
Browse files Browse the repository at this point in the history
  • Loading branch information
Adarsh275 committed Dec 8, 2022
1 parent 1942482 commit 20d05ef
Show file tree
Hide file tree
Showing 30 changed files with 97 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Lab 1 - Packet sniffing and spoofing attack/Code/Task1.1A.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/python3
from scapy.all import *
print("SNIFFING PACKETS...");
def print_pkt(pkt):
pkt.show()
pkt = sniff(iface = "br-****",prn=print_pkt)

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#! / usr/bin/python3
from scapy.all import *
print ("SNIFFING PACKETS...");
def print_pkt(pkt):
pkt.show()
pkt = sniff (iface = "br-****",filter='icmp', prn=print_pkt)

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/python3
from scapy.all import *
print("SNIFFING PACKETS...")
def print_pkt(pkt):
pkt.show()
pkt = sniff(iface = "br-****",filter='src net 172.17.0.0/24', prn=print_pkt)

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/python3
from scapy.all import *
print ("SNIFFING PACKETS...")
def print_pkt(pkt):
pkt.show()
pkt = sniff (iface = "br-****",filter='tcp and src host 10.9.0.5 and dst port 23', prn=print_pkt)

11 changes: 11 additions & 0 deletions Lab 1 - Packet sniffing and spoofing attack/Code/Task1.2A.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/python3
from scapy.all import *
print ("SENDING SPOOFED ICMP PACKET...")
IPLayer = IP()
IPLayer.src="10.9.0.1"
IPLayer.dst="10.9.0.5"
ICMPpkt = ICMP()
pkt = IPLayer/ICMPpkt
pkt. show ()
send(pkt,verbose=0)

11 changes: 11 additions & 0 deletions Lab 1 - Packet sniffing and spoofing attack/Code/Task1.2B.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/python3
from scapy.all import *
print ("SENDING SPOOFED ICMP PACKET...")
IPLayer = IP()
IPLayer.src="10.9.0.11"
IPLayer.dst="10.9.0.99"
ICMPpkt = ICMP()
pkt = IPLayer/ICMPpkt
pkt. show()
send(pkt,verbose=0)

22 changes: 22 additions & 0 deletions Lab 1 - Packet sniffing and spoofing attack/Code/Task1.3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/python3
from scapy.all import *
'''Usage: ./traceroute.py " hostname or ip address"'''
host=sys.argv[1]
print ("Traceroute "+ host)
ttl=1
while 1:
IPLayer=IP ()
IPLayer.dst=host
IPLayer.ttl=ttl
ICMPpkt=ICMP()
pkt=IPLayer/ICMPpkt
replypkt = sr1(pkt,verbose=0)
if replypkt is None:
break
elif replypkt [ICMP].type==0:
print(f"{ttl} hops away: ", replypkt [IP].src)
print( "Done", replypkt [IP].src)
break
else:
print (f"{ttl} hops away: ", replypkt [IP].src)
ttl+=1
25 changes: 25 additions & 0 deletions Lab 1 - Packet sniffing and spoofing attack/Code/Task1.4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

#!/usr/bin/python3
from scapy.all import *
def spoof_pkt(pkt):
newseq=0
if ICMP in pkt:
print("original packet.........")
print("source IP :", pkt [IP].src)
print("Destination IP :", pkt [IP]. dst)
srcip = pkt [IP]. dst
dstip = pkt[IP].src
newihl = pkt [IP]. ihl
newtype = 0
newid = pkt [ICMP].id
newseq = pkt [ICMP]. seq
data = pkt [Raw]. load
IPLayer = IP (src=srcip, dst=dstip, ihl=newihl)
ICMPpkt = ICMP (type=newtype, id=newid, seq=newseq)
newpkt = IPLayer/ICMPpkt/data
print ("spoofed packet........")
print ("Source IP:", newpkt [IP].src)
print ("Destination IP:", newpkt [IP]. dst)
send (newpkt, verbose=0)
pkt = sniff (iface="br-****",filter='icmp and src host 10.9.0.5', prn=spoof_pkt)

Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 20d05ef

Please sign in to comment.