示例#1
0
def robot(target):
    from core.build_menu import buildmenu
    for host in target:
        host.lvl2=inspect.stack()[0][3]
        host.lvl3=''
        if '//' in host.name:
            site = host.name
        else:
            site = 'https://'+host.name
        url = site + '/robots.txt'
        print(' [!] Testing for robots.txt...\n')
        try:
            resp = requests.get(url).text
            m = str(resp)
            print(color.yellow(' [+] Robots.txt found!'))
            print(color.green(' [*] Saving contents of robots.txt...'))
            data = m
            save_data(host.database, host.module, host.lvl1, host.lvl2, host.lvl3, host.name, str(data))
            #print(m)
        except:
            print(color.red(' [-] Robots.txt not found'))

        print(' [!] Testing for sitemap.xml...\n')
        url0 = site + '/sitemap.xml'
        try:
            resp = requests.get(url0).text
            m = str(resp)
            print(color.yellow(' [+] Sitemap.xml found!'))
            print(color.green(' [*] Saving contents of sitemap.xml'))
            data=m
            save_data(host.database, host.module, host.lvl1, host.lvl2, host.lvl3, host.name, str(data))
        except:
            print(color.red(' [-] Sitemap.xml not found'))
        time.sleep(2)
        buildmenu(target,target[0].main_menu,'Main Menu','')
示例#2
0
def check0x00(content, url):

    for pattern in patterns:
        print(color.blue(' [!] Finding ') + pattern + ' ...')
        time.sleep(0.005)
        if search(pattern, content):
            print(color.green(' [!] Possible error at ') + color.yellow(url))
            print(color.green(" [+] Found : \"%s\" at %s" % (pattern, url)))
            found = 0x01
示例#3
0
def iphistory(target):
    for t in target:
        site = t.name.replace('http://', '').replace('https://', '')
        try:
            web0 = site.split('/')[-1]
            print(' [!] Making the request...')
            html = requests.get('https://viewdns.info/iphistory/?domain=' +
                                web0).text
            print(' [*] Parsing raw-data...')
            soup = BeautifulSoup(html, 'lxml')
            print(soup)
            print(' [!] Setting parameters...')
            table = soup.findAll('table', attrs={'border': '1'})[0]
            print(' [!] Finding IP history instances...')
            trs = table.findAll('tr')
            trs.pop(0)

            print('\n [+] Following instances were found...')

            for tr in trs:
                td = tr.findAll('td')
                info = {
                    'ip': td[0].text,
                    'owner': td[2].text.rstrip(),
                    'last': td[3].text
                }
                print(
                    color.green(' [+] Instance : ') + color.blue(info['ip']) +
                    color.white(' => ' + info['owner']) +
                    color.blue(' - (' + info['last'] + ')'))
        except:
            print(color.red(' [-] No instances of IP History found...'))
            pass
示例#4
0
def revip(target):
    for t in target:
        site = t.name.replace('http://', '').replace('https://', '')
        print(' [!] Looking Up for Reverse IP Info...')
        print(' [~] Result : \n')
        text = requests.get('http://api.hackertarget.com/reverseiplookup/?q=' +
                            site).text
        result = str(text)
        res = result.splitlines()
        if 'error' not in result:
            for r in res:
                print(color.yellow(' [+] Site :> ') + color.green(r))
                #links.append(r)

                # p = 'tmp/logs/'+web+'-logs/'+str(web)+'-reverse-ip.lst'
                # open(p,'w+')
                # print(B+' [!] Saving links...')
                # time.sleep(1)
                # for m in links:
                #     m = m + '\n'
                #     ile = open(p,"a")
                #     ile.write(m)
                #     ile.close()
                # pa = os.getcwd()
                # print(G+' [+] Links saved under '+pa+'/'+p+'!')
                # print('')

        elif 'error' in result:
            print(color.red(' [-] Outbound Query Exception!'))
示例#5
0
def subnet(target):
    for t in target:
        site = t.name.replace('http://', '').replace('https://', '')
        print(color.green(' [!] Enumerating subnets in network...'))
        print('[*] Getting subnet class infos...\n')
        text = requests.get('http://api.hackertarget.com/subnetcalc/?q=' +
                            site).text
        http = str(text)
        if 'error' not in http:
            result = http.splitlines()
            for r in result:
                print(
                    color.green(' ' + r.split('=')[0] + '=' +
                                color.yellow(r.split('=')[1])))
        elif 'No results found' in http:
            print(color.red(' [-] No results found!'))
        else:
            print(color.red(' [-] Outbound Query Exception!'))
示例#6
0
def build_db_menu(a_list, b_list, selection, target):
    from core.build_menu import buildmenu
    if selection == "None":
        build_banner("Access Data")
    else:
        build_banner(query_list[-1])
    while True:
        ctr = 0
        while ctr < len(a_list):
            if "Data" in selection.values():
                print(
                    color.green(' [' + str(ctr + 1) + '] ') +
                    color.blue(str(a_list[ctr])))
            elif b_list != "None":
                print(
                    color.green(' [' + str(ctr + 1) + '] ') +
                    color.blue(b_list[ctr]))
            else:
                print(
                    color.green(' [' + str(ctr + 1) + '] ') +
                    color.blue(a_list[ctr]))
            ctr += 1
        if selection != "None":
            print(higher_menu_exit_message)
        print(main_exit_message)
        cmd = input(input_cursor)
        if cmd.lower() == "m":
            found = True
            buildmenu(target, target[0].main_menu, 'Main Menu', '')
        elif cmd == "0":
            del query_list[-1]
            return cmd
        elif int(cmd) <= len(a_list):
            query_list.append(a_list[int(cmd) - 1])
            if selection == "None":
                return a_list[int(cmd) - 1]
            elif selection[a_list[int(cmd) - 1]] == "Data":
                query_db(query_list)
                del query_list[-1]
            else:
                return a_list[int(cmd) - 1]
        else:
            print(error_message)
示例#7
0
def hackertarget(target):
    from core.build_menu import buildmenu
    site = 'https://api.hackertarget.com/'
    options = ['mtr','nping','dnslookup','reversedns','whois','geoip','reverseiplookup',\
        'httpheaders','pagelinks','aslookup']
    description=['Access to the MTR Traceroute API','Access to the on-line Test Ping API',\
    'Access to the DNS Lookup API','Access to the Reverse DNS Lookup API',\
    'Access to the Whois Lookup API','Access to the GeoIP Lookup API',\
    'Access to the Reverse IP Lookup API','Access to the HTTP Headers API',\
    'Access to the Page Links API','Access to the AS Lookup API']
    print(
        color.green(
            " [*] Finding HackerTarget.com information. This will take approximately 20 seconds ...\n"
        ))
    for host in target:
        host.lvl2 = inspect.stack()[0][3]
        host.lvl3 = ''
        i = 0
        for option in options:
            try:
                print(
                    color.green(' [#] Checking: ') +
                    color.yellow(description[i]))
                url = site + option + '/?q=' + host.ip.replace(
                    'http://', '').replace('https://', '')
                check = requests.get(url)
                time.sleep(.5)  # max query is 3 per second or you get blocked
                if check.status_code == 200:
                    data = check.text
                    save_data(host.database, host.module, host.lvl1, host.lvl2,
                              host.lvl3, host.name, str(data))
                else:
                    print(
                        color.red(' [-] Did not find any info about domain ') +
                        color.yellow(host.name))
                    print(color.red(' [+] Try with another one...'))
            except Exception as e:
                pass
                print(color.red(' [-] Encountered Exception : ' + str(e)))
            i = i + 1
    # return to main menu
    buildmenu(target, target[0].main_menu, 'Main Menu', '')
示例#8
0
def request(url):

    time.sleep(0.5)
    links = [url]
    if '//' in url:
        po = url.split('//')[1]
    for w in links:
        print(color.green(' [*] Scraping Page: ') + color.yellow(url))
        req = requests.get(w).text
        check0x00(req, url)

    soup = BeautifulSoup(req, 'lxml')
    for line in soup.find_all('a', href=True):
        newline = line['href']
        try:
            if newline[:4] == "http":
                if po in newline:
                    urls.append(str(newline))
            elif newline[:1] == "/":
                combline = url + newline
                urls.append(str(combline))
        except:
            print(color.red(' [-] Unhandled Exception Occured!'))

    try:
        for uurl in urls:
            print(color.green("\n [+] Scraping Page: ") + color.yellow(uurl))
            req = requests.get(uurl).text
            check0x00(req, url)

    except Exception as e:
        print(color.red(' [-] Outbound Query Exception...'))

    if found == 0x00:
        print(color.red('\n [-] No Errors found in Source Code!\n'))

    print(color.green(' [+] Scraping Done!'))
示例#9
0
def credit0x00(host):
    print(color.green(' [+] Importing credit card signatures...'))
    links = [host.name]
    if '//' in host.name:
        site = host.name.split('//')[1]
    else:
        site = host.name
    for link in links:
        print(' [*] Scraping Page: ' + color.yellow(site))
        req = requests.get(link).text
        check0x00(req)
    soup = BeautifulSoup(req, 'lxml')
    #site='https://'+site
    for line in soup.find_all('a', href=True):
        newline = line['href']
        try:
            if newline[:4] == "http":
                if site in newline:
                    urls.append(str(newline))
            elif newline[:1] == "/":
                combline = site + newline
                urls.append(str(combline))
        except:
            print(color.red(' [-] Unhandled Exception Occured!'))
    try:
        for uurl in urls:
            print(color.green("\n [+] Scraping Page: " + color.yellow(uurl)))
            req = requests.get(uurl).text
            check0x00(req)
    except Exception as e:  #requests.exceptions:
        print(color.red(' [-] Outbound Query Exception...'))
    if found == 0x00:
        print(
            color.red(
                ' [-] No Credit Cards found disclosed in plaintext in source code!'
            ))
    print(color.green(' [+] Scraping Done!'))
示例#10
0
def checkuser(target):
    for host in target:
        host.lvl2=inspect.stack()[0][3]
        host.lvl3=''
        if len(host.usernames):
            print(' [*] Parsing Url...')
            #web0 = tld.get_fld(host.name).split('.', 1)[0]
            print(color.green(' [+] Alias Set : '+str(host.usernames)))
            print(color.yellow(' [*] Setting services...'))
            global services
            services = ['YouTube', 'Hypemachine', 'Yahoo', 'Linkagogo', 'Coolspotters', 'Wikipedia',\
                'Twitter', 'gdgt', 'BlogMarks', 'LinkedIn', 'Ebay', 'Tumblr', 'Pinterest','yotify',\
                'Blogger', 'Flickr', 'FortyThreeMarks','Moof', 'HuffingtonPost', 'Wordpress',\
                'DailyMotion', 'LiveJournal', 'vimeo', 'DeviantArt', 'reddit','StumbleUpon',\
                'Answers', 'Sourceforge', 'Wikia', 'ArmChairGM', 'Photobucket', 'MySpace',\
                'Etsy','SlideShare', 'Fiverr', 'scribd', 'Squidoo', 'ImageShack','ThemeForest',\
                'SoundCloud', 'Tagged', 'Hulu', 'Typepad', 'Hubpages', 'weebly', 'Zimbio', 'github',\
                'TMZ', 'WikiHow', 'Delicious', 'zillow', 'Jimdo', 'goodreads','Segnalo', 'Netlog',\
                'Issuu', 'ForumNokia', 'UStream', 'Gamespot', 'MetaCafe', 'askfm', 'hi5', 'JustinTV',\
                'Blekko', 'Skyrock', 'Cracked', 'foursquare', 'LastFM','posterous', 'steam', 'Opera',\
                'Dreamstime', 'Fixya', 'UltimateGuitar', 'docstoc', 'FanPop', 'Break', 'tinyurl',\
                'Kongregate', 'Disqus', 'Armorgames', 'Behance','ChaCha', 'CafeMom', 'Liveleak',\
                'Topix', 'lonelyplanet', 'Stardoll', 'Instructables', 'Polyvore', 'Proboards',\
                'Weheartit', 'Diigo', 'Gawker', 'FriendFeed','Videobash', 'Technorati', 'Gravatar',\
                'Dribbble', 'formspringme', 'myfitnesspal', '500px', 'Newgrounds', 'GrindTV',\
                'smugmug', 'ibibo', 'ReverbNation', 'Netvibes','Slashdot', 'Fool', 'Plurk',\
                'zedge', 'Discogs', 'YardBarker', 'Ebaumsworld', 'sparkpeople', 'Sharethis',\
                'Xmarks', 'Crunchbase', 'FunnyOrDie','Suite101', 'OVGuide','Veoh', 'Yuku',\
                'Experienceproject', 'Fotolog', 'Hotklix', 'Epinions', 'Hyves', 'Sodahead',\
                'Stylebistro', 'fark', 'AboutMe', 'Metacritic', 'Toluna', 'Mobypicture','Gather',\
                'Datpiff', 'mouthshut', 'blogtalkradio', 'Dzone', 'APSense', 'Bigstockphoto', 'n4g',\
                'Newsvine', 'ColourLovers', 'Icanhazcheezburger', 'Xanga','InsaneJournal', 'redbubble',\
                'Kaboodle', 'Folkd', 'Bebo', 'Getsatisfaction', 'WebShots', 'threadless', 'Active',\
                'GetGlue', 'Shockwave', 'Pbase', 'FaceBook', 'Instagram', 'Myspace']
            print(color.yellow(' [!] Loaded ')+color.green(str(len(services)))+color.yellow(' services...'))
            check0x00(host)
示例#11
0
def create_edit_menu(menu, passed_target):
    global description_boolean
    index = 0
    for index, order_header in enumerate(preferred_order):
        for each_menu in menu_objects:
            if (each_menu["header"].find(order_header) != -1):
                string_index = str(index + 1)
                menu[string_index] = each_menu

    # --------------------- Lower Menu -----------------------------
    menu[" "] = {"header" : False} 
    menu[the_all_off_button.upper()] = {"header" : "Turn off all options"}
    menu[the_all_on_button.upper()] = {"header" : "Turn on all options"}
    menu[description_button.upper()] = {"header" : "Description Toggle"}
    menu[exit_button.upper()] = {"header" : ">>> Exit"}
    cmd2num_associator(cmd_list, menu)


    ### --- Shortcut variable to avoid repeated typing of ~[0]["nmap"] --- ###
    # nmap_obj = default_target[0]["nmap"]
    nmap_obj = passed_target[0].cmd_options
    ##########################################################################


    # DYNAMIC TOGGLE UPDATING OF MENU ICONS using {cmd2num} as template to access {menu} values
    for key in cmd2num:
        node = menu[cmd2num[key]]
        header = color.blue(node["header_template"])
        # If target obj has a relevant param set to true, show in menu as on. Otherwise show as turned off
        if(key in nmap_obj and nmap_obj[key] == True):
            nmap_obj[key] = True
            node["header"] = color.yellow(node["on"]) + header
        elif(key in nmap_obj and nmap_obj[key] == True):
            nmap_obj[key] = False
            node["header"] = color.red(node["off"]) + header
        else:
            nmap_obj[key] = False
            node["header"] = color.red(node["off"]) + header

    # Display Menu on screen
    for menu_number in menu:
        each_menu = menu[menu_number]
        single_digit_buffer = ''
        if(menu_number.isdigit() and int(menu_number) < 10):
            single_digit_buffer = ' '
        else:
            single_digit_buffer = ''
        if(each_menu["header"] == False):
            print(' ')
        elif(description_boolean and "description" in each_menu):
            print(color.green(" [") +color.green(menu_number)+color.green("]"), single_digit_buffer, color.blue(each_menu["header"]), color.dark_grey(each_menu["description"]))
        else:
            print(color.green(" [") +color.green(menu_number)+color.green("]"), single_digit_buffer, color.blue(each_menu["header"]))
示例#12
0
def multi(func, tgt):

    tasks_to_accomplish.put(str(func))

    # creating processes
    #for w in range(NUM_WORKERS):
    #p = Process(target=do_job, args=(func,tgt,tasks_to_accomplish, tasks_that_are_done))
    p = Process(target=do_job, args=(func, tgt))
    processes.append(p)
    print(color.green('INFO: Starting ' + tgt[0].module))
    p.start()

    # completing process
    for p in processes:
        p.join()

    # print the output
    # while not tasks_that_are_done.empty():
    #     print(tasks_that_are_done.get())

    return True
示例#13
0
def subnet(target):
    for host in target:
        host.lvl2 = inspect.stack()[0][3]
        host.lvl3 = ''
        site = host.name.replace('http://', '').replace('https://', '')
        print(color.green(' [!] Enumerating subnets in network...'))
        print('[*] Getting subnet class infos...\n')
        text = requests.get('http://api.hackertarget.com/subnetcalc/?q=' +
                            site).text
        http = str(text)
        if 'error' not in http:
            data = http
            # result = http.splitlines()
            # for data in result:
            save_data(host.database, host.module, host.lvl1, host.lvl2,
                      host.lvl3, host.name, data)
        elif 'No results found' in http:
            print(color.red(' [-] No results found!'))
        else:
            print(color.red(' [-] Outbound Query Exception!'))
    return
示例#14
0
def nikto_menu(target):
    from core.build_menu import buildmenu

    nikto_ip = ''
    nikto_ports = target[0].port or ''
    nikto_options = ''

    target_ip = nikto_ip if nikto_ip else target[0].ip
    target_ports = nikto_ports if nikto_ports else target[0].port
    target_options = nikto_options if nikto_options else target[0].options_str

    current_cmd_str = 'nikto -h ' + target_ip + ' -p ' + target_ports + ' ' + target_options

    for host in target:
        host.help = 'nikto'
        host.lvl2 = 'Nikto'

        if host.port == '':
            host.port = '80'

        nikto_ip = host.ip
        nikto_ports = host.port
        nikto_options = host.options_str
        host.cmd_str = current_cmd_str

    menu = { # '#' : ['module', 'description', 'function']
        '1':['Update Target IP',target_ip,'nikto_ip'],\
        '2':['Update Target Port(s)',target_ports,'nikto_port'],\
        '3':['Update Command Options',target_options,'nikto_add_options'],\
        '4':['Run Nikto','(Run Current Nikto Command)','nikto'],\
    }

    current_cmd = '\n' + '-' * 55 + '\n' + color.green(
        'Current nikto Command:  \n') + color.red(
            current_cmd_str) + '\n' + '-' * 55

    print(current_cmd)

    buildmenu(target, menu, 'Nikto Scan Configuration', '')
示例#15
0
def photon_menu(target):
    from core.build_menu import buildmenu

    photon_site = target[0].ip if not target[0].website else target[0].website
    photon_options = ''

    target_website = photon_site if photon_site else target[0].website
    if 'https://' not in target_website:
        target_website = 'https://' + target_website

    target_options = photon_options if photon_options else target[0].options_str
    target_run_file = target[0].run_file

    display_cmd_str = 'photon -u ' + target_website + ' ' + target_options
    current_cmd_str = 'python3 ' + target_run_file + ' -u ' + target_website + ' ' + target_options

    for host in target:
        # host.module = 'ScanANDEnum'
        # host.lvl1 = 'Scanning & Enumeration'
        host.help = 'python3 lib/Photon/photon.py'
        host.lvl2 = 'Crawler'
        host.lvl3 = 'Photon'
        host.run_file = './lib/Photon/photon.py'

        photon_site = host.website
        photon_options = host.options_str
        host.cmd_str = current_cmd_str

    menu = { # '#' : ['module', 'description', 'function']
        '1':['Update Target Website',target_website,'photon_website'],\
        '2':['Update Command Options',target_options,'photon_options'],\
        '3':['Run Photon','(Run Current Crawler Command)','photon_run'],\
    }

    display_cmd = '\n' + '-'*55 + '\n' + color.green('Current Photon Command:  \n') + color.red(display_cmd_str) + '\n' + '-'*55

    print(display_cmd)

    buildmenu(target,menu,'Photon Scan Configuration','')
示例#16
0
def getconinfo(target):
    for host in target:
        host.lvl2 = inspect.stack()[0][3]
        host.lvl3 = ''
        print(color.white(' [*] Importing API Key...'))
        try:
            from files.API_KEYS import FULLCONTACT_API_KEY
        except (IOError, ImportError):
            print(color.red(' [-] Error while importing key...'))
        pass
        try:

            if FULLCONTACT_API_KEY != '':
                print(
                    color.green(' [+] Found API Key : ') +
                    color.yellow(FULLCONTACT_API_KEY))
                base_url = 'https://api.fullcontact.com/v2/company/lookup.json'
                print(color.white(' [*] Looking up info...'))
                time.sleep(0.7)
                payload = {'domain': host.name, 'apiKey': FULLCONTACT_API_KEY}
                resp = requests.get(base_url, params=payload)
                #print(resp)
                if resp.status_code == 200:
                    data = resp.text
                    save_data(host.database, host.module, host.lvl1, host.lvl2,
                              host.lvl3, host.name, data)
                else:
                    print(
                        color.red(' [-] Did not find any info about domain ') +
                        color.yellow(host.name))
                    print(color.red(' [+] Try with another one...'))
            else:
                print(color.red(' [-] FULL CONTACT API TOKEN not set!'))
                print(color.red(' [-] This module cannot be used!'))
        except Exception as e:
            pass
            print(color.red(' [-] Encountered Exception : ' + str(e)))
示例#17
0
def nmap_editor(passed_target):
    from core.build_menu import buildmenu

    global description_boolean
    user_input = ''
    nmap_obj = passed_target[0]
    nmap_params = passed_target[0].cmd_options
    exit_condition = False

    while(exit_condition == False):
        # Invoke Create Menu Function
        create_edit_menu(menu, passed_target)
        nmap_command = str(nmap_target_sorter(passed_target[0]))
        nmap_obj.nmap = nmap_command
        print('\n' + '-'*55)
        print(color.green('Current nmap Command:  \n') + color.red(nmap_command) + '\n' + '-'*55)

        # [E] :  ----------- Graceful Exit  --------------------
        user_input = input('\n[#] Choose Option:> ')
        lowered = user_input.lower()
        if(lowered == exit_button or lowered == 'exit' or lowered == 'e' or lowered == 0):
            exit_condition = True

        # Clean user input
        if (list(user_input.strip())[0].isalpha()):
            user_input = list(user_input.strip())[0].lower()
        else:
            user_input = str(user_input.strip())
        tag_arg_set = [preferred_order, nmap_params, menu]

        # [D] : --------- Description toggle -------------------------
        if(user_input.lower() == 'd'):
            reversed = not description_boolean # Reverse Boolean
            description_boolean = reversed

        # [O] or [F] : --------- Turn ON/OFF ALL NMAP tag toggles -------------------------
        elif(user_input.upper() == the_all_on_button):
            tag_manager(menu_toggle_items, True, tag_arg_set)
        elif(user_input.upper() == the_all_off_button):
            tag_manager(menu_toggle_items, False, tag_arg_set)

        # [1] :  --------------------- 2. Run NMAP  -----------------------------------------
        elif(user_input == '1'):
            exit_condition = True

        # [2] :  -------- 2. Adjust IP Address (Target Address)  -----------------------------
        elif(user_input == retrieve_module_index('Edit Target', preferred_order)):
            address = input(menu[user_input]["start_msg"])
            reg_string = r'^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$'
            if(address == 'exit'):
                print('Exiting')
            elif(re.match(reg_string, address)):
                nmap_obj.name = address
            else:
                print(color.red(menu[user_input]["error"]))

        # [3] : -------------------- 3. Set Port Range ---------------------------------------
        elif(user_input == retrieve_module_index('Set Port Range', preferred_order)):
            port_range = input(menu[user_input]["start_msg"])
            if(port_range == 'exit'):
                print('Exiting')
            elif(port_range.lower() == 'none' or port_range == 0):
                nmap_params['-p'] = False
                nmap_params['-p-'] = False   
            elif(port_range.lower() == 'all' or port_range == '-p-'):
                nmap_params['-p'] = False
                nmap_params['-p-'] = True
            elif(re.match(r'^\d{1,5}(-?\d{1,5})?$', port_range)):
                nmap_params['-p'] = port_range
            else:
                print(color.red(menu[user_input]["error"]))
        
        # -------------------- All other toggle options --------------------------------------- 
        else:
            for each_toggle in menu_toggle_items:
                tag_manager(each_toggle, user_input, tag_arg_set)
    nmap_menu(passed_target)
