Skip to content

A Go-based P2P activity monitoring suite. A standalone generator (planned GUI) creates packages: a stealth Windows client captures keyboard/app activity, encrypts, and sends logs via Libp2p. A server receives, decrypts, stores data in SQLite, and offers a web UI for viewing. Focus on embedded config and robust P2P.

Notifications You must be signed in to change notification settings

RIZAmohammadkhan/GuiKeyStandaloneGo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GenMon: Your Personal Activity Monitoring Suite Generator

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.

Overview

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:

  1. 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.
  2. 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.
  3. 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.

Features

  • 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.

How It Works (Conceptual Flow)

  1. Run GenMon.exe (the GUI Generator): Launch the application.
  2. 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.
  3. Configure:
    • Specify the Output Directory where the generated client and server packages will be saved.
    • Optionally, customize Libp2p Bootstrap Peer Addresses.
  4. Generate: Click "Generate Packages". GenMon uses its internal Go compiler and templates to build unique client and server executables with fresh cryptographic keys.
  5. Deploy Server: Copy the LocalLogServer_Package (containing local_log_server.exe, web_templates/, and static/ folders) to your chosen server machine and run local_log_server.exe.
  6. Deploy Client(s): Distribute the contents of ActivityMonitorClient_Package (containing activity_monitor_client.exe) to the target Windows machines and run the client.
  7. 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.

Getting Started

There are two main ways to get started: using the generated monitoring suite, or using the GenMon GUI Generator to create the suite.

A. Using the Generated Monitoring Suite (Client & Server)

This section is for users who have already run GenMon.exe and have the ActivityMonitorClient_Package and LocalLogServer_Package.

  1. 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.
  2. 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).
  3. 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.
  4. 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.

B. Using the GenMon GUI Package Generator (GenMon.exe)

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:
  • Running the Generator:
    1. Double-click the downloaded GenMon.exe.
    2. 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.
    3. Configuration:
      • Once preparation is complete, the configuration section will be enabled.
      • Output Directory: Click "Browse..." to select a folder where the ActivityMonitorClient_Package and LocalLogServer_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.
    4. Generation:
      • Click the "Generate Packages" button.
      • The GUI will display progress as it compiles the client and server executables with unique configurations.
    5. 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.

For Developers: Building the GenMon GUI Generator from Source

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:
    1. Clone the Repository:
      git clone https://github.com/RIZAmohammadkhan/GuiKeyStandaloneGo.git
      cd GuiKeyStandaloneGo
    2. 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 this gui_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 like sha256sum (Linux/macOS) or Get-FileHash -Algorithm SHA256 (PowerShell).
    3. Navigate to the GUI App Directory:
      cd gui_generator_app
    4. Tidy Dependencies: Ensure Go modules are up to date:
      go mod tidy
      If you've made changes to shared packages in GuiKeyStandaloneGo/pkg/, also run go mod tidy in the project root directory (GuiKeyStandaloneGo/).
    5. Build the Executable:
      • Recommended (for distribution, includes icon and manifest from FyneApp.toml): Make sure you have an Icon.png (or your chosen icon file) in the gui_generator_app directory, and a FyneApp.toml configured.
        fyne package -os windows -icon Icon.png
        This will create GenMon.exe (or the name specified in FyneApp.toml) in the gui_generator_app/ directory.
      • Simple Build (for quick testing):
        go build -o GenMon.exe -ldflags="-H windowsgui"
        This creates GenMon.exe in the current directory (gui_generator_app/).

Technical Highlights & Design

  • 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 the GenMon.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.

Security Considerations

  • 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.

Future Work & Potential Enhancements

  • 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.

About

A Go-based P2P activity monitoring suite. A standalone generator (planned GUI) creates packages: a stealth Windows client captures keyboard/app activity, encrypts, and sends logs via Libp2p. A server receives, decrypts, stores data in SQLite, and offers a web UI for viewing. Focus on embedded config and robust P2P.

Resources

Stars

Watchers

Forks

Packages

No packages published