Class DEmuExternalPolicy

java.lang.Object
com.pnfsoftware.jeb.core.units.code.android.ir.DEmuExternalPolicy

public class DEmuExternalPolicy extends Object
The emulation policy for API methods relying or depending on the execution environment, the date and time, and random number generators.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Restrict APIs that may expose execution-environment data.
    static final int
    Restrict APIs that may produce random values.
    static final int
    Restrict APIs that may produce time-dependent values.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a safe execution policy object (all restrictions are enabled).
    DEmuExternalPolicy(boolean restrictRandom, boolean restrictTime, boolean restrictEnv)
    Create an execution policy object.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add a class, method, or field signature to the blacklist.
    void
    Add a class, method, or field signature to the restricted set.
    void
    Add a class, method, or field signature to the whitelist.
    boolean
    Determine whether a field may be accessed.
    boolean
    Determine whether a method may be executed.
    boolean
    Retrieve the default decision for APIs not covered by explicit rules.
    void
    setDefaultAllow(boolean defaultAllow)
    Set the default decision for APIs not covered by explicit rules.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • RESTRICT_RANDOM

      public static final int RESTRICT_RANDOM
      Restrict APIs that may produce random values.
      See Also:
    • RESTRICT_TIME

      public static final int RESTRICT_TIME
      Restrict APIs that may produce time-dependent values.
      See Also:
    • RESTRICT_ENV

      public static final int RESTRICT_ENV
      Restrict APIs that may expose execution-environment data.
      See Also:
  • Constructor Details

    • DEmuExternalPolicy

      public DEmuExternalPolicy()
      Create a safe execution policy object (all restrictions are enabled).
    • DEmuExternalPolicy

      public DEmuExternalPolicy(boolean restrictRandom, boolean restrictTime, boolean restrictEnv)
      Create an execution policy object.
      Parameters:
      restrictRandom - true to restrict random-value APIs
      restrictTime - true to restrict time-dependent APIs
      restrictEnv - true to restrict environment-dependent APIs
  • Method Details

    • setDefaultAllow

      public void setDefaultAllow(boolean defaultAllow)
      Set the default decision for APIs not covered by explicit rules.
      Parameters:
      defaultAllow - true to allow by default, false to deny by default
    • isDefaultAllow

      public boolean isDefaultAllow()
      Retrieve the default decision for APIs not covered by explicit rules.
      Returns:
      true if APIs are allowed by default
    • addRestricted

      public void addRestricted(String sig)
      Add a class, method, or field signature to the restricted set.
      Parameters:
      sig - class, method, or field signature
    • addWhitelisted

      public void addWhitelisted(String sig)
      Add a class, method, or field signature to the whitelist.
      Parameters:
      sig - class, method, or field signature
    • addBlacklisted

      public void addBlacklisted(String sig)
      Add a class, method, or field signature to the blacklist.
      Parameters:
      sig - class, method, or field signature
    • canExecute

      public boolean canExecute(String msig)
      Determine whether a method may be executed.
      Parameters:
      msig - method signature
      Returns:
      true if execution is allowed
    • canAccess

      public boolean canAccess(String fsig)
      Determine whether a field may be accessed.
      Parameters:
      fsig - field signature
      Returns:
      true if access is allowed