示例#18
0
from core.colors import color
import sys

menu_dict = {
    'ReconANDOSINT': 'Reconnaissance & OSINT',
    'ScanANDEnum': 'Scanning & Enumeration',
    'VulnAnalysis': 'Vulnerability Analysis',
    'Exploitation': 'Exploitation',
    'AuxModules': 'Auxiliary Modules'
}
db_name = "modules/database/tidos.db"
query_list = [db_name]
error_message = "Sorry, please enter one of the choices listed."
menu_message = "Please make your selection: "
input_cursor = "[#] Choose Option:> "
main_exit_message = color.green('\n [M] ') + color.yellow('Main Menu\n')
higher_menu_exit_message = color.green('\n [0] ') + color.yellow(
    'Exit to higher menu')
exit_message = "Now exiting. Goodbye."


def build_banner(banner):
    size = len(banner) * 2 + 4
    padding = "".join("=" for i in range(size))
    letters = "| "
    for letter in banner:
        letters = letters + color.yellow(letter.upper()) + " "
    letters = letters + color.blue(" |")
    print("\n")
    print(color.blue(padding))
    print(color.blue(letters))
示例#19
0
def censysdom(target):
    for host in target:
        host.lvl2 = inspect.stack()[0][3]
        host.lvl3 = ''
        print(' [*] Importing API Key...')
        try:
            from files.API_KEYS import CENSYS_UID, CENSYS_SECRET
        except IOError as ImportError:
            print(color.red(' [-] Error while importing key...'))
        if '//' in host.name:
            web = host.name.split('//')[1]
        else:
            web = host.name
        if CENSYS_SECRET != '' and CENSYS_UID != '':
            print(
                color.green(' [+] Found Censys UID Key : ') +
                color.yellow(CENSYS_UID))
            print(
                color.green(' [+] Found Censys Secret Token : ') +
                color.yellow(CENSYS_SECRET))
            base_url = 'https://www.censys.io/api/v1'
            print(' [*] Looking up info...')

            resp = requests.get(base_url + "/view/websites/" + web,
                                auth=(CENSYS_UID, CENSYS_SECRET))
            if 'quota_exceeded' in resp.text:
                print(
                    color.red(
                        ' [-] Daily limit reached for this module. Use you own API key for CENSYS.'
                    ))
            if resp.status_code == 200:
                print(color.green(' [+] Found domain info!'))
                w = resp.text.encode('utf-8')
                asio = json.dumps(resp.json(), indent=4)
                data = asio.splitlines()
                print(color.yellow(' [!] Parsing info...\n'))
                #print(data)
                save_data(host.database, host.module, host.lvl1, host.lvl2,
                          host.lvl3, host.name, str(data))
        #         for q in quest:
        #             q = q.replace('"','')
        #             if ':' in q and '[' not in q and '{' not in q:
        #                 q1 = q.split(':',1)[0].strip().title()
        #                 q2 = q.split(':',1)[1].strip().replace(',','')
        #                 print(C+'   [+] '+q1+' : '+GR+q2)
        #                 time.sleep(0.01)

        #             elif ('{' or '[' in q) and (':' in q):
        #                 w1 = q.split(':',1)[0].strip().upper()
        #                 w2 = q.split(':',1)[1].strip()
        #                 print(O+'\n [+] '+w1+' :-'+'\n')

        #             elif '{' not in q and '[' not in q and ']' not in q and '}' not in q:
        #                 print(GR+'   [+] '+q.replace(',','').strip())

        #         print(O+' [!] Saving retrieved CENSYS data...')
        #         time.sleep(1)
        #         with open('tmp/logs/'+web+'-logs/'+web+'-censys-data.json', 'w+') as file:
        #             json.dump(resp.json(), file, ensure_ascii=True,indent=4)
        #             eq = os.getcwd()
        #             print(G+' [+] Censys Data stored '+eq+'/tmp/logs/'+web+'-logs/'+web+'-censys-data.json')

            else:
                print(color.red(' [-] Did not find any info about domain '))
                print(color.red(' [+] Try with another one...'))

        else:
            print(color.red(' [-] CENSYS API TOKENs not set!'))
            print(color.red(' [-] This module cannot be used!'))
