Skip to content

Instantly share code, notes, and snippets.

@ezztahoun
Created July 5, 2022 18:27
Show Gist options
  • Select an option

  • Save ezztahoun/76390dd4ba93f37247de06cb36b30c07 to your computer and use it in GitHub Desktop.

Select an option

Save ezztahoun/76390dd4ba93f37247de06cb36b30c07 to your computer and use it in GitHub Desktop.
Crack Passwords .ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Crack Passwords .ipynb",
"provenance": [],
"authorship_tag": "ABX9TyN+KakcGtYus9L7EIL7DQR7",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/ezzeldinadel/76390dd4ba93f37247de06cb36b30c07/crack-passwords.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"source": [
"# cyberdatascience.org\n",
"\n",
"\n",
"---\n",
"\n"
],
"metadata": {
"id": "QaXHFoqrPhob"
}
},
{
"cell_type": "markdown",
"source": [
"data acq"
],
"metadata": {
"id": "OIfnPN2aPrr6"
}
},
{
"cell_type": "code",
"source": [
"import shutil\n",
"import urllib.request as request\n",
"from contextlib import closing\n",
"\n",
"# download the data and process it \n",
"with closing(request.urlopen('http://downloads.skullsecurity.org/passwords/rockyou.txt.bz2')) as r:\n",
" with open('rockyou.txt.bz2', 'wb') as f:\n",
" shutil.copyfileobj(r, f)\n",
"!bzip2 -d rockyou.txt.bz2\n",
"\n",
"\n",
"\n"
],
"metadata": {
"id": "80h_U37OP2Ea"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"data selection and processing"
],
"metadata": {
"id": "7Lq6oTd5cc5i"
}
},
{
"cell_type": "code",
"source": [
"!git clone https://github.com/brannondorsey/PassGAN.git \n",
"!python PassGAN/bin/make-rockyou-full.py > PassGAN/data/rockyou-full.txt\n",
"!python PassGAN/bin/prep-data.py\n",
"\n",
"# or just download the processed ones by the two commands below \n",
"\n",
"!curl -L -o PassGAN/data/rockyou-train.txt https://github.com/brannondorsey/PassGAN/releases/download/data/rockyou-train.txt\n",
"!curl -L -o PassGAN/data/rockyou-test.txt https://github.com/brannondorsey/PassGAN/releases/download/data/rockyou-test.txt\n"
],
"metadata": {
"id": "DFns7p4bceoa"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"Choosing a model"
],
"metadata": {
"id": "pI3AC0RPXfOl"
}
},
{
"cell_type": "code",
"source": [
"!pip install -r PassGAN/requirements.txt"
],
"metadata": {
"id": "9uCLz6_KXRtG"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"Train the gan "
],
"metadata": {
"id": "HkaUjaKOYbEW"
}
},
{
"cell_type": "code",
"source": [
"!python PassGAN/train.py --output-dir PassGAN/output --training-data PassGAN/data/rockyou-train.txt"
],
"metadata": {
"id": "eWk3AAh-Xd29"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"Eval the rzlts "
],
"metadata": {
"id": "oagx2YIcYpqj"
}
},
{
"cell_type": "code",
"source": [
"!python PassGAN/sample.py --input-dir PassGAN/pretrained --checkpoint PassGAN/pretrained/checkpoints/195000.ckpt --output passgan_gen_passwords.txt --batch-size 1024 --num-samples 10000"
],
"metadata": {
"id": "gn_iCGUwYoZE"
},
"execution_count": null,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment