Created
March 26, 2025 18:45
-
-
Save VinayakTiwari1103/d5e091c19401c2533c753925521bd8e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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