Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save VinayakTiwari1103/d5e091c19401c2533c753925521bd8e5 to your computer and use it in GitHub Desktop.

Select an option

Save VinayakTiwari1103/d5e091c19401c2533c753925521bd8e5 to your computer and use it in GitHub Desktop.
import subprocess
class CustomFuzzing:
"""A class to execute custom fuzzing tasks on local binaries."""
@staticmethod
def run_fuzzer(target_binary, timeout=60):
"""
Runs a fuzzing instance on a specified target binary using OSS-Fuzz infrastructure.
Args:
target_binary (str): Path to the compiled fuzz target binary.
timeout (int, optional): Maximum fuzzing duration in seconds. Defaults to 60.
Returns:
str: Output from the fuzzing execution.
"""
try:
command = ["oss-fuzz-runner", "--target", target_binary, "--timeout", str(timeout)]
result = subprocess.run(command, capture_output=True, text=True)
return result.stdout
except Exception as e:
return {"error": str(e)}
# Usage Example
fuzz_result = CustomFuzzing.run_fuzzer("/path/to/fuzz_target_binary")
print(fuzz_result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment