Stay organized with collections Save and categorize content based on your preferences.

NativePoc.Builder

public static abstract class NativePoc.Builder
extends Object

java.lang.Object
   ↳ com.android.sts.common.NativePoc.Builder


Summary

Public constructors

Builder()

Public methods

abstract NativePoc.Builder after(NativePoc.AfterFunction value)

Function to run after the PoC finishes executing but before assertion or cleanups.

abstract NativePoc.Builder args(List<String> value)

List of arguments to be passed to the executable PoC

abstract NativePoc.Builder args(String... value)

List of arguments to be passed to the executable PoC

abstract NativePoc.Builder asserter(NativePocAsserter value)

A NativePocAsserter to check PoC execution results or side-effect

abstract NativePoc.Builder assumePocExitSuccess(boolean value)

Whether to throw an assumption failure when PoC does not return 0.

NativePoc build()

Build an immutable NativePoc object

abstract NativePoc.Builder envVars(Map<String, String> value)

Map of environment variables to be set before running the PoC

NativePoc.Builder only32()

Force using 32-bit version of the PoC executable

NativePoc.Builder only64()

Force using 64-bit version of the PoC executable

abstract NativePoc.Builder pocName(String value)

Name of executable to be uploaded and run.

abstract NativePoc.Builder resourcePushLocation(String value)

Where to upload extracted Java resources to.

abstract NativePoc.Builder resources(String... value)

List of java resources to extract and upload to the device

abstract NativePoc.Builder resources(List<String> value)

List of java resources to extract and upload to the device

NativePoc.Builder timeoutSeconds(long value, String reason)

How long to let the PoC run before terminating

abstract NativePoc.Builder useDefaultLdLibraryPath(boolean value)

Whether to include /system/lib64 and /system/lib in LD_LIBRARY_PATH

Public constructors

Builder

public Builder ()

Public methods

after

public abstract NativePoc.Builder after (NativePoc.AfterFunction value)

Function to run after the PoC finishes executing but before assertion or cleanups. This is typically used to wait for side effects of the PoC that may happen after the PoC process itself finished, e.g. waiting for a crashdump to be written to file or for a service to crash.

Parameters
value NativePoc.AfterFunction

Returns
NativePoc.Builder

args

public abstract NativePoc.Builder args (List<String> value)

List of arguments to be passed to the executable PoC

Parameters
value List

Returns
NativePoc.Builder

args

public abstract NativePoc.Builder args (String... value)

List of arguments to be passed to the executable PoC

Parameters
value String

Returns
NativePoc.Builder

asserter

public abstract NativePoc.Builder asserter (NativePocAsserter value)

A NativePocAsserter to check PoC execution results or side-effect

Parameters
value NativePocAsserter

Returns
NativePoc.Builder

assumePocExitSuccess

public abstract NativePoc.Builder assumePocExitSuccess (boolean value)

Whether to throw an assumption failure when PoC does not return 0. Defaults true

Parameters
value boolean

Returns
NativePoc.Builder

build

public NativePoc build ()

Build an immutable NativePoc object

Returns
NativePoc

envVars

public abstract NativePoc.Builder envVars (Map<String, String> value)

Map of environment variables to be set before running the PoC

Parameters
value Map

Returns
NativePoc.Builder

only32

public NativePoc.Builder only32 ()

Force using 32-bit version of the PoC executable

Returns
NativePoc.Builder

only64

public NativePoc.Builder only64 ()

Force using 64-bit version of the PoC executable

Returns
NativePoc.Builder

pocName

public abstract NativePoc.Builder pocName (String value)

Name of executable to be uploaded and run. Do not include "_sts??" suffix.

Parameters
value String

Returns
NativePoc.Builder

resourcePushLocation

public abstract NativePoc.Builder resourcePushLocation (String value)

Where to upload extracted Java resources to. Defaults to where the PoC is uploaded

Parameters
value String

Returns
NativePoc.Builder

resources

public abstract NativePoc.Builder resources (String... value)

List of java resources to extract and upload to the device

Parameters
value String

Returns
NativePoc.Builder

resources

public abstract NativePoc.Builder resources (List<String> value)

List of java resources to extract and upload to the device

Parameters
value List

Returns
NativePoc.Builder

timeoutSeconds

public NativePoc.Builder timeoutSeconds (long value, 
                String reason)

How long to let the PoC run before terminating

Parameters
value long: how many seconds to let the native PoC run before it's terminated

reason String: explain why a different timeout amount is needed instead of the default NativePoc.DEFAULT_POC_TIMEOUT_SECONDS. Generally used for PoCs that tries to exploit race conditions.

Returns
NativePoc.Builder this Builder instance

useDefaultLdLibraryPath

public abstract NativePoc.Builder useDefaultLdLibraryPath (boolean value)

Whether to include /system/lib64 and /system/lib in LD_LIBRARY_PATH

Parameters
value boolean

Returns
NativePoc.Builder