Skip to content

Commit

Permalink
Public release
Browse files Browse the repository at this point in the history
  • Loading branch information
p0dalirius committed Apr 7, 2022
0 parents commit edb5113
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: p0dalirius
patreon: Podalirius
84 changes: 84 additions & 0 deletions LootApacheServerStatus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File name : LootApacheServerStatus.py
# Author : Podalirius (@podalirius_)
# Date created : 7 Apr 2022

import requests
from bs4 import BeautifulSoup
import argparse


def get_infos(url, verify=True):
r = requests.get(url, verify=verify)
soup = BeautifulSoup(r.content, "lxml")
table = soup.find("table")
data = []
if table is not None:
for row in table.findAll("tr"):
# Srv PID Acc M CPU SS Req Conn Child Slot Client VHost Request
values = [td.text for td in row.findAll("td")]
columns = ["Srv", "PID", "Acc", "M", "CPU", "SS", "Req", "Conn", "Child", "Slot", "Client", "VHost", "Request"]
values = {columns[k]: values[k] for k in range(len(values))}
if len(values.keys()) != 0:
data.append(values)
return data


def parseArgs():
print("LootApacheServerStatus v1.1 - by @podalirius_\n")

parser = argparse.ArgumentParser(description="A script to automatically dump all URLs present in /server-status to a file locally.")
parser.add_argument("-t", "--target", dest="target", action="store", type=str, required=True, help="URL of the Apache server-status to connect to.")
parser.add_argument("-l", "--logfile", dest="logfile", action="store", type=str, required=False, default=None, help="Output URLs to specified logfile.")
parser.add_argument("-v", "--verbose", default=False, action="store_true", help='Verbose mode. (default: False)')
parser.add_argument("-k", "--insecure", dest="insecure_tls", action="store_true", default=False, help="Allow insecure server connections when using SSL (default: False)")
return parser.parse_args()


if __name__ == '__main__':
options = parseArgs()

if options.target.startswith("http://") and not options.target.startswith("https://"):
options.target = "http://" + options.target

if options.insecure_tls:
# Disable warings of insecure connection for invalid certificates
requests.packages.urllib3.disable_warnings()
# Allow use of deprecated and weak cipher methods
requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += ':HIGH:!DH:!aNULL'
try:
requests.packages.urllib3.contrib.pyopenssl.util.ssl_.DEFAULT_CIPHERS += ':HIGH:!DH:!aNULL'
except AttributeError:
pass

urls = []

r = requests.get(options.target)
if b"Apache Server Status" in r.content:
running = True
while running:
try:
data = get_infos(options.target, verify=(not options.insecure_tls))
for entry in data:
host = entry['VHost']
if " " in entry['Request']:
path = entry['Request'].split(' ')[1].split(' ')[0]
if entry['VHost'].endswith(":80"):
new_url = "http://%s%s" % (entry['VHost'][:-3], path)
elif entry['VHost'].endswith(":443"):
new_url = "https://%s%s" % (entry['VHost'][:-4], path)
else:
new_url = "http://%s%s" % (entry['VHost'], path)
if new_url not in urls:
urls.append(new_url)
if options.logfile is not None:
f = open(options.logfile, "a")
f.write(new_url+"\n")
f.close()
print(new_url)

except KeyboardInterrupt as e:
running = False
else:
print("[!] Could not detect 'Apache Server Status' in page.")
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# LootApacheServerStatus

<p align="center">
A script to automatically dump all URLs present in /server-status to a file locally.
<br>
<img alt="GitHub release (latest by date)" src="https://img.shields.io/github/v/release/p0dalirius/LootApacheServerStatus">
<a href="https://twitter.com/intent/follow?screen_name=podalirius_" title="Follow"><img src="https://img.shields.io/twitter/follow/podalirius_?label=Podalirius&style=social"></a>
<br>
</p>

## Features

- [x] Automatically parses the URLs present in Apache Server Status.
- [x] Export all URLs to a file.

## Usage

```
$ ./LootApacheServerStatus.py -h
LootApacheServerStatus v1.1 - by @podalirius_
usage: LootApacheServerStatus.py [-h] -t TARGET [-l LOGFILE] [-v] [-k]
A script to automatically dump all URLs present in /server-status to a file locally.
optional arguments:
-h, --help show this help message and exit
-t TARGET, --target TARGET
URL of the Apache server-status to connect to.
-l LOGFILE, --logfile LOGFILE
Output URLs to specified logfile.
-v, --verbose Verbose mode. (default: False)
-k, --insecure Allow insecure server connections when using SSL (default: False)
```

## Example



## Contributions

Pull requests are welcome. Feel free to open an issue if you want to add other features.

0 comments on commit edb5113

Please sign in to comment.