Skip to content

Commit

Permalink
version 2.0.5#dev update
Browse files Browse the repository at this point in the history
1. add birthday、scratch and pid4 plugin
2. add AwesomeSystemTestUsername.txt wordlist
3. modify --conf function
4. modify CommonWebAdminPass.txt wordlist
5. other perfect modify
  • Loading branch information
LandGrey committed Oct 2, 2017
1 parent 68803e3 commit 298ae3b
Show file tree
Hide file tree
Showing 16 changed files with 1,545 additions and 312 deletions.
50 changes: 30 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pydictor
[![build](https://img.shields.io/badge/build-passing-brightgreen.svg)](https://www.github.com/landgrey/pydictor) [![Python 2.7|3.4](https://img.shields.io/badge/python-2.7|3.4-yellow.svg)](https://www.python.org/) ![release](https://img.shields.io/badge/version-2.0.4-orange.svg) ![License](https://img.shields.io/badge/license-GPLv3-red.svg)
[![build](https://img.shields.io/badge/build-passing-brightgreen.svg)](https://www.github.com/landgrey/pydictor) [![Python 2.7|3.4](https://img.shields.io/badge/python-2.7|3.4-yellow.svg)](https://www.python.org/) ![release](https://img.shields.io/badge/version-2.0.5-orange.svg) ![License](https://img.shields.io/badge/license-GPLv3-red.svg)

**README.md [中文版](README_CN.md)**

Expand Down Expand Up @@ -51,7 +51,7 @@ python pydictor.py
![social engineering dictionary builder](/screenshots/sedb.png "sedb")

## Quick to use:
#### types of generate wordlist(14 types)and descriptions
#### types of generate wordlist(15 types)and descriptions

| wordlist type | number| description |
|:------------- | :---- |:--------------------------------------------------- |
Expand All @@ -60,7 +60,7 @@ python pydictor.py
| chunk | 3 | permutation and combination wordlist |
| conf | 4 | based on configuration file wordlist |
| sedb | 5 | social engineering wordlist |
| idcard | 6 | id card last 6/8 char wordlist |
| idcard | 6 | id card last 4/6/8 char wordlist |
| extend | 7 | extend wordlist based on rules |
| scratch | 8 | wordlist based on web pages keywords |
| passcraper | 9 | wordlist against to web admin and users |
Expand All @@ -69,20 +69,21 @@ python pydictor.py
| counter | 12 | word frequency count wordlist |
| combiner | 13 | combine the input file generate wordlist |
| uniqbiner | 14 | combine and unique the input file generate wordlist |
| birthday | 15 | birthday keyword wordlist in specify datetime scope |

#### function and scope of support wordlist number

| function | number (wordlist) | description |
|:---------- | :--------------------------- |:-------------------------------------------------------- |
| len | 1 2 3 4 5 6 7 9 10 11 12 14 | lenght scope |
| head | 1 2 3 4 5 6 7 9 10 11 12 14 | add items prefix |
| tail | 1 2 3 4 5 6 7 9 10 11 12 14 | add items suffix |
| encode | 1 2 3 4 5 6 7 9 10 11 12 14 | encode the items |
| occur | 3 4 5 7 9 10 11 12 14 | filter by occur times of letter、digital、special chars |
| types | 3 4 5 7 9 10 11 12 14 | filter by types of letter、digital、special chars |
| regex | 3 4 5 7 9 10 11 12 14 | filter by regex |
| level | 5 7 9 | set the wordlist level |
| leet | 5 7 9 | 1337 mode |
| function | number (wordlist) | description |
|:---------- | :------------------------------ |:-------------------------------------------------------- |
| len | 1 2 3 4 5 6 7 9 10 11 12 14 15 | lenght scope |
| head | 1 2 3 4 5 6 7 9 10 11 12 14 15 | add items prefix |
| tail | 1 2 3 4 5 6 7 9 10 11 12 14 15 | add items suffix |
| encode | 1 2 3 4 5 6 7 9 10 11 12 14 15 | encode the items |
| occur | 3 4 5 7 9 10 11 12 14 | filter by occur times of letter、digital、special chars |
| types | 3 4 5 7 9 10 11 12 14 | filter by types of letter、digital、special chars |
| regex | 3 4 5 7 9 10 11 12 14 | filter by regex |
| level | 5 7 9 | set the wordlist level |
| leet | 5 7 9 | 1337 mode |


## usage examples
Expand Down Expand Up @@ -133,23 +134,31 @@ python pydictor.py -extend /names.txt --leet 0 1 2 11 21 --level 1 --len 4 16 --
```


#### 7: id card last 6/8 char wordlist
#### 7: id card last 4/6/8 char wordlist

```
pydictor.py -plug pid6 --types ">=0" ">=4" ">=0" --encode b64
```

**note**: default sex ='all', it decided by lib/data/data.py default_sex, and 'm' is Male, 'f' is Female


#### 7-2: birthday range wordlist
```
pydictor.py -plug birthday 19750101 20001231 --len 6 8
```


#### 8: using passcraper plugin crawl website generating password wordlist based on plain text found and extend rules

1. the rules of passcraper plug and extend function are the same
2. passcraper plug will generate two wordlist,preffix with SCRATCH is raw wordlist by website plain text,
and if you feel that there are a lot of unrelated words in the SCRATCH wordlist,
you can remove them, and then use the extend function to specify the new file to generate dictionary again.
3. you can modify the funcfg/passcraper_blacklist.conf file,add or delete useless words that need to be filtered out,
3. or directed using scratch plug,then remove some useless words and use the extend function to generate dictionary again.
4. you can modify the funcfg/passcraper_blacklist.conf file,add or delete useless words that need to be filtered out,
and also can modify lib/data/data.py file passcraper_filter argument,change the filter regular expressions
4. with same extend function,you can put your weak password in /wordlist/Web,new wordlist will contains them
5. with same extend function,you can put your weak password in /wordlist/Web,new wordlist will contains them

```
python pydictor.py -plug passcraper using default file scraper.sites as multi-input file
Expand All @@ -161,8 +170,9 @@ python pydictor.py -plug passcraper http://www.example.com
##### this function contains all of "-base" and "-char" capacities,and more precise control

```
python pydictor.py --conf using default file funcfg/build.conf build the dictionary
python pydictor.py --conf /my/other/awesome.conf using /my/other/awesome.conf build the dictionary
pydictor.py --conf "[1-9]{6,6}<none>" --output six.txt build wordlist
python pydictor.py --conf using default file funcfg/build.conf build the dictionary
python pydictor.py --conf /my/other/awesome.conf using /my/other/awesome.conf build the dictionary
```

**note**: parsing rules details as following,besides referred to build.conf file
Expand Down Expand Up @@ -208,7 +218,7 @@ python pydictor.py -tool shredder delete the currently specified output path(d
python pydictor.py -tool shredder base delete the files of it's prefix is "BASE" in currently specified output path
```

prefix(case insensitive) range in 14 items: base,char,chunk,conf,sedb,idcard,extend,handler,uniqifer,counter,combiner,uniqbiner,scratch,passcraper
prefix(case insensitive) range in 15 items: base,char,chunk,conf,sedb,idcard,extend,handler,uniqifer,counter,combiner,uniqbiner,scratch,passcraper,birthday

besides,you can safe shred files or whole directory as following:
```
Expand Down
51 changes: 32 additions & 19 deletions README_CN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pydictor
[![build](https://img.shields.io/badge/build-passing-brightgreen.svg)](https://www.github.com/landgrey/pydictor) [![Python 2.7|3.4](https://img.shields.io/badge/python-2.7|3.4-yellow.svg)](https://www.python.org/) ![release](https://img.shields.io/badge/version-2.0.4-orange.svg) ![License](https://img.shields.io/badge/license-GPLv3-red.svg)
[![build](https://img.shields.io/badge/build-passing-brightgreen.svg)](https://www.github.com/landgrey/pydictor) [![Python 2.7|3.4](https://img.shields.io/badge/python-2.7|3.4-yellow.svg)](https://www.python.org/) ![release](https://img.shields.io/badge/version-2.0.5-orange.svg) ![License](https://img.shields.io/badge/license-GPLv3-red.svg)

**README.md [English](README.md)**

Expand Down Expand Up @@ -55,7 +55,7 @@ python pydictor.py

## 快速上手:

#### 可以生成的字典类型(14种)及其说明
#### 可以生成的字典类型(15种)及其说明

| 类型 | 编号 | 说明 |
|:------------- | :---- |:----------------- |
Expand All @@ -64,7 +64,7 @@ python pydictor.py
| chunk | 3 | 排列组合字典 |
| conf | 4 | 配置文件生成字典 |
| sedb | 5 | 社会工程学字典 |
| idcard | 6 | 身份证后6/8位字典 |
| idcard | 6 | 身份证后4/6/8位字典 |
| extend | 7 | 扩展字典 |
| scratch | 8 | 网页原始关键词字典|
| passcraper | 9 | 网页爆破针对字典 |
Expand All @@ -73,20 +73,21 @@ python pydictor.py
| counter | 12 | 词频统计字典 |
| combiner | 13 | 合并字典 |
| uniqbiner | 14 | 先合并后去重字典 |
| birthday | 15 | 生日范围字典 |

#### 字典类型与功能适用范围对照表

| 功能 | 适用范围(字典类型编号) | 说明 |
|:---------- | :--------------------------- |:------------------------------------ |
| len | 1 2 3 4 5 6 7 9 10 11 12 14 | 定义长度范围 |
| head | 1 2 3 4 5 6 7 9 10 11 12 14 | 添加前缀 |
| tail | 1 2 3 4 5 6 7 9 10 11 12 14 | 添加后缀 |
| encode | 1 2 3 4 5 6 7 9 10 11 12 14 | 编码或自定义加密方法 |
| occur | 3 4 5 7 9 10 11 12 14 | 字母、数字、特殊字符出现次数范围筛选 |
| types | 3 4 5 7 9 10 11 12 14 | 字母、数字、特殊字符各种类数范围筛选 |
| regex | 3 4 5 7 9 10 11 12 14 | 正则筛选 |
| level | 5 7 9 | 字典级别筛选 |
| leet | 5 7 9 | 1337 模式 |
| 功能 | 适用范围(字典类型编号) | 说明 |
|:---------- | :------------------------------ |:------------------------------------ |
| len | 1 2 3 4 5 6 7 9 10 11 12 14 15 | 定义长度范围 |
| head | 1 2 3 4 5 6 7 9 10 11 12 14 15 | 添加前缀 |
| tail | 1 2 3 4 5 6 7 9 10 11 12 14 15 | 添加后缀 |
| encode | 1 2 3 4 5 6 7 9 10 11 12 14 15 | 编码或自定义加密方法 |
| occur | 3 4 5 7 9 10 11 12 14 | 字母、数字、特殊字符出现次数范围筛选 |
| types | 3 4 5 7 9 10 11 12 14 | 字母、数字、特殊字符各种类数范围筛选 |
| regex | 3 4 5 7 9 10 11 12 14 | 正则筛选 |
| level | 5 7 9 | 字典级别筛选 |
| leet | 5 7 9 | 1337 模式 |


## 使用实例
Expand Down Expand Up @@ -138,18 +139,26 @@ webzhang
python pydictor.py -extend /names.txt --leet 0 1 2 11 21 --level 1 --len 4 16 --occur "<=10" ">0" "<=2" -o /possbile/wordlist.lst
```

#### 示例7: 身份证后6/8位生成插件
#### 示例7: 身份证后4/6/8位生成插件
##### 使用pid6插件生成中国公民身份证后6位爆破字典, 并规定至少要出现4种不同的数字,并用base64编码
```
pydictor.py -plug pid6 --types ">=0" ">=4" ">=0" --encode b64
```

****: 默认的性别为全体'all',它由 lib/data/data.py文件default_sex参数指定,'m'指男性,'f'指女性


#### 示例7-2: 生日范围字典生成插件
```
pydictor.py -plug birthday 19750101 20001231 --len 6 8
```


#### 示例8: 使用passcraper插件爬行网站指定页面并基于获得的文本词组生成密码字典

1. passcraper 规则和extend完全一致
2. passcraper 插件会生成两个字典,SCRATCH开头的是从网站内容获得的原始词组列表,如果感觉SCRATCH字典中有许多无关词,可以自己去除后,重新使用extend功能指定文件生成字典
3. 或直接使用scratch插件,只从网站内容中获得原始词列表,人工拣选后,再使用extend功能生成扩展字典
3. 你可以修改 funcfg/passcraper_blacklist.conf 文件,选择需要过滤掉的无用单词,也可以修改lib/data/data.py 中的passcraper_filter,更改过滤正则表达式
4. 和extend一样,你可以将自己的弱密码字典放在 /wordlist/Web 目录下,生成的字典会包含它们

Expand All @@ -163,11 +172,15 @@ python pydictor.py -plug passcraper http://www.example.com
1. 此功能可以完成"-base"和"-char"的所有功能,并在此基础上有更精细化的字典控制力;
2. extend.conf 文件支持此功能,具体参考funcfg/extend.conf文件;
3. 可以生成固定模式的字典,比如 lisa【两位到四位数字】@【qq.com, 163.com, some.net 中的一个】,在配置文件中写入
'lisa[0-9]{2,4}<none>@[qq.com,163.com,some.net]{1,1}<none>' ,然后指定运行即可
```
lisa[0-9]{2,4}<none>@[qq.com,163.com,some.net]{1,1}<none>
```
然后指定路径运行即可

```
python pydictor.py --conf --encode b64 使用默认位置的funcfg/build.conf 配置文件建立字典,并用base64编码
python pydictor.py --conf /my/other/awesome.conf 使用/my/other/awesome.conf文件建立字典
pydictor.py --conf "[1-9]{6,6}<none>" --output six.txt 生成6位纯数字字典
python pydictor.py --conf --encode b64 使用默认位置的funcfg/build.conf 配置文件建立字典,并用base64编码
python pydictor.py --conf /my/other/awesome.conf 使用/my/other/awesome.conf文件建立字典
```

****: 具体解析规则如下,另可参考build.conf文件示例;
Expand Down Expand Up @@ -211,7 +224,7 @@ python pydictor.py -tool shredder 删除当前指定的字典输出目
python pydictor.py -tool shredder base 删除当前指定的字典输出目录下,以"BASE"开头的所有字典文件
```

支持的前缀(不区分大小写)有14种:base,char, chunk, conf,sedb,idcard,extend,handler,uniqifer,counter,combiner,uniqbiner,scratch,passcraper
支持的前缀(不区分大小写)有15种:base,char, chunk, conf,sedb,idcard,extend,handler,uniqifer,counter,combiner,uniqbiner,scratch,passcraper,birthday

另外,还可以像下面这样,将传入的任意位置的一个文件或目录,整个的安全删除
```
Expand Down
9 changes: 4 additions & 5 deletions core/CONF.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ def get_conf_dic(minlength, maxlength, objflag, encodeflag, head, tail):
return diclist


def build_conf_dic():
storepath = finalsavepath(paths.results_path, pystrs.CONF_prefix, mybuildtime(), pyoptions.filextension, paths.results_file_name)
def build_conf_dic(source="", file_prefix=pystrs.CONF_prefix):
storepath = finalsavepath(paths.results_path, file_prefix, mybuildtime(), pyoptions.filextension, paths.results_file_name)
with open(storepath, "a") as f:
for item in confcore(paths.buildconf_path):
for item in confcore(source):
item = filterforfun(item, head=pyoptions.head, tail=pyoptions.tail,
lenght_is_filter=pyoptions.args_pick,
minlen=pyoptions.minlen, maxlen=pyoptions.maxlen,
Expand All @@ -59,10 +59,8 @@ def confcore(resource):
except IndexError:
confdicts = {}
exit(cool.red("[-] parse element error, please check your parsing element"))

finalen = len(confdicts[pystrs.conf_head])
listpool = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

for x in range(0, finalen):
lengthchecker(confdicts[pystrs.conf_minlen][x], confdicts[pystrs.conf_maxlen][x])
listpool[x] = get_conf_dic(int(confdicts[pystrs.conf_minlen][x]), int(confdicts[pystrs.conf_maxlen][x]),
Expand All @@ -83,6 +81,7 @@ def confcore(resource):
elif finalen == 4:
countchecker(-1, len(listpool[0]), len(listpool[1]), len(listpool[2]), len(listpool[3]))
for item in itertools.product(listpool[0], listpool[1], listpool[2], listpool[3]):
# print("".join(item) + '\n')
yield "".join(item)
elif finalen == 5:
countchecker(-1, len(listpool[0]), len(listpool[1]), len(listpool[2]), len(listpool[3]), len(listpool[4]))
Expand Down
13 changes: 4 additions & 9 deletions core/EXTEND.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def extend_enter(rawlist, leet=True):
return unique(res)


def get_extend_dic(target, need_passcratch=False):
def get_extend_dic(target, need_extendscratch=False):
rawlist = []
for t in target:
if os.path.isfile(t):
Expand All @@ -226,23 +226,18 @@ def get_extend_dic(target, need_passcratch=False):
rawlist.append(line.strip())
else:
rawlist.append(t)
extend_magic(rawlist, need_passcratch=need_passcratch)
extend_magic(rawlist, need_extendscratch=need_extendscratch)


def extend_magic(rawlist, need_passcratch=False):
def extend_magic(rawlist, need_extendscratch=False):
prefix = pystrs.EXTEND_prefix
if rawlist == []:
exit(pyoptions.CRLF + cool.red("[-] raw extend resource cannot be empty"))

leet = pyoptions.extend_leet
if need_passcratch:
if need_extendscratch:
prefix = pystrs.PASSCRAPER_prefix
leet = pyoptions.passcraper_leet
rawstorepath = os.path.join(paths.results_path, "%s_%s%s" % (pystrs.SCFATCH_prefix, mybuildtime(),
pyoptions.filextension))
with open(rawstorepath, "a") as f:
for line in rawlist:
f.write(str(line) + pyoptions.CRLF)

storepath = finalsavepath(paths.results_path, prefix, mybuildtime(), pyoptions.filextension, paths.results_file_name)
with open(storepath, "a") as f:
Expand Down
Loading

0 comments on commit 298ae3b

Please sign in to comment.