Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.78 KB | None | 0 0
  1. #!/usr/bin/ruby
  2. #simple macchanger, the OUI is selected from one of many in the array for a unique valid MAC
  3.  
  4. # usage: `sudo macchange <iface>`
  5.  
  6. class Array
  7.   # If +number+ is greater than the size of the array, the method
  8.   # will simply return the array itself sorted randomly
  9.   def randomly_pick(number)
  10.     sort_by{ rand }.slice(0...number)
  11.   end
  12. end
  13.  
  14. macs = [ "00:04:23" , "00:1e:64" , "00:26:b0" , "00:26:08" , "00:19:d2" , "00:26:b6" , "79:ca:39" , "c4:17:fe" ]
  15.  
  16. oui = macs.randomly_pick(1)
  17.  
  18. 3.times do
  19. rand_hex = ((0xff)* rand).to_i.to_s(16)
  20. $new_mac = oui << ":" + rand_hex
  21. end
  22. print "\033[00;31m[SYSTEM]\033[00m \033[00;34myour new MAC Address is #{$new_mac}\033[00m\n"
  23. `ifconfig #{ARGV[0]} down`
  24. `ifconfig #{ARGV[0]} hw ether #{$new_mac}`
  25. `ifconfig #{ARGV[0]} up`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement