Esempio n. 1
0
def test_catalogue_mismatch(t, tc):
    banner('Testing for source name mismatches')
    count = 0
    print 'Making lists...'
    tn = list(set(t['Source_Name']))
    tcn = list(set(tc['Source_Name']))
    print 'Sorting...'
    tn.sort()
    tcn.sort()
    print 'Checking...'
    i = 0
    j = 0
    while i < len(tn) and j < len(tcn):
        if tn[i] == tcn[j]:
            i += 1
            j += 1
        elif tn[i] < tcn[j]:
            name = tn[i]
            source = t[t['Source_Name'] == name][0]
            print '%s (%i) is in source catalogue but not component catalogue' % (
                name, source['ID_flag']), i, j
            count += 1
            i += 1
        elif tcn[j] < tn[i]:
            print tcn[
                j], 'is in component catalogue but not source catalogue', i, j
            j += 1
            count += 1
        else:
            raise RuntimeError('Cannot happen')
    print 'Found', count, 'mismatches'
    return count == 0
Esempio n. 2
0
def check_for_db():

	if os.path.exists('Responder.db'):
		return True
	else:
		os.system('clear')
		utils.banner()
		print Colors.yellow + "[!] Waiting for the Responder.db database to be created.(Should be after 1st Capture)..\n" + Colors.normal
Esempio n. 3
0
def test_duplicate_id(t):
    banner('Testing for duplicate optical IDs')
    count = test_duplicate(t,
                           'ID_name',
                           'optical ID name',
                           exclude=['Mult', 'Altered'])
    print 'Found', count, 'cases of duplication'
    return count == 0
Esempio n. 4
0
def cleaner() -> None:
    """Remove all docker containers and iptables rules"""

    banner()
    logger.info("Cleaning process has started.")
    docker_cleaner()
    iptables_cleaner()
    logger.info("Done!")
Esempio n. 5
0
def print_summary(sub_def_dict, subscribers):
    """Printing subscriber's summary."""
    print(utils.banner("Summary"))
    total_subs = len(subscribers)
    total_unique_sub = len(sub_def_dict)
    print("Total subscriber: {}").format(total_subs)
    print("Total unique subscriber: {}").format(total_unique_sub)
    print("Total duplicate "
          "subscriber:{}").format(total_subs - total_unique_sub)
    print(utils.banner("End of Summary"))
Esempio n. 6
0
def test_missing_source(tc, ta, ts):
    banner('Testing for missing sources from the PyBDSF catalogue')
    count = 0
    for r in pbar(ts):
        name = r['Source_Name']
        if np.sum(tc['Component_Name'] == name) == 0:
            # not in component catalogue
            if np.sum(tc['Deblended_from'] == name) == 0:
                # not deblended
                if np.sum(ta['Source_Name'] == name) == 0:
                    print 'PyBDSF source', name, 'not found'
                    count += 1
    print 'Found', count, 'missing sources'
    return count == 0
Esempio n. 7
0
def main():
    banner()
    dataset = DataSet()
    dataset.read()

    model = Model()
    model.build_model(dataset)
    model.train(dataset, nb_epoch=10)
    model.save()

    model = Model()
    model.load()
    model.evaluate(dataset)
    gc.collect()
Esempio n. 8
0
    def solve(self):
        iterator = self.solver.iterator
        
        done = False
        utils.banner('Replace with actual termination conditions')
        for i in xrange(2):
            utils.banner('Basis outerloop iteration')
            # Inner loop solve
            self.solver.solve()

            # Generate a new basis function
            # (N,1) ndarray or sparse matrix
            (basis_fn,block_id) = self.basis_improver.\
                                  improve_basis(iterator)
            iterator.update_basis(basis_fn,block_id) # update
Esempio n. 9
0
def main():
    banner()
    logger.info("Initializing...")

    logger.info("Starting base docker")
    container = create_container()
    if not container:
        return

    host_port = docker_host_port(
        CURRENT_CONTAINER)[HONEYPOT_DOCKER_SERVICE_PORT]
    logger.info("Base docker has started")

    logger.info("Creating initial iptables rules...")
    local_ip = get_local_ip(INTERFACE)

    out, ok = command("iptables -t nat -A PREROUTING -p tcp "
                      f"-d { local_ip } --dport { HONEYPOT_SERVICE_PORT } "
                      f"-j DNAT --to { local_ip }:{ host_port }")
    if not ok:
        return

    out, ok = command(f"iptables -A INPUT -p tcp -i { INTERFACE } "
                      "--dport 22 -m state --state NEW,ESTABLISHED "
                      "-j ACCEPT")
    if not ok:
        return

    out, ok = command(f"iptables -A OUTPUT -p tcp -o { INTERFACE } "
                      "--sport 22 -m state --state ESTABLISHED "
                      "-j ACCEPT")
    if not ok:
        return

    out, ok = command(
        f"iptables -A OUTPUT -p tcp --tcp-flags SYN,ACK SYN,ACK",
        ["-j", "LOG", "--log-prefix", "Connection established: "])
    if not ok:
        return

    logger.info("Rules created. Honeydock is ready to go. :)")

    handler = EventHandler(KERN_LOG_PATH)
    watch_manager = WatchManager()
    watch_manager.add_watch(handler.file_path, IN_MODIFY)
    notifier = Notifier(watch_manager, handler)
    notifier.loop()
Esempio n. 10
0
def main():
    banner()
    parser = argparse.ArgumentParser()
    parser.add_argument('-uD',
                        '--update-domains',
                        dest='update_domains',
                        help='update domains',
                        action='store_true')
    # update all domains will take a long time
    parser.add_argument('-uDA',
                        '--update-all-domains',
                        dest='update_all_domains',
                        help='update all domains',
                        action='store_true')
    parser.add_argument('-uSD',
                        '--update-subdomains',
                        dest='update_subdomains',
                        help='update subdomains',
                        action='store_true')
    parser.add_argument('-uA',
                        '--update-all',
                        dest='update_all',
                        help='update all',
                        action='store_true')

    if len(sys.argv) == 1:
        parser.print_help()
        sys.exit(0)

    args = parser.parse_args()

    if args.update_all:
        update_all()
        return

    if args.update_domains:
        update_domains()
    else:
        if args.update_all_domains:
            update_domains(update_all=True)

    if args.update_subdomains:
        update_subdomains()
Esempio n. 11
0
def display_to_screen():

	os.system("clear")
	utils.banner()
        answers,cleartext,hash = fetch()
        print Colors.bldyellow + "[!]Running in Status Only Mode\n" + Colors.normal
	print Colors.blue + '[*] Session Poison Counts'+ Colors.normal

	if len(answers) == 0:
		print Colors.normal + "\n  No records for this session"
	else:
	        for name,count in answers:
			pname = Colors.yellow + name
                	pcount = Colors.bldblue + str(count) + Colors.normal
	       	        print '    %-15s' % pname  + "%s"%(pcount)
	
	print Colors.blue + '\n[*] Session Password/Hash Counts' + Colors.normal 
	
	if len(cleartext) == 0:
		pass
	else:
		for name,count in cleartext:
			pname = Colors.yellow + name
                	pcount = Colors.bldblue + str(count) + Colors.normal
	                print '    %-15s' % pname  + "%s"%(pcount)

	if len(hash) == 0:
		print Colors.normal + "\n  No Hashes found"
	else:
		for name,count in hash:
			pname = Colors.yellow + name
                        pcount = Colors.bldblue + str(count) + Colors.normal
                        print '    %-20s' % pname  + "%s"%(pcount)
	print ""
	print "\tResponder output may appear below. " 
	print "-" * 60
Esempio n. 12
0
def test_duplicate_sourcename(t):
    banner('Testing for optical cat sourcenames')
    count = test_duplicate(t, 'Source_Name', 'source name')
    print 'Found', count, 'cases of duplication'
    return count == 0
Esempio n. 13
0
    people_menu = WebNavMenu("People search tools",
                             " - extract OSINT from multiple databases",
                             people_tools)
    social_menu = WebNavMenu(
        "Social media tools",
        " - collect OSINT from various social media platforms",
        social_tools,
    )
    paste_menu = WebNavMenu("Paste site tools",
                            "  - collect OSINT from multiple paste sites",
                            paste_tools)
    dark_menu = WebNavMenu("Dark web tools",
                           " - collect OSINT from dark web sources",
                           dark_tools)

    # Create the main menu from the sub menus
    main_menu = SuperMenu(
        "Main Menu",
        sub_menus=[
            recon_menu, people_menu, social_menu, paste_menu, dark_menu
        ],
    )
    main_menu.show_menu()


if __name__ == "__main__":
    banner()  # Display the banner
    announce(
        "New tools available in the Citadel: POCKINT, InstaLoader, CardPwn, Onioff"
    )
    main()
Esempio n. 14
0
    # if needed, more options can be used
    # hour = now.hour
    # minute = now.minute
    # seconds = now.second

    file_name = f'{router["server_ip"]}_{year}-{month}-{day}.txt'
    with open(file_name, 'w') as f:
        f.write(output)

    paramikoModule.close(client)
    time.sleep(5)


while True:
    # Calls Georgios's banner
    utils.banner()
    # Provides the menu options to the user
    answer = utils.menu()

    if answer == '1':

        # Rather than storing creds in the code. Call the get_creds method to get them
        # it will return a dictionary consisting of the username & password variables
        credentials = utils.get_creds()
        # gets the new secret
        secret = utils.get_secret()

        # creating a dictionary for each device to connect to. It could read from a file the IPs...
        # add more routers as needed
        router1 = {
            'server_ip': '10.x.x.x',
def test_banner():
    banner()
Esempio n. 16
0
def cli()->None:

    ut.banner()

    prs = arp.ArgumentParser()
    sub_prs = prs.add_subparsers(dest ="command")
    aa = prs.add_argument

    run_prs = sub_prs.add_parser("run")
    ana_prs = sub_prs.add_parser("analyze")

    run_aa = run_prs.add_argument
    ana_aa = ana_prs.add_argument

    run_aa("-z","--input_data",required = True)
    run_aa("-mp","--model_parameters",required = True)
    run_aa("-t0","--initial_time",
           type = int,
           default = 0,
           )
    run_aa("-o",
           "--out_dir",
           default = "/tmp",
           )

    run_aa("-tag","--tag",
           default = "",
           )

    ana_aa("-r","--result",
           type = str,
           )

    ana_aa("-a","--animate",
       action = "store_true",
       default = False,
       )

    ana_aa("-o","--out_dir",
           default = "/tmp",
           )

    ana_aa("-img","--images",
           nargs = "+",
           )

    ana_aa("-tag",
           "--tag",
           default ="",
           )

    ana_aa("-ms","--marker_size",
           default = 5.0,
           type = float
           )

    ana_aa("-d","--delay",
           default = 10,
           type = int,
           )

    ana_aa("-kf","-keep_frames",
           default = False,
           type = bool,
           action ="store_true",
           )


    args = prs.parse_args()


    if args.command == "run":
        iprint("Reading model parameters from : {}".format(args.model_parameters))
        with open(args.model_parameters) as f:
            model_parameters = yaml.load(f, Loader=yaml.FullLoader)

        for p,v in model_parameters.items():
            if isinstance(v,str):
                model_parameters[p] = eval(v)
            if isinstance(v,dict):
                for sp,sv in v.items():
                    if isinstance(sv,str):
                        v[sp] = eval(sv)

        iprint("Reading observational data from : {}".format(args.input_data))
        obs_data = pd.read_csv(args.input_data,
                            sep = "\t",
                            header = 0,
                            index_col = 0,
                            )

        iprint("Running celltracker")
        results = run_celltrack(obs = obs_data,
                                model_params = model_parameters,
                                t0 = args.initial_time,
                                )
        iprint("Completed celltracker")

        tag = (args.tag + "-" if args.tag != "" else args.tag)

        out_fn = osp.join(args.out_dir,
                                tag + "cell-track-res.tsv",
                                )
        results.to_csv(out_fn,
                       sep = "\t",
                       )

        iprint("Saved results to : {}".format(out_fn))


    if args.command == "analyze":
        iprint("Entering analysis module")
        iprint("Using results file : {}".format(args.result))
        results = pd.read_csv(args.result,
                              sep = "\t",
                              header = 0,
                              index_col = 0,
                              )
        if args.tag == "":
            tag = osp.basename(args.results).split("-")[0] + "-"
            if tag == "cell":
                tag = ""
        else:
            tag = args.tag + "-"

        if args.animate:
            iprint("Animating results")
            from sys import platform
            if platform.lower() != "linux":
                eprint("OS not supported for animation")
            else:
                if osp.isdir(args.images[0]):
                    image_ext = ["png",
                                "tiff",
                                "tif",
                                "jpg",
                                "jpeg",
                                "gif",
                                "bmp"]
                    is_image = lambda x : x.split(".")[-1] in image_ext
                    img_pths = list(filter(is_image,os.listdir(args.images[0])))
                    img_pths = [osp.join(args.images[0],p) for p in img_pths]
                else:
                    img_pths = args.images

                img_pths.sort()
                iprint("Initating animation")
                ut.animate_trajectories(results,
                                        images = img_pths,
                                        out_dir = args.out_dir,
                                        tag = tag,
                                        marker_size = args.marker_size,
                                        delay = args.delay,
                                        save_frames = args.keep_frames,
                                        )
                iprint("Completed animation. Results saved to : {}".format(args.out_dir))
Esempio n. 17
0
 def improve_basis(self,iterator):
     utils.banner('Will not always have access to MDP object')
     mdp_obj = iterator.mdp_obj
     v = iterator.get_value_vector()
     res = mdp_obj.get_value_residual(v)
     return (res,0) # Value is 0
Esempio n. 18
0
def test_idflag_mismatch(t, tc):
    banner('Testing for mismatched ID flags')
    tt = join(t, tc, keys=['Source_Name'])
    count = np.sum(tt['ID_flag_1'] != tt['ID_flag_2'])
    print 'Found', count, 'cases of mismatching ID_flag\'s'
    return count == 0
Esempio n. 19
0
        base.reqs += 1

        if 'charset=gbk' in req.content:
            content = req.content.decode('gbk').encode('utf8')
        else:
            content = req.content

        for plg in self.plgptn.findall(content):
            self.outs.add(plg[1])

        print '[+] In "index.php" %s plugins are found.\n' % len(self.outs)


if __name__ == "__main__":
    start_time = datetime.datetime.now()
    banner()
    cmdArgs = parseCmd()

    base = DzscanBase(cmdArgs)
    # {'url': None, 'force': False, 'gevents': 10, 'update': True, 'verbose': False, 'log': False}
    # base.brute_founder_pwd('admin')
    # base.brute_admin_id()

    if cmdArgs['update']:
        base.update()

    elif cmdArgs['url'] == None:
        print "usage: ./dzscan.py --help"

    else:
        base.fetch_version()
Esempio n. 20
0
from lua_bridge.lua_bridge import LuaBridge

gettext.bindtextdomain('magicked_admin', 'locale')
gettext.textdomain('magicked_admin')
gettext.install('magicked_admin', 'locale')

init()

parser = argparse.ArgumentParser(
    description=_('Killing Floor 2 Magicked Administrator')
)
parser.add_argument('-s', '--skip_setup', action='store_true',
                    help=_('Skips the guided setup process'))
args = parser.parse_args()

banner()

REQUESTS_CA_BUNDLE_PATH = find_data_file("./certifi/cacert.pem")

if hasattr(sys, "frozen"):
    import certifi.core

    os.environ["REQUESTS_CA_BUNDLE"] = REQUESTS_CA_BUNDLE_PATH
    certifi.core.where = REQUESTS_CA_BUNDLE_PATH

    import requests.utils
    import requests.adapters

    requests.utils.DEFAULT_CA_BUNDLE_PATH = REQUESTS_CA_BUNDLE_PATH
    requests.adapters.DEFAULT_CA_BUNDLE_PATH = REQUESTS_CA_BUNDLE_PATH
Esempio n. 21
0
def test_duplicate_compname(t):
    banner('Testing for duplicate component cat component names')
    count = test_duplicate(t, 'Component_Name', 'component name')
    print 'Found', count, 'cases of duplication'
    return count == 0