SlideShare a Scribd company logo
1 of 2
Download to read offline
I use the below scapy code to sniff and then spoof on the IP addresses 1.2.3.4 and 8.8.8.8 and it
works perfectly fine. However, when I ping the IP address 10.9.0.99 , I get the Destionation
Host Unreachable. What is the reason for that? Please give your answer clear and legible
format. The Machine that I ping the addresses has the IP address 10.9.0.6. Thank you!
# code starts here
#!/usr/bin/env python3
from scapy.all import *
def spoof(pkt):
if ICMP in pkt and pkt[ICMP].type == 8:
print("Original Packet.........")
print("Source IP : ", pkt[IP].src)
print("Destination IP :", pkt[IP].dst)
ip = IP(src=pkt[IP].dst, dst=pkt[IP].src, ihl=pkt[IP].ihl)
icmp = ICMP(type=0, id=pkt[ICMP].id, seq=pkt[ICMP].seq)
data = pkt[Raw].load
newpkt = ip/icmp/data
print("Spoofed Packet.........")
print("Source IP : ", newpkt[IP].src)
print("Destination IP :", newpkt[IP].dst)
send(newpkt, verbose=0)
sniff(filter=icmp and src host 10.9.0.6, prn=spoof_pkt)
# code ends here
I use the below scapy code to sniff and then spoof on the IP addresses.pdf

More Related Content

Similar to I use the below scapy code to sniff and then spoof on the IP addresses.pdf

Lab manual cn-2012-13
Lab manual cn-2012-13Lab manual cn-2012-13
Lab manual cn-2012-13
Sasi Kala
 
I need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdfI need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdf
sukhvir71
 
Could you take a look at this Python code Towards the botto.pdf
Could you take a look at this Python code Towards the botto.pdfCould you take a look at this Python code Towards the botto.pdf
Could you take a look at this Python code Towards the botto.pdf
devangmittal4
 
YAPC::Brasil 2009, POE
YAPC::Brasil 2009, POEYAPC::Brasil 2009, POE
YAPC::Brasil 2009, POE
Thiago Rondon
 

Similar to I use the below scapy code to sniff and then spoof on the IP addresses.pdf (20)

Lab manual cn-2012-13
Lab manual cn-2012-13Lab manual cn-2012-13
Lab manual cn-2012-13
 
BSides London - Scapy Workshop
BSides London - Scapy WorkshopBSides London - Scapy Workshop
BSides London - Scapy Workshop
 
Microarmy - by J2 Labs
Microarmy - by J2 LabsMicroarmy - by J2 Labs
Microarmy - by J2 Labs
 
Code Red Security
Code Red SecurityCode Red Security
Code Red Security
 
I need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdfI need help building a dictionary for the unique packets tha.pdf
I need help building a dictionary for the unique packets tha.pdf
 
Ip Spoofing
Ip SpoofingIp Spoofing
Ip Spoofing
 
Could you take a look at this Python code Towards the botto.pdf
Could you take a look at this Python code Towards the botto.pdfCould you take a look at this Python code Towards the botto.pdf
Could you take a look at this Python code Towards the botto.pdf
 
python programming
python programmingpython programming
python programming
 
04 - I love my OS, he protects me (sometimes, in specific circumstances)
04 - I love my OS, he protects me (sometimes, in specific circumstances)04 - I love my OS, he protects me (sometimes, in specific circumstances)
04 - I love my OS, he protects me (sometimes, in specific circumstances)
 
YAPC::Brasil 2009, POE
YAPC::Brasil 2009, POEYAPC::Brasil 2009, POE
YAPC::Brasil 2009, POE
 
Pycon - Python for ethical hackers
Pycon - Python for ethical hackers Pycon - Python for ethical hackers
Pycon - Python for ethical hackers
 
Cell processor lab
Cell processor labCell processor lab
Cell processor lab
 
Socket programming in c
Socket programming in cSocket programming in c
Socket programming in c
 
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
 
05 - Bypassing DEP, or why ASLR matters
05 - Bypassing DEP, or why ASLR matters05 - Bypassing DEP, or why ASLR matters
05 - Bypassing DEP, or why ASLR matters
 
도커 없이 컨테이너 만들기 4편 네트워크네임스페이스 (2)
도커 없이 컨테이너 만들기 4편 네트워크네임스페이스 (2)도커 없이 컨테이너 만들기 4편 네트워크네임스페이스 (2)
도커 없이 컨테이너 만들기 4편 네트워크네임스페이스 (2)
 
