<filename>bandit/blacklists/calls.py
from bandit.blacklists import utils


def gen_blacklist():
    """Generate a list of items to blacklist.

    Methods of this type, "bandit.blacklist" plugins, are used to build a list
    of items that bandit's built in blacklisting tests will use to trigger
    issues. They replace the older blacklist* test plugins and allow
    blacklisted items to have a unique bandit ID for filtering and profile
    usage.

    :return: a dictionary mapping node types to a list of blacklist data
    """

    sets = []

    sets.append(utils.build_conf_dict(
        'base64_b64decode', 'B300', ['base64.b64decode'],
        'base64.b64decode'
        ))

    sets.append(utils.build_conf_dict(
        'base64_b64encode', 'B301', ['base64.b64encode'],
        'base64.b64encode'
        ))

    #examples/socket_gethostname.py
    sets.append(utils.build_conf_dict(
        'socket_gethostname', 'B302', ['socket.gethostname'],
        'socket.gethostname'
        ))

    #examples/socket_gethostname.py
    sets.append(utils.build_conf_dict(
        'pwd_getpwuid', 'B303', ['pwd.getpwuid'],
        'pwd.getpwuid'
        ))

    sets.append(utils.build_conf_dict(
        'socket_socket', 'B304', ['socket.socket'],
        'socket.socket'
        ))

    #examples/os_getuid.py
    sets.append(utils.build_conf_dict(
        'os_getuid', 'B305', ['os.getuid'],
        'os.getuid'
        ))

    #examples/zlib_decompress.py
    sets.append(utils.build_conf_dict(
        'zlib_decompress', 'B306', ['zlib.decompress'],
        'zlib.decompress'
        ))

    #examples/urllib_request_urlopen.py
    sets.append(utils.build_conf_dict(
        'urllib_request', 'B307', ['urllib.request'],
        'urllib.request'
        ))

    #examples/urllib_request_urlopen.py
    sets.append(utils.build_conf_dict(
        'platform_system', 'B308', ['platform.system'],
        'platform.system'
        ))

    #examples/os_chmod.py
    sets.append(utils.build_conf_dict(
        'os_chmod', 'B315', ['os.chmod'],
        'os.chmod'
        ))

    #examples/os_system.py
    sets.append(utils.build_conf_dict(
        'os_system', 'B316', ['os.system'],
        'os.system'
        ))

    #examples/os_environ.py
    sets.append(utils.build_conf_dict(
        'os_environ', 'B317', ['os.environ'],
        'os.environ'
        ))

    #examples/urllib2_urlopen.py
    sets.append(utils.build_conf_dict(
        'urllib2_urlopen', 'B320', ['urllib2.urlopen'],
        'urllib2_urlopen'
        ))

    #examples/urllib2_Request.py
    sets.append(utils.build_conf_dict(
        'urllib2_Request', 'B321', ['urllib2.Request'],
        'urllib2_Request'
        ))

    #examples/multiprocessing_Pool.py
    sets.append(utils.build_conf_dict(
        'multiprocessing_Pool', 'B323', ['multiprocessing.Pool'],
        'multiprocessing_Pool'
        ))

    #examples/multiprocessing_Pool.py
    sets.append(utils.build_conf_dict(
        'signal_signal', 'B324', ['signal.signal'],
        'signal_signal'
        ))
    #examples/getpass_getuser.py
    sets.append(utils.build_conf_dict(
        'getpass_getuser', 'B329', ['getpass.getuser'],
        'getpass_getuser'
        ))
    return {'Call': sets}
