Skip to content

Commit

Permalink
vendor retrieval configurable and tries harder
Browse files Browse the repository at this point in the history
Signed-off-by: koniu <gkusnierz@gmail.com>
  • Loading branch information
koniu committed Dec 23, 2010
1 parent 5669e3e commit 0d100a0
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions wassup.lua
Expand Up @@ -14,8 +14,6 @@ delay = 0
leave = reps leave = reps
obscure = false obscure = false
row_highlight_field = "enc" row_highlight_field = "enc"
manuf = "/etc/manuf"
macdb = "/usr/share/macchanger/wireless.list"


-- colors -- colors
colors = { colors = {
Expand Down Expand Up @@ -50,6 +48,16 @@ columns = {
} }
column_order = {"bssid", "ch", "s", "essid", "sig", "min", "avg", "max", "loss", "enc"} column_order = {"bssid", "ch", "s", "essid", "sig", "min", "avg", "max", "loss", "enc"}


-- vendor lists
vendors = {
{ files = { "/etc/manuf", "/usr/share/wireshark/manuf" },
pattern = "# (.*)\n", sep = ":" },
{ files = { "/etc/manuf", "/usr/share/wireshark/manuf" },
pattern = "%w%w:%w%w:%w%w%s-([%w%p]+)", sep = ":" },
{ files = { "oui.txt" }, pattern = "%(hex%)[\t%s]+(.*)\n", sep = "-" },
{ files = { "/usr/share/macchanger/wireless.list", "/usr/share/macchanger/OUI.list" },
pattern = "%w%w %w%w %w%w (.*)\n", sep = " " },
}
--}}} --}}}
--{{{ functions --{{{ functions
--{{{ getopt --{{{ getopt
Expand Down Expand Up @@ -288,15 +296,16 @@ end
--{{{ get_vendor --{{{ get_vendor
function get_vendor(mac) function get_vendor(mac)
if not mac then return end if not mac then return end
if readable(manuf) then for i, list in ipairs(vendors) do
local str = read("grep -i ^"..mac:sub(1,8).." " .. manuf, "popen") for j, file in ipairs(list.files) do
return (str:sub(10,20)):match("[%w%p]*") if readable(file) then
elseif readable(macdb) then local fmac = string.gsub(mac:sub(1,8),":",list.sep)
local str = read("grep -i ^'".. string.gsub(mac:sub(1,8),":"," ") .."' " .. macdb, "popen") local str = read(string.format("grep -i ^'%s' %s", fmac, file), "popen")
return (str:sub(10,20)):match("[%w%p]*") if #str > 0 then return str:match(list.pattern) end
else end
return "" end
end end
return ""
end end
--}}} --}}}
--{{{ cls --{{{ cls
Expand Down

0 comments on commit 0d100a0

Please sign in to comment.