lib/ownlan/protect/resynchronize.rb in ownlan-0.3.2 vs lib/ownlan/protect/resynchronize.rb in ownlan-0.4.0

- old
+ new

@@ -1,6 +1,32 @@ module Ownlan module Protect - class Resynchronize + class Resynchronize < Base + + attr_reader :gateway_packet, :client_packet + + 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 + + def send + ServiceObjects::SendArpPackets.new(config, [gateway_packet, client_packet]).call + end + + + def gateway_mac + gateway_ip = ServiceObjects::NetworkInformation.gateway_ip + mac = ::Ownlan::Attack::Base.new(config).ip_to_mac(gateway_ip) + end + + def client_mac + ::Ownlan::Attack::Base.new(config).ip_to_mac(config.target_ip) + end end end end \ No newline at end of file