|
| 1 | +# Python 3 HTTPS Reverse Shell |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +[](https://www.codefactor.io/repository/github/EONRaider/BCA-HTTPS-Reverse-Shell) |
| 8 | +[](https://github.com/EONRaider/BCA-HTTPS-Reverse-Shell/blob/master/LICENSE) |
| 9 | + |
| 10 | +[](https://www.reddit.com/user/eonraider) |
| 11 | +[](https://discord.gg/KVjWBptv) |
| 12 | +[](https://twitter.com/intent/follow?screen_name=eon_raider) |
| 13 | + |
| 14 | +A **cross-platform HTTPS Reverse Shell** server and client in Python 3. Binaries for |
| 15 | +Linux and Windows platforms can be built through an embedded script that implements |
| 16 | +PyInstaller. |
| 17 | + |
| 18 | +This application also includes a helper shell script that enables fast generation of |
| 19 | +self-signed certificates for use of both servers and clients. After generation, the |
| 20 | +server and certificate authority certificates required for encrypted connections |
| 21 | +are bundled in the binaries for portability and ease of execution. |
| 22 | + |
| 23 | +## Try it out! |
| 24 | +If you just need to see the tool in action on a local environment, simply head over |
| 25 | +to the [demo-files](https://github.com/EONRaider/BCA-HTTPS-Reverse-Shell/tree/master/demo-files) |
| 26 | +directory and download the pre-built Linux/Unix/macOS or Windows binaries. |
| 27 | + |
| 28 | +The files are all bundled with certificates for `localhost` and work straight out-of-the-box. *Just |
| 29 | +set them with permissions to execute and run.* |
| 30 | + |
| 31 | +## Build |
| 32 | +Encrypted communication through HTTPS requires at least two certificates: One for |
| 33 | +the server, named `server.pem` by default, and another for the certificate authority, or `ca.pem`. |
| 34 | +This HTTPS Reverse Shell bundles both files in binaries for fast deployment. They can be |
| 35 | +generated by [multiple methods](https://www.digitalocean.com/community/tutorials/openssl-essentials-working-with-ssl-certificates-private-keys-and-csrs) |
| 36 | +or by a simple execution of the [generate_certs.sh](https://github.com/EONRaider/BCA-HTTPS-Reverse-Shell/blob/master/src/generate_certs.sh) helper script. |
| 37 | + |
| 38 | +Once the certificates are ready you only need to (I) install the dependencies and (II) |
| 39 | +run `build.py` to build the `server` and `client` binaries. |
| 40 | + |
| 41 | +### I. Install Dependencies |
| 42 | +Dependency management works with both [Poetry](https://python-poetry.org/) (recommended) |
| 43 | +and [Virtualenv](https://virtualenv.pypa.io/en/latest/) |
| 44 | +```shell |
| 45 | +git clone https://github.com/EONRaider/BCA-HTTPS-Reverse-Shell.git |
| 46 | +cd BCA-HTTPS-Reverse-Shell |
| 47 | +poetry install <--or--> pip install -r requirements.txt |
| 48 | +``` |
| 49 | + |
| 50 | +### II. Build Server and Client binaries |
| 51 | +The `build.py` file takes care of it all. |
| 52 | +```shell |
| 53 | +python build.py server --server-cert /path/to/server.pem |
| 54 | +python build.py client --ca-cert /path/to/ca.pem |
| 55 | +``` |
| 56 | + |
| 57 | +## Usage |
| 58 | + |
| 59 | + |
| 60 | +## Development mode (optional) |
| 61 | +You could optionally run the HTTPS Reverse Shell directly from a local Python 3 |
| 62 | +interpreter. [Install all dependencies](https://github.com/EONRaider/BCA-HTTPS-Reverse-Shell/tree/master#i-install-dependencies) |
| 63 | +and run the `server.py` and `client.py` files. All required certificates will be |
| 64 | +automatically generated for `localhost`. |
| 65 | + |
| 66 | +Execute the **Server** on one shell... |
| 67 | +```shell |
| 68 | +python src/server/server.py localhost 4443 |
| 69 | +``` |
| 70 | + |
| 71 | +... And the **Client** on another shell: |
| 72 | +```shell |
| 73 | +python src/client/client.py \ |
| 74 | +--host localhost \ |
| 75 | +--port 4443 \ |
| 76 | +--ca-cert src/server/ca.pem |
| 77 | +``` |
| 78 | + |
| 79 | +## Legal Disclaimer |
| 80 | + |
| 81 | +The use of code contained in this repository, either in part or in its totality, |
| 82 | +for engaging targets without prior mutual consent is illegal. **It is |
| 83 | +the end user's responsibility to obey all applicable local, state and |
| 84 | +federal laws.** |
| 85 | + |
| 86 | +Developers assume **no liability** and are not |
| 87 | +responsible for misuses or damages caused by any code contained |
| 88 | +in this repository in any event that, accidentally or otherwise, it comes to |
| 89 | +be utilized by a threat agent or unauthorized entity as a means to compromise |
| 90 | +the security, privacy, confidentiality, integrity, and/or availability of |
| 91 | +systems and their associated resources. In this context the term "compromise" is |
| 92 | +henceforth understood as the leverage of exploitation of known or unknown vulnerabilities |
| 93 | +present in said systems, including, but not limited to, the implementation of |
| 94 | +security controls, human- or electronically-enabled. |
| 95 | + |
| 96 | +The use of this code is **only** endorsed by the developers in those |
| 97 | +circumstances directly related to **educational environments** or |
| 98 | +**authorized penetration testing engagements** whose declared purpose is that |
| 99 | +of finding and mitigating vulnerabilities in systems, limiting their exposure |
| 100 | +to compromises and exploits employed by malicious agents as defined in their |
| 101 | +respective threat models. |
0 commit comments