コード例 #1
0
def subnetScan(host, hostOnly=False, configFile=None):
    '''
    C段扫描
    '''
    if not URL.check(host):
        return None

    host = URL.getHost(host)

    confFile = configFile if configFile else os.path.join(
        conf['ptdpath'], "port_mapping.yaml")

    portsConf = YamlConf(confFile)
    httpPorts = [
        str(k) for k in portsConf if portsConf[k]['protocol'] == "http"
    ]
    httpPorts = ",".join(httpPorts)

    if not hostOnly:
        nmapCmd = "nmap -n -PS{ports} -p{ports} {host}/24 -oX -".format(
            ports=httpPorts, host=host)
    else:
        nmapCmd = "nmap -n -PS{ports} -p{ports} {host} -oX -".format(
            ports=httpPorts, host=host)

    return nmapScan(nmapCmd)
コード例 #2
0
ファイル: subnet.py プロジェクト: Ddosser/pentestdb
def subnetScan(host, hostOnly=False, configFile=None):
    '''
    C段扫描
    '''
    if not URL.check(host):
        return None

    host = URL.getHost(host)

    confFile = configFile if configFile else os.path.join(sys.path[0],"script","data","port_mapping.yaml")

    conf = YamlConf(confFile)
    httpPorts = [str(k) for k in conf if conf[k]['protocol']=="http"]
    httpPorts = ",".join(httpPorts)

    if not hostOnly:
        nmapCmd = "nmap -n -PS{ports} -p{ports} {host}/24 -oX -".format(ports=httpPorts, host=host)
    else:
        nmapCmd = "nmap -n -PS{ports} -p{ports} {host} -oX -".format(ports=httpPorts, host=host)

    return nmapScan(nmapCmd)
コード例 #3
0
def doGoogleHacking(args, out):
    '''
    Google Hacking功能
    '''
    out.init(u"Google Hacking功能", args.output)

    keywords = args.keywords.decode(sys.stdin.encoding)
    engineName = args.engine.lower().strip() if args.engine else "baidu"
    size = args.size if args.size else 20

    if engineName == "baidu":
        engine = Baidu()
    elif engineName == "bing":
        engine = Bing()
    elif engineName == "google":
        engine = Google()
    else:
        out.error(u"不支持 '{0}' 搜索引擎,必须为 baidu/bing/google 之一".format(engineName))
        return False

    hostSet = set()
    out.warnning(u"'{0}' 在 '{1}' 中的搜索结果如下:\n".format(keywords, engineName))
    for item in engine.search(keywords,size):
        if not args.unique:
            out.info(out.Y("{0:>6} : ".format("title")) + item.title)
            out.info(out.Y("{0:>6} : ".format("url")) + item.url + "\n")
            out.writeLine(item.url)
        else:
            host = URL.getHost(item.url)
            if host:
                if host not in hostSet:
                    hostSet.add(host)
                    out.info(out.Y("{0:>6} : ".format("title")) + item.title)
                    out.info(out.Y("{0:>6} : ".format("url")) + item.url + "\n")
                    out.writeLine(item.url)
                else:
                    continue