How to use the black.workers.common.async_task.AsyncTask function in black

To help you get started, we’ve selected a few black examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github c0rvax / project-black / black / workers / masscan / masscan_task.py View on Github external
def __init__(self, task_id, target, params, project_uuid):
        AsyncTask.__init__(self, task_id, 'masscan', target, params, project_uuid)
        self.proc = None

        self.exit_code = None
        self.stdout = []
        self.stderr = []
github c0rvax / project-black / black / workers / masscan / masscan_task.py View on Github external
""" Keeps class with the interfaces that are pulled by worker
to manager the launched instance of scan. """
import re
import json
import signal

import asyncio
from asyncio.subprocess import PIPE

from black.workers.common.async_task import AsyncTask
from black.workers.masscan.db_save import save_raw_output

class MasscanTask(AsyncTask):
    """ Major class for working with masscan """

    def __init__(self, task_id, target, params, project_uuid):
        AsyncTask.__init__(self, task_id, 'masscan', target, params, project_uuid)
        self.proc = None

        self.exit_code = None
        self.stdout = []
        self.stderr = []

        if type(self.target) == list:
            self.target = ",".join(self.target)

    async def start(self):
        """ Launch the task and readers of stdout, stderr """
        print(self.params, self.target)
github c0rvax / project-black / black / workers / amass / amass_task.py View on Github external
""" Keeps class with the interfaces that are pulled by worker
to manager the launched instance of scan. """
import re
import json
import signal

import asyncio
from asyncio.subprocess import PIPE

from black.workers.common.async_task import AsyncTask
from black.workers.amass.db_save import Saver

from common.logger import log

@log
class AmassTask(AsyncTask):
    """ Major class for working with amass """

    def __init__(self, task_id, target, params, project_uuid):
        AsyncTask.__init__(self, task_id, 'amass', target, params, project_uuid)
        self.proc = None

        self.exit_code = None
        self.stdout = []
        self.stderr = []


    async def start(self):
        """ Launch the task and readers of stdout, stderr """
        try:
            self.command = ['amass', 'enum' '-d'] + [self.target] + [self.params['program']['argv']]
            print(' '.join(self.command))
github c0rvax / project-black / black / workers / dnsscan / DNSScanTask.py View on Github external
import asyncio
import aiodns
import time
import json
import itertools
from collections import defaultdict

from black.workers.common.async_task import AsyncTask
from .save import save

domain_to_brute = 'anatoly.tech'


class DNSScanTask(AsyncTask):
    """ Major class for working with dnsscan """

    def __init__(self, task_id, target, params, project_uuid):
        AsyncTask.__init__(self, task_id, 'dnsscan', target, params, project_uuid)
        # program_params = params['program']
        # self.params_object = program_params

        self.request_queue = asyncio.Queue()
        self.resolver = aiodns.DNSResolver()

        self.pool_size = 10

        self.new_ips_ids = list()
        self.new_hosts_ids = list()

    def send_notification(self, command):