Last active
March 23, 2020 01:52
-
-
Save SirNeural/e3e342ae319d2fa1ee09e3449218b208 to your computer and use it in GitHub Desktop.
CSE365 S20 Lookalike Key Generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "nbformat": 4, | |
| "nbformat_minor": 0, | |
| "metadata": { | |
| "colab": { | |
| "name": "Untitled2.ipynb", | |
| "provenance": [], | |
| "authorship_tag": "ABX9TyProM0/BX+Rt/b63919kf64", | |
| "include_colab_link": true | |
| }, | |
| "kernelspec": { | |
| "name": "python3", | |
| "display_name": "Python 3" | |
| }, | |
| "accelerator": "GPU" | |
| }, | |
| "cells": [ | |
| { | |
| "cell_type": "markdown", | |
| "metadata": { | |
| "id": "view-in-github", | |
| "colab_type": "text" | |
| }, | |
| "source": [ | |
| "<a href=\"https://colab.research.google.com/gist/SirNeural/e3e342ae319d2fa1ee09e3449218b208/untitled2.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "metadata": { | |
| "id": "8BLiq0zauhBR", | |
| "colab_type": "code", | |
| "colab": {} | |
| }, | |
| "source": [ | |
| "import subprocess\n", | |
| "import re\n", | |
| "with open(\"gen-key-script\", \"w\") as f:\n", | |
| " f.write(\"\"\"\n", | |
| "%no-protection\n", | |
| "%transient-key\n", | |
| "Key-Type: 1\n", | |
| "Key-Length: 1024\n", | |
| "Subkey-Type: 1\n", | |
| "Subkey-Length: 1024\n", | |
| "Name-Real: cse365s20 (Signing key for CSE365 S20)\n", | |
| "Expire-Date: 2020-06-15\n", | |
| "Creation-Date: 2020-03-17\n", | |
| "Passphrase: password\n", | |
| "Key-Usage: sign\n", | |
| "Subkey-Usage: encrypt\n", | |
| "%commit\n", | |
| "%echo done\"\"\")\n", | |
| " f.close()" | |
| ], | |
| "execution_count": 0, | |
| "outputs": [] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "metadata": { | |
| "id": "4S8xYtIxv9Iu", | |
| "colab_type": "code", | |
| "colab": {} | |
| }, | |
| "source": [ | |
| "while True:\n", | |
| " output = subprocess.run(['gpg', '--batch', '--gen-key', 'gen-key-script'],stdout=subprocess.PIPE, stderr=subprocess.PIPE).stderr\n", | |
| " print(output)\n", | |
| " if str(output).find(\"key 07EF8\") != -1:\n", | |
| " break\n" | |
| ], | |
| "execution_count": 0, | |
| "outputs": [] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "metadata": { | |
| "id": "LtYc3tldxZVz", | |
| "colab_type": "code", | |
| "colab": {} | |
| }, | |
| "source": [ | |
| "!gpg --list-sigs" | |
| ], | |
| "execution_count": 0, | |
| "outputs": [] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "metadata": { | |
| "id": "X_qsbWobh6N2", | |
| "colab_type": "code", | |
| "colab": {} | |
| }, | |
| "source": [ | |
| "!gpg --export-secret-keys --armor 07EFDEB697BDEF78 > cse_better_fake.gpg" | |
| ], | |
| "execution_count": 0, | |
| "outputs": [] | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment