【问题标题】:BASH command-line method to obtain OUI vendor info from MAC address从 MAC 地址获取 OUI 供应商信息的 BASH 命令行方法
【发布时间】:2021-06-05 07:29:13
【问题描述】:

我正在尝试重现旧 UnixStackExchange post 中概述的方法,以使用 curl 命令使用本地获取的 MAC 地址搜索供应商名称。命令是:

curl -sS "http://standards-oui.ieee.org/oui.txt" | grep -i "$OUI" |剪切-d')' -f2 | tr -d 't'

但是,当我运行它时,它什么也没产生。我已验证“OUI”包含我要搜索的 MAC 地址。示例:

回显 $OUI

EC-58-EA

【问题讨论】:

    标签: bash macos curl grep wifi


    【解决方案1】:

    这是因为 HTTP 服务器返回一个 301 Moved Permanently 响应

    ➜  ~ curl http://standards-oui.ieee.org/oui.txt -i
    HTTP/1.1 301 Moved Permanently
    Server: nginx/1.12.0
    Date: Sun, 07 Mar 2021 05:41:37 GMT
    Content-Type: text/html
    Content-Length: 185
    Location: http://standards-oui.ieee.org/oui/oui.txt
    Connection: keep-alive
    
    <html>
    <head><title>301 Moved Permanently</title></head>
    <body bgcolor="white">
    <center><h1>301 Moved Permanently</h1></center>
    <hr><center>nginx/1.12.0</center>
    </body>
    </html>
    
    

    指示新位置 ---> &lt; Location: http://standards-oui.ieee.org/oui/oui.txt

    您可以 curl 新位置或告诉 curl 遵循 301 重定向:curl -L http://standards-oui.ieee.org/oui.txt

    测试

    ➜  ~ curl -LsS "http://standards-oui.ieee.org/oui.txt" | grep -i "EC-58-EA" | cut -d')' -f2 | tr -d 't'
            Ruckus Wireless
    
    

    【讨论】:

    • 非常感谢!!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-12
    • 1970-01-01
    • 2012-05-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多