13048671.ppt
13048671.ppt13048671.ppt
13048671.ppt
 
Network security Lab manual
Network security Lab manual Network security Lab manual
Network security Lab manual
 
INTRODUCTION TO SOCKETS IN COMPUTER NETWORKS DEPT OF CSE.ppt
INTRODUCTION TO SOCKETS IN COMPUTER NETWORKS DEPT OF CSE.pptINTRODUCTION TO SOCKETS IN COMPUTER NETWORKS DEPT OF CSE.ppt
INTRODUCTION TO SOCKETS IN COMPUTER NETWORKS DEPT OF CSE.ppt
 
Getting Started with iBeacons (Designers of Things 2014)
Getting Started with iBeacons (Designers of Things 2014)Getting Started with iBeacons (Designers of Things 2014)
Getting Started with iBeacons (Designers of Things 2014)
 

More from MattU5mLambertq

I want you to add the output of the F1 score- Precision- ROC AUC- and.pdf
I want you to add the output of the F1 score- Precision- ROC AUC- and.pdfI want you to add the output of the F1 score- Precision- ROC AUC- and.pdf
I want you to add the output of the F1 score- Precision- ROC AUC- and.pdf
MattU5mLambertq
 
I need help with the moveStudentsFromChairToLine() method- This method.pdf
I need help with the moveStudentsFromChairToLine() method- This method.pdfI need help with the moveStudentsFromChairToLine() method- This method.pdf
I need help with the moveStudentsFromChairToLine() method- This method.pdf
MattU5mLambertq
 

More from MattU5mLambertq (20)

I want you to add the output of the F1 score- Precision- ROC AUC- and.pdf
I want you to add the output of the F1 score- Precision- ROC AUC- and.pdfI want you to add the output of the F1 score- Precision- ROC AUC- and.pdf
I want you to add the output of the F1 score- Precision- ROC AUC- and.pdf
 
I would appreciate it if you can explain how you got the answers- Than (3).pdf
I would appreciate it if you can explain how you got the answers- Than (3).pdfI would appreciate it if you can explain how you got the answers- Than (3).pdf
I would appreciate it if you can explain how you got the answers- Than (3).pdf
 
I try to change the port number ut this error appears(MongoServerError.pdf
I try to change the port number ut this error appears(MongoServerError.pdfI try to change the port number ut this error appears(MongoServerError.pdf
I try to change the port number ut this error appears(MongoServerError.pdf
 
I tried graphing each function on Desmos but I'm still confused as to.pdf
I tried graphing each function on Desmos but I'm still confused as to.pdfI tried graphing each function on Desmos but I'm still confused as to.pdf
I tried graphing each function on Desmos but I'm still confused as to.pdf
 
I need some help with part A and B- Thank you! 4) Use truth tables to.pdf
I need some help with part A and B- Thank you! 4) Use truth tables to.pdfI need some help with part A and B- Thank you! 4) Use truth tables to.pdf
I need some help with part A and B- Thank you! 4) Use truth tables to.pdf
 
I need help with the moveStudentsFromChairToLine() method- This method.pdf
I need help with the moveStudentsFromChairToLine() method- This method.pdfI need help with the moveStudentsFromChairToLine() method- This method.pdf
I need help with the moveStudentsFromChairToLine() method- This method.pdf
 
If fur color in mice is determined polygenicly by the alleles A and B-.pdf
If fur color in mice is determined polygenicly by the alleles A and B-.pdfIf fur color in mice is determined polygenicly by the alleles A and B-.pdf
If fur color in mice is determined polygenicly by the alleles A and B-.pdf
 
If MX(t)---70-(1-3et)-5 what is the distribution of X -.pdf
If MX(t)---70-(1-3et)-5 what is the distribution of X -.pdfIf MX(t)---70-(1-3et)-5 what is the distribution of X -.pdf
If MX(t)---70-(1-3et)-5 what is the distribution of X -.pdf
 
if I had a merge sort function in python and I wish to count each time.pdf
if I had a merge sort function in python and I wish to count each time.pdfif I had a merge sort function in python and I wish to count each time.pdf
if I had a merge sort function in python and I wish to count each time.pdf
 
If Clare has no T-helper cells- she would have Impaired cell-mediated.pdf
If Clare has no T-helper cells- she would have Impaired cell-mediated.pdfIf Clare has no T-helper cells- she would have Impaired cell-mediated.pdf
If Clare has no T-helper cells- she would have Impaired cell-mediated.pdf
 
if arbitrageurs notice a price discrepancy between the dollar and the.pdf
if arbitrageurs notice a price discrepancy between the dollar and the.pdfif arbitrageurs notice a price discrepancy between the dollar and the.pdf
if arbitrageurs notice a price discrepancy between the dollar and the.pdf
 
If Bowen Co- has a return on assets of 11 percent and also a return on.pdf
If Bowen Co- has a return on assets of 11 percent and also a return on.pdfIf Bowen Co- has a return on assets of 11 percent and also a return on.pdf
If Bowen Co- has a return on assets of 11 percent and also a return on.pdf
 
If a fly landed on animal feces- picked up Salmonella on its feet- and.pdf
If a fly landed on animal feces- picked up Salmonella on its feet- and.pdfIf a fly landed on animal feces- picked up Salmonella on its feet- and.pdf
If a fly landed on animal feces- picked up Salmonella on its feet- and.pdf
 
If a patient is found to have Lynch syndrome- what are the chances tha.pdf
If a patient is found to have Lynch syndrome- what are the chances tha.pdfIf a patient is found to have Lynch syndrome- what are the chances tha.pdf
If a patient is found to have Lynch syndrome- what are the chances tha.pdf
 
Identification and Documentation of a Business Process 1- Identify a b.pdf
Identification and Documentation of a Business Process 1- Identify a b.pdfIdentification and Documentation of a Business Process 1- Identify a b.pdf
Identification and Documentation of a Business Process 1- Identify a b.pdf
 
Identify each image- Header Footer Page Layout View Normal View.pdf
Identify each image- Header Footer Page Layout View Normal View.pdfIdentify each image- Header Footer Page Layout View Normal View.pdf
Identify each image- Header Footer Page Layout View Normal View.pdf
 
identify rocks Metamorphic Grade- Foliated Only Classification I- Met.pdf
identify rocks  Metamorphic Grade- Foliated Only Classification I- Met.pdfidentify rocks  Metamorphic Grade- Foliated Only Classification I- Met.pdf
identify rocks Metamorphic Grade- Foliated Only Classification I- Met.pdf
 
Identify the inference rule- U+ABUU(A)+BIdentify the inference rule-.pdf
Identify the inference rule- U+ABUU(A)+BIdentify the inference rule-.pdfIdentify the inference rule- U+ABUU(A)+BIdentify the inference rule-.pdf
Identify the inference rule- U+ABUU(A)+BIdentify the inference rule-.pdf
 
identify which bone is displayed below-.pdf
identify which bone is displayed below-.pdfidentify which bone is displayed below-.pdf
identify which bone is displayed below-.pdf
 
Identifiable Intangibles and Goodwill- IFRS International Foodis- a U-.pdf
Identifiable Intangibles and Goodwill- IFRS International Foodis- a U-.pdfIdentifiable Intangibles and Goodwill- IFRS International Foodis- a U-.pdf
Identifiable Intangibles and Goodwill- IFRS International Foodis- a U-.pdf
 

Recently uploaded

Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 

Recently uploaded (20)

8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 

I use the below scapy code to sniff and then spoof on the IP addresses.pdf

  • 1. I use the below scapy code to sniff and then spoof on the IP addresses 1.2.3.4 and 8.8.8.8 and it works perfectly fine. However, when I ping the IP address 10.9.0.99 , I get the Destionation Host Unreachable. What is the reason for that? Please give your answer clear and legible format. The Machine that I ping the addresses has the IP address 10.9.0.6. Thank you! # code starts here #!/usr/bin/env python3 from scapy.all import * def spoof(pkt): if ICMP in pkt and pkt[ICMP].type == 8: print("Original Packet.........") print("Source IP : ", pkt[IP].src) print("Destination IP :", pkt[IP].dst) ip = IP(src=pkt[IP].dst, dst=pkt[IP].src, ihl=pkt[IP].ihl) icmp = ICMP(type=0, id=pkt[ICMP].id, seq=pkt[ICMP].seq) data = pkt[Raw].load newpkt = ip/icmp/data print("Spoofed Packet.........") print("Source IP : ", newpkt[IP].src) print("Destination IP :", newpkt[IP].dst) send(newpkt, verbose=0) sniff(filter=icmp and src host 10.9.0.6, prn=spoof_pkt) # code ends here