Skip to content

JulWas797/JTimeBomb

Repository files navigation

JTimeBomb

Java CI with Gradle GitHub top language

Protect your Java code with expiration dates.

Why?

Imagine this situation — you give a trial/demo of a product to a customer, yet you don't want them to use it indefinitely. That's where JTimeBomb comes in handy. You can give an expiration date to the code, so it cannot be run after a specified date has passed.

JTimeBomb can be used to easily include a proper time-bomb, instead of relying on a single utility method (that can be easily removed with a bit of tinkering) or manually repeating the same code multiple times.

This app works using pure bytecode transformations, providing way faster performance than standard annotation processing.

Only Java 21 (and beyond) is supported! I advise against using legacy Java versions.

Original inspiration :-)

Meme

How?

Import the jtimebomb-annotations library (for instructions, look at the next section), and add the necessary annotations to methods that you want to be time-bombed.

import io.github.julwas797.jtimebomb.annotations.*;

class App {
    
    @TimeBomb("2025-05-13T14:00")
    public void doSomething() {
        // Code here :)
    }
}

The @TimeBomb annotations uses ISO-8601 syntax for determining date.

After you've compiled the code run the jtimebomb-processor tool, to automatically transform methods, such that they’re now time-bombed. This tool uses the following syntax:

java -jar jtimebomb-processor.jar [input] [output]

The processor also removes the annotation using bytecode manipulations, so it's harder to trace it. It's also recommended to obfuscate the code beforehand. This greatly improves the effectiveness of this app. Some of the Java bytecode obfuscate tools include dProtect or yGuard.

Plans

  • Obtain the date by an NTP server (Users can define a custom LocalDateTime provider, and implement it using the timeMethod parameter)
  • Make a Gradle plugin
  • Implement other types of time-bombs
  • Incremental time-bombing (calculate time-delta at the time of processing)

License

This project is licensed under the MIT License. License doesn’t affect distributed JARs generated by the processor.

About

Protect your Java code with expiration dates

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages