nwatch.py 文件源码

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

项目:nWatch 作者: rootlabs 项目源码 文件源码
def postAS(hostslist):
    hosts = [host for host, x in hostslist.items()]
    macs = [mac for x, mac in hostslist.items()]
    try:
        nm = nmap.PortScanner()         
    except Exception, ex:
        try:
            print "["+Fore.RED+"-"+Style.RESET_ALL+"] Exception('%s') occured\n\t%s-> Errno : %d\n\t-> Error : %s"%(type(ex).__name__,Style.DIM,ex.args[0],ex.args[1])
        except:
            print "["+Fore.RED+"-"+Style.RESET_ALL+"] %s"%(str(ex))
        sys.exit(0)
    try:
        FiFlag, isDHCP = False, False
        isDHCPlst = []
        try: 
            isDHCPlst=DHCPDiscover()
        except:
            pass
        for host, mac in hostslist.items():
            if host in isDHCPlst:
                isDHCP = True
            else:
                isDHCP = False

            nm.scan(str(host), arguments="-O")
            FiFlag = prettyPrint(host,mac, nm, isDHCP)

            if not(FiFlag):
                print "["+Fore.YELLOW+"*"+Style.RESET_ALL+"] Warning : couldn't detect to OS"

    except Exception, ex:
        print "["+Fore.RED+"-"+Style.RESET_ALL+"] Error in OS fingerprinting, continuing..."
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号