Guest User

kraken.py alpha

a guest
Mar 20th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 26.04 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. import argparse
  4. import configparser
  5. import csv
  6. import ftplib
  7. import functools
  8. import gzip
  9. import os
  10. import sys
  11. from urllib.request import urlopen
  12. from time import sleep
  13.  
  14. BANNER = """
  15. \033[1;36m\033[1;m   ██╗  ██╗██████╗  █████╗ ██╗  ██╗███████╗███╗   ██╗
  16. \033[1;36m\033[1;m   ██║ ██╔╝██╔══██╗██╔══██╗██║ ██╔╝██╔════╝████╗  ██║
  17. \033[1;36m\033[1;m   █████╔╝ ██████╔╝███████║█████╔╝ █████╗  ██╔██╗ ██║
  18. \033[1;36m\033[1;m   ██╔═██╗ ██╔══██╗██╔══██║██╔═██╗ ██╔══╝  ██║╚██╗██║
  19. \033[1;36m\033[1;m   ██║  ██╗██║  ██║██║  ██║██║  ██╗███████╗██║ ╚████║
  20. \033[1;36m\033[1;m   ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚═╝  ╚═══╝
  21.                                  
  22. \033[1;32m\033[1;m     Kraken Password Cracker && Wordlist Generator                
  23.                                              
  24. """
  25. print(BANNER)
  26. try:
  27.     import readline
  28. except ImportError:
  29.     print(ImportError)
  30.     pass
  31. CFG = {}
  32. FTP_CFG = {}
  33. HS_CFG = {}
  34.  
  35.  
  36. def main():
  37.     # CLI
  38.     args = get_parser().parse_args()
  39.     read_cfg()
  40.     if not args.quiet:
  41.         print(BANNER)
  42.     if args.interactive:
  43.         heatseeker()
  44.     elif args.download_wordlist:
  45.         dl_wlist()
  46.     elif args.alecto:
  47.         dl_adb()
  48.     elif args.improve:
  49.         dict_import(args.improve)
  50.  
  51.  
  52. def get_parser():
  53.     # RETURN AN ARGUMENT PARSER; TRIGGERED VIA main() FUNCTION
  54.     parser = argparse.ArgumentParser(description='KRAKEN')
  55.     group = parser.add_mutually_exclusive_group(required=True)
  56.     # LAUNCH HEATSEAKER MODE; MORE ADVANCED OPTIONS. MUST MODIFY SCRIPT; READ COMMENTS
  57.     group.add_argument('-m', '--heatseeker-mode', action='store_true',
  58.                        help='Enter active target profile mode')
  59.     # IMPROVE DICTIONARY
  60.     group.add_argument('-w', dest='improve', metavar='FILENAME',
  61.                        help='Improve an existing dictionary'
  62.                             ' or WyD.pl output to make a more powerful wordlist')
  63.     # DOWNLOAD WORDLIST
  64.     group.add_argument('-d', dest='download_wordlist',
  65.                        action='store_true', help='Download lists from a repository')
  66.     # ALECTO DATABASE
  67.     group.add_argument('-a', action='store_true', help='Parse default username and passwords directly'
  68.                        ' from Alecto Database. Project Alecto uses purified'
  69.                        ' databases of Phenoelit and CIRT; merged && enhanced')
  70.     # STEALTH MODE
  71.     group.add_argument('-s', '--go-dark', action='store_true', help="Activate stealth mode; will not print banner")
  72.     return parser
  73.  
  74.  
  75. def read_cfg(file='kraken.cfg'):
  76.     # READ CFG FILE
  77.     global cfg
  78.     cfg = configparser.ConfigParser()
  79.     cfg.read(file)
  80.     CFG.update({
  81.         'years':     cfg.get('years', 'years').split(','),
  82.         'chars':     cfg.get('special_chars', 'chars').split(','),
  83.  
  84.         'nums_from': cfg.getint('nums', 'from'),
  85.         'nums_to':   cfg.getint('nums', 'to'),
  86.  
  87.         'wc_from':   cfg.getint('nums', 'wc_from'),
  88.         'wc_to':     cfg.getint('nums', 'wc_to'),
  89.  
  90.         'threshold': cfg.getint('nums', 'threshold'),
  91.         'alectourl': cfg.get('alecto', 'alectourl')
  92.     })
  93. # HEATSEEKER MODE CONFIGURATION; LEAVE ALONE IF DON'T KNOW WHAT YOU DOING
  94. heatseeker = functools.partial(cfg.get, 'heatseeker')
  95. HS_CFG.update(dict(a=heatseeker('a'), e=heatseeker('e'), g=heatseeker('g'), i=heatseeker('i'),
  96.                    o=heatseeker('o'), s=heatseeker('s'), t=heatseeker('t'), z=heatseeker('z')))
  97. ftp_cfg = functools.partial(cfg.get, 'downloader')
  98. FTP_CFG.update(dict(name=ftp_cfg('ftpname'), url=ftp_cfg('ftpurl'), path=ftp_cfg('ftppath'),
  99.                     user=ftp_cfg('ftpuser'), password=ftp_cfg('ftppass')))
  100.  
  101.  
  102. def heatseeker():
  103.     print(' ')
  104.     print("[+] Loading HeatSeeker module. Initiating KRAKEN active target profiling mode... Please wait...")
  105.     sleep(2)
  106.     print(">>> Please enter the following information about the victim to make a personalized dictionary wordlist...")
  107.     sleep(1)
  108.     print("[!] If you do not know the information being asked, simply press enter to skip the question.\n")
  109.     sleep(2)
  110.     print(' ')
  111.     tn = input(">>> First Name of the Target: ").lower().strip()
  112.     while not tn:
  113.         print("\n[x] You must enter the Target's name.", file=sys.stderr)
  114.         tn = input(">>> First Name of the Target: ").lower().strip()
  115.     ln = input(">>> Last Name: ").lower()
  116.     nn = input(">>> Nickname or Alias: ").lower()
  117.     tb = input(">>> Birthdate, formatted as 'DDMMYYYY': ").strip()
  118.     while len(tb) not in (0, 8):
  119.         print("\n[x] The Target's Birthdate must be comprised of 8 digits.", file=sys.stderr)
  120.         tb = input(">>> Birthdate, formatted as 'DDMMYYYY': ").strip()
  121.     print(' ')
  122.     p = input("[+] Partner's Name: ").lower()
  123.     pn = input(">>> Partner's Nickname or Alias").lower()
  124.     pb = input(">>> Partner's Birthdate, formatted as DDMMYYYY: ").strip()
  125.     while len(pb) not in (0, 8):
  126.         print("\n[x] Partner's Birthdate must be comprised of 8 digits.", file=sys.stderr)
  127.         pb = input(">>> Partner's Birthdate, formatted as 'DDMMYYYY': ").strip()
  128.     print(' ')
  129.     k = input("[+] Child's First Name: ").lower()
  130.     kn = input(">>> Child's Nickname or Alias: ").lower()
  131.     kb = input(">>> Childs Birthdate, formated as 'DDMMYYYY: ").strip()
  132.     while len(kb) not in (0, 8):
  133.         print("\n[x] Child's's Birthdate must be comprised of 8 digits.", file=sys.stderr)
  134.         kb = input(">>> Partner's Birthdate, formatted as 'DDMMYYYY': ").strip()
  135.     print(' ')
  136.     pet = input(">>> Pet's Name: ").lower().strip()
  137.     co = input(">>> Company Name: ").lower().strip()
  138.     print(' ')
  139.     ask = "[?] Would you like to add additional keywords RE: your target? Y/[N]: "
  140.     w1 = input(ask).lower().strip()
  141.     w2 = ''
  142.     if w1 == 'y':
  143.         ask = (">>> Please enter the words. Separate them with commas."
  144.                   "[!] If you leave whitespaces, they are auto-removed.")
  145.         w2 = input(ask).replace(' ', '')
  146.     w = w2.split(',')
  147.     sp = []
  148.     ask = "[+] Would you like to add special characters at the end of the words? Y/[N]: "
  149.     sp1 = input(ask).lower().strip()
  150.     if sp1 == "y":
  151.         for sp1 in CFG['chars']:
  152.             sp.append(sp1)
  153.             for sp2 in CFG['chars']:
  154.                 sp.append(sp1 + sp2)
  155.                 for sp3 in CFG['chars']:
  156.                     sp.append(sp1 + sp2 + sp3)
  157.     num_rand = input("[+] Would you like to add some random numbers at the end of words? Y[N]: ").lower()
  158.     hs_mode = input("[+] Activate Enhanced Mode? Y/[N]: ").lower().strip()
  159.     print(' ')
  160.     print("[+] A customized dictionary password list based on the data you provided is being created...")
  161.     sleep(2)
  162.     print("    Please wait while the system processes your request...")
  163.     print("    Almost done...")
  164.     sleep(2)
  165.     # MOD TARGET BIRTHDATE
  166.     tbyy, tbyyy = tb[-2:], tb[-3:]
  167.     tbyyyy = tb[-4:]
  168.     tb_d, tb_m = tb[1:2], tb[3:4]
  169.     tbdd, tbmm = tb[:2], tb[2:4]
  170.     # MOD PARTNER BIRTHDATE
  171.     pbyy = pb[-2:]
  172.     pbyyy = pb[-3:]
  173.     pbyyyy = pb[-4:]
  174.     pb_d = pb[1:2]
  175.     pb_m = pb[3:4]
  176.     pbdd = pb[:2]
  177.     pbmm = pb[2:4]
  178.     # MOD CHILD'S BIRTHDAY
  179.     kbyy = pb[-2:]
  180.     kbyyy = pb[-3:]
  181.     kbyyyy = pb[-4:]
  182.     kb_d = pb[1:2]
  183.     kb_m = pb[3:4]
  184.     kbdd = pb[:2]
  185.     kbmm = pb[2:4]
  186.     # CAPITALIZE BEGINNING OF STRING
  187.     tnup = tn.title()
  188.     lnup = ln.title()
  189.     nnup = nn.title()
  190.     pup = p.title()
  191.     pnup = pn.title()
  192.     kup = k.title()
  193.     knup = kn.title()
  194.     petup = pet.title()
  195.     coup = co.title()
  196.     wup = [w1.title() for w1 in w]
  197.     word = w + wup
  198.     # REVERSE NAME STRINGS
  199.     rev_tn = tn[::-1]
  200.     rev_tnup = tnup[::-1]
  201.     rev_nn = nn[::-1]
  202.     rev_nnup = nnup[::-1]
  203.     rev_p = p[::-1]
  204.     rev_pup = pup[::-1]
  205.     rev_k = k[::-1]
  206.     rev_kup = kup[::-1]
  207.     # REVERSALS OF REST OF STRINGS
  208.     rev = [rev_tn, rev_tnup, rev_nn, rev_nnup, rev_p, rev_pup, rev_k, rev_kup]
  209.     rev_n = [rev_tn, rev_tnup, rev_nn, rev_nnup]
  210.     rev_w = [rev_p, rev_pup]
  211.     rev_k = [rev_k, rev_kup]
  212.     # COMBINATIONS FOR TARGET'S BIRTHDATE
  213.     tbd = [tbyy, tbyyy, tbyyyy, tb_d, tb_m, tbdd, tbmm]
  214.     bd_list = []
  215.     for bds1 in tbd:
  216.         bd_list.append(bds1)
  217.         for bds2 in tbd:
  218.             if tbd.index(bds1) != tbd.index(bds2):
  219.                 bd_list.append(bds1 + bds2)
  220.                 for bds3 in tbd:
  221.                     condition = (tbd.index(bds1) != tbd.index(bds2) and
  222.                                  tbd.index(bds2) != tbd.index(bds3) and
  223.                                  tbd.index(bds1) != tbd.index(bds3))
  224.                     if condition:
  225.                         bd_list.append(bds1 + bds2 + bds3)
  226.     # COMBINATIONS FOR PARTNER'S BIRTHDATE
  227.     pbd = [pbyy, pbyyy, pbyyyy, pb_d, pb_m, pbdd, pbmm]
  228.     pbd_list = []
  229.     for pbd1 in pbd:
  230.         pbd_list.append(pbd1)
  231.         for pbd2 in pbd:
  232.             if pbd.index(pbd1) != pbd.index(pbd2):
  233.                 pbd_list.append(pbd1 + pbd2)
  234.                 for pbd3 in pbd:
  235.                     condition = (pbd.index(pbd1) != pbd.index(pbd2) and
  236.                                  pbd.index(pbd2) != pbd.index(pbd3) and
  237.                                  pbd.index(pbd1) != pbd.index(pbd3))
  238.                     if condition:
  239.                         pbd_list.append(pbd1 + pbd2 + pbd3)
  240.     # COMBINATIONS FOR CHILD'S BIRTHDATE
  241.     kbd = [kbyy, kbyyy, kbyyyy, kb_d, kb_m, kbdd, kbmm]
  242.     kbd_list = []
  243.     for kbd1 in kbd:
  244.         kbd_list.append(kbd1)
  245.         for kbd2 in kbd:
  246.             if kbd.index(kbd1) != kbd.index(kbd2):
  247.                 kbd_list.append(kbd1 + kbd2)
  248.                 for kbd3 in kbd:
  249.                     condition = (kbd.index(kbd1) != kbd.index(kbd2) and
  250.                                  kbd.index(kbd2) != kbd.index(kbd3) and
  251.                                  kbd.index(kbd1) != kbd.index(kbd3))
  252.                     if condition:
  253.                         kbd_list.append(kbd1 + kbd2 + kbd3)
  254.     # string combinations
  255.     grandmaster = [tn, ln, nn, tnup, lnup, nnup]
  256.     master = [p, pn, pup, pnup, ln, lnup]
  257.     sub_master = [k, kn, kup, knup, ln, lnup]
  258.     change_key = [pet, petup, co, coup]
  259.     # MAIN NAME; STRING MODS
  260.     key_a = []
  261.     for key1 in grandmaster:
  262.         key_a.append(key1)
  263.         for key2 in grandmaster:
  264.             condition = (grandmaster.index(key1) != grandmaster.index(key2) and
  265.                          grandmaster.index(key1.title()) != grandmaster.index(key2.title()))
  266.             if condition:
  267.                 key_a.append(key1 + key2)
  268.     # WIFE NAME; STRING MODS
  269.     key_aaw = []
  270.     for key1 in master:
  271.         key_aaw.append(key1)
  272.         for key2 in master:
  273.             condition = (master.index(key1) != master.index(key2) and
  274.                          master.index(key1.title()) != master.index(key2.title()))
  275.             if condition:
  276.                 key_aaw.append(key1 + key2)
  277.     # CHILD NAME; STRING MODS
  278.     key_aak = []
  279.  
  280.     for key1 in sub_master:
  281.         key_aak.append(key1)
  282.         for key2 in sub_master:
  283.             condition = sub_master.index(key1) != sub_master.index(key2) and \
  284.                         sub_master.index(key1.title()) != sub_master.index(key2.title())
  285.             if condition:
  286.                 key_aak.append(key1 + key2)
  287.     c1 = list(transmute(grandmaster, bd_list))
  288.     c2 = list(transmute(key_aaw, pbd_list))
  289.     c3 = list(transmute(key_aak, kbd_list))
  290.     c4 = list(transmute(grandmaster, CFG['years']))
  291.     c5 = list(transmute(change_key, CFG['years']))
  292.     c6 = list(transmute(key_aaw, CFG['years']))
  293.     c7 = list(transmute(key_aak, CFG['years']))
  294.     c8 = list(transmute(word, bd_list))
  295.     c9 = list(transmute(word, pbd_list))
  296.     c10 = list(transmute(word, kbd_list))
  297.     c11 = list(transmute(word, CFG['years']))
  298.     c12 = c13 = c14 = c15 = c16 = c21 = []
  299.     if num_rand == "y":
  300.         c12 = list(mod(word, CFG['numfrom'], CFG['numto']))
  301.         c13 = list(mod(grandmaster, CFG['numfrom'], CFG['numto']))
  302.         c14 = list(mod(change_key, CFG['numfrom'], CFG['numto']))
  303.         c15 = list(mod(key_aaw, CFG['numfrom'], CFG['numto']))
  304.         c16 = list(mod(key_aak, CFG['numfrom'], CFG['numto']))
  305.         c21 = list(mod(rev, CFG['numfrom'], CFG['numto']))
  306.     c17 = list(transmute(rev, CFG['years']))
  307.     c18 = list(transmute(rev_w, pbd_list))
  308.     c19 = list(transmute(rev_k, kbd_list))
  309.     c20 = list(transmute(rev_n, bd_list))
  310.     c001 = c002 = c003 = c004 = c005 = c006 = []
  311.     if sp1 == "y":
  312.         c001 = list(transmute(grandmaster, sp))
  313.         c002 = list(transmute(change_key, sp))
  314.         c003 = list(transmute(key_aaw, sp))
  315.         c004 = list(transmute(key_aak, sp))
  316.         c005 = list(transmute(word, sp))
  317.         c006 = list(transmute(rev, sp))
  318.     print("[+] Sorting list and removing duplicates...")
  319.     sets = [set(c1), set(c2), set(c3), set(c4), set(c5),
  320.             set(c6), set(c7), set(c8), set(c9), set(c10),
  321.             set(c11), set(c12), set(c13), set(c14), set(c15),
  322.             set(c16), set(c17), set(c18), set(c19), set(c20),
  323.             set(c21), set(grandmaster), set(change_key), set(master),
  324.             set(sub_master), set(word), set(c001), set(c002), set(c003),
  325.             set(c004), set(c005), set(c006)]
  326.     set1 = set()
  327.     for s in sets:
  328.         set1.update(s)
  329.     list_1 = bd_list + pbd_list + kbd_list + rev + list(set1)
  330.     list_a = sorted(set(list_1))
  331.     list_hs = []
  332.     if hs_mode == "y":
  333.         for x in list_a:
  334.             list_hs.append(run_heatseeker(x))
  335.     list_1 = list_a + list_hs
  336.     list_finished = [x for x in list_1 if CFG['wcfrom'] < len(x) < CFG['wcto']]
  337.     list_finished.sort()
  338.     with open(tn + '.txt', 'w') as f:
  339.         f.write(os.linesep.join(list_finished))
  340.     with open(tn + '.txt') as f:
  341.         lines = len(list(f))
  342.         # shorter, but possibly more memory expensive
  343.     message = ("[+] Saving dictionary to \033[1;31m%s.txt\033[1;m, counting"
  344.                " \033[1;31m%i\033[1;m words.")
  345.     print(message % (tn, lines))
  346.     message = ("[+] Now load your pistolero with \033[1;31m%s.txt\033[1;m and"
  347.                " shoot! Good luck!")
  348.     print(message % tn)
  349.     sys.exit()
  350.  
  351.  
  352. def dl_ftp(ftp_dir, *fns):
  353.     """
  354.    Helper function for download_wordlist(). Download the given files from
  355.    the ftp directory.
  356.    """
  357.     print("\n[+] connecting...\n")
  358.     ftp = ftplib.FTP(FTP_CFG['url'], FTP_CFG['user'], FTP_CFG['password'])
  359.     # ftp.login(FTP_CONFIG['user'], FTP_CONFIG['password'])
  360.     ftp.cwd(FTP_CFG['path'])
  361.     ftp.cwd(ftp_dir)
  362.     dir_prefix = 'dictionaries/%s/' % ftp_dir
  363.     if not os.path.isdir(dir_prefix):
  364.         os.mkdir(dir_prefix)
  365.  
  366.     def handle_download(target, block):
  367.         # Callback for retrobinary. Prints a progress bar as well
  368.         target.write(block)
  369.         print('.', end=' ')
  370.     for filename in fns:
  371.         with open(dir_prefix + filename, 'wb') as outfile:
  372.             print("\n[+] downloading %s..." % filename)
  373.             callback = functools.partial(handle_download, outfile)
  374.             ftp.retrbinary('RETR %s' % filename, callback)
  375.         print(' done.')
  376.     print('[+] file(s) saved to %s' % dir_prefix)
  377.     ftp.quit()
  378.  
  379.  
  380. def dl_wlist():
  381.     """
  382.    # DOWNLOAD WORDLISTS VIA FTP FROM REPOSITORY; REFER TO CFG FILE FOR MORE DETAILED INFO
  383.    """
  384.     if not os.path.isdir('dictionaries'):
  385.         os.mkdir('dictionaries')
  386.     menu = """
  387.     1   Moby            14      french          27      places
  388.     2   afrikaans       15      german          28      polish
  389.     3   american        16      hindi           39      random
  390.     4   aussie          17      hungarian       30      religion
  391.     5   chinese         18      italian         31      russian
  392.     6   computer        19      japanese        32      science
  393.     7   croatian        20      latin           33      spanish
  394.     8   czech           21      literature      34      swahili
  395.     9   danish          22      movieTV         35      swedish
  396.    10   databases       23      music           36      turkish
  397.    11   dictionaries    24      names           37      yiddish
  398.    12   dutch           25      net             38      exit program
  399.    13   finnish         26      norwegian
  400.    """
  401.     print("\n  Choose the section you want to download:\n")
  402.     print(menu)
  403.     print("\n  Files will be downloaded from %s repository" % FTP_CFG['name'])
  404.     print("\n  Tip: After downloading wordlist, you can improve it with -w option\n")
  405.     option = input("Enter number: ")
  406.     while not option.isdigit() or int(option) > 38:
  407.         print("\n[x] Your choice is invalid. Please try again. Refer to help command if needed.", file=sys.stderr)
  408.         option = input(">>> Enter number: ")
  409.     option = int(option)
  410.     if option == 38:
  411.         print('[X] Exiting KRAKEN...', file=sys.stderr)
  412.         sleep(1)
  413.         sys.exit()
  414.     # FTP DIRS ARE FIRST TOUPLES
  415.     # DO NOT CHANGE
  416.     arguments = {
  417.         1: ('Moby', 'mhyph.tar.gz', 'mlang.tar.gz', 'moby.tar.gz',
  418.             'mpos.tar.gz', 'mpron.tar.gz', 'mthes.tar.gz', 'mwords.tar.gz'),
  419.         2: ('afrikaans', 'afr_dbf.zip'),
  420.         3: ('american', 'dic-0294.tar.gz'),
  421.         4: ('aussie', 'oz.gz'),
  422.         5: ('chinese', 'chinese.gz'),
  423.         6: ('computer', 'Domains.gz', 'Dosref.gz', 'Ftpsites.gz', 'Jargon.gz',
  424.             'common-passwords.txt.gz', 'etc-hosts.gz', 'foldoc.gz',
  425.             'language-list.gz', 'unix.gz'),
  426.         7: ('croatian', 'croatian.gz'),
  427.         8: ('czech', 'czech-wordlist-ascii-cstug-novak.gz'),
  428.         9: ('danish', 'danish.words.gz', 'dansk.zip'),
  429.         10: ('databases', 'acronyms.gz', 'att800.gz',
  430.              'computer-companies.gz', 'world_heritage.gz'),
  431.         11: ('dictionaries', 'Antworth.gz', 'CRL.words.gz', 'Roget.words.gz',
  432.              'Unabr.dict.gz', 'Unix.dict.gz', 'englex-dict.gz',
  433.              'knuth_britsh.gz', 'knuth_words.gz', 'pocket-dic.gz',
  434.              'shakesp-glossary.gz', 'special.eng.gz', 'words-english.gz'),
  435.         12: ('dutch', 'words.dutch.gz'),
  436.         13: ('finnish', 'finnish.gz', 'firstnames.finnish.gz', 'words.finnish.FAQ.gz'),
  437.         14: ('french', 'dico.gz'),
  438.         15: ('german', 'deutsch.dic.gz', 'germanl.gz', 'words.german.gz'),
  439.         16: ('hindi', 'hindu-names.gz'),
  440.         17: ('hungarian', 'hungarian.gz'),
  441.         18: ('italian', 'words.italian.gz'),
  442.         19: ('japanese', 'words.japanese.gz'),
  443.         20: ('latin', 'wordlist.aug.gz'),
  444.         21: ('literature', 'LCarrol.gz', 'Paradise.Lost.gz', 'aeneid.gz',
  445.              'arthur.gz', 'cartoon.gz', 'cartoons-olivier.gz', 'charlemagne.gz',
  446.              'fable.gz', 'iliad.gz', 'myths-legends.gz', 'odyssey.gz', 'sf.gz',
  447.              'shakespeare.gz', 'tolkien.words.gz'),
  448.         22: ('movieTV', 'Movies.gz', 'Python.gz', 'Trek.gz'),
  449.         23: ('music', 'music-classical.gz', 'music-country.gz', 'music-jazz.gz',
  450.              'music-other.gz', 'music-rock.gz', 'music-shows.gz',
  451.              'rock-groups.gz'),
  452.         24: ('names', 'ASSurnames.gz' 'Congress.gz', 'Family-Names.gz',
  453.              'Given-Names.gz', 'actor-givenname.gz', 'actor-surname.gz',
  454.              'cis-givenname.gz', 'cis-surname.gz', 'crl-names.gz', 'famous.gz',
  455.              'fast-names.gz', 'female-names-kantr.gz', 'female-names.gz',
  456.              'givennames-ol.gz', 'male-names.gz', 'movie-characters.gz',
  457.              'names.french.gz', 'names.hp.gz', 'other-names.gz',
  458.              'shakesp-names.gz', 'surnames-ol.gz', 'surnames.finnish.gz',
  459.              'usenet-names.gz'),
  460.         25: ('net', 'hosts-txt.gz', 'inet-machines.gz', 'usenet-loginids.gz',
  461.              'usenet-machines.gz', 'uunet-sites.gz'),
  462.         26: ('norwegian', 'words.norwegian.gz'),
  463.         27: ('places', 'Colleges.gz', 'US-counties.gz', 'World.factbook.gz',
  464.              'Zipcodes.gz', 'places.gz'),
  465.         28: ('polish', 'words.polish.gz'),
  466.         29: ('random', 'Ethnologue.gz', 'abbr.gz', 'chars.gz', 'dogs.gz',
  467.              'drugs.gz', 'junk.gz', 'numbers.gz', 'phrases.gz', 'sports.gz',
  468.              'statistics.gz'),
  469.         30: ('religion', 'Koran.gz', 'kjbible.gz', 'norse.gz'),
  470.         31: ('russian', 'russian.lst.gz', 'russian_words.koi8.gz'),
  471.         32: ('science', 'Acr-diagnosis.gz', 'Algae.gz', 'Bacteria.gz',
  472.              'Fungi.gz', 'Microalgae.gz', 'Viruses.gz', 'asteroids.gz',
  473.              'biology.gz', 'tech.gz'),
  474.         33: ('spanish', 'words.spanish.gz'),
  475.         34: ('swahili', 'swahili.gz'),
  476.         35: ('swedish', 'words.swedish.gz'),
  477.         36: ('turkish', 'turkish.dict.gz'),
  478.         37: ('yiddish', 'yiddish.gz'),
  479.     }
  480.     dl_ftp(*(arguments[option]))
  481.  
  482.  
  483. def dl_adb():
  484.  
  485.     """
  486.    Download csv from alectodb and save into local file as a list of
  487.    usernames and passwords
  488.    """
  489.     url = CFG['alectourl']
  490.     loc_fn = url.split('/')[-1]
  491.     print("\n[+] Checking if alectodb is not present...")
  492.     if not os.path.isfile('alectodb.csv.gz'):
  493.         print("[+] Downloading alectodb.csv.gz...")
  494.         print("    Please wait while Database is ")
  495.         print("    downloaded and updated to the ")
  496.         print("        most current version.     ")
  497.         sleep(2)
  498.         # wf = web file; locf = local file
  499.         wf = urlopen(url)
  500.         locf = open(loc_fn, 'w')
  501.         locf.write(wf.read())
  502.         wf.close()
  503.         locf.close()
  504.     f = gzip.open(loc_fn, 'rb')
  505.     data = csv.reader(f)
  506.     uid_list = []
  507.     pwd_list = []
  508.     for row in data:
  509.         uid_list.append(row[5])
  510.         pwd_list.append(row[6])
  511.     gus = sorted(set(uid_list))
  512.     gpa = sorted(set(pwd_list))
  513.     f.close()
  514.     print("\n[+] Exporting to alectodb-usernames.txt and alectodb-passwords.txt")
  515.     with open('alectodb-usernames.txt', 'w') as uidf:
  516.         uidf.write(os.linesep.join(gus))
  517.     with open('alectodb-passwords.txt', 'w') as pwdf:
  518.         pwdf.write(os.linesep.join(gpa))
  519.     print("[+] Done.")
  520.  
  521.  
  522. def mod(sequence, go, end):
  523.     # THIS FUNCTION WILL MODIFY YOUR STRINGS AND CONCATENATE THEM
  524.     for s in sequence:
  525.         for num in range(go, end):
  526.             yield s + str(num)
  527.  
  528.  
  529. def transmute(sequence, go):
  530.     # SORTS && COMBINES FUNCTIONS VIA transmute FUNCTION
  531.     for kstr in sequence:
  532.         for kstr1 in go:
  533.             yield kstr + kstr1
  534.  
  535.  
  536. def run_heatseeker(s):
  537.     # DRAWS FROM THE HEATSEAKER CONFIG OPTIONS TO CREATE POWER POWERFUL AND DIRECTED PASSWORD CRACKING ATTACK
  538.     for c, n in HS_CFG.items():
  539.         s = s.replace(c, n)
  540.     return s
  541.  
  542.  
  543. def dict_import(fn):
  544.     """Implementation of the -w option. Improve a dictionary by
  545.    interactively questioning the user."""
  546.     with open(fn) as fajl:
  547.         add2dict = fajl.readlines()
  548.     imp_list = len(add2dict)
  549.     dict_exists = []
  550.     for x in add2dict:
  551.         dict_exists.extend(x.split())
  552.     print("\n      +~-~-~-~-~-~-~-~-~-~-~-~-~--~-~-~-~-~-~-~-~-~-~-~-~-~+")
  553.     print("      |                    \033[1;31mWARNING!!!\033[1;m                   |")
  554.     print("      |[!] Overly-large worldlists are not recommended...  |")
  555.     print("      | Make CUSTOM PASSLIST after INTEL for BEST RESULTS. |")
  556.     print("      +~-~-~-~-~-~-~-~-~-~-~-~-~--~-~-~-~-~-~-~-~-~-~-~-~-~+\n")
  557.     ask = "Do you want to concatenate all words from wordlist? Y/[N]: "
  558.     mod0 = input(ask).lower().strip()
  559.     if mod0 == 'y' and imp_list > CFG['threshold']:
  560.         print("\n[-] Maximum number of words for concatenation is %i" % CFG['threshold'])
  561.         print("[-] Check configuration file for increasing this number.\n")
  562.         mod0 = input(ask).lower().strip()
  563.     mod_list = []
  564.     if mod0 == 'y':
  565.         for mod1 in dict_exists:
  566.             for mod2 in dict_exists:
  567.                 if dict_exists.index(mod1) != dict_exists.index(mod2):
  568.                     mod_list.append(mod1 + mod2)
  569.     sp0 = []
  570.     ask = "Do you want to add special chars at the end of words? Y/[N]: "
  571.     sp1 = input(ask).lower()
  572.     if sp1 == "y":
  573.         for sc0 in CFG['chars']:
  574.             sp0.append(sc0)
  575.             for sc1 in CFG['chars']:
  576.                 sp0.append(sc0 + sc1)
  577.                 for sc2 in CFG['chars']:
  578.                     sp0.append(sc0 + sc1 + sc2)
  579.     ask = "[+] Do you want to add some random numbers at the end of words? Y/[N]: "
  580.     random_num = input(ask).lower().strip()
  581.     hs_mode = input("Activate Heatseeker Mode? Y/[N]: ").lower().strip()
  582.     ca1 = list(transmute(dict_exists, CFG['years']))
  583.     ca2 = []
  584.     if mod0 == "y":
  585.         ca2 = list(transmute(mod_list, CFG['years']))
  586.     ca3 = []
  587.     ca4 = []
  588.     if sp1 == "y":
  589.         ca3 = list(transmute(dict_exists, sp0))
  590.         if mod0 == "y":
  591.             ca4 = list(transmute(mod_list, sp0))
  592.     ca5 = []
  593.     ca6 = []
  594.     if random_num == "y":
  595.         ca5 = list(mod(dict_exists, CFG['numfrom'], CFG['numto']))
  596.         if mod0 == "y":
  597.             ca6 = list(mod(mod_list, CFG['numfrom'], CFG['numto']))
  598.     print("\n[+] Now making a dictionary...")
  599.     print("[+] Sorting list and removing duplicates...")
  600.     sets = [set(ca1), set(ca2), set(ca3),
  601.             set(ca4), set(ca5), set(ca6),
  602.             set(dict_exists), set(mod_list)]
  603.     uq = set()
  604.     for s in sets:
  605.         uq.update(s)
  606.     u0 = sorted(uq)
  607.     hs0 = []
  608.     if hs_mode == "y":
  609.         for x in u0:
  610.             hs0.append(run_heatseeker(x))
  611.     u1 = u0 + hs0
  612.     u2 = [x for x in u1 if CFG['wcfrom'] < len(x) < CFG['wcto']]
  613.     u2.sort()
  614.     with open(fn + '.kraken.txt', 'w') as f:
  615.         f.write(os.linesep.join(u2))
  616.     with open(fn + '.kraken.txt') as f:
  617.         lines = len(list(f))
  618.     msg = ("[+] Saving dictionary to \033[1;31m%s.cupp.txt\033[1;m, counting"
  619.            " \033[1;31m%i words.\033[1;m")
  620.     print(msg % (fn, lines))
  621.     msg = ("[+] Now load your pistolero with \033[1;31m%s.kraken.txt\033[1;m"
  622.            " and shoot! Good luck!")
  623.     print(msg % fn)
  624.  
  625.  
  626. if __name__ == '__main__':
  627.     main()
Add Comment
Please, Sign In to add comment