Skip to content

Instantly share code, notes, and snippets.

@diegozr1
Created June 15, 2016 21:06
Show Gist options
  • Save diegozr1/b30ab72c05447b3bc8f94d4200c10ffe to your computer and use it in GitHub Desktop.
Save diegozr1/b30ab72c05447b3bc8f94d4200c10ffe to your computer and use it in GitHub Desktop.
Python3 script for finding bugs in the cloud
import xml.etree.ElementTree as ET
import requests
import random
import json
# generate a random number to find bugs
def genrandomid():
num = random.randrange(3456, 61344)
return num
# get the full information for a given url
def readurl(url):
r = requests.get(url)
return (r.text)
# check if the bug exists
def isbug(data):
root = ET.fromstring(data)
for child in root:
error = (child.tag, child.attrib)
if(str(error)=="('bug', {})"):
return True
else:
return False
# save the bug data parsed to a file
def saveBug(data):
return data
# check the data parsed
def checkheader():
"""
r.headers = str(r.headers)
r.headers = r.headers.replace("'",'"')
#print(r.headers)
"""
if __name__ == '__main__':
url = 'https://bugzilla.kernel.org/show_bug.cgi?ctype=xml&id=' + str(genrandomid())
if isbug((readurl(url))) :
print("Bug from Kernel found at "+ url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment