aboutsummaryrefslogtreecommitdiff
path: root/url-checkback-script.py
blob: d41890cc88bd05b32a2feb9a7c547320929e1e58 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import time
import webbrowser
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support.ui import WebDriverWait
from tkinter import *
from tkinter.filedialog import askopenfile

print (">>> URL Check-Back Tool <<< ")
print (">>> Made by s1nical <<< ")

# When the script calls "code", it's asking for values from the .txt file which you provided, that contains all of the URL paths that
# should go after the last trailing slash in your URL in line 27, "driver.get("http://example.com/" + code)".

driver = webdriver.Chrome("C:/chromedriver.exe");
xPath = """//*[@id="app-mount"]/div[1]/div/div[2]/div/section/div/div[1]"""
count = 0
might = 0
attempts = 0

file = askopenfile(filetypes=[("Text files","*.txt")])
codes = file.readlines()

for code in codes:
	print(attempts)
	attempts += 1
	driver.get("http://example.com/" + code)
	time.sleep(2)
	try:
		texter = driver.find_element_by_xpath(xPath)
	except NoSuchElementException:
		print ("Might be Valid \n \n \n \n %s - @s1nical - \n \n \n \n" % code)
		might += 1
		continue
	if(texter.text == "Code Invalid"):
		print("Might: %d | Invalid: %d" % (might, attempts))
time.sleep(3);
print("\n\tMight: %d \n\t Invalids: %d" % (might, attempts))
driver.close()
input('Finished')