def account_info(self): try: if not self.api_key: colorprint.red("[-] Shodan api cant not be Null") sys.exit() api = Shodan(self.api_key) account_info = api.info() msg = "[+] Available Shodan query credits: %d" % account_info.get( 'query_credits') colorprint.green(msg) except APIError as e: colorprint.red(e) sys.exit() return True
def account_info(self): try: if not self.api_key: outputscreen.error("[-] Shodan api cant not be Null") sys.exit() api = Shodan(self.api_key) account_info = api.info() msg = "[+] Available Shodan query credits: %d" % account_info.get( 'query_credits') outputscreen.success(msg) except APIError as e: outputscreen.error(e) sys.exit() return True
def check_credits(): keys_list = [] try: SHODAN_API_KEY = keys['keys']['shodan'] api = Shodan(SHODAN_API_KEY) a = api.info() keys_list.append(a['query_credits']) except Exception as e: print(e) try: be_key = keys['keys']['binaryedge'] headers = {"X-Key": be_key} req = requests.get("https://api.binaryedge.io/v2/user/subscription", headers=headers) req_json = json.loads(req.content) keys_list.append(req_json['requests_left']) except Exception as e: print(e) return keys_list