Exemple #1
0
	def __init__(self, session, ldap_mgr, ad_id = None, agent_cnt = None, progress_queue = None, show_progress = True, graph_id = None, resumption = False, members_target_file_handle = None, store_to_db = True):
		self.session = session
		self.ldap_mgr = ldap_mgr
		self.agent_cnt = agent_cnt
		self.ad_id = ad_id
		self.graph_id = graph_id
		self.domain_name = None
		self.resumption = resumption
		self.members_target_file_handle = members_target_file_handle
		
		self.progress_queue = progress_queue
		self.show_progress = show_progress

		if self.agent_cnt is None:
			self.agent_cnt = min(get_cpu_count(), 8)

		self.member_finish_ctr = 0
		self.agent_in_q = None
		self.agent_out_q = None
		self.total_targets = 0
		self.total_members_to_poll = 0
		self.progress_last_updated = datetime.datetime.utcnow()
		self.agents = []
		self.progress_step_size = 1000
		self.lookup = {}
		self.store_to_db = store_to_db
Exemple #2
0
def main():
	import os
	import argparse
	parser = argparse.ArgumentParser(description='auto collector for MP')
	#parser.add_argument('-v', '--verbose', action='count', default=0, help='Increase verbosity, can be stacked')
	#parser.add_argument('sql', help='SQL connection string in URL format')
	parser.add_argument('-q', '--sqlite_folder_path', default='./workdir', help='A folder to store enumeration results in')
	parser.add_argument('-m', '--multiplexor', default = 'ws://127.0.0.1:9999', help='multiplexor connection string in URL format')
	parser.add_argument('-p', '--parallel_cnt', default = get_cpu_count(), type=int, help='agent count')
	parser.add_argument('-o', '--progress-out-file', default = None, help='Filename to write progress to')
	parser.add_argument('-s', '--start-ui', action='store_true', help='Automatically start jackdaw UI after successful enumeration')

	args = parser.parse_args()

	logging.basicConfig(level=logging.DEBUG)
	msldaplogger.setLevel(logging.INFO)
	smblogger.setLevel(1)
	logging.getLogger('websockets.server').setLevel(logging.ERROR)
	logging.getLogger('websockets.client').setLevel(logging.ERROR)
	logging.getLogger('websockets.protocol').setLevel(logging.ERROR)
	logging.getLogger('aiosmb').setLevel(100)
	logging.getLogger('asysocks').setLevel(100)

	
	mas = MultiplexorAutoStart(args.multiplexor, args.sqlite_folder_path, parallel_cnt=args.parallel_cnt, progress_file_name = args.progress_out_file, start_ui = args.start_ui)
	asyncio.run(mas.run())
Exemple #3
0
    def __init__(self,
                 session,
                 ldap_mgr,
                 ad_id=None,
                 graph_id=None,
                 agent_cnt=None,
                 sd_target_file_handle=None,
                 resumption=False,
                 progress_queue=None,
                 show_progress=True,
                 store_to_db=True):
        self.session = session
        self.ldap_mgr = ldap_mgr
        self.agent_cnt = agent_cnt
        self.ad_id = ad_id
        self.domain_name = None
        self.graph_id = graph_id
        self.sd_target_file_handle = sd_target_file_handle
        self.resumption = resumption
        self.progress_queue = progress_queue
        self.show_progress = show_progress
        self.store_to_db = store_to_db
        self.progress_step_size = 1000
        self.sd_upload_pbar = None

        if self.agent_cnt is None:
            self.agent_cnt = min(get_cpu_count(), 4)

        self.progress_last_updated = datetime.datetime.utcnow()
        self.agent_in_q = None
        self.agent_out_q = None
        self.sd_file = None
        self.sd_file_path = None
        self.total_targets = None
        self.agents = []
Exemple #4
0
    def __init__(self,
                 session,
                 ldap_mgr,
                 agent_cnt=None,
                 progress_queue=None,
                 show_progress=True,
                 members_file_handle=None,
                 sd_file_handle=None,
                 stream_data=False):
        self.session = session
        self.members_file_handle = members_file_handle
        self.sd_file_handle = sd_file_handle

        self.agent_cnt = agent_cnt
        if self.agent_cnt is None:
            self.agent_cnt = min(get_cpu_count(), 4)

        self.progress_queue = progress_queue
        self.show_progress = show_progress

        self.ldap_mgr = ldap_mgr
        self.agents = []

        self.agent_in_q = None
        self.agent_out_q = None
        self.ad_id = None
        self.domain_name = None

        self.total_progress = None
        self.total_counter = 0
        self.total_counter_steps = 100
        self.progress_last_updated = datetime.datetime.utcnow()
        self.progress_last_counter = 0
        self.user_ctr = 0
        self.machine_ctr = 0
        self.ou_ctr = 0
        self.group_ctr = 0
        self.sd_ctr = 0
        self.spn_ctr = 0
        self.member_ctr = 0
        self.domaininfo_ctr = 0
        self.gpo_ctr = 0
        self.trust_ctr = 0

        self.running_enums = {}
        self.finished_enums = []
        self.stream_data = stream_data

        self.enum_types = [
            'adinfo',
            'trusts',
            'users',
            'machines',
            'groups',
            'ous',
            'gpos',
            'spns',
        ]
        self.enum_types_len = len(self.enum_types)
