一款用于分析文档以寻找密码候选的 Docker 化应用程序。
博客文章 《DeepPass — 使用深度学习寻找密码》 提供了有关模型方法与开发的更多细节。
运行方式:docker-compose up
这会开放 http://localhost:5000,可以在其中上传文档。
该 API 也可以手动使用,位于 http://localhost:5000/api/passwords:
C:\Users\harmj0y\Documents\GitHub\DeepPass>curl -F "file=@test_doc.docx" http://localhost:5000/api/passwords
[{"file_name": "test_doc.docx", "model_password_candidates": [{"left_context": ["for", "the", "production", "server", "is:"], "password": "P@ssword123!", "right_context": ["Please", "dont", "tell", "anyone", "on"]}, {"left_context": ["that", "the", "other", "password", "is"], "password": "LiverPool1", "right_context": [".", "This", "is", "our", "backup."]}], "regex_password_candidates": [{"left_context": ["for", "the", "production", "server", "is:"], "password": "P@ssword123!", "right_context": ["Please", "dont", "tell", "anyone", "on"]}], "custom_regex_matches": null}]
Apache Tika 用于从多种文档格式中提取数据。Tensorflow Serving 用于提供模型服务。
神经网络是双向 LSTM:
embedding_dimension = 20
dropout = 0.5
cells = 200
model = Sequential()
model.add(Embedding(total_chars, embedding_dimension, input_length=32, mask_zero=True))
model.add(Bidirectional(LSTM(cells)))
model.add(Dropout(dropout))
model.add(Dense(1, activation='sigmoid'))
该模型在从这份泄露的密码列表中随机选取的 2,000,000 个密码,以及从各种 Google dork 文档中提取的 2,000,000 个术语上进行训练。.1 测试集上的统计数据如下:
------------------
loss : 0.04804224148392677
tn : 199446.0
fp : 731.0
fn : 3281.0
tp : 196542.0
------------------
accuracy : 0.9899700284004211
precision : 0.9962944984436035
recall : 0.983580470085144
------------------
F1 score. : 0.9898966618590025
------------------
模型的训练笔记本位于 ./notebooks/password_model_bilstm.ipynb。