【问题标题】:How get mac adress of routeur if I use newlist如果我使用新列表,如何获取路由器的 MAC 地址
【发布时间】:2015-04-07 22:38:27
【问题描述】:

当ESSID为Home时,我编写这个脚本来获取routeur的mac地址

        proc = Popen(['iwlist', 'wlan0', 'scan'], stdout=PIPE)
        for line in proc.communicate()[0].split('\n'):
          if ' ESSID:' in line:
              intext=str(line)
              m2=search('ESSID:".*" ',intext)
              ESSID=m2.group(0).split('"')[1]
              if ESSID =="home":
                   if ' - Address:' in line: # first line in iwlist scan for a new AP
                             intext=str(line)
                             m2=search('Address: .*',intext)
                             adress_router=m2.group(0).split('')[1]

但我有这个错误。

Traceback (most recent call last):
File "att_de.py", line 80, in <module>
routeur()
File "att_de.py", line 23, in routeur
ESSID=m2.group(0).split('"')[1]
AttributeError: 'NoneType' object has no attribute 'group'

我需要帮助。 谢谢。

【问题讨论】:

    标签: python linux networking command-line


    【解决方案1】:

    我的猜测是'ESSID:".*" ' 中的最后一个空格把你弄乱了。如果这没有帮助,请在遇到错误之前在其中添加 print intext 语句并将输出添加到您的问题中

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多