def __init__(self, url="", cookies={}, headers={}, args={}, proxy={}): ''' @params url: 目标url cookie: 自定义cookie,字符串类型 headers: http headers, 字典类型 args: 其他参数, 字典类型 ''' self.url = url.strip() if self.url: formated = URL.format(self.url) self.protocol = formated.protocol self.uri = formated.uri self.host = formated.host self.path = formated.path self.baseURL = formated.baseURL self.params = formated.params else: self.uri,self.host,self.path,self.baseURL,self.params = "","","","","" self.args = args self.http = requests.Session() if cookies: for key,value in cookies.iteritems(): self.http.cookies.set(key,value) if headers: self.http.headers.update(headers) if proxy: self.http.proxies = proxy self.register()
def __init__(self, url="", cookies={}, headers={}, args={}, proxy={}): ''' @params url: 目标url cookie: 自定义cookie,字符串类型 headers: http headers, 字典类型 args: 其他参数, 字典类型 ''' self.url = url.strip() if self.url: formated = URL.format(self.url) self.protocol = formated.protocol self.uri = formated.uri self.host = formated.host self.path = formated.path self.baseURL = formated.baseURL self.params = formated.params else: self.uri, self.host, self.path, self.baseURL, self.params = "", "", "", "", "" self.args = args self.http = requests.Session() if cookies: for key, value in cookies.iteritems(): self.http.cookies.set(key, value) if headers: self.http.headers.update(headers) if proxy: self.http.proxies = proxy self.register()
def __init__(self, url="", cookie="", headers={}, args={}): ''' 参数: url: 目标url cookie: 自定义cookie,字符串类型 headers: http headers, 字典类型 args: 其他参数, 字典类型 ''' self.url = url.strip() if self.url: formated = URL.format(self.url) self.protocol = formated.protocol self.uri = formated.uri self.host = formated.host self.path = formated.path self.baseURL = formated.baseURL self.params = formated.params else: self.uri,self.host,self.path,self.baseURL,self.params = "","","","","" self.args = args cookie = cookie.strip() self.http = requests.Session() if cookie: for item in _strCookie2Dict(cookie): self.http.cookies.set(item['name'],item['value']) self.http.headers.update(headers) self.register()
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 __init__(self, url="", cookie="", headers={}, elseArgs={}): self.url = url.strip() if self.url: formated = URL.format(self.url) self.uri = formated.uri self.host = formated.host self.path = formated.path self.baseURL = formated.baseURL self.params = formated.params else: self.uri, self.host, self.path, self.baseURL, self.params = "", "", "", "", "" self.elseArgs = elseArgs cookie = cookie.strip() self.http = requests.Session() if cookie: for item in _strCookie2Dict(cookie): self.http.cookies.set(item['name'], item['value']) self.http.headers.update(headers) self.register()
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")