MCPcopy Index your code
hub / github.com/NullArray/AutoSploit / load_api_keys

Function load_api_keys

lib/settings.py:279–304  ·  view source on GitHub ↗

load the API keys from their .key files

(unattended=False, path="{}/etc/tokens".format(CUR_DIR))

Source from the content-addressed store, hash-verified

277
278
279def load_api_keys(unattended=False, path="{}/etc/tokens".format(CUR_DIR)):
280
281 """
282 load the API keys from their .key files
283 """
284
285 # make the directory if it does not exist
286 if not os.path.exists(path):
287 os.mkdir(path)
288
289 for key in API_KEYS.keys():
290 if not os.path.isfile(API_KEYS[key][0]):
291 access_token = lib.output.prompt("enter your {} API token".format(key.title()), lowercase=False)
292 if key.lower() == "censys":
293 identity = lib.output.prompt("enter your {} ID".format(key.title()), lowercase=False)
294 with open(API_KEYS[key][1], "a+") as log:
295 log.write(identity)
296 with open(API_KEYS[key][0], "a+") as log:
297 log.write(access_token.strip())
298 else:
299 lib.output.info("{} API token loaded from {}".format(key.title(), API_KEYS[key][0]))
300 api_tokens = {
301 "censys": (open(API_KEYS["censys"][0]).read().rstrip(), open(API_KEYS["censys"][1]).read().rstrip()),
302 "shodan": (open(API_KEYS["shodan"][0]).read().rstrip(), )
303 }
304 return api_tokens
305
306
307def cmdline(command, is_msf=True):

Callers 1

mainFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected