def doGenerate(): variables.head = handleList(variables.head) variables.tail = handleList(variables.tail) variables.name.append("") variables.birthday.append("") variables.extinfo.append("") variables.dict_max.append("") variables.tail.append("") variables.head.append("") variables.year.append("") # variables.lett.append("") variables.email.append("") variables.qq.append("") variables.phoneNumer.append("") f = open('./result.txt', 'w') for birstdayItem in variables.birthday: for nameItem in variables.name: for extinfoItem in variables.extinfo: for dictMaxItem in variables.dict_max: for yearItem in variables.year: for phoneItem in variables.phoneNumer: for qqItem in variables.qq: for emailItem in variables.email: preS = birstdayItem + nameItem + extinfoItem\ + dictMaxItem + yearItem + phoneItem\ + qqItem + emailItem if len(preS) < variables.minLen or len( preS) > variables.maxLen: continue obj = Permutation() obj.words = [birstdayItem, nameItem, extinfoItem, \ dictMaxItem, \ yearItem, phoneItem, qqItem, \ emailItem] obj.words = handleList(obj.words) rst = obj.permutationList() for s in rst: if len(s) < variables.minLen or len( s) > variables.maxLen: break for tailItem in variables.tail: for headItem in variables.head: s2 = headItem + s + tailItem if len( s2 ) >= variables.minLen and len( s2 ) <= variables.maxLen: print s2 if const.isRelease: f.write(s2) f.write('\n') f.close() print "Done!"
def doGenerate(): variables.head = handleList(variables.head) variables.tail = handleList(variables.tail) variables.name.append("") variables.birthday.append("") variables.extinfo.append("") variables.dict_max.append("") variables.tail.append("") variables.head.append("") variables.year.append("") # variables.lett.append("") variables.email.append("") variables.qq.append("") variables.phoneNumer.append("") f = open('./result.txt', 'w') for birstdayItem in variables.birthday: for nameItem in variables.name: for extinfoItem in variables.extinfo: for dictMaxItem in variables.dict_max: for yearItem in variables.year: for phoneItem in variables.phoneNumer: for qqItem in variables.qq: for emailItem in variables.email: preS = birstdayItem + nameItem + extinfoItem\ + dictMaxItem + yearItem + phoneItem\ + qqItem + emailItem if len(preS) < variables.minLen or len(preS) > variables.maxLen: continue obj = Permutation() obj.words = [birstdayItem, nameItem, extinfoItem, \ dictMaxItem, \ yearItem, phoneItem, qqItem, \ emailItem] obj.words = handleList(obj.words) rst = obj.permutationList() for s in rst: if len(s) < variables.minLen or len(s) > variables.maxLen: break for tailItem in variables.tail: for headItem in variables.head: s2 = headItem + s + tailItem if len(s2) >= variables.minLen and len(s2) <= variables.maxLen: print s2 if const.isRelease: f.write(s2); f.write('\n') f.close() print "Done!"
def generateBirthDayList(yearStr, monthStr, dayStr): #以1949-10-01为例 yearStr = str(yearStr) monthStr = "%02d" % (int(monthStr)) dayStr = "%02d" % (int(dayStr)) birthDayList = [] birthDayList.append(yearStr) birthDayList.append(monthStr) birthDayList.append(dayStr) obj = Permutation() obj.words = birthDayList variables.birthday.extend(obj.permutationList()) #只有月份和日期的全序列 10-01 birthDayList.remove(yearStr) obj = Permutation() obj.words = birthDayList variables.birthday.extend(obj.permutationList()) birthDayList.append(yearStr) #日期以单位数的全序列 1949-10-1 if re.match(r"0\d", monthStr) or re.match(r"0\d", dayStr): birthDayList.remove(monthStr) birthDayList.append(str(int(monthStr))) birthDayList.remove(dayStr) birthDayList.append(str(int(dayStr))) obj.words = birthDayList variables.birthday.extend(obj.permutationList()) #日期以单位数,没有年份的全序列 10-1 birthDayList.remove(yearStr) obj = Permutation() obj.words = birthDayList variables.birthday.extend(obj.permutationList()) birthDayList.append(yearStr) #年份是两位数的全序列 49-10-1 if len(yearStr) == 4: sYear = yearStr[2:4] generateBirthDayList(sYear, monthStr, dayStr)
def afterGenerateNameList(f, l): nameList = [] nameList.append(f) nameList.append(l) obj = Permutation() obj.words = nameList rst = obj.permutationList() if rst: variables.name.extend(rst) #字符串去重 variables.name = list(set(variables.name))