Class DEmuExternalPolicy
java.lang.Object
com.pnfsoftware.jeb.core.units.code.android.ir.DEmuExternalPolicy
The emulation policy for API methods relying or depending on the execution environment, the date
and time, and random number generators.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intRestrict APIs that may expose execution-environment data.static final intRestrict APIs that may produce random values.static final intRestrict APIs that may produce time-dependent values. -
Constructor Summary
ConstructorsConstructorDescriptionCreate 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 TypeMethodDescriptionvoidaddBlacklisted(String sig) Add a class, method, or field signature to the blacklist.voidaddRestricted(String sig) Add a class, method, or field signature to the restricted set.voidaddWhitelisted(String sig) Add a class, method, or field signature to the whitelist.booleanDetermine whether a field may be accessed.booleancanExecute(String msig) Determine whether a method may be executed.booleanRetrieve the default decision for APIs not covered by explicit rules.voidsetDefaultAllow(boolean defaultAllow) Set the default decision for APIs not covered by explicit rules.
-
Field Details
-
RESTRICT_RANDOM
public static final int RESTRICT_RANDOMRestrict APIs that may produce random values.- See Also:
-
RESTRICT_TIME
public static final int RESTRICT_TIMERestrict APIs that may produce time-dependent values.- See Also:
-
RESTRICT_ENV
public static final int RESTRICT_ENVRestrict 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 APIsrestrictTime- true to restrict time-dependent APIsrestrictEnv- 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
Add a class, method, or field signature to the restricted set.- Parameters:
sig- class, method, or field signature
-
addWhitelisted
Add a class, method, or field signature to the whitelist.- Parameters:
sig- class, method, or field signature
-
addBlacklisted
Add a class, method, or field signature to the blacklist.- Parameters:
sig- class, method, or field signature
-
canExecute
Determine whether a method may be executed.- Parameters:
msig- method signature- Returns:
- true if execution is allowed
-
canAccess
Determine whether a field may be accessed.- Parameters:
fsig- field signature- Returns:
- true if access is allowed
-