Exemple #5
0
    def __init__(self,
                 db_conn,
                 ad_id,
                 smb_mgr,
                 worker_cnt=None,
                 progress_queue=None,
                 show_progress=True,
                 rdns_resolver=None,
                 stream_data=False):
        self.in_q = None
        self.out_q = None
        self.smb_mgr = smb_mgr
        self.gathering_type = ['all']
        self.localgroups = [
            'Administrators', 'Distributed COM Users', 'Remote Desktop Users',
            'Remote Management Users'
        ]
        self.concurrent_connections = worker_cnt if worker_cnt is not None else get_cpu_count(
        )
        self.db_conn = db_conn
        self.progress_queue = progress_queue
        self.rdns_resolver = rdns_resolver
        self.show_progress = show_progress

        self.queue_size = self.concurrent_connections

        self.total_targets = 0
        self.session = None

        self.gatherer = None
        self.gatherer_task = None
        self.job_generator_task = None
        self.domain_name = None
        self.ad_id = ad_id

        self.prg_hosts = None
        self.prg_shares = None
        self.prg_sessions = None
        self.prg_groups = None
        self.prg_errors = None

        self.prg_errors_cnt = 0
        self.prg_sessions_cnt = 0
        self.prg_shares_cnt = 0
        self.prg_groups_cnt = 0
        self.prg_hosts_cnt = 0
        self.progress_step_size = 1

        self.results_thread = None
        self.rdns_task = None
        self.stream_data = stream_data
Exemple #6
0
    def __init__(self,
                 db_conn,
                 ad_id,
                 smb_mgr,
                 depth=10,
                 worker_cnt=None,
                 progress_queue=None,
                 show_progress=True,
                 stream_data=False,
                 to_file=None,
                 target_filters=[]):
        self.in_q = None
        self.out_q = None
        self.smb_mgr = smb_mgr
        self.concurrent_connections = worker_cnt if worker_cnt is not None else get_cpu_count(
        )
        self.db_conn = db_conn
        self.progress_queue = progress_queue
        self.show_progress = show_progress
        self.queue_size = self.concurrent_connections
        self.to_file = to_file
        self.depth = depth
        self.target_filters = target_filters

        self.session = None
        self.total_targets = 0

        self.gatherer = None
        self.gatherer_task = None
        self.job_generator_task = None
        self.domain_name = None
        self.ad_id = ad_id

        self.prg_hosts = None
        self.prg_shares = None
        self.prg_dirs = None
        self.prg_files = None
        self.prg_size = None
        self.prg_errors = None

        self.prg_hosts_cnt = 0
        self.prg_shares_cnt = 0
        self.prg_dirs_cnt = 0
        self.prg_files_cnt = 0
        self.prg_size_cnt = 0
        self.prg_errors_cnt = 0
        self.progress_step_size = 1

        self.stream_data = stream_data
        self.result_buffer = []
        self.result_buffer_size = 1000
Exemple #7
0
    def __init__(self,
                 db_session,
                 ldap_mgr,
                 agent_cnt=None,
                 progress_queue=None,
                 ad_id=None,
                 graph_id=None,
                 work_dir=None,
                 show_progress=True,
                 store_to_db=True,
                 base_collection_finish_evt=None,
                 stream_data=False,
                 no_work_dir=False,
                 proxy=None):
        self.db_session = db_session
        self.ldap_mgr = ldap_mgr
        self.work_dir = work_dir
        self.no_work_dir = no_work_dir
        self.show_progress = show_progress
        self.store_to_db = store_to_db
        self.progress_queue = progress_queue
        self.base_collection_finish_evt = base_collection_finish_evt
        self.proxy = proxy

        self.agent_in_q = None
        self.agent_out_q = None
        self.agents = []

        self.agent_cnt = agent_cnt
        if agent_cnt is None:
            self.agent_cnt = min(get_cpu_count(), 4)

        self.graph_id = graph_id
        self.resumption = False
        self.ad_id = ad_id

        if ad_id is not None:
            self.resumption = True
        self.domain_name = None

        self.members_target_file_name = None
        self.sd_target_file_name = None

        self.sd_task = None
        self.members_task = None
        self.stream_data = stream_data