Пример #1
0
    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")
Пример #2
0
 def __init__(self, fp):
     self['meta'] = {}
     self['apps'] = {}
     try:
         for key,value in fp['Categories'].iteritems():
             self['apps'][key] = []
     except KeyError:
         raise PenError("MatchsInfo figerprint format error")
Пример #3
0
    def __init__(self, baseURL, notFoundPattern=None):
        if not baseURL.startswith("http"):
            raise PenError(
                "CMSIdentify, baseURL format error, not startswith 'http(s)'.")
        self.baseURL = baseURL.rstrip("/")
        self.notFoundPattern = notFoundPattern

        self.fp = json.load(open(self.fingerprintFile, "r"))

        self.log = Log("cmsidentify")
Пример #4
0
    def __init__(self, baseURL=None, stype=None, keywords=None, exts=None, notFoundPattern=None, safeURL=None, timeout=None, delay=None, encode="utf-8"):
        if baseURL:
            if not baseURL.startswith("http"):
                raise PenError("URIBruter, baseURL format error, not startswith 'http'.")
            self.baseURL = baseURL.rstrip("/")
        else:
            self.baseURL = baseURL
        self.stype = stype
        self.keywords = keywords.split() if keywords else []
        self.userdefinedExt = exts.split() if exts else []
        self.defaultExt = ["asp","aspx","php","jsp"]
        self.notFoundPattern = notFoundPattern
        self.safeURL = safeURL
        self.timeout = int(timeout) if timeout else 10
        self.delay = float(delay) if delay else 0
        self.encode = encode if encode else "utf-8"

        self.info = self._loadInfoDB()
        self.log = Log("uribrute")
Пример #5
0
    def _initMetaInfo(self):
        self._metaInfo['url'] = self._url
        self._metaInfo['target'] = self._target
        try:
            response = http.get(self._target.uri)
        except http.ConnectionError:
            raise PenError("Can not connect to {0}".format(self._target.uri))
        else:
            self._metaInfo['statusCode'] = response.status_code
            self._metaInfo['headers'] = response.headers
            self._metaInfo['html'] = response.content
            self._metaInfo['title'] = self._getTitle(response.content)

        self._metaInfo['robots'] = ""
        try:
            response = http.get(self._target.baseURL+"robots.txt")
        except http.ConnectionError:
            pass
        else:
            if response.status_code == 200:
                self._metaInfo['robots'] = response.content
Пример #6
0
    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")