Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import os
- a = 0
- filenames = {}
- generationOptions = []
- generatedLines = 0
- def openfile(file):
- global filenames
- if os.path.isfile('./{0}.txt'.format(file)):
- filenames[file] = open("{0}.txt".format(file), "r+")
- else:
- os.mknod("{0}.txt".format(file))
- filenames[file] = open("{0}.txt".format(file), "r+")
- def exitprogram(message):
- input(message)
- sys.exit()
- combolist = open("combo.txt", "r")
- print(
- "[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"
- )
- optionchoice = int(input("->"))
- if optionchoice is 0:
- print(
- "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"
- )
- print(
- "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"
- )
- print(
- "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."
- )
- if optionchoice is 1:
- openfile("output")
- minimum = int(input("Minimum number of characters ?"))
- removedlines = 0
- for line in combolist:
- if int(len(line)) > minimum:
- filenames["output"].write(line)
- else:
- removedlines += 1
- print("{0} removed lines, the new combolist is available in output.txt.".
- format(removedlines))
- filenames["output"].close()
- exitprogram("Done. Press enter to leave.")
- elif optionchoice is 2:
- openfile("output")
- maximum = int(input("Maximum number of characters ?"))
- removedlines = 0
- for line in combolist:
- if int(len(line)) < maximum:
- filenames["output"].write(line)
- else:
- removedlines += 1
- print("{0} removed lines, the new combolist is available in output.txt.".
- format(removedlines))
- filenames["output"].close()
- exitprogram("Done. Press enter to leave.")
- elif optionchoice is 3:
- openfile("output")
- duplicates_n = 0
- duplicates = set()
- for line in combolist:
- if line not in duplicates:
- filenames["output"].write(line)
- duplicates.add(line)
- else:
- duplicates_n += 1
- print(
- "{0} duplicate lines removed, the new combolist is available in output.txt.".
- format(duplicates_n))
- filenames["output"].close()
- exitprogram("Done. Press enter to leave.")
- elif optionchoice is 4:
- lines = 0
- for line in combolist:
- lines += 1
- print("{0} lines in the combolist.".format(lines))
- exitprogram("Done. Press enter to leave.")
- elif optionchoice is 5:
- openfile("user")
- openfile("pass")
- lines = 0
- for line in combolist:
- line = line.rstrip()
- username, password = line.split(":")
- filenames["user"].write(username, "\n")
- filenames["pass"].write(password, "\n")
- filenames["user"].close()
- filenames["pass"].close()
- exitprogram("Done. Press enter to leave.")
- elif optionchoice is 6:
- openfile("output")
- for line in combolist:
- line = line.rstrip()
- username, password = line.split(":")
- user, mail = line.split("@")
- outputline = "{0}:{1}\n".format(user, password)
- filenames["output"].write(outputline)
- filenames["output"].close()
- exitprogram("Done. Press enter to leave.")
- elif optionchoice is 7:
- while a is not 1:
- generateOption = input("Please input a format. To stop, type 0.\n")
- if generateOption is "0":
- a = 1
- else:
- generationOptions.append(generateOption)
- with open("user.txt", "r") as u:
- openfile("output")
- for line in u:
- line = line.rstrip()
- userName = line
- for i in range(len(generationOptions)):
- passWord = generationOptions[i]
- passWord = passWord.replace("%user%", userName)
- passWord = passWord.replace("%USER%", userName.upper())
- passWord = passWord.replace("%User%", userName.title())
- passWord = passWord.replace("%useR%", userName[0:len(userName)-1]+userName[len(userName)-1].upper())
- comboOutput = "{0}:{1}\n".format(userName, passWord)
- filenames["output"].write(comboOutput)
- generatedLines += 1
- filenames["output"].close()
- exitprogram("{0} generated lines. Press enter to leave.".format(generatedLines))
- elif optionchoice is 8:
- openfile("output")
- ajoute = input("What string do we add ?")
- for line in combolist:
- filenames["output"].write(line.rstrip('\n') + ajoute + "\n")
- else:
- exitprogram("Invalid command. Press enter to leave.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement