FullSiemensScan.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:isf 作者: w3h 项目源码 文件源码
def getAllInterfaces():
    def addToArr(array, adapter, ip, mac, device, winguid):
        if len(mac) == 17: # When no or bad MAC address (e.g. PPP adapter), do not add
            array.append([adapter, ip, mac, device, winguid])
        return array

    # Returns twodimensional array of interfaces in this sequence for each interface:
    # [0] = adaptername (e.g. Ethernet or eth0)
    # [1] = Current IP (e.g. 192.168.0.2)
    # [2] = Current MAC (e.g. ff:ee:dd:cc:bb:aa)
    # [3] = Devicename (e.g. Intel 82575LM, Windows only)
    # [4] = DeviceGUID (e.g. {875F7EDB-CA23-435E-8E9E-DFC9E3314C55}, Windows only)
    netcard_info = []
    info = psutil.net_if_addrs()
    for k, v in info.items():
        ninfo = ['', '', '', '', '']
        ninfo[0] = k
        for item in v:
            if item[1] == '127.0.0.1':
                break
            if item[0] == 2:
                ninfo[1] = item[1]
            else:
                ninfo[2] = item[1]

        if ninfo[1] == '':
            continue

        netcard_info.append(ninfo)

    return netcard_info

## Listing all NPF adapters and finding the correct one that has the Windows Devicename (\Device\NPF_{GUID})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号