How synawkx/shazam works
Project type and purpose
• This is a two-component remote agent system (“shazam v0.1”):
– A Windows-targeted C-based agent (src/) that performs tasks and communicates over HTTP.
– A Python-based command-and-control (C2) server (c2/app.py) that issues commands and collects data.
File structure
• Top level
– install.bat: Windows installer script for the agent
– shazam.log: sample or runtime log file
• c2/ directory (C2 server)
– app.py: Python HTTP server entry point
– requirements.txt: Python dependencies (e.g., Flask or requests server libraries)
• src/ directory (agent code)
– shazam.c / shazam.h: core agent logic
– winsys.h: Windows-specific system calls and APIs
– lib/: reusable C modules
• common.c/.h: utility functions
• connection.c/.h: socket-level connection management
• http.c/.h: HTTP client implementation
Main components
a. Agent (C executable)
– Core module (shazam.c) orchestrates tasks
– Windows system interface (winsys.h)
– HTTP client module (lib/http) on top of connection module (lib/connection)
– Common utilities (lib/common)
b. C2 server (Python app)
– HTTP server framework (e.g., Flask/Django)
– Command handler and data store or in-memory state
– External dependencies (requirements.txt)
c. Deployment artifacts
– install.bat installs the agent on Windows endpoints
– Logs (shazam.log) stored locally or forwarded
Relationships and data flows
• Agent startup → reads config (hard-coded or via registry/files)
• Agent → performs system calls via winsys → collects data
• Agent → uses lib/http → opens TCP connection → sends HTTP requests to C2
• C2 server → listens on HTTP endpoint → parses requests → issues commands or stores data
• Agent polls or keeps long-lived connections based on design in connection.c
Architectural patterns and design principles
• Modular C library layering (common → connection → http → core)
• Separation of concerns: system interface vs. networking vs. core logic
• Client-server over HTTP (REST-style or custom)
• Simple deployment script ensures repeatable installation
Technologies, frameworks, and libraries
• Native C (gcc/clang on Windows via MinGW/MSVC)
• Winsock or Windows API for networking (lib/connection + winsys)
• HTTP parsing and formatting in C (lib/http)
• Python HTTP framework (Flask or similar) for C2
• install.bat for Windows automation