Created
December 29, 2016 18:50
-
-
Save userimack/3a822b86db093b2d98b1b0341c291faf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*-coding:utf-8-*- | |
from itertools import permutations as pmt | |
import argparse | |
import math | |
import re | |
class combrider(object): | |
def __init__(self, *args, **kwargs): | |
self.lists = args | |
self.stop = 5 | |
# this is adjust that how many parameters can we add on live usege, | |
# I kept it at 5 because there will be always so many keys, | |
# but if you set more or less that is fine, it works so just set this how you want | |
self.mixer = self.mix_list() | |
self.counter = self.length() | |
def mix_list(self): | |
for i in self.lists: | |
j = i.split(',') | |
# if bigger, then stop | |
if len(j) > self.stop: | |
return j | |
# combination starts here | |
else: | |
mixerlist = [] | |
# ALL the combination stuff goes here | |
# normal tree | |
print '\n' | |
print j,' will be permutated' | |
raw_c = list(pmt(j)) | |
# all characters are upper | |
capital_l = [i.upper() for i in j] | |
print capital_l,' will be permutated' | |
capital_c = list(pmt(capital_l)) | |
# only first and last characters are upper | |
for i in j: | |
if len(i) > 1: | |
if re.match(r'\D', i): | |
mixerlist.append(i[:1].upper()+i[1:len(i)-1]+i[-1].upper()) | |
else: | |
mixerlist.append(i) | |
else: | |
mixerlist.append(i) | |
first_last_cap_l = mixerlist | |
print first_last_cap_l,' will be permutated' | |
first_last_cap_c = list(pmt(first_last_cap_l)) | |
# only first letters as LOWER | |
mixerlist = [] | |
for i in j: | |
if re.match(r'\D', i): | |
mixerlist.append(i[0]) | |
else: | |
mixerlist.append(i) | |
only_first_l = mixerlist | |
print only_first_l,' will be permutated' | |
only_first_c = list(pmt(only_first_l)) | |
# only first letters as UPPER | |
mixerlist = [] | |
for i in j: | |
if re.match(r'\D', i): | |
mixerlist.append(i[0].upper()) | |
else: | |
mixerlist.append(i) | |
only_first_u_l = mixerlist | |
print only_first_u_l,' will be permutated' | |
only_first_u_c = list(pmt(only_first_l)) | |
# one lower one upper | |
mixerlist = [] | |
for i in j: | |
for k in range(0,len(i),2): | |
k += 1 | |
mixerlist.append(i[k-1:k]+i[k:k+1].upper()) | |
lastlist = mixerlist | |
rev = ''.join(lastlist) | |
zero = 0 | |
mixerlist = [] | |
for i in j: | |
getlist = rev[zero:zero+len(i)] | |
mixerlist.append(getlist) | |
zero += len(i) | |
one_l_one_u_l = mixerlist | |
print one_l_one_u_l,' will be permutated' | |
one_l_one_u_c = list(pmt(one_l_one_u_l)) | |
return j | |
def length(self): | |
for i in self.lists: | |
j = i.split(',') | |
if len(j) > self.stop: | |
return '[-] Warning : there will be too much combination so that trying with multiple times much be better' | |
else: | |
est = math.factorial(len(j)) * 6 | |
return 'estimated wordlist counted as -> ' + str(est) + '\n' | |
def getlist(*args, **kwargs): | |
parser = argparse.ArgumentParser() | |
parser.add_argument('-c','--combiner', help='usage: $python combrider.py -c jason,1938,newyork,blue') | |
argsx = parser.parse_args() | |
args = argsx.combiner | |
comb = combrider(args) | |
print comb.counter | |
if __name__ == '__main__': | |
try: | |
getlist() | |
except: | |
print 'try -h or --help' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment