networkMngr.py 文件源码

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

项目:WMIControl 作者: crutchcorn 项目源码 文件源码
def getComputers(search=getDeviceNetwork()[2], args='-sS -p 22 -n -T5'):
    """Given string search and string args: Return list of hosts on network
    'args' being nmap arguments to be passed to nmap for optimized searching on networks

    'search' defaults to current network subnet
    'args' defaults to '-sS -p 22 -n -T5'
    To break down these NMAP arguments:
        -sS  : TCP SYN scan. A fast unobtrusive stealthy scan that shouldn't raise any flags while remaining quick
        -p 22: Only scan port 22. This should speed things up while remaining fairly reliable
        -n   : No DNS resolution. Since we don't need the host names, we can go ahead and skip that
        -T5  : Insane timing template. This is the most unreliable, but also the quickest. If you have issues with
               assets being found, I'd suggest to start change with this option.
    """
    nm = nmap.PortScanner()
    scanInfo = nm.scan(hosts=search, arguments=args)  # Remove -n to get DNS NetBIOS results
    IPs = nm.all_hosts()  # Gives me an host of hosts
    return IPs, scanInfo
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号