A Java-based Command and Control (C2) server with native agents for security research and educational purposes.
IMPORTANT: This software is intended for legitimate security research, educational purposes, and authorized penetration testing only. Do not use for any illegal activities.
BitStrike is a lightweight C2 framework consisting of:
- A Java-based C2 server that manages agent communications and provides a command console
- Native agents written in C for various platforms (Phase 1 includes Windows)
-
Server:
- HTTP/HTTPS communication with agents
- Agent registration and management
- Command queuing system
- Console interface for managing agents
- Encrypted communications
- Command execution on connected agents
-
Windows Agent:
- HTTP/HTTPS communication with C2 server
- System information collection
- Command execution via cmd.exe
- Sleep with jitter pattern
- Basic anti-analysis features
- Encrypted communications
-
Server:
- Java 11 or higher
- Maven
-
Windows Agent:
- MinGW-w64 (for cross-compilation on non-Windows systems)
- Windows build tools (if building on Windows)
cd BitStrike/server
mvn clean package
The server JAR will be generated in the target
directory.
-
Install MinGW-w64
- macOS:
brew install mingw-w64
- Ubuntu:
apt install mingw-w64
- macOS:
-
Build the agent
# Using the Makefile cd BitStrike/agents/windows make # OR using the provided build script on macOS cd BitStrike/agents/windows ./build_mac.sh
- Install build tools (MinGW or Visual Studio Build Tools)
- Compile with:
gcc -Wall -o agent.exe agent.c -lwinhttp -lws2_32
java -jar server/target/c2-server-1.0-SNAPSHOT.jar
The server will start on port 8443.
Once the server is running, you can use the following commands in the console:
help
- Show available commandslist
- List all connected agentsshell <agent_id> <command>
- Execute shell command on agentsleep <agent_id> <seconds>
- Set agent sleep intervalkill <agent_id>
- Terminate agentexit
- Exit the C2 server
Simply run the agent executable on the target Windows system:
agent.exe
The agent will automatically connect to the C2 server defined in the agent code.
Since the Windows agent relies on Windows-specific APIs like WinHTTP and other Windows SDK functions, you need a Windows environment to properly run and test the agent. Here are your options:
-
Install a virtualization solution:
- VMware Fusion (commercial)
- Parallels Desktop (commercial)
- VirtualBox (free)
-
Set up a Windows 10/11 VM
-
Cross-compile the agent on your Mac:
cd BitStrike/agents/windows ./build_mac.sh
-
Copy the generated
agent.exe
to your Windows VM -
Run the C2 server on your Mac
java -jar server/target/c2-server-1.0-SNAPSHOT.jar
-
Configure your VM's network settings to allow communication with the host machine
-
Update the C2 server address in the agent code to point to your Mac's IP address, then recompile
-
Run the agent in the Windows VM
If you have access to a remote Windows machine or server:
- Cross-compile the agent on your Mac
- Copy the agent to the Windows machine
- Run the C2 server on your Mac (ensure it's accessible from the Windows machine)
- Run the agent on the Windows machine
Wine can run some Windows applications on macOS, but with limitations, especially for applications using Windows-specific APIs:
-
Install Wine:
brew install --cask wine-stable
-
Try running the agent:
wine agent.exe
Note: The agent likely won't work properly under Wine due to WinHTTP dependencies, but it's useful for basic testing.
For macOS users, we've included configuration files to help with development:
- VS Code will show Windows header errors since these headers aren't available on macOS
- Use the included
.vscode/c_cpp_properties.json
for IDE integration - For actual testing, always use a Windows VM or Windows machine
BitStrike/
├── server/ # Java C2 server
│ ├── src/ # Server source code
│ └── pom.xml # Maven configuration
├── agents/ # Agent implementations
│ └── windows/ # Windows agent
│ ├── agent.c # Windows agent source code
│ ├── Makefile # Build script for Windows agent
│ └── build_mac.sh # macOS cross-compilation script
└── docs/ # Documentation
- This is a basic implementation for educational purposes
- In a production environment, you would want to:
- Implement proper TLS certificate validation
- Use more secure key management
- Add additional layers of obfuscation
- Implement proper command sanitization
- Add more robust anti-analysis features
If you see package resolution errors in your IDE:
- Make sure Maven dependencies are properly downloaded:
cd server && mvn dependency:resolve
- Ensure your IDE recognizes the project structure: Import the project as a Maven project
- Check that your Java version matches the one in
pom.xml
(Java 11)
- Make sure MinGW-w64 is properly installed:
brew install mingw-w64
- Check that Windows headers are found by the compiler
- Try using the provided
build_mac.sh
script
- Check firewall settings on both machines
- Ensure the C2 host/port in the agent code matches your server
- Test basic connectivity with
ping
andtelnet
- Additional agent platforms (Linux, macOS)
- Web-based administration interface
- File upload/download capabilities
- More advanced anti-detection techniques
- Plugin system for extending functionality