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 all 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
10 changes: 9 additions & 1 deletion data_prep/introspector.py
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@
INTROSPECTOR_ORACLE_KEYWORD = ''
INTROSPECTOR_ORACLE_EASY_PARAMS = ''
INTROSPECTOR_ORACLE_ALL_CANDIDATES = ''
INTROSPECTOR_ORACLE_OPTIMAL = ''
INTROSPECTOR_FUNCTION_SOURCE = ''
INTROSPECTOR_PROJECT_SOURCE = ''
INTROSPECTOR_XREF = ''
@@ -75,6 +76,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

@@ -88,7 +90,7 @@ def set_introspector_endpoints(endpoint):
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_HEADERS_FOR_FUNC
INTROSPECTOR_ORACLE_OPTIMAL, INTROSPECTOR_HEADERS_FOR_FUNC

INTROSPECTOR_ENDPOINT = endpoint
logging.info('Fuzz Introspector endpoint set to %s', INTROSPECTOR_ENDPOINT)
@@ -102,6 +104,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'
@@ -206,6 +209,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)