1
+ import random
2
+ import undetected_chromedriver as uc
3
+ import time
4
+ from selenium .webdriver .common .by import By
5
+ from selenium .webdriver .common .action_chains import ActionChains
6
+ from selenium .webdriver .support .wait import WebDriverWait
7
+ from selenium .webdriver .support import expected_conditions as EC
8
+ from key_creating import generate_key
9
+
10
+ good_keys = 0
11
+ user = int (input ("Enter how many times you want this script to check this keys? " ))
12
+ def get_chrome ():
13
+ global driver
14
+
15
+ chrome_options = uc .ChromeOptions ()
16
+ chrome_options .add_argument ("--no-sandbox" )
17
+ path = r'C:\Users\ABC\vpn1'
18
+ chrome_options .add_argument (f'--load-extension={ path } ' )
19
+ chrome_options .add_argument ("--disable-dev-shm-usage" )
20
+ chrome_options .add_argument ("--start-maximized" )
21
+ chrome_options .add_argument ('--disable-popup-blocking' )
22
+
23
+ driver = uc .Chrome (options = chrome_options )
24
+ curr = driver .current_window_handle
25
+ for handle in driver .window_handles :
26
+ driver .switch_to .window (handle )
27
+ if handle != curr :
28
+ driver .close ()
29
+ driver .switch_to .window (curr )
30
+ driver .get ("https://www.google.com/search?q=what+is+my+ip+address&ei" )
31
+ time .sleep (2 )
32
+ global main_ip
33
+ try :
34
+ main_ip = driver .find_element (By .XPATH ,"//div[@style='padding-top:16px;padding-bottom:0px;padding-left:16px;padding-right:0px']//span//span" ).text
35
+ print (f"Requesting with this ip Address : { main_ip } " )
36
+ driver .get ("https://www.pidkeys.com/index/check/pid.html" )
37
+ time .sleep (7 )
38
+ except :pass
39
+ main_ip = ''
40
+
41
+ def appl_visa ():
42
+ driver .get ('chrome-extension://ebfdollnfpnidpbijmeljimeiglnnkgc/html/foreground.html' )
43
+ time .sleep (5 )
44
+ # time.sleep(4)
45
+ title = 'VeePN'
46
+
47
+ driver .find_element (By .CLASS_NAME ,value = 'next' ).click ()
48
+ time .sleep (0.5 )
49
+ driver .find_element (By .CLASS_NAME ,value = 'next' ).click ()
50
+ driver .find_element (By .CLASS_NAME ,value = 'area-name' ).click ()
51
+ locations = ['//*[@id="region-list"]/div[2]/div[2]' ,'//*[@id="region-list"]/div[3]' ,'//*[@id="region-list"]/div[4]' ,'//*[@id="region-list"]/div[5]' ,'//*[@id="region-list"]/div[6]' ,'//*[@id="region-list"]/div[7]' ]
52
+ country = random .choice (locations )
53
+
54
+ if country == '//*[@id="region-list"]/div[5]' :
55
+ driver .find_element (By .XPATH ,value = country ).click ()
56
+ number = random .randint (1 ,2 )
57
+ time .sleep (1 )
58
+ driver .find_element (By .XPATH ,value = f'//*[@id="region-list"]/div[5]/div[2]/div/div[{ number } ]' ).click ()
59
+
60
+ elif country == '//*[@id="region-list"]/div[7]' :
61
+ driver .find_element (By .XPATH ,value = country ).click ()
62
+ number = random .randint (1 ,3 )
63
+ time .sleep (1 )
64
+ driver .find_element (By .XPATH ,value = f'//*[@id="region-list"]/div[7]/div[2]/div/div[{ number } ]' ).click ()
65
+ else :
66
+ driver .find_element (By .XPATH ,value = country ).click ()
67
+
68
+ time .sleep (0.5 )
69
+ driver .find_element (By .ID ,value = "mainBtn" ).click ()
70
+ while True :
71
+ time .sleep (5 )
72
+ if driver .find_element (By .XPATH ,value = '//*[@id="content"]/div[3]/div/div[2]/span[2]' ).text == main_ip :
73
+ driver .find_element (By .ID ,value = "mainBtn" ).click ()
74
+ else :
75
+ break
76
+
77
+ def final_scraper ():
78
+ key = generate_key ()
79
+ print ("The key is " , key )
80
+ driver .find_element (By .ID ,"textarea_keys" ).clear ()
81
+ driver .find_element (By .ID ,"textarea_keys" ).send_keys (key )
82
+ time .sleep (1 )
83
+ try :
84
+ driver .find_element (By .ID ,"button_check" ).click ()
85
+ time .sleep (8 )
86
+ except :pass
87
+ try :
88
+ driver .find_element (By .XPATH ,"//*[text()='Format error']" )
89
+
90
+ with open ("output/block_list_keys.txt" , "a" ) as file :
91
+ file .write (f"{ key } | " )
92
+ file .close ()
93
+ # good_keys += 1
94
+
95
+ except :
96
+ with open ("output/working_keys.txt" , "a" ) as file :
97
+ file .write (f"{ key } | " )
98
+ file .close ()
99
+
100
+ get_chrome ()
101
+ time .sleep (1 )
102
+ totalCount = 0
103
+ for i in range (user ):
104
+ if totalCount != 10 :
105
+ final_scraper ()
106
+ # print(f"Total {good_keys} working keys are collected")
107
+ print ("-----------------------------------------" )
108
+ totalCount += 1
109
+
110
+ try :
111
+ driver .find_element (By .XPATH ,"//*[text()='Tourists can check up to 10 times every 24 hours']" )
112
+ appl_visa ()
113
+ totalCount = 0
114
+ driver .get ("https://www.google.com/search?q=what+is+my+ip+address&ei" )
115
+ time .sleep (2 )
116
+ main_ip = driver .find_element (By .XPATH ,"//div[@style='padding-top:16px;padding-bottom:0px;padding-left:16px;padding-right:0px']//span//span" ).text
117
+ print (f"Requesting with this ip Address : { main_ip } " )
118
+ driver .get ("https://www.pidkeys.com/index/check/pid.html" )
119
+ time .sleep (7 )
120
+ except :pass
121
+ else :
122
+ appl_visa ()
123
+ totalCount = 0
124
+ driver .get ("https://www.google.com/search?q=what+is+my+ip+address&ei" )
125
+ time .sleep (2 )
126
+ main_ip = driver .find_element (By .XPATH ,"//div[@style='padding-top:16px;padding-bottom:0px;padding-left:16px;padding-right:0px']//span//span" ).text
127
+ print (f"Requesting with this ip Address : { main_ip } " )
128
+ driver .get ("https://www.pidkeys.com/index/check/pid.html" )
129
+ time .sleep (7 )
130
+ # driver.quit()
0 commit comments