# HardHatC2 | A C# Command And Control Framework

**URL:** <https://onehack.st/t/hardhatc2-a-c-command-and-control-framework/250756>\
**Category:** Tools & Scripts\
**Tags:** tools, programming\
**Created:** [July 1, 2023, 11:03pm UTC](https://onehack.st/t/hardhatc2-a-c-command-and-control-framework/250756 "2023-07-01T23:03:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BlueHacker](https://onehack.st/user_avatar/onehack.st/bluehacker/32/174721_2.png) [@BlueHacker](https://onehack.st/u/BlueHacker)\
**Post date:** [July 1, 2023, 11:03pm UTC](https://onehack.st/t/hardhatc2-a-c-command-and-control-framework/250756/1 "2023-07-01T23:03:28Z")

</div>

![image](https://onehack.st/uploads/default/original/3X/a/4/a42d2cc1093cce7627205d4596337631a8b00efb.png)

[![Discord](https://camo.githubusercontent.com/099968005b484f92f7f17dde31354dd02b44c35c44cf384b756faf849526c7e0/68747470733a2f2f696d672e736869656c64732e696f2f646973636f72642f383832363432353639323037363434323030)](https://camo.githubusercontent.com/099968005b484f92f7f17dde31354dd02b44c35c44cf384b756faf849526c7e0/68747470733a2f2f696d672e736869656c64732e696f2f646973636f72642f383832363432353639323037363434323030) [![GitHub issues](https://camo.githubusercontent.com/7ade074864a45e0926832080308c6a30bd514d39fce24f59fb35aebed75457aa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f447261676f5143432f486172644861744332)](https://camo.githubusercontent.com/7ade074864a45e0926832080308c6a30bd514d39fce24f59fb35aebed75457aa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f447261676f5143432f486172644861744332) [![GitHub Repo stars](https://camo.githubusercontent.com/4b48a3b8c50db2b2a09627adad46cfd391686c2f93959471d8f3377c0d1408b8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f447261676f5163632f4861726448617443323f7374796c653d736f6369616c)](https://camo.githubusercontent.com/4b48a3b8c50db2b2a09627adad46cfd391686c2f93959471d8f3377c0d1408b8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f447261676f5163632f4861726448617443323f7374796c653d736f6369616c) [![GitHub forks](https://camo.githubusercontent.com/23a0f46431f24c653074a7532448d21f68a58312f3bc71e3659133f4ec633f6e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f447261676f7163632f4861726448617443323f7374796c653d736f6369616c)](https://camo.githubusercontent.com/23a0f46431f24c653074a7532448d21f68a58312f3bc71e3659133f4ec633f6e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f447261676f7163632f4861726448617443323f7374796c653d736f6369616c) [![GitHub tag (latest by date)](https://camo.githubusercontent.com/ed376a0e184bfc6914fabaf6de13d957f75dfd7511b17e3390d801a0c2aea797/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f447261676f5163632f486172644861746332)](https://camo.githubusercontent.com/ed376a0e184bfc6914fabaf6de13d957f75dfd7511b17e3390d801a0c2aea797/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f447261676f5163632f486172644861746332) [![GitHub last commit](https://camo.githubusercontent.com/4d78cece486d0bd212c6518bc4a8c5b2ad0a5aa96fd07f904b9c5ab84e587bee/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f647261676f7163632f686172646861746332)](https://camo.githubusercontent.com/4d78cece486d0bd212c6518bc4a8c5b2ad0a5aa96fd07f904b9c5ab84e587bee/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6173742d636f6d6d69742f647261676f7163632f686172646861746332)

# HardHat C2

## A cross-platform, collaborative, Command & Control framework written in C#, designed for red teaming and ease of use.

HardHat is a multiplayer C# .NET-based command and control framework. Designed to aid in red team engagements and penetration testing. HardHat aims to improve the quality of life factors during engagements by providing an easy-to-use but still robust C2 framework.  
It contains three primary components, an [ASP.NET](http://ASP.NET) teamserver, a blazor .NET client, and C# based implants.

# Release Tracking

Alpha Release - 3/29/23 NOTE: HardHat is in Alpha release; it will have bugs, missing features, and unexpected things will happen. Thank you for trying it, and please report back any issues or missing features so they can be addressed.

# Community

[Discord](https://discord.gg/npW2yy7JFK) Join the community to talk about HardHat C2, Programming, Red teaming and general cyber security things The discord community is also a great way to request help, submit new features, stay up to date on the latest additions, and submit bugs.

# Features

## Teamserver & Client

- Per-operator accounts with account tiers to allow customized access control and features, including view-only guest modes, team-lead opsec approval(WIP), and admin accounts for general operation management.
- Managers (Listeners)
- Dynamic Payload Generation (Exe, Dll, shellcode, PowerShell command)
- Creation & editing of C2 profiles on the fly in the client
- Customization of payload generation
  - sleep time/jitter
  - kill date
  - working hours
  - type (Exe, Dll, Shellcode, ps command)
  - Included commands(WIP)
  - option to run confuser

- File upload & Downloads
- Graph View
- File Browser GUI
- Event Log
- JSON logging for events & tasks
- Loot tracking (Creds, downloads)
- IOC tracing
- Pivot proxies (SOCKS 4a, Port forwards)
- Cred store
- Autocomplete command history
- Detailed help command
- Interactive bash terminal command if the client is on linux or powershell on windows, this allows automatic parsing and logging of terminal commands like proxychains
- Persistent database storage of teamserver items (User accounts, Managers, Engineers, Events, tasks, creds, downloads, uploads, etc. )
- Recon Entity Tracking (track info about users/devices, random metadata as needed)
- Shared files for some commands (see teamserver page for details)
- tab-based interact window for command issuing
- table-based output option for some commands like ls, ps, etc.
- Auto parsing of output from seatbelt to create “recon entities” and fill entries to reference back to later easily
- Dark and Light 🤮 theme

[![image](https://user-images.githubusercontent.com/15575425/228551170-cd455c24-3541-47ec-ad85-dcb84ce64075.png)](https://user-images.githubusercontent.com/15575425/228551170-cd455c24-3541-47ec-ad85-dcb84ce64075.png) [![image](https://user-images.githubusercontent.com/15575425/228551467-750a5a3a-dcff-4290-968e-7b18598e74b6.png)](https://user-images.githubusercontent.com/15575425/228551467-750a5a3a-dcff-4290-968e-7b18598e74b6.png)

## Engineers

- C# .NET framework implant for windows devices, currently only CLR/.NET 4 support
- atm only one implant, but looking to add others
- It can be generated as EXE, DLL, shellcode, or PowerShell stager
- Rc4 encryption of payload memory & heap when sleeping (Exe / DLL only)
- AES encryption of all network communication
- ConfuserEx integration for obfuscation
- HTTP, HTTPS, TCP, SMB communication
  - TCP & SMB can work P2P in a bind or reverse setups

- Unique per implant key generated at compile time
- multiple callback URI’s depending on the C2 profile
- P/Invoke & D/Invoke integration for windows API calls
- SOCKS 4a support
- Reverse Port Forward & Port Forwards
- All commands run as async cancellable jobs
  - Option to run commands sync if desired

- Inline assembly execution & inline shellcode execution
- DLL Injection
- Execute assembly & Mimikatz integration
- Mimikatz is not built into the implant but is pushed when specific commands are issued
- Various localhost & network enumeration tools
- Token manipulation commands
  - Steal Token Mask(WIP)

- Lateral Movement Commands
- Jump (psexec, wmi, wmi-ps, winrm, dcom)
- Remote Execution (WIP)
- AMSI & ETW Patching
- Unmanaged Powershell
- Script Store (can load multiple scripts at once if needed)
- Spawn & Inject
  - Spawn-to is configurable

- run, shell & execute [![image](https://user-images.githubusercontent.com/15575425/228551103-0f1fe1f5-9b2d-42f9-a22d-f929f17b3b93.png)](https://user-images.githubusercontent.com/15575425/228551103-0f1fe1f5-9b2d-42f9-a22d-f929f17b3b93.png)

# Documentation

documentation can be found at [docs](https://docs.hardhat-c2.net/)

# Getting Started

## Prerequisites

- Installation of the [.net 7 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/7.0) from Microsoft
- Once installed, the teamserver and client are started with dotnet run

### Teamserver

To configure the team server’s starting address (where clients will connect), edit the HardHatC2\TeamServer\Properties\LaunchSettings.json changing the “applicationUrl”: “[https://127.0.0.1:5000](https://127.0.0.1:5000/)” to the desired location and port. start the teamserver with dotnet run from its top-level folder ../HrdHatC2/Teamserver/

### HardHat Client

1. When starting the client to set the target teamserver location, include it in the command line dotnet run [https://127.0.0.1:5000](https://127.0.0.1:5000/) for example
2. open a web browser and navigate to [https://localhost:7096/](https://localhost:7096/) if this works, you should see the login page
3. Log in with the HardHat\_Admin user (Password is printed on first TeamServer startup)
4. Navigate to the settings page & create a new user if successful, a message should appear, then you may log in with that account to access the full client

# Contributions & Bug Reports

Code contributions are welcome feel free to submit feature requests, pull requests or send me your ideas on discord.

## GitHub:

> **[GitHub - DragoQCC/CrucibleC2: A C# Command & Control framework](https://github.com/DragoQCC/CrucibleC2)**
>
> A C# Command & Control framework
