Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- # MAC address OUI checker
- # Thijs (Thice) Bosschert
- # http://www.thice.nl
- # v0.1 24-06-2010
- # Revised by Lux Æterna on 12-10-2016 to work with Kali 2.0
- # Print header
- print "\n MAC address OUI checker v0.1\n".
- " by Thijs (Thice) Bosschert\n\n";
- # Check if argument has been given
- if (!$ARGV[0]) {
- &error;
- }
- # Removing seperators from MAC address and uppercase chars
- $ARGV[0] =~ s/[:|\s|-]//g;
- $ARGV[0] =~ y/a-z/A-Z/;
- # Get OUI from MAC
- if ($ARGV[0] =~ /^([0-9a-f]{6})/i) {
- $OUI = $1;
- print " Checking OUI: ".$OUI."\n";
- } else {
- &error;
- }
- # Open OUI file from aircrack-ng
- open(FILE,"/var/lib/ieee-data/oui.txt");
- while (<FILE>) {
- ($checkoui,$company) = split(/\(hex\)/,$_);
- $checkoui =~ s/[-|\s]//g;
- # Check if OUI can be found in the list
- if ($OUI eq $checkoui) {
- $company =~ s/\t//g;
- # Output found OUI
- print " Found OUI: ".$OUI." - ".$company."\n\n";
- exit;
- }
- }
- close(FILE);
- # Show if OUI was not found
- print " Could not find OUI: ".$OUI."\n\n";
- # Error messages
- sub error {
- print " Error: No MAC address or OUI specified or could not recognize it.\n".
- " Usage: perl OUI_lookup.pl <MAC/OUI>\n".
- " MAC can be submitted as:\n".
- " 001122334455\n".
- " 00:11:22:33:44:55\n".
- " 00-11-22-33-44-55\n".
- " OUI can be submitted as:\n".
- " 001122\n".
- " 00:11:22\n".
- " 00-11-22\n\n";
- exit;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement