def find_secrets(userdata): detections = regex_checker(userdata) [ Color.print(Color.GREEN, '\tDetected {}: {}'.format(itemkey, detections[itemkey])) for itemkey in detections ]
def scan_tags(instance): try: tags = instance['Tags'] [ Color.print( Color.GREEN, '\tTag discovered {}: {}'.format(tag["Key"], tag["Value"])) for tag in tags if regex_checker(tag['Value']) ] except KeyError: return
def check_secrets(session_name, tableData): acc = [] for item in tableData['Items']: acc += list(NestedDictValues(item)) for val in acc: if isinstance(val, str): secrets = regex_checker(val) if secrets: [ Color.print(Color.GREEN, "\t{}: {}".format(key, secrets[key])) for key in secrets ]
def check_source_secrets(session_name, function): pattern = "(#.*|//.*|\\\".*\\\"|'.*'|/\\*.*|\".*\")" source_data = get_function_source(session_name, function) for key in source_data: for line in re.findall(pattern, source_data[key]): secrets = regex_checker(line) if secrets: [ Color.print(Color.GREEN, "\t{}: {}".format(key, secrets[key])) for key in secrets ]