-
Notifications
You must be signed in to change notification settings - Fork 0
/
CyberIvy.py
49 lines (42 loc) · 1.97 KB
/
CyberIvy.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
#!/bin/python3
import requests
proxies = {'http': '127.0.0.1:7657'}
ip = input("Enter IP address: ")
port = int(input("Enter port number: "))
class Scrape_websites_for_Data:
def __init__(self, ip, port, timeout):
self.target_url = ip
self.port = port
self.timeout = timeout
self.headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
self.url = "http://" + ip + ":" + str(port) + "/login.php"
self.login_data = {"username": "admin", "password": "admin"}
self.credentialed_url = "http://" + ip + ":" + str(port) + "/admin.php"
self.credentialed_data = {"username": "admin", "password": "admin"}
def make_request(self):
try:
print(f"Checking availability of: {self.url}")
response = requests.get(self.url, headers=self.headers, timeout=self.timeout, proxies=proxies)
if response.status_code == 200:
print("Website is up and running.")
return True
else:
print("Website may be down (status code: {})".format(response.status_code))
return False
except requests.exceptions.RequestException as e:
print("An error occurred while making the request:", e)
return False
def login(self):
if self.make_request():
try:
print("Attempting to login to: {}".format(self.url))
response = requests.post(self.url, data=self.login_data, headers=self.headers, timeout=self.timeout, proxies=proxies)
if response.url == self.credentialed_url:
print("Login successful")
else:
print("Login failed")
except requests.exceptions.RequestException as e:
print("An error occurred during login:", e)
if __name__ == "__main__":
scraper = Scrape_websites_for_Data(ip, port, 10)
scraper.login()