-
-
Save oswalpalash/0502dc35f3ef32381ca2ae66e413a73a to your computer and use it in GitHub Desktop.
Download Syzkaller Repros
This file contains 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
#!/usr/bin/env python3 | |
from bs4 import BeautifulSoup | |
import requests | |
import re | |
''' | |
Query https://syzkaller.appspot.com/upstream/fixed for all bugs that have been fixed and have "C" reproducers | |
Save reproducers to files | |
''' | |
def main(): | |
# Query the page | |
bugs = [] | |
page = requests.get("https://syzkaller.appspot.com/upstream/fixed") | |
soup = BeautifulSoup(page.content, 'html.parser') | |
# parse table rows | |
rows = soup.find_all('tr') | |
for row in rows: | |
# print row with class as "title" and first "stat" | |
title = row.find_all('td', class_="title") | |
stat = row.find_all('td', class_="stat") | |
# if title and stat exist | |
if title and stat: | |
# check if stat[0] contains "C" in "td" | |
if "C" in stat[0]: | |
print(title[0].find('a').get('href')) | |
bugs.append(title[0].find('a').get('href')) | |
# for each bug, get the reproducers from "https://syzkaller.appspot.com/$bug" | |
for bug in bugs: | |
page = requests.get("https://syzkaller.appspot.com" + bug) | |
soup = BeautifulSoup(page.content, 'html.parser') | |
# parse last table in page that has class "list_table" | |
table = soup.find_all('table', class_="list_table")[-1] | |
# find td that has text "C", only one | |
td = table.find_all('td', text="C") | |
for entry in td: | |
# get the href of the link | |
link = entry.find('a').get('href') | |
page = requests.get("https://syzkaller.appspot.com" + link) | |
# get the id from the bug | |
bug_id = bug.split("=")[1] | |
# get the x from the link | |
x = re.search(r'x=(.*)', link).group(1) | |
print("Saving bug " + bug_id + " with x " + x) | |
with open("files/" + bug_id + "-" + x + ".c", 'w+') as f: | |
f.write(page.text) | |
if __name__ == "__main__": | |
main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment