Skip to content

Files

Latest commit

42aa2c4 · Apr 4, 2025

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Sep 6, 2024
Sep 6, 2024
Apr 3, 2025
Sep 6, 2024

Timer Project

A Rust-based timer application that implements a time-based execution control mechanism. This project demonstrates how to create a program that checks the time elapsed since compilation and executes specific actions based on a predefined time threshold.

Downlaod Timer PoC : Downlaod

Features

  • Tracks time elapsed since program compilation
  • Implements a configurable time threshold (default: 1 day)
  • Provides countdown information until the target time
  • Exits with a specific status code when the time threshold is reached

Technical Details

The program uses:

  • chrono crate for datetime handling
  • Build-time environment variables to capture compilation timestamp
  • Time difference calculation between current time and build time

Prerequisites

  • Rust (latest stable version)
  • Cargo (comes with Rust)

Building

To build the project:

cargo build

Running

To run the project:

cargo run

How It Works

  1. The program captures the build time during compilation using environment variables
  2. When executed, it calculates the time difference between the current time and build time
  3. If the elapsed time exceeds the configured threshold (1 day by default):
    • Prints "Time of attack!"
    • Exits with status code -1
  4. If the threshold hasn't been reached:
    • Displays the remaining time until the threshold

Configuration

The time threshold can be modified by changing the TIME_ATTACK_IN_DAYS constant in src/main.rs.

Credits / References

Found the idea while discussion. The author did not known !.

Rust by : @5mukx