示例#20
0
def hashes(target):
    from core.build_menu import buildmenu
    for host in target:
        host.lvl2 = inspect.stack()[0][3]
        host.lvl3 = ''
    try:
        message = input('\n [#] Enter the string to hash:> ')
        print(color.green(' [+] Generating hashes...'))
        md5 = hashlib.md5()
        md5.update(message.encode('utf-8'))

        sha1 = hashlib.sha1()
        sha1.update(message.encode('utf-8'))

        sha224 = hashlib.sha224()
        sha224.update(message.encode('utf-8'))

        sha256 = hashlib.sha256()
        sha256.update(message.encode('utf-8'))

        sha384 = hashlib.sha384()
        sha384.update(message.encode('utf-8'))

        sha512 = hashlib.sha512()
        sha512.update(message.encode('utf-8'))

        print(color.green(" [+] MD5 Hash : ") + color.yellow(md5.hexdigest()))
        save_data(host.database, host.module, host.lvl1, host.lvl2, host.lvl3,
                  host.name, str(md5.hexdigest()))
        print(
            color.green(" [+] SHA1 Hash : ") + color.yellow(sha1.hexdigest()))
        save_data(host.database, host.module, host.lvl1, host.lvl2, host.lvl3,
                  host.name, str(sha1.hexdigest()))
        print(
            color.green(" [+] SHA224 Hash : ") +
            color.yellow(sha224.hexdigest()))
        save_data(host.database, host.module, host.lvl1, host.lvl2, host.lvl3,
                  host.name, str(sha224.hexdigest()))
        print(
            color.green(" [+] SHA256 Hash : ") +
            color.yellow(sha256.hexdigest()))
        save_data(host.database, host.module, host.lvl1, host.lvl2, host.lvl3,
                  host.name, str(sha256.hexdigest()))
        print(
            color.green(" [+] SHA384 Hash : ") +
            color.yellow(sha384.hexdigest()))
        save_data(host.database, host.module, host.lvl1, host.lvl2, host.lvl3,
                  host.name, str(sha384.hexdigest()))
        print(
            color.green(" [+] SHA512 Hash : ") +
            color.yellow(sha512.hexdigest()))
        save_data(host.database, host.module, host.lvl1, host.lvl2, host.lvl3,
                  host.name, str(sha512.hexdigest()))

    except EOFError as e:
        #os.system('clear')
        print(e)
    st = input(
        color.blue(' [#] Press') + color.red(' Enter ') +
        color.blue('to continue... '))
    buildmenu(target, target[0].main_menu, 'Main Menu', '')
示例#21
0
def encodeall(info):
    from core.build_menu import buildmenu
    try:
        st = input(
            color.yellow(' [-] Enter a string to be encoded/decoded :> '))
        m64 = base64.b64encode(st.encode())
        data = m64.decode()
        print(
            color.green(' [+] Base64 Encoded String : ') + color.yellow(data))
        #save_data(host.database, host.module, host.lvl1, host.lvl2, host.lvl3, host.name, str(data))
    except Exception as e:
        pass
    try:
        m32 = base64.b32encode(st.encode())
        data = m32.decode()
        print(
            color.green(' [+] Base32 Encoded String : ') + color.yellow(data))
        #save_data(host.database, host.module, host.lvl1, host.lvl2, host.lvl3, host.name, str(data))
    except Exception as e:
        pass
    try:
        m16 = base64.b16encode(st.encode())
        data = m16.decode()
        print(
            color.green(' [+] Base16/Hex Encoded String : ') +
            color.yellow(data))
        #save_data(host.database, host.module, host.lvl1, host.lvl2, host.lvl3, host.name, str(data))
    except Exception as e:
        print(color.red(" [-] Caught Exception : " + str(e)))
    try:
        m64d = base64.b64decode(st.encode())
        data = m64d.decode()
        print(color.red(' [+] Base64 Decoded String : ') + color.white(data))
        #save_data(host.database, host.module, host.lvl1, host.lvl2, host.lvl3, host.name, str(data))
    except Exception as e:
        pass
    try:
        m32d = base64.b32decode(st.encode())
        data = m32d.decode()
        print(color.red(' [+] Base32 Decoded String : ') + color.white(data))
        #save_data(host.database, host.module, host.lvl1, host.lvl2, host.lvl3, host.name, str(data))
    except Exception as e:
        pass
    try:
        m16d = base64.b16decode(st.encode())
        data = m16d.decode()
        print(
            color.red(' [+] Base16/Hex Decoded String : ') + color.white(data))
        #save_data(host.database, host.module, host.lvl1, host.lvl2, host.lvl3, host.name, str(data))
    except Exception as e:
        pass
    try:
        data = urllib.parse.quote(st, safe='')
        print(color.green(' [+] URL Encoded String : ') + color.yellow(data))
        data = urllib.parse.quote_plus(st, safe='')
        print(
            color.green(' [+] URL plus Encoded String : ') +
            color.yellow(data))
    except Exception as e:
        pass
    try:
        data = urllib.parse.unquote(st)
        print(color.green(' [+] URL Decoded String : ') + color.yellow(data))
        data = urllib.parse.unquote_plus(st)
        print(
            color.green(' [+] URL plus Decoded String : ') +
            color.yellow(data))
    except Exception as e:
        pass
    # more types of encoding still need added
    # encod = ''
    # stri = list(st)
    # for i in stri:
    #     encod = encod + escape(i)
    # print(color.green(' [+] Encoded String : ')+color.yellow(encod))
    # m = st.encode('base64', 'strict')
    # print(color.green(' [+] Encoded String : ')+color.yellow(m))
    # m = st.encode('hex', 'strict')
    # print(color.green(' [+] Encoded String : ')+color.yellow(m))
    # result = []
    # for char in st:
    #     result.append('\%o' % ord(char))
    # print(color.green(' [+] Octal Encoded String : ')+color.yellow(str(''.join(result))))
    # m = ''.join(format(ord(x),'b') for x in st)
    # print(color.green(' [+] Encoded String : ')+color.yellow(m))
    # m = st.encode('zlib','strict')
    # print(color.green(' [+] Encoded String : ')+color.yellow(m))
    st = input(
        color.blue(' [#] Press') + color.red(' Enter ') +
        color.blue('to continue... '))
    buildmenu(info, info.main_menu, 'Main Menu', '')
示例#22
0
def check0x00(req):
    try:
        append_name = ' '.join(str(req.encode('utf-8')).strip())
    except UnicodeDecodeError:
        append_name = ' '.join(str(req.decode('utf-8')).strip())
    print(color.yellow(' [!] Reading response...'))
    print(color.green(' [*] Searching for credit cards...'))
    AMEX = re.match(AMEX_CARD_SIGNATURE, append_name)
    VISA = re.match(VISA_SIGNATURE, append_name)
    MASTERCARD = re.match(MASTERCARD_SIGNATURE, append_name)
    DISCOVER = re.match(DISCOVER_CARD_SIGNATURE, append_name)
    EXPRESS = re.match(EXPRESS_CARD_SIGNATURE, append_name)
    VISA_MASTERCARD = re.match(VISA_MASTERCARD_SIGNATURE, append_name)
    print(color.yellow(' [!] Matching signatures...'))
    try:
        if EXPRESS.group():
            print(color.green(" [+] Website has American Express Cards!"))
            print(color.yellow(' [!] Card : ') + color.green(EXPRESS.group()))
            found = 0x01
    except:
        pass
    try:
        if VISA_MASTERCARD.group():
            print(color.green(" [+] Website has a Visa-Master Card!"))
            print(
                color.yellow(' [!] Card : ') +
                color.green(VISA_MASTERCARD.group()))
            found = 0x01
    except:
        pass
    try:
        if MASTERCARD.group():
            print(color.green(" [+] Website has a Master Card!"))
            print(
                color.yellow(' [!] Card : ') + color.green(MASTERCARD.group()))
            found = 0x01
    except:
        pass
    try:
        if VISA.group():
            print(color.green(" [+] Website has a VISA card!"))
            print(color.yellow(' [!] Card : ') + color.green(VISA.group()))
            found = 0x01
    except:
        pass
    try:
        if AMEX.group():
            print(color.green(" [+] Website has a AMEX card!"))
            print(color.yellow(' [!] Card : ') + color.green(AMEX.group()))
            found = 0x01
    except:
        pass
    try:
        if DISCOVER.group():
            print(color.green(" [+] Website has a DISCOVER card!"))
            print(color.yellow(' [!] Card : ') + color.green(DISCOVER.group()))
            found = 0x01
    except:
        pass
    return