forked from shamantechnology/RedAGPT
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
108 lines (89 loc) · 2.98 KB
/
main.py
File metadata and controls
108 lines (89 loc) · 2.98 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
"""
ReadAGPT main
Using the menu select which test to run
"""
from dotenv import load_dotenv
import validators
from tools.login_checker import LoginChecker
import multiprocessing
import time
import os
from datetime import datetime
import pprint
class textformat:
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARKCYAN = '\033[36m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
END = '\033[0m'
log_dict = {
"lfp": None
}
def main():
load_dotenv()
options_open = [1]
print(
f"{textformat.RED}%%-------------------------------------------%%{textformat.END}",
f"\n{textformat.RED}%%-------%% RED AutoGPT Tool v0.1 %%---------%%{textformat.END}",
f"\n{textformat.RED}%%-------------------------------------------%%{textformat.END}",
"\nSelect which tool to run by number",
"\n\n[1] Login Test",
"\n"
)
number_choice = 0
while True:
choice = input("")
try:
number_choice = int(choice)
if number_choice in options_open:
break
else:
print(f"{choice} is not a choice, please try again")
except ValueError:
print(f"{choice} is not a choice, please try again")
# login Checker
if number_choice == 1:
while True:
http_type = input("\nLocal or Remote\n")
if http_type == "Local":
break
elif http_type == "Remote":
print(f"\n{textformat.RED}REMOTE SHOULD ONLY BE DONE ON IPs YOU OWN{textformat.END}")
break
else:
print("Please enter \"Local\" or \"Remote\", without the quotes, to answer")
while True:
http_url = input("\nEnter the url of the form to test\n")
if validators.url(http_url):
break
else:
print(f"{http_url} is not a valid URL. Try again")
lgcheck = LoginChecker(http_url)
process = multiprocessing.Process(target=lgcheck.run())
process.start()
process.join()
seek_pos = None
while process.is_alive:
if os.path.exists(lgcheck.logging_file_path):
with open(lgcheck.logging_file_path, "r") as runtxt:
if seek_pos:
runtxt.seek(seek_pos)
log_lines = runtxt.readlines()
if len(log_lines) > 0:
log_line = ''.join(log_lines).replace('\n', '')
pprint.pprint(f"log_line: {log_line}")
seek_pos = runtxt.tell()
print("sleep 10")
time.sleep(10)
process.join()
if process.exitcode is not None:
break
print("Tool completed run")
print(lgcheck.autogpt_resp)
if __name__ == "__main__":
main()