Skip to content

Commit 0dac2de

Browse files
committed
Use PacketFu::EthHeader.mac2str for MAC formatting
1 parent 2d484a3 commit 0dac2de

File tree

1 file changed

+1
-9
lines changed
  • modules/auxiliary/spoof/cisco

1 file changed

+1
-9
lines changed

modules/auxiliary/spoof/cisco/cdp.rb

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,15 @@ def run
7171
def do_spoof
7272
print_status("Sending CDP message on #{interface}")
7373
p = prep_cdp # Preparation of the CDP content
74-
dst_mac = "\x01\x00\x0C\xCC\xCC\xCC" # CDP multicast
75-
76-
# Source Mac Address Preparation
77-
src_mac = mac_to_bytes(smac)
7874

7975
# Injecting packet to the network
8076
l = PacketFu::Inject.new(iface: interface)
8177
cdp_length = ["%04X" % (p.length + 8).to_s].pack('H*')
82-
dot3 = dst_mac + src_mac + cdp_length
78+
dot3 = PacketFu::EthHeader.mac2str("01:00:0C:CC:CC:CC") + PacketFu::EthHeader.mac2str(smac) + cdp_length
8379
llc = "\xAA\xAA\x03\x00\x00\x0c\x20\x00"
8480
l.array_to_wire(array: [dot3 + llc + p])
8581
end
8682

87-
def mac_to_bytes(mac)
88-
[mac.gsub(':', '')].pack('H*')
89-
end
90-
9183
def prep_cdp
9284
# device ID
9385
p = tlv(1, datastore['DEVICE_ID'])

0 commit comments

Comments
 (0)