Skip to content

Instantly share code, notes, and snippets.

@nl5887
Created January 28, 2016 21:01
Show Gist options
  • Select an option

  • Save nl5887/b82cbb059aed74fb5179 to your computer and use it in GitHub Desktop.

Select an option

Save nl5887/b82cbb059aed74fb5179 to your computer and use it in GitHub Desktop.
{
timestamp=$1
spot = ""
if (match($0, /Probe Request \((.*)\)/, arr)) {
spot = arr[1]
}
bssid = ""
if (match($0, /BSSID\:(([a-f0-9]{2}\:){5}[a-f0-9]{2})( \(oui (.+?)\))?/, arr)) {
bssid = arr[1]
}
da = ""
da_oui = ""
if (match($0, /DA\:(([a-f0-9]{2}\:){5}[a-f0-9]{2})( \(oui (.+?)\))?/, arr)) {
da = arr[1]
da_oui = arr[3]
}
sa = ""
sa_oui = ""
if (match($0, /SA\:(([a-f0-9]{2}\:){5}[a-f0-9]{2})( \(oui (.+?)\))?/, arr)) {
sa = arr[1]
sa_oui = arr[3]
}
# BSSID:00:95:69:1b:44:78 (oui Unknown) DA:Broadcast SA:00:95:69:1b:44:78 (oui Unknown) Probe Request (test)
#da=$
#sa=
#sip=$3;
#proto=$6;
#dip=substr($5, 1,length($5)-1);
## direction=$4;
#type="";
#match(dip, /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)
#dport=substr(dip,RLENGTH+2);
gsub(".[0-9]*$","",timestamp);
#gsub(".[0-9]*$","",dip);
#network=dip;
#gsub(".[0-9]*$","",network);
#gsub(".[0-9]*$","",sip);
group = "0"
if (bssid == "ff:ff:ff:ff:ff:ff") {
group = "200"
}
fabr = "";
cmd = sprintf("/Users/remco/Projects/go-ouitools/ouidb %s", sa);
cmd | getline fabr;
close(cmd)
#printf("%s|%s|A|%s.%s|#FF00ff\n",timestamp,spot,sa,sa_oui);
#printf("%s|%s|A|%s/%s.%s|#FF00ff\n",timestamp,"",spot,sa,sa_oui);
printf("%s|%s(%s)|%s|%s|%s\n",timestamp,fabr,sa,spot,group,"");
#printf("%s|%s(%s)|A|%s.|#FF00ff\n",timestamp,sa,sa_oui,spot);
# fflush();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment