コード例 #1
0
ファイル: ip_calc.py プロジェクト: KhasMek/python-iet
def main(config, _type=None, target=None, netblock=None):
    global logger
    logger = setup_logging(load_config(config, 'logging'))
    if _type == 'summary':
        summary([target])
    if _type == "range":
        range([target])
    if _type == "isitin":
        key = target
        net = netblock
        isitin(net, key)
コード例 #2
0
def main(config, target):
    global logger
    shodan_base_url = "https://www.shodan.io/search?query=http.favicon.hash%3A"
    logger = setup_logging(load_config(config, 'logging'))
    response = requests.get(target, verify=False)
    logger.debug("Response: %s" % response)
    favicon = codecs.encode(response.content,"base64")
    favicon_hash = mmh3.hash(favicon)

    logger.debug("Favicon hash: %s" % favicon_hash)
    shodan_hash_url = "%s%s" % (shodan_base_url, favicon_hash)
    logger.info("Results: %s" % shodan_hash_url)
コード例 #3
0
def main(config, basename, project_name, project_type):
    """
    - load config file
    - create base directory and subdirs from config.
       - we use makedirs over makedir in case the parent
       directory needs to be created too
    - move .in and .out (and other files??) over
    - set vars for ssh ports,etc. This stage needs more work atm
    """
    global logger
    logger = setup_logging(load_config(config, 'logging'))
    config = load_config(config, 'bootstrap')[project_type]
    logger.info("project type: %s" % project_type)
    logger.info("basename: %s" % basename, )
    logger.info("project name: %s" % project_name)
    iet_vars = mkvars(config['vars'])
    logger.debug("iet variables: %s" % iet_vars)
    for _dir in config['dirs']:
        logger.debug("Creating directory: %s" % _dir)
        os.makedirs(os.path.join(basename, project_name, _dir))
    for file_dirs in config['files']:
        logger.debug("Files copy dir: %s - %s" %
                     (file_dirs, ', '.join(config['files'][file_dirs])))
        for copy_file in config['files'][file_dirs]:
            src = os.path.basename(copy_file)
            if file_dirs in 'basedir':
                dst = os.path.join(basename, project_name, src)
            else:
                dst = os.path.join(basename, project_name, file_dirs, src)
            do_replace = True
            if copy_file.endswith('-noreplace'):
                do_replace = False
                copy_file = copy_file.replace('-noreplace', '')
            copy_file = get_file_path(copy_file)
            if do_replace:
                if do_copy_update_file(copy_file, dst, iet_vars):
                    logger.debug("Copied %s to %s" % (copy_file, dst))
                else:
                    logger.error("ERROR: could not copy %s to %s" %
                                 (copy_file, dst))
            else:
                logger.debug("Not performing find/replace on %s" % copy_file)
                copyfile(copy_file, dst)
                logger.debug("Copied %s to %s" % (copy_file, dst))
コード例 #4
0
def main(config,
         iters=100,
         basic=False,
         regex=None,
         copy=False,
         stdout=False,
         write=False,
         outfile='iet-wordlist.txt'):
    global logger
    logger = setup_logging(load_config(config, 'logging'))
    config = load_config(config, 'wordlists')
    iters = int(iters.replace('k', '000'))
    wordlist = ''
    if (not basic) and (not regex):
        logger.error("You must provide regex or generate a basic list!")
        sys.exit(0)
    if basic:
        logger.debug("Generating basic seasonal wordlist")
        wordlist = gen_seasonal_wordlist(config['month_spread'],
                                         config['seasons'],
                                         config['end_characters'])
    if regex:
        logger.debug("Generating wordlist based off regular expression (%s)" %
                     regex)
        if wordlist:
            regex_wordlist = gen_regex_list(regex, iters)
            wordlist.update(regex_wordlist)
        else:
            wordlist = gen_regex_list(regex, iters)
    if stdout:
        for line in wordlist:
            logger.info(line)
    if write:
        write_outfile(outfile, wordlist)
        logger.info("Wordlist written to %s" % outfile)
    if copy:
        try:
            pyperclip.copy('\n'.join(wordlist))
            logger.info("Wordlist copied to the clipboard")
        except pyperclip.PyperclipException:
            logger.error(
                "Could not find a copy/paste mechanism for your system.")
コード例 #5
0
def main(config, target=None, outfile=None, no_verify=False):
    global logger
    logger = setup_logging(load_config(config, 'logging'))
    session = requests.Session()
    if no_verify:
        logger.debug("Disable SSL Verificaiton: %s" % no_verify)
        urllib3.disable_warnings()
        session.get(target, verify=False)
    else:
        try:
            session.get(target)
        except Exception as e:
            logger.error(e)
            logger.error("Have you tried with -nv?")
    cookies = session.cookies.get_dict()
    if cookies:
        for k, v in cookies.items():
            logger.info("%s: %s" % (k, v))
    else:
        logger.info("%s does not assign any cookies" % target)
    if outfile:
        write_outfile(outfile, cookies)