Advertisement
Alternis_Dim

Hitler Combos

May 13th, 2018
1,245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.51 KB | None | 0 0
  1. import sys
  2. import os
  3. a = 0
  4. filenames = {}
  5. generationOptions = []
  6. generatedLines = 0
  7.  
  8.  
  9. def openfile(file):
  10.     global filenames
  11.     if os.path.isfile('./{0}.txt'.format(file)):
  12.         filenames[file] = open("{0}.txt".format(file), "r+")
  13.     else:
  14.         os.mknod("{0}.txt".format(file))
  15.         filenames[file] = open("{0}.txt".format(file), "r+")
  16.  
  17.  
  18. def exitprogram(message):
  19.     input(message)
  20.     sys.exit()
  21.  
  22.  
  23. combolist = open("combo.txt", "r")
  24. print(
  25.     "[0] Help (Read me first)\n[1] Remove short lines\n[2] Remove long lines\n[3] Remove duplicates\n[4] Count lines\n[5] Split user/pass\n[6] Transform mail:pass to user:pass\n[7] Create combo from usernames\n[8] Add string at the end of each line"
  26. )
  27. optionchoice = int(input("->"))
  28. if optionchoice is 0:
  29.     print(
  30.         "This program should NOT be in the same folder as files bearing one of these names : user.txt , pass.txt , output.txt , as these could be overwritten and lost.\n"
  31.     )
  32.     print(
  33.         "However, you NEED to put your combo in the same folder as this program, named combo.txt or usernames.txt depending on the option you want to use.\n"
  34.     )
  35.     print(
  36.         "For the combo creator, use %user% and %USER% to use the username, without and with caps. If the username is John and you type %user%%USER%1, the generated line will be JohnJOHN1."
  37.     )
  38. if optionchoice is 1:
  39.     openfile("output")
  40.     minimum = int(input("Minimum number of characters ?"))
  41.     removedlines = 0
  42.     for line in combolist:
  43.         if int(len(line)) > minimum:
  44.             filenames["output"].write(line)
  45.         else:
  46.             removedlines += 1
  47.     print("{0} removed lines, the new combolist is available in output.txt.".
  48.           format(removedlines))
  49.     filenames["output"].close()
  50.     exitprogram("Done. Press enter to leave.")
  51. elif optionchoice is 2:
  52.     openfile("output")
  53.     maximum = int(input("Maximum number of characters ?"))
  54.     removedlines = 0
  55.     for line in combolist:
  56.         if int(len(line)) < maximum:
  57.             filenames["output"].write(line)
  58.         else:
  59.             removedlines += 1
  60.     print("{0} removed lines, the new combolist is available in output.txt.".
  61.           format(removedlines))
  62.     filenames["output"].close()
  63.     exitprogram("Done. Press enter to leave.")
  64. elif optionchoice is 3:
  65.     openfile("output")
  66.     duplicates_n = 0
  67.     duplicates = set()
  68.     for line in combolist:
  69.         if line not in duplicates:
  70.             filenames["output"].write(line)
  71.             duplicates.add(line)
  72.         else:
  73.             duplicates_n += 1
  74.     print(
  75.         "{0} duplicate lines removed, the new combolist is available in output.txt.".
  76.         format(duplicates_n))
  77.     filenames["output"].close()
  78.     exitprogram("Done. Press enter to leave.")
  79. elif optionchoice is 4:
  80.     lines = 0
  81.     for line in combolist:
  82.         lines += 1
  83.     print("{0} lines in the combolist.".format(lines))
  84.     exitprogram("Done. Press enter to leave.")
  85. elif optionchoice is 5:
  86.     openfile("user")
  87.     openfile("pass")
  88.     lines = 0
  89.     for line in combolist:
  90.         line = line.rstrip()
  91.         username, password = line.split(":")
  92.         filenames["user"].write(username, "\n")
  93.         filenames["pass"].write(password, "\n")
  94.     filenames["user"].close()
  95.     filenames["pass"].close()
  96.     exitprogram("Done. Press enter to leave.")
  97. elif optionchoice is 6:
  98.     openfile("output")
  99.     for line in combolist:
  100.         line = line.rstrip()
  101.         username, password = line.split(":")
  102.         user, mail = line.split("@")
  103.         outputline = "{0}:{1}\n".format(user, password)
  104.         filenames["output"].write(outputline)
  105.     filenames["output"].close()
  106.     exitprogram("Done. Press enter to leave.")
  107. elif optionchoice is 7:
  108.     while a is not 1:
  109.         generateOption = input("Please input a format. To stop, type 0.\n")
  110.         if generateOption is "0":
  111.             a = 1
  112.         else:
  113.             generationOptions.append(generateOption)
  114.     with open("user.txt", "r") as u:
  115.         openfile("output")
  116.         for line in u:
  117.             line = line.rstrip()
  118.             userName = line
  119.             for i in range(len(generationOptions)):
  120.                 passWord = generationOptions[i]
  121.                 passWord = passWord.replace("%user%", userName)
  122.                 passWord = passWord.replace("%USER%", userName.upper())
  123.                 passWord = passWord.replace("%User%", userName.title())
  124.                 passWord = passWord.replace("%useR%", userName[0:len(userName)-1]+userName[len(userName)-1].upper())
  125.                 comboOutput = "{0}:{1}\n".format(userName, passWord)
  126.                 filenames["output"].write(comboOutput)
  127.                 generatedLines += 1
  128.     filenames["output"].close()
  129.     exitprogram("{0} generated lines. Press enter to leave.".format(generatedLines))
  130. elif optionchoice is 8:
  131.   openfile("output")
  132.   ajoute = input("What string do we add ?")
  133.   for line in combolist:
  134.     filenames["output"].write(line.rstrip('\n') + ajoute + "\n")
  135. else:
  136.     exitprogram("Invalid command. Press enter to leave.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement