Sha256: 7b6c7bbfd4bb25164a8b1c7ac4fbf302de2833009409610f586ca0b2f89a3852
Contents?: true
Size: 1.36 KB
Versions: 6
Compression:
Stored size: 1.36 KB
Contents
module Ownlan module Attack class Base attr_reader :config, :crafted_packet def initialize(config) @config = config end def ip_to_mac(ip = nil) if ip == ServiceObjects::NetworkInformation.self_ip(config.interface) mac = ServiceObjects::NetworkInformation.self_mac(config.interface) else mac = ::PacketFu::Utils::arp(ip, iface: config.interface) mac ||= raise ::Ownlan::VictimNotReachable, "#{ip}'s mac address cannot be guessed." end rescue RuntimeError raise ::Ownlan::NotRoot, "Please rerun this tool with root privileges." rescue ArgumentError raise ::Ownlan::WrongVictimIpFormat, "#{ip} is not a valid ip format." rescue StandardError raise ::Ownlan::WrongInterace, "#{config.interface} is not ready? Retry again" end private def victim_ip config.victim_ip ||= raise ::Ownlan::MissingArgumentError, 'victim_ip parameter is missing.' end def victim_mac ip_to_mac(victim_ip) end def self_mac ServiceObjects::NetworkInformation.self_mac(config.interface) end def packet_craft(*params) ServiceObjects::CraftArpPacket.new(*params) end def send_packet ServiceObjects::SendArpPackets.new(config, crafted_packet).call end end end end
Version data entries
6 entries across 6 versions & 1 rubygems