Example #1
0
def find_secrets(userdata):

    detections = regex_checker(userdata)
    [
        Color.print(Color.GREEN,
                    '\tDetected {}: {}'.format(itemkey, detections[itemkey]))
        for itemkey in detections
    ]
def check_evn_secrets(function):
    try:
        env_vars = function['Environment']['Variables']
        [
            Color.print(
                Color.GREEN,
                '\t[+] Secret (ENV): {}= {}'.format(key, env_vars[key]))
            for key in env_vars if contains_secret(env_vars[key])
        ]
    except KeyError:
        return
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
Example #4
0
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
                ]