Skip to content

Commit 755d3b3

Browse files
committed
Merge pull request #4 from OutOfBrain/unicast_only
Generate unicast only mac addresses and no multicast ones
2 parents 070cea9 + 97b6d13 commit 755d3b3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bin/macchanger

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ class MacChanger
3333
end
3434

3535
def self.generate
36-
(1..6).map { format('%0.2x', rand(256)) }.join(':')
36+
# least significant bit of most significant octet has to be 0 to to be unicast
37+
[format('%0.2x', rand(256) & ~1), (1..5).map { format('%0.2x', rand(256)) }].join(':')
3738
end
3839

3940
def self.valid?(mac)

0 commit comments

Comments
 (0)