Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introspector: add optimal target API #415

Merged
merged 3 commits into from
Jul 3, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion data_prep/introspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
INTROSPECTOR_ORACLE_KEYWORD = ''
INTROSPECTOR_ORACLE_EASY_PARAMS = ''
INTROSPECTOR_ORACLE_ALL_CANDIDATES = ''
INTROSPECTOR_ORACLE_OPTIMAL = ''
INTROSPECTOR_FUNCTION_SOURCE = ''
INTROSPECTOR_PROJECT_SOURCE = ''
INTROSPECTOR_XREF = ''
Expand All @@ -72,6 +73,7 @@ def get_oracle_dict() -> Dict[str, Any]:
'low-cov-with-fuzz-keyword': query_introspector_for_keyword_targets,
'easy-params-far-reach': query_introspector_for_easy_param_targets,
'all-public-candidates': query_introspector_for_all_public_candidates,
'optimal-targets': query_introspector_for_optimal_targets,
}
return oracle_dict

Expand All @@ -84,7 +86,8 @@ def set_introspector_endpoints(endpoint):
INTROSPECTOR_ORACLE_KEYWORD, INTROSPECTOR_ADDR_TYPE, \
INTROSPECTOR_ALL_HEADER_FILES, INTROSPECTOR_ALL_FUNC_TYPES, \
INTROSPECTOR_SAMPLE_XREFS, INTROSPECTOR_ORACLE_EASY_PARAMS, \
INTROSPECTOR_ORACLE_ALL_CANDIDATES, INTROSPECTOR_ALL_JVM_SOURCE_PATH
INTROSPECTOR_ORACLE_ALL_CANDIDATES, INTROSPECTOR_ALL_JVM_SOURCE_PATH, \
INTROSPECTOR_ORACLE_OPTIMAL

INTROSPECTOR_ENDPOINT = endpoint
logging.info('Fuzz Introspector endpoint set to %s', INTROSPECTOR_ENDPOINT)
Expand All @@ -98,6 +101,7 @@ def set_introspector_endpoints(endpoint):
f'{INTROSPECTOR_ENDPOINT}/easy-params-far-reach')
INTROSPECTOR_ORACLE_ALL_CANDIDATES = (
f'{INTROSPECTOR_ENDPOINT}/all-public-candidates')
INTROSPECTOR_ORACLE_OPTIMAL = f'{INTROSPECTOR_ENDPOINT}/optimal-targets'
INTROSPECTOR_FUNCTION_SOURCE = f'{INTROSPECTOR_ENDPOINT}/function-source-code'
INTROSPECTOR_PROJECT_SOURCE = f'{INTROSPECTOR_ENDPOINT}/project-source-code'
INTROSPECTOR_XREF = f'{INTROSPECTOR_ENDPOINT}/all-cross-references'
Expand Down Expand Up @@ -195,6 +199,11 @@ def query_introspector_oracle(project: str, oracle_api: str) -> list[dict]:
return _get_data(resp, 'functions', [])


def query_introspector_for_optimal_targets(project: str) -> list[dict]:
"""Queries Fuzz Introspector for optimal target analysis."""
return query_introspector_oracle(project, INTROSPECTOR_ORACLE_OPTIMAL)


def query_introspector_for_keyword_targets(project: str) -> list[dict]:
"""Queries FuzzIntrospector for targets with interesting fuzz keywords."""
return query_introspector_oracle(project, INTROSPECTOR_ORACLE_KEYWORD)
Expand Down