def downloadFile(): #login to the site HTS.loginUserInput(); #start the mission HTS.getPage("https://www.hackthissite.org/missions/prog/5/"); #get the compressed file print("downloading file..."); response = HTS.getPage("https://www.hackthissite.org/missions/prog/5/corrupted.png.bz2"); print("file downloaded.."); return response;
def getImage(): #login to the site HTS.loginUserInput(); #start the mission HTS.getPage("https://www.hackthissite.org/missions/prog/2/"); #get the image response = HTS.getPage("https://www.hackthissite.org/missions/prog/2/PNG"); im = Image.open(StringIO(response.content)); print("image downloaded \n") return im;
def downloadXML(): #login to the site HTS.loginUserInput() #start the mission HTS.getPage("https://www.hackthissite.org/missions/prog/4/") #get the xml response = HTS.getPage("https://www.hackthissite.org/missions/prog/4/XML") #uncompress downloaded content xmlContent = bz2.decompress(response.content) return xmlContent
def downloadXML(): #login to the site HTS.loginUserInput(); #start the mission HTS.getPage("https://www.hackthissite.org/missions/prog/4/"); #get the xml response = HTS.getPage("https://www.hackthissite.org/missions/prog/4/XML"); #uncompress downloaded content xmlContent = bz2.decompress(response.content); return xmlContent;
def getImage(): #login to the site HTS.loginUserInput() #start the mission HTS.getPage("https://www.hackthissite.org/missions/prog/2/") #get the image response = HTS.getPage("https://www.hackthissite.org/missions/prog/2/PNG") im = Image.open(StringIO(response.content)) print("image downloaded \n") return im
def downloadData(): #login HTS.loginUserInput(); #start mission HTS.getPage("https://www.hackthissite.org/missions/prog/6/"); #get url print("downloading data"); response = HTS.getPage("https://www.hackthissite.org/missions/prog/6/image"); #parse content and get the data # we have to mine the code starting with new Array(...); javascriptCode = response.content; mineStartIndex = javascriptCode.find("new Array("); mineEndIndex = javascriptCode.find(");",mineStartIndex); data = javascriptCode[mineStartIndex + 10:mineEndIndex] return data;
def downloadData(): #login HTS.loginUserInput(); #start mission and get the page response = HTS.getPage("https://www.hackthissite.org/missions/prog/11/"); #parse content and get the data # we have to mine the code starting with Generated String and Shift; javascriptCode = response.content; mineStartIndex = javascriptCode.find("Generated String: "); #find the first non-numeric character which is used as the delimiter delimiter = ""; mineEndIndex = javascriptCode.find("<",mineStartIndex); encodedData = javascriptCode[mineStartIndex + 18:mineEndIndex]; encodedData = encodedData[0:len(encodedData)-1]; for chars in encodedData: if (chars.isdigit() is False): delimiter = chars; break; mineStartIndex = javascriptCode.find("Shift: "); mineEndIndex = javascriptCode.find("<",mineStartIndex); shift = javascriptCode[mineStartIndex + 6:mineEndIndex]; return [encodedData, delimiter, shift];
def downloadData(): #login HTS.loginUserInput() #start mission and get the page response = HTS.getPage("https://www.hackthissite.org/missions/prog/11/") #parse content and get the data # we have to mine the code starting with Generated String and Shift; javascriptCode = response.content mineStartIndex = javascriptCode.find("Generated String: ") #find the first non-numeric character which is used as the delimiter delimiter = "" mineEndIndex = javascriptCode.find("<", mineStartIndex) encodedData = javascriptCode[mineStartIndex + 18:mineEndIndex] encodedData = encodedData[0:len(encodedData) - 1] for chars in encodedData: if (chars.isdigit() is False): delimiter = chars break mineStartIndex = javascriptCode.find("Shift: ") mineEndIndex = javascriptCode.find("<", mineStartIndex) shift = javascriptCode[mineStartIndex + 6:mineEndIndex] return [encodedData, delimiter, shift]
def downloadData(): #login HTS.loginUserInput() #start mission HTS.getPage("https://www.hackthissite.org/missions/prog/6/") #get url print("downloading data") response = HTS.getPage( "https://www.hackthissite.org/missions/prog/6/image") #parse content and get the data # we have to mine the code starting with new Array(...); javascriptCode = response.content mineStartIndex = javascriptCode.find("new Array(") mineEndIndex = javascriptCode.find(");", mineStartIndex) data = javascriptCode[mineStartIndex + 10:mineEndIndex] return data