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)
def __init__(self, url, notFoundPattern=None, cmsEnhance=False): self._url = url.strip() self._notFoundPattern = notFoundPattern self._cmsEnhance = cmsEnhance if not URL.check(self._url): raise PenError("Service Identify, URL format error") self._target = URL.format(self._url) self._fp = YamlConf(os.path.join(sys.path[0],"script","data","app_fingerprint.yaml")) # debug>>>>>>>>>>>>>>>>>>> name = 'Drupal' ddddd = self._fp['Applications'][name] #self._fp['Applications'] = {name:ddddd} # debug>>>>>>>>>>>>>>>>>>>>> # metaInfo 页面元信息 # url, statusCode, headers, html, title, robots self._metaInfo = {} self._initMetaInfo() # result 中存储的信息 self._result = MatchsInfo(self._fp) self._matchFuncs = {} self._initHandleFuncs() self._log = Log("service_identify")
def subnetScan(host, hostOnly=False, configFile=None): ''' C段扫描 ''' if not URL.check(host): return None 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)
def __init__(self, url, notFoundPattern=None, cmsEnhance=False): self._url = url.strip() self._notFoundPattern = notFoundPattern self._cmsEnhance = cmsEnhance if not URL.check(self._url): raise PenError("Service Identify, URL format error") self._target = URL.format(self._url) self._fp = YamlConf( os.path.join(conf['ptdpath'], "app_fingerprint.yaml")) # metaInfo 页面元信息 # url, statusCode, headers, html, title, robots self._metaInfo = {} self._initMetaInfo() # result 中存储的信息 self._result = MatchsInfo(self._fp) self._matchFuncs = {} self._initHandleFuncs() self._log = Log("service_identify")