Ejemplo n.º 1
0
def load_all_modules():
    """
    load all available modules

    Returns:
        an array of all module names
    """
    # Search for Modules
    # the modules are available in lib/modules/category_name/module_name (e.g. lib/modules/ftp/weak_password
    # they will be listed based on the folder names and if "Dockerfile" exist!
    # structure of module name: module_name = lib/modules/(category_name/module_name)/__init.py
    # example: module_name = lib/modules/(ftp/weak_password)/__init.py = ftp/weak_password
    module_names = []
    for module in glob(
            os.path.dirname(inspect.getfile(lib)) +
            '/modules/*/*/__init__.py'):
        module_name = module.rsplit('\\' if is_windows() else '/')[-3] + '/' + \
                      module.rsplit('\\' if is_windows() else '/')[-2]
        if os.path.exists(
                module.rsplit('__init__.py')[0] + '/' + 'Dockerfile'):
            if module_name not in module_names:
                module_names.append(module_name)
        else:
            warn(messages("en", "module_not_available").format(module_name))
    return module_names
Ejemplo n.º 2
0
def load_all_graphs():
    graph_names = []
    for _lib in glob(os.path.dirname(inspect.getfile(lib)) + '/*/*/engine.py'):
        if os.path.dirname(_lib).rsplit('\\' if is_windows(
        ) else '/')[-2] == "graph" and _lib + '_graph' not in graph_names:
            _lib = _lib.rsplit('\\' if is_windows() else '/')[-2]
            graph_names.append(_lib + '_graph')
    return graph_names
Ejemplo n.º 3
0
def load_all_modules():
    # Search for Modules
    module_names = []
    for _lib in glob(os.path.dirname(inspect.getfile(lib)) + '/*/*/engine.py'):
        libname = _lib.rsplit('\\' if is_windows() else '/')[-2]
        category = _lib.rsplit('\\' if is_windows() else '/')[-3]
        if category != 'graph' and libname + '_' + category not in module_names:
            module_names.append(libname + '_' + category)
    module_names.append('all')
    return module_names
Ejemplo n.º 4
0
                            27356, 27715, 28201, 30000, 30718, 30951, 31038, 31337, 32768, 32769, 32770,
                            32771, 32772, 32773, 32774, 32775, 32776, 32777, 32778, 32779, 32780, 32781,
                            32782, 32783, 32784, 32785, 33354, 33899, 34571, 34572, 34573, 35500, 38292,
                            40193, 40911, 41511, 42510, 44176, 44442, 44443, 44501, 45100, 48080, 49152,
                            49153, 49154, 49155, 49156, 49157, 49158, 49159, 49160, 49161, 49163, 49165,
                            49167, 49175, 49176, 49400, 49999, 50000, 50001, 50002, 50003, 50006, 50300,
                            50389, 50500, 50636, 50800, 51103, 51493, 52673, 52822, 52848, 52869, 54045,
                            54328, 55055, 55056, 55555, 55600, 56737, 56738, 57294, 57797, 58080, 60020,
                            60443, 61532, 61900, 62078, 63331, 64623, 64680, 65000, 65129, 65389]
    }


if "--method-args" in sys.argv and "port_scan_stealth" in " ".join(sys.argv).lower():
    from scapy.all import *

    if is_windows():  # fix later
        from scapy.base_classes import Gen, SetGen
        import scapy.plist as plist
        from scapy.utils import PcapReader
        from scapy.data import MTU, ETH_P_ARP
        import re
        import sys
        import itertools
    WINDOWS = True
    conf.verb = 0
    conf.nofilter = 1


def check_closed(ip):
    for i in range(1, 10):
        s = sr1(IP(dst=ip) / TCP(dport=i), timeout=2, verbose=0)
Ejemplo n.º 5
0
from core.compatible import make_tmp_thread_dir
from core.get_modules import virtual_machine_names_to_container_names
from core.get_modules import virtual_machine_name_to_container_name
from core.network import new_network_events
from core.exit_helper import terminate_thread
from api.server import start_api_server
from core.compatible import check_for_requirements
from core.compatible import copy_dir_tree
from core.compatible import mkdir
from core.compatible import get_module_dir_path
from database.connector import insert_bulk_events_from_thread
from database.connector import insert_events_in_bulk
from core.compatible import is_verbose_mode

# temporary use fixed version of argparse
if is_windows():
    if version() is 2:
        from lib.argparse.v2 import argparse
    else:
        from lib.argparse.v3 import argparse
else:
    import argparse

# tmp dirs
tmp_directories = []
processor_threads = []


def all_existing_networks():
    """
    list of all existing networks