Hi hope you guys are doing well.
i have a code that takes a list of domains from a text file and returns their status code and servers their hosted on. i only want it to save only 200 and 301 results in a text file not 302 and other codes. the current code saves everything to the text file. i want to see all the results while it is scanning the whole file on screen but it must not save 302 results to the text file
below is the code
Printing the results
if (r.status_code == 200):
print("\n", '\x1b[6;30;42m' + '[OK] : 200', bcolors.ENDC, ':' , url)
if (r.status_code == 302):
print('\n', bcolors.FAIL, r.status_code , bcolors.OKCYAN, ' : ' , url)
if (r.status_code == 301):
print(' >' + bcolors.OKCYAN,r.status_code ,bcolors.UNDERLINE + 'Worth Checking if you are not busy\x1b[0m')
print("\nOutput saved in : " + filename + ‘\n’)
out.close()