Class: Ownlan::Protect::Resynchronize

Inherits:
Base
  • Object
show all
Defined in:
lib/ownlan/protect/resynchronize.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

Instance Attribute Details

#client_packetObject (readonly)

Returns the value of attribute client_packet.



5
6
7
# File 'lib/ownlan/protect/resynchronize.rb', line 5

def client_packet
  @client_packet
end

#gateway_packetObject (readonly)

Returns the value of attribute gateway_packet.



5
6
7
# File 'lib/ownlan/protect/resynchronize.rb', line 5

def gateway_packet
  @gateway_packet
end

Instance Method Details

#client_macObject



27
28
29
# File 'lib/ownlan/protect/resynchronize.rb', line 27

def client_mac
  ::Ownlan::Attack::Base.new(config).ip_to_mac(config.target_ip)
end

#gateway_macObject



22
23
24
25
# File 'lib/ownlan/protect/resynchronize.rb', line 22

def gateway_mac
  gateway_ip = ServiceObjects::NetworkInformation.gateway_ip
  mac        = ::Ownlan::Attack::Base.new(config).ip_to_mac(gateway_ip)
end

#processObject



7
8
9
10
11
12
13
14
15
# File 'lib/ownlan/protect/resynchronize.rb', line 7

def process
  config.source_mac = gateway_mac
  @gateway_packet = Ownlan::Attack::Client.new(config).generate_packet

  config.source_mac = client_mac
  @client_packet = Ownlan::Attack::Gateway.new(config).generate_packet

  send
end

#sendObject



17
18
19
# File 'lib/ownlan/protect/resynchronize.rb', line 17

def send
  ServiceObjects::SendArpPackets.new(config, [gateway_packet, client_packet]).call
end