Class EnvironmentChecker

java.lang.Object
com.craftingdead.protect.EnvironmentChecker

public final class EnvironmentChecker extends Object
Detects debugging and profiling environments at runtime. Enhanced with native-code protection layer for deeper environment checks. All methods return booleans and never throw exceptions to ensure protection checks don't crash the application.
  • Method Details

    • isDebuggingActive

      public static boolean isDebuggingActive()
      Checks if JDWP (Java Debug Wire Protocol) is active. This indicates that a debugger is or can be attached.
      Returns:
      true if JDWP debugging is detected, false otherwise
    • hasJavaAgents

      public static boolean hasJavaAgents()
      Checks if any Java agents are attached to the JVM. Agents can be used for debugging, profiling, or code manipulation.
      Returns:
      true if any -javaagent option is detected, false otherwise
    • hasSuspiciousAgents

      public static boolean hasSuspiciousAgents()
      Checks for known debugger or profiler signatures in JVM arguments. This includes IntelliJ IDEA, Eclipse, JProfiler, YourKit, etc.
      Returns:
      true if suspicious agent signatures are detected, false otherwise
    • isHostileEnvironment

      public static boolean isHostileEnvironment()
      Performs a comprehensive check for any debugging or profiling environment. This combines all detection methods including native-level checks when available. In RELEASE mode with native library loaded: - Checks both Java-based detection AND native environment verification - Both layers must report clean for overall environment to be considered safe In DEV mode or without native library: - Only performs Java-based checks - Logs advisory warnings but doesn't fail strictly
      Returns:
      true if any debugging/profiling is detected, false otherwise
    • performComprehensiveEnvironmentCheck

      public static boolean performComprehensiveEnvironmentCheck()
      Performs comprehensive environment verification using both Java and native methods. This is more thorough than isHostileEnvironment() and includes challenge-response. In RELEASE mode with native library loaded: - Performs Java checks, native environment check, AND native challenge-response - All checks must pass for environment to be considered clean In DEV mode or without native library: - Only performs Java-based checks - Logs advisory warnings
      Returns:
      true if environment is clean, false if hostile/suspicious
    • quickEnvironmentCheck

      public static boolean quickEnvironmentCheck()
      Quick environment check that only uses native layer if available. Faster than comprehensive check, suitable for frequent validation.
      Returns:
      true if environment appears clean, false if suspicious
    • getJvmArguments

      public static String getJvmArguments()
      Gets all JVM input arguments as a single string for logging/debugging. Should only be used in development mode.
      Returns:
      Space-separated JVM arguments, or empty string if unavailable