├── README.MD ├── config.py ├── fdict.py └── rules ├── commonPwd.txt ├── mid.txt ├── suf.txt └── year.txt /README.MD: -------------------------------------------------------------------------------- 1 | # Fdict 2 | 3 | 一款面向企业的渗透测试字典生成工具。 4 | 5 | ## 功能 6 | 7 | 先说优点:简单、高效、不生产垃圾数据、密码覆盖全面。 8 | 9 | 代码可能不够pythonic,但非常实用,完爆大部分的字典生成工具。 10 | 11 | 不仅可以生成强大的密码字典,还可以生成强大的用户名字典。 12 | 13 | ## 如何使用 14 | 15 | 填写 config.py 里面的配置即可,不知道的可以不填。 16 | 17 | ``` 18 | # 公司主域名 19 | company_domain = 'xx.com' 20 | # 公司的简称 21 | company_short_name = 'xx' 22 | # 公司所在城市名称简写 23 | company_city_short_name = 'gz' 24 | # 公司相关代码 证卷代码 或者 股票代码 或者 客服电话号码 或者 邮政编码 或者 公司成立的时间 25 | company_code = ['002500',] 26 | # 工号 27 | jobNo = '1234' 28 | # 已知账号,不知道可以不写 29 | username = 'lzy' 30 | # 你所需要的密码的最小位数 31 | min_pwd = 0 32 | # 密码的最大位数 33 | max_pwd = 50 34 | # 在已生成的密码后面全都添加 ! 35 | # 例如某个站点的域名为 abc.xxx.com,你可以设置全部密码前面添加 abc,获取更多可能的密码。 36 | is_add_pre = False 37 | add_pre = ['abc',] 38 | # 在已生成的密码后面全都添加 ! 39 | is_add_suf = False 40 | add_suf = ['!'] 41 | 42 | # 根据已知工号生成用户名如 1234 会遍历四位数生成一系列用户名为 公司简称+工号 43 | build_jobNo_username = True 44 | build_other_username = True 45 | ``` 46 | 47 | 然后使用命令生成你的专属字典: 48 | ``` 49 | python fdict.py 50 | ``` 51 | 52 | ## 规则 53 | 54 | 规则很多,在兼顾降低密码数量的基础上,基本覆盖了所有可能的密码。填写全部信息后生成的密码数量大约在4000个左右。 55 | 56 | 如有遗漏,欢迎提出 issues。 57 | 58 | 59 | 60 | ## 写在最后 61 | 62 | 为了弥补在面向企业渗透这方面用户名密码字典工具的空白,于是有了这个工具,代码含量不高,但经过深思熟虑,为爱发电,开源让世界变得美好。 63 | -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- 1 | # 公司信息 2 | company_domain = 'xx.com' 3 | company_short_name = 'xx' 4 | company_city_short_name = 'gz' 5 | # 公司相关代码 证卷代码 或者 股票代码 或者 客服电话号码 或者 邮政编码 或者 公司成立的时间 6 | company_code = [] 7 | # 工号 8 | jobNo = '' 9 | # 已知账号,不知道可以不写 10 | username = '' 11 | # 密码的最小位数 12 | min_pwd = 0 13 | # 密码的最大位数 14 | max_pwd = 50 15 | # 在已生成的密码前面全都添加 ! , 密码翻倍 16 | is_add_pre = False 17 | add_pre = ['!',] 18 | # 在已生成的密码后面全都添加 ! , 密码翻倍 19 | is_add_suf = False 20 | add_suf = ['!'] 21 | # 根据已知工号生成用户名如 1234 会遍历四位数生成一系列用户名为 公司简称+工号 22 | build_jobNo_username = False 23 | build_other_username = False -------------------------------------------------------------------------------- /fdict.py: -------------------------------------------------------------------------------- 1 | import math 2 | from config import * 3 | 4 | class Fdict(): 5 | def __init__(self): 6 | self.mid = self.readDict('./rules/mid.txt') 7 | self.common_pwd = self.readDict('./rules/commonPwd.txt') 8 | self.weak_suf = self.readDict('./rules/suf.txt') 9 | self.year = self.readDict('./rules/year.txt') 10 | self.pwd = [] 11 | self.username = [] 12 | self.initModifyString() 13 | 14 | def readDict(self,filename): 15 | """ 16 | return ['a','b','c'] 17 | """ 18 | with open(filename,'r',encoding='utf-8')as f: 19 | results = [data.strip() for data in f.readlines()] 20 | return results 21 | 22 | def modifyString(self,str): 23 | """ 24 | input ['ab'] 25 | return ['ab','Ab','AB] 26 | """ 27 | strs = [] 28 | strs.append(str) 29 | strs.append(str.upper()) 30 | strs.append(str.capitalize()) 31 | return strs 32 | 33 | def concactString(self,pre,mid,suf): 34 | """ 35 | return [pre[0]+mid[0]+suf[0],...] 36 | """ 37 | _pwd = [] 38 | for p in pre: 39 | for m in mid: 40 | _pwd += [p + m + s for s in suf] 41 | return _pwd 42 | 43 | def buildUsername(self): 44 | """ 45 | return ['a','b','c'] 46 | """ 47 | self.user = [] 48 | jobNo_len = len(jobNo) 49 | if build_jobNo_username: 50 | jobNos = ['0'*int(jobNo_len-len(str(j))) + str(j) for j in range(int(math.pow(10,jobNo_len)))] 51 | self.user += self.concactString(self.company_short_names,[''],jobNos) 52 | if build_other_username: 53 | pass 54 | 55 | def initModifyString(self): 56 | self.usernames = self.modifyString(username) 57 | self.company_short_names = self.modifyString(company_short_name) 58 | self.company_city_short_names = self.modifyString(company_city_short_name) 59 | 60 | def initConcact(self,head): 61 | """ 62 | input ['head'] 63 | return ['head'+mid+othersuf] 64 | """ 65 | _pwd = [] 66 | _pwd += self.concactString(head,self.mid,self.weak_suf) 67 | _pwd += self.concactString(head,self.mid,self.year) 68 | return _pwd 69 | 70 | def savePwd(self,filename,data): 71 | with open(filename,'a',encoding='utf-8')as f: 72 | for d in data: 73 | f.write(d + '\n') 74 | 75 | def removeRepeat(self): 76 | self.pwd = set(self.pwd) 77 | self.pwd = list(self.pwd) 78 | 79 | def filterPwd(self): 80 | tmp_pwd = self.pwd[:] 81 | for p in tmp_pwd: 82 | if len(p) < min_pwd: 83 | self.pwd.remove(p) 84 | if len(p) > max_pwd: 85 | self.pwd.remove(p) 86 | 87 | def addSufPre(self): 88 | tmp_pwd = self.pwd[:] 89 | if is_add_suf: 90 | for a in add_suf: 91 | self.pwd += [p + a for p in tmp_pwd] 92 | if is_add_pre: 93 | for a in add_pre: 94 | self.pwd += [a + p for p in tmp_pwd] 95 | 96 | def main(self): 97 | if jobNo: 98 | pwdJobNos = [jobNo] 99 | if len(jobNo) < 6: 100 | pwdJobNos.append('00'+jobNo) 101 | self.pwd += self.initConcact(pwdJobNos) 102 | if jobNo and company_domain: 103 | self.pwd += self.concactString(pwdJobNos,self.mid,company_domain) 104 | if jobNo and company_short_name: 105 | self.pwd += self.concactString(self.company_short_names,self.mid,pwdJobNos) 106 | if jobNo and company_city_short_name: 107 | self.pwd += self.concactString(self.company_city_short_names,self.mid,pwdJobNos) 108 | if jobNo and company_short_name and company_city_short_name: 109 | cmid = [company_short_name + m for m in self.mid] 110 | self.pwd += self.concactString(self.company_city_short_names,cmid,pwdJobNos) 111 | 112 | if username: 113 | self.pwd += self.initConcact(self.usernames) 114 | if username and company_code: 115 | self.pwd += self.concactString(self.usernames,self.mid,company_code) 116 | if username and company_domain: 117 | self.pwd += self.concactString([company_domain.split('.')[0]],self.mid,self.usernames) 118 | self.pwd += self.concactString(self.usernames,self.mid,company_domain) 119 | if username and company_short_name: 120 | self.pwd += self.concactString(self.usernames,self.mid,self.company_short_names) 121 | self.pwd += self.concactString(self.company_short_names,self.mid,self.usernames) 122 | self.pwd += self.concactString(self.company_short_names,self.mid,[username[0]]) 123 | if username and company_city_short_name: 124 | self.pwd += self.concactString(self.company_city_short_names,self.mid,self.usernames) 125 | self.pwd += self.concactString(self.usernames,self.mid,self.company_city_short_names) 126 | 127 | if company_code: 128 | self.initConcact(company_code) 129 | if company_code and company_domain: 130 | self.pwd += self.concactString(company_code,self.mid,[company_domain]) 131 | self.pwd += self.concactString([company_domain.split('.')[0]],self.mid,company_code) 132 | if company_code and company_short_name: 133 | self.pwd += self.concactString(self.company_short_names,self.mid,company_code) 134 | if company_code and company_city_short_name: 135 | self.pwd += self.concactString(self.company_city_short_names,self.mid,company_code) 136 | if company_code and company_domain and company_short_name and company_city_short_name: 137 | for code in company_code: 138 | cmid = [code + m for m in self.mid] 139 | self.pwd += self.concactString(self.company_city_short_names,cmid,company_domain) 140 | self.pwd += self.concactString(self.company_short_names,cmid,company_domain) 141 | if company_domain: 142 | self.initConcact(company_domain) 143 | if company_domain and company_short_name: 144 | self.pwd += self.concactString(self.company_short_names,self.mid,[company_domain]) 145 | self.pwd += self.concactString([company_domain.split('.')[0]],self.mid,self.company_short_names) 146 | if company_domain and company_city_short_name: 147 | self.pwd += self.concactString(self.company_city_short_names,self.mid,[company_domain]) 148 | self.pwd += self.concactString([company_domain.split('.')[0]],self.mid,self.company_city_short_names) 149 | if company_domain and company_short_name and company_city_short_name: 150 | cmid = [company_short_name + m for m in self.mid] 151 | self.pwd += self.concactString(self.company_city_short_names,self.mid,[company_domain]) 152 | self.pwd += self.concactString(self.company_city_short_names,cmid,[company_domain]) 153 | 154 | if company_short_name: 155 | self.pwd += self.initConcact(self.company_short_names) 156 | if company_short_name and company_city_short_name: 157 | self.pwd += self.concactString(self.company_city_short_names,self.mid,company_short_name) 158 | self.pwd += self.concactString(company_short_name,self.mid,company_city_short_name) 159 | 160 | if company_city_short_name: 161 | self.pwd += self.initConcact(self.company_city_short_names) 162 | self.addSufPre() 163 | self.removeRepeat() 164 | self.filterPwd() 165 | if build_jobNo_username: 166 | self.buildUsername() 167 | if company_domain: 168 | self.savePwd('./results/{}.txt'.format(company_domain),self.pwd) 169 | self.savePwd('./results/username-{}.txt'.format(company_domain),self.user) 170 | else: 171 | self.savePwd('./results/passwords.txt',self.pwd) 172 | self.savePwd('./results/usernames.txt',self.user) 173 | 174 | if __name__ == '__main__': 175 | fdict = Fdict() 176 | fdict.main() -------------------------------------------------------------------------------- /rules/commonPwd.txt: -------------------------------------------------------------------------------- 1 | 123456 2 | 0 3 | 4 | aa123456 5 | Abc123! 6 | Abc123!@# 7 | abc1234! 8 | @bcd1234 9 | #EDC4rfv 10 | abcABC123 11 | 1qaz!@#$ 12 | admin@123 13 | admin@1234 14 | QAZwsx123 15 | Pa$$w0rd 16 | P@ssw0rd 17 | P@$$word 18 | P@$$word123 19 | Abcd1234 20 | !QAZ2wsx 21 | !QAZ3edc 22 | 2wsx#EDC 23 | 1!qaz2@wsx 24 | 1q2w3e4r 25 | 1234abcd 26 | 1234qwer 27 | 1qaz!QAZ 28 | 1qaz2wsx 29 | 1qaz@WSX 30 | 1qaz@WSX#EDC 31 | !q2w3e4r 32 | QWER!@#$ 33 | Passwd@123 34 | Passwd12 35 | Passwd@123456 36 | p@ssw0rdaa123456 37 | abc123 38 | qwe123 39 | 123qaz 40 | qweasd 41 | P@ssw0rd! 42 | !QAZ@WSX#EDC 43 | P2ssw0rd 44 | 1qaz2wsx3edc 45 | abcd123456789 46 | 123456Aa 47 | 1234@Qaz#123admin 48 | admin123 49 | admin888 50 | admin12345 51 | admin111 52 | adminadmin 53 | admintest 54 | administrator 55 | root 56 | guest 57 | root123 58 | root@123 59 | user 60 | ceshi 61 | ceshi123 62 | ceshi@123 63 | test 64 | test123 65 | test@123 66 | !@# 67 | pass 68 | pass123 69 | pass@123 70 | password 71 | p@ssword 72 | passw0rd 73 | NULL 74 | tomcat 75 | sys 76 | system 77 | qq.com 78 | 123123 79 | 654321 80 | 1001 81 | 1 82 | 2 83 | 3 84 | 4 85 | 5 86 | 6 87 | 7 88 | 8 89 | 9 90 | 10 91 | 11 92 | 22 93 | 33 94 | 44 95 | 55 96 | 66 97 | 77 98 | 88 99 | 99 100 | 100 101 | 111 102 | 222 103 | 333 104 | 444 105 | 555 106 | 666 107 | 777 108 | 888 109 | 999 110 | 1000 111 | 1111 112 | 2222 113 | 3333 114 | 4444 115 | 5555 116 | 6666 117 | 7777 118 | 8888 119 | 9999 120 | 11111 121 | 22222 122 | 33333 123 | 55555 124 | 66666 125 | 77777 126 | 88888 127 | 111111 128 | 222222 129 | 333333 130 | 555555 131 | 666666 132 | 777777 133 | 888888 134 | 999999 135 | 12 136 | 123 137 | 1234 138 | 12345 139 | 12345678 140 | 5211314 141 | 456123 142 | 9876543210 143 | 987654321 144 | 123456789 -------------------------------------------------------------------------------- /rules/mid.txt: -------------------------------------------------------------------------------- 1 | 2 | + 3 | @ 4 | # 5 | = -------------------------------------------------------------------------------- /rules/suf.txt: -------------------------------------------------------------------------------- 1 | 2 | root 3 | admin 4 | 000 5 | 111 6 | 222 7 | 333 8 | 1111 9 | 2222 10 | 3333 11 | 520 12 | 666 13 | 888 14 | 321 15 | 123 16 | 1234 17 | 12345 18 | 54321 19 | 123456 20 | abc 21 | wsx 22 | WSX 23 | jkl 24 | uio 25 | ABC 26 | JKL 27 | UIO 28 | QWE 29 | QAZ 30 | ZXC 31 | ASD 32 | qwe 33 | qaz 34 | zxc 35 | asd 36 | ! 37 | !@# 38 | 001 39 | 002 40 | 007 41 | 006 42 | 009 -------------------------------------------------------------------------------- /rules/year.txt: -------------------------------------------------------------------------------- 1 | 2007 2 | 2008 3 | 2009 4 | 2010 5 | 2011 6 | 2012 7 | 2013 8 | 2014 9 | 2015 10 | 2016 11 | 2017 12 | 2018 13 | 2019 14 | 2020 15 | 2021 16 | 2022 17 | 2023 18 | 2024 --------------------------------------------------------------------------------