How to use the pocsuite3.lib.request.requests.get function in pocsuite3

To help you get started, we’ve selected a few pocsuite3 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github knownsec / pocsuite3 / pocsuite3 / modules / seebug / __init__.py View on Github external
def fetch_poc(self, ssvid):
        if self.check_account():
            try:
                if ssvid and ssvid.startswith('ssvid-'):
                    ssvid = ssvid.split('ssvid-')[-1]
                resp = requests.get('https://www.seebug.org/api/user/poc_detail?id=%s' % ssvid, headers=self.headers)
                if resp and resp.status_code == 200 and "code" in resp.json():
                    poc = resp.json()['code']
                    return poc
                elif resp.status_code == 200 and "status" in resp.json() and resp.json()["status"] is False:
                    if "message" in resp.json():
                        msg = resp.json()["message"]
                        if msg == "没有权限访问此漏洞":
                            msg = "No permission to access the vulnerability POC"
                    else:
                        msg = "Unknown"
                    msg = "[PLUGIN] " + msg
                    raise Exception(msg)
            except Exception as ex:
                logger.error(str(ex))
        else:
            return None
github knownsec / pocsuite3 / pocsuite3 / modules / zoomeye / __init__.py View on Github external
def token_is_available(self):
        if self.token:
            headers = {'Authorization': 'JWT %s' % self.token}
            try:
                resp = requests.get('https://api.zoomeye.org/resources-info', headers=headers)
                if resp and resp.status_code == 200 and "plan" in resp.json():
                    self.headers = headers
                    return True
            except Exception as ex:
                logger.error(str(ex))
        return False
github knownsec / pocsuite3 / pocsuite3 / modules / zoomeye / __init__.py View on Github external
def search(self, dork, pages=1, resource='web'):
        search_result = set()
        try:
            for page in range(1, pages + 1):
                url = "https://api.zoomeye.org/{}/search?query={}&page={}&facet=app,os".format(resource,
                                                                                               urllib.parse.quote(dork),
                                                                                               page)
                resp = requests.get(url, headers=self.headers)
                if resp and resp.status_code == 200 and "matches" in resp.json():
                    content = resp.json()
                    if resource == 'web':
                        search_result.update([match['site'] for match in content['matches']])
                    else:
                        for match in content['matches']:
                            ans = match['ip']
                            if 'portinfo' in match:
                                ans += ':' + str(match['portinfo']['port'])
                            search_result.add(ans)
        except Exception as ex:
            logger.error(str(ex))
        return search_result
github knownsec / pocsuite3 / pocsuite3 / modules / seebug / __init__.py View on Github external
def token_is_available(self):
        if self.token:
            headers = {'Authorization': 'JWT %s' % self.token}
            try:
                resp = requests.get('https://www.seebug.org/api/user/poc_list', headers=headers)
                if resp and resp.status_code == 200 and "id" in resp.json()[0]:
                    self.headers = headers
                    return True
            except Exception as ex:
                logger.error(str(ex))
        return False
github knownsec / pocsuite3 / pocsuite3 / modules / seebug / __init__.py View on Github external
def get_available_pocs(self):
        if self.check_account():
            try:
                resp = requests.get('https://www.seebug.org/api/user/poc_list', headers=self.headers)
                if resp and resp.status_code == 200:
                    pocs = resp.json()
                    return pocs
            except Exception as ex:
                logger.error(str(ex))
        else:
            return []
github knownsec / pocsuite3 / pocsuite3 / modules / fofa / __init__.py View on Github external
def search(self, dork, pages=1, resource='ip,port'):
        if resource == 'host':
            resource = 'ip,port'
        else:
            resource="web"
        search_result = set()
        try:
            for page in range(1, pages + 1):
                url = "https://fofa.so/api/v1/search/all?email={user}&key={token}&qbase64={dork}&fields={resource}&page={page}".format(
                    user=self.user, token=self.token, dork=b64encode(dork.encode()).decode(), resource=resource, page=page)
                resp = requests.get(url,timeout=80)
                if resp and resp.status_code == 200 and "results" in resp.json():
                    content = resp.json()
                    for match in content['results']:
                        if resource == "ip,port":
                            search_result.add("%s:%s"%(match[0],match[1]))
                        else:
                            if not  match.startswith("https://"):
                                search_result.add("http://"+match)
                            else:
                                search_result.add(match)
                else:
                    logger.error("[PLUGIN] Fofa:{}".format(resp.text))
        except Exception as ex:
            logger.error(str(ex))
        return search_result
github knownsec / pocsuite3 / pocsuite3 / modules / shodan / __init__.py View on Github external
def get_resource_info(self):
        if self.check_token():
            try:
                resp = requests.get('https://api.shodan.io/account/profile?key={0}'.format(self.token))
                if resp and resp.status_code == 200 and 'credits' in resp.json():
                    content = resp.json()
                    self.credits = content['credits']
                    return True
            except Exception as ex:
                logger.error(str(ex))
        return False