GenMon is a Go-based project featuring a user-friendly GUI application that generates a standalone, P2P-based Windows activity monitoring suite (client and server). This project is part of the GuiKeyStandaloneGo
repository.
GenMon allows you to easily create and deploy your own Windows activity monitoring solution. It's designed for users who want to monitor application usage and keyboard input on Windows machines without needing to delve into complex setups or have a Go development environment.
The project consists of three main components:
- GenMon GUI Generator (
GenMon.exe
): A Fyne-based desktop application (this repository's primary output for end-users) that compiles and packages the client/server monitoring tools. It embeds the Go compiler and source templates, making it self-contained. - Activity Monitor Client: A discreet Windows executable generated by GenMon. It tracks application usage and keyboard input, stores data in an encrypted local SQLite cache, and can be configured for auto-start.
- Local Log Server: A Windows executable also generated by GenMon. It securely receives encrypted logs from clients over a P2P connection, stores them in its own SQLite database, and provides a simple web UI for viewing the collected data.
The core principle is to empower users (even non-developers) to easily generate and deploy a secure, custom activity monitoring system.
- User-Friendly GUI Generator: Create custom monitoring packages with a simple graphical interface (
GenMon.exe
). - Standalone & Portable: The generator itself is a single executable. The generated client/server tools are also standalone executables for Windows.
- No Go Environment Needed (for Users): Users of the pre-compiled
GenMon.exe
or the generated client/server packages do not need to install Go. - Secure Data Handling:
- AES-256 encryption for all activity logs.
- Unique encryption keys automatically generated for each set of client/server packages.
- Secure P2P communication using Libp2p between client and server.
- Discreet Windows Client:
- Monitors active applications and keyboard input.
- Stores data in a local, encrypted SQLite cache for resilience before syncing.
- Windows auto-start capability.
- Centralized Log Server:
- Receives, decrypts, and stores logs from multiple clients in a local SQLite database.
- Configurable log retention policies.
- Web Interface for Log Viewing:
- The server provides a built-in web UI to easily view and browse collected activity logs.
- Features paginated display, CSV export, and content copying.
- Pure Go Implementation: The generated client and server are built with pure Go (utilizing
modernc.org/sqlite
), eliminating CGo dependencies. This simplifies compilation by the embedded Go compiler and ensures portability. - Robust P2P Networking: Leverages Libp2p for P2P connections, including DHT for peer discovery, a rendezvous mechanism, and potential NAT traversal capabilities.
- Embedded Resources: The GenMon GUI Generator embeds the necessary Go compiler and source code templates, extracting them to temporary locations on its first run.
- Run
GenMon.exe
(the GUI Generator): Launch the application. - Environment Preparation (First Run): On its first launch, GenMon automatically extracts its embedded Go compiler and source templates to a temporary location on your system. This step makes the generator self-contained.
- Configure:
- Specify the Output Directory where the generated client and server packages will be saved.
- Optionally, customize Libp2p Bootstrap Peer Addresses.
- Generate: Click "Generate Packages". GenMon uses its internal Go compiler and templates to build unique client and server executables with fresh cryptographic keys.
- Deploy Server: Copy the
LocalLogServer_Package
(containinglocal_log_server.exe
,web_templates/
, andstatic/
folders) to your chosen server machine and runlocal_log_server.exe
. - Deploy Client(s): Distribute the contents of
ActivityMonitorClient_Package
(containingactivity_monitor_client.exe
) to the target Windows machines and run the client. - Data Sync & Viewing: The client encrypts activity logs and sends them to your server via the secure P2P connection. You can then view the collected logs through the server's web UI.
There are two main ways to get started: using the generated monitoring suite, or using the GenMon GUI Generator to create the suite.
This section is for users who have already run GenMon.exe
and have the ActivityMonitorClient_Package
and LocalLogServer_Package
.
- Read Your Custom Instructions: After generating your packages, first refer to the
README_IMPORTANT_INSTRUCTIONS.txt
file located in your chosen output directory. This file contains specific details crucial for your uniquely generated executables, including encryption keys and server PeerID. - Deploy and Run the Server:
- Copy the entire
LocalLogServer_Package
directory to your server machine. - Run
local_log_server.exe
from within this directory. - Access the web UI at the address specified in the generated README (typically
http://127.0.0.1:8090/logs
if running on the same machine).
- Copy the entire
- Deploy and Run the Client(s):
- Copy the entire
ActivityMonitorClient_Package
directory to each target Windows machine you wish to monitor. - Run
activity_monitor_client.exe
on these machines. It will attempt to connect to your server.
- Copy the entire
- Initial Connection Note:
- Patience is key! After the client is first launched, it may take up to 20 minutes for initial data to appear on the server. This is due to P2P network discovery (DHT, rendezvous), routing table population, and potential NAT traversal. Once the connection is established, data synchronization will be more regular.
This section is for users who want to generate the client/server monitoring packages themselves.
- Prerequisites for Running
GenMon.exe
:- A Windows machine.
- No Go installation is required to run the pre-compiled
GenMon.exe
.
- Downloading
GenMon.exe
:- Download the latest
GenMon.exe
from the Project Releases Page.
- Download the latest
- Running the Generator:
- Double-click the downloaded
GenMon.exe
. - First Run - Environment Preparation:
- The application will automatically prepare its environment. This involves extracting an embedded Go compiler and source code templates to temporary locations on your system.
- This process typically happens only once or when the application is updated. Progress will be shown in the GUI.
- This step ensures GenMon is self-contained and ready to generate packages without external dependencies.
- Configuration:
- Once preparation is complete, the configuration section will be enabled.
- Output Directory: Click "Browse..." to select a folder where the
ActivityMonitorClient_Package
andLocalLogServer_Package
will be saved. - Bootstrap Peer Addresses (Optional): If you have specific Libp2p bootstrap nodes, you can list them here (comma or newline separated). Defaults are provided and are usually sufficient.
- Generation:
- Click the "Generate Packages" button.
- The GUI will display progress as it compiles the client and server executables with unique configurations.
- Results:
- Upon successful generation, the GUI will display the generated Server's Libp2p Peer ID and the content of the
README_IMPORTANT_INSTRUCTIONS.txt
. - Your client and server packages will be ready in the output directory you specified.
- Click "Finish" to close GenMon. Temporary files will be cleaned up.
- Upon successful generation, the GUI will display the generated Server's Libp2p Peer ID and the content of the
- Double-click the downloaded
This section is for developers who want to build GenMon.exe
from the source code, for example, to contribute to its development or customize it.
- Prerequisites:
- Go (e.g., version 1.22+ recommended, compatible with Fyne).
- Fyne command-line tool:
go install fyne.io/fyne/v2/cmd/fyne@latest
- (Windows) A C compiler like MinGW (e.g., via TDM-GCC or MSYS2) installed and available in your system's PATH. This is often required by Fyne for packaging and linking.
- Build Steps:
- Clone the Repository:
git clone https://github.com/RIZAmohammadkhan/GuiKeyStandaloneGo.git cd GuiKeyStandaloneGo
- Prepare Embedded Go SDK (Crucial for Standalone Generator):
- The generator embeds a Go SDK to compile the client/server packages. You need to provide this SDK.
- Download the Go ZIP archive for Windows (amd64) (e.g.,
go1.24.3.windows-amd64.zip
) from https://go.dev/dl/. - Create the directory:
gui_generator_app/embedded_go_sdk/
. - Place the downloaded Go ZIP file (e.g.,
go1.24.3.windows-amd64.zip
) into thisgui_generator_app/embedded_go_sdk/
directory. - CRITICAL: Open
gui_generator_app/resources.go
. Update the following constants to match the exact filename and SHA256 checksum of the Go ZIP file you just placed:embeddedGoSDKZipName
(e.g.,"go1.24.3.windows-amd64.zip"
)embeddedGoSDKSHA256
(e.g.,"be9787cb08998b1860fe3513e48a5fe5b96302d358a321b58e651184fa9638b3"
) You can get the SHA256 checksum using tools likesha256sum
(Linux/macOS) orGet-FileHash -Algorithm SHA256
(PowerShell).
- Navigate to the GUI App Directory:
cd gui_generator_app
- Tidy Dependencies:
Ensure Go modules are up to date:
If you've made changes to shared packages in
go mod tidy
GuiKeyStandaloneGo/pkg/
, also rungo mod tidy
in the project root directory (GuiKeyStandaloneGo/
). - Build the Executable:
- Recommended (for distribution, includes icon and manifest from
FyneApp.toml
): Make sure you have anIcon.png
(or your chosen icon file) in thegui_generator_app
directory, and aFyneApp.toml
configured.This will createfyne package -os windows -icon Icon.png
GenMon.exe
(or the name specified inFyneApp.toml
) in thegui_generator_app/
directory. - Simple Build (for quick testing):
This creates
go build -o GenMon.exe -ldflags="-H windowsgui"
GenMon.exe
in the current directory (gui_generator_app/
).
- Recommended (for distribution, includes icon and manifest from
- Clone the Repository:
- Standalone Generator: The GenMon GUI application embeds its own Go compiler (extracted from the embedded Go SDK ZIP on first run) and source code templates. This allows users to generate packages without a pre-existing Go development environment.
- Dynamic Package Generation: Client and server packages are compiled on-demand by the generator, with unique cryptographic keys (AES and Libp2p identity) and user-defined configurations embedded directly into the binaries.
- Pure Go Client/Server: The generated client and server applications utilize
modernc.org/sqlite
for database operations, eliminating CGo dependencies. This simplifies their compilation by the embedded Go and enhances portability. - Fyne GUI: The generator employs the Fyne toolkit for its graphical interface, primarily targeting Windows for deployment.
- Libp2p Networking: Secure P2P communication between the generated client and server is achieved using Libp2p. This includes features like DHT for peer discovery, a rendezvous mechanism for finding the server, and potential NAT traversal.
- Embedded Resources (
go:embed
): The Go SDK ZIP file and all necessary source code templates for the client and server are embedded within theGenMon.exe
binary. These are extracted to temporary locations during the GUI's "Environment Preparation" step. - Modular Structure: The project's codebase is organized into:
gui_generator_app/
: The Fyne GUI application.gui_generator_app/generator/core/
: Core logic for package generation.gui_generator_app/generator/templates/
: Source code templates for the client and server.gui_generator_app/pkg/
: Shared packages for configuration, cryptography, P2P protocol, and data types.
- Configuration Management: Default settings for client and server are defined in
pkg/config/models.go
. These are used as a base, customized during generation, and then embedded into the compiled client/server binaries.
- Encryption Key: The app-level AES-256 encryption key (
CfgEncryptionKeyHex
) is vital for data confidentiality. It's uniquely generated for each set of packages and embedded in both the client and server. - Server Identity: The server's Libp2p identity seed (
CfgServerIdentityKeySeedHex
) is critical for establishing its P2P identity. This seed should be kept secure. - Server Machine Security: The machine running the Local Log Server must be secured. Unauthorized access to this machine could lead to access to decrypted logs and the server's private identity key.
- Client Deployment Ethics: The Activity Monitor Client is a powerful tool. Always ensure you have explicit consent and adhere to all applicable privacy laws and regulations before deploying it. Use responsibly.
- Bootstrap Peers: Bootstrap peers are public nodes used for initial P2P network discovery. While they facilitate connections, the actual activity data transmitted between your client and server is encrypted end-to-end.
- Web UI Access: The server's web UI currently does not implement user authentication. It is intended for access on the local machine or within a trusted network. If exposing the web UI more broadly, consider implementing network-level access controls or other security measures.
- GUI Generator:
- More granular control over client/server configuration options directly in the GUI.
- Ability to save and load generation profiles/configurations.
- Investigate cross-compilation options (if embedding Go toolchains for other OS/Arch becomes more feasible).
- Add an "Open Output Folder" button with native OS file explorer integration.
- Generated Client/Server:
- Implement more advanced structured and leveled logging (e.g., using Zerolog or Zap).
- Enhance the server's Web UI with features like filtering, searching, and potentially user accounts.
- Further harden P2P connectivity, including more sophisticated NAT traversal techniques and connection management.
- Develop a comprehensive automated testing suite for client/server interactions.