-
Notifications
You must be signed in to change notification settings - Fork 0
/
PingFederateEnum.py
62 lines (52 loc) · 2.16 KB
/
PingFederateEnum.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
import argparse
def check_user(username, url, output_file, incognito, headless):
options = Options()
if incognito:
options.add_argument("--incognito")
if headless:
options.add_argument("--headless")
with webdriver.Chrome(options=options) as driver:
driver.get(url)
username_input = driver.find_element_by_name('subject')
username_input.send_keys(username)
try:
driver.execute_script("""
try {
postOk();
} catch (error) {
console.error(error);
}
""")
except Exception as e:
print(f"Exception: {e}")
driver.implicitly_wait(100)
time.sleep(3)
try:
driver.find_element_by_name('subject')
print(f'[-] The User: {username} not found')
time.sleep(3)
return
except Exception as e:
print('Keep Working...')
try:
driver.find_element_by_name('pf.pass')
print(f'[+] The User: {username} found! ')
f = open(output_file, "a")
f.write(username + "\n")
f.close()
except Exception as e:
print(f'[-] The User: {username} not found')
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--url", required=True, help="URL to check the users")
parser.add_argument("--users", required=True, help="Path to the input user file")
parser.add_argument("--output", required=True, help="Path to the output valid user file")
parser.add_argument("--incognito", required=True, action='store_true', help="Enable incognito mode for the browser")
parser.add_argument("--headless", required=True, action='store_true', help="Enable headless mode for the browser")
args = parser.parse_args()
with open(args.users, 'r') as file:
for line in file:
check_user(line.strip(), args.url, args.output, args.incognito, args.headless)