-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from clem9669/main
Adding apps
- Loading branch information
Showing
1,394 changed files
with
5,496,553 additions
and
0 deletions.
There are no files selected for viewing
4,856 changes: 4,856 additions & 0 deletions
4,856
Content-Management-System-(CMS)/cockpit/cockpit.txt
Large diffs are not rendered by default.
Oops, something went wrong.
746 changes: 746 additions & 0 deletions
746
Content-Management-System-(CMS)/cockpit/cockpit_dirs.txt
Large diffs are not rendered by default.
Oops, something went wrong.
4,110 changes: 4,110 additions & 0 deletions
4,110
Content-Management-System-(CMS)/cockpit/cockpit_files.txt
Large diffs are not rendered by default.
Oops, something went wrong.
109 changes: 109 additions & 0 deletions
109
Content-Management-System-(CMS)/cockpit/gen_cockpit_wordlists.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
# File name : get_cockpit_wordlists.py | ||
# Author : Podalirius (@podalirius_) | ||
# Date created : 03 Dec 2024 | ||
|
||
import json | ||
import os | ||
import sys | ||
import requests | ||
import argparse | ||
import subprocess | ||
from bs4 import BeautifulSoup | ||
|
||
def parseArgs(): | ||
parser = argparse.ArgumentParser(description="Description message") | ||
parser.add_argument("-v", "--verbose", default=None, action="store_true", help='Verbose mode (default: False)') | ||
parser.add_argument("-f", "--force", default=None, action="store_true", help='Force updating existing wordlists. (default: False)') | ||
parser.add_argument("-n", "--no-commit", default=False, action="store_true", help='Disable automatic commit (default: False)') | ||
return parser.parse_args() | ||
|
||
def get_releases_from_github(username, repo, per_page=100): | ||
print(f"[+] Loading {username}/{repo} versions ...") | ||
versions, page_number, running = {}, 1, True | ||
while running: | ||
r = requests.get( | ||
f"https://api.github.com/repos/{username}/{repo}/releases?per_page={per_page}&page={page_number}", | ||
headers={"Accept": "application/vnd.github.v3+json"} | ||
) | ||
if r.status_code != 200: | ||
print(f"Error: {r.json().get('message', 'Unknown error')}") | ||
running = False | ||
else: | ||
for release in r.json(): | ||
tag_name = release['tag_name'] | ||
if tag_name.startswith('v'): | ||
tag_name = tag_name[1:] | ||
versions[tag_name] = release['zipball_url'] | ||
if len(r.json()) < per_page: | ||
running = False | ||
page_number += 1 | ||
print(f'[>] Loaded {len(versions)} {username}/{repo} versions.') | ||
return versions | ||
|
||
def save_wordlist(result, version, filename): | ||
list_of_files = [l.strip() for l in result.split()] | ||
with open(f'./versions/{version}/{filename}', "w") as f: | ||
for remotefile in list_of_files: | ||
if remotefile not in ['.', './', '..', '../']: | ||
if remotefile.startswith('./'): | ||
remotefile = remotefile[2:] | ||
f.write(remotefile + "\n") | ||
|
||
def run_command(command, verbose=False): | ||
if verbose: | ||
print(f" [>] Running command: {command}") | ||
result = subprocess.run(command, shell=True, capture_output=True, text=True) | ||
if result.returncode != 0: | ||
print(f"Error running command: {command}\n{result.stderr}") | ||
return result | ||
|
||
if __name__ == '__main__': | ||
options = parseArgs() | ||
|
||
os.chdir(os.path.dirname(__file__)) | ||
|
||
versions = get_releases_from_github("Cockpit-HQ", "Cockpit") | ||
|
||
for version in versions.keys(): | ||
str_version = version | ||
|
||
generate = False | ||
version_dir = f'./versions/{str_version}/' | ||
if not os.path.exists(version_dir): | ||
os.makedirs(version_dir, exist_ok=True) | ||
generate = True | ||
elif options.force: | ||
generate = True | ||
elif options.verbose: | ||
print(f'[>] Ignoring Cockpit version {str_version} (local wordlists exist)') | ||
|
||
if generate: | ||
print(f'[>] Extracting wordlists for Cockpit version {str_version}') | ||
|
||
dl_url = versions[version] | ||
|
||
run_command('rm -rf /tmp/paths_cockpit_extract/; mkdir -p /tmp/paths_cockpit_extract/', options.verbose) | ||
run_command(f'wget -q "{dl_url}" -O /tmp/paths_cockpit_extract/cockpit.zip', options.verbose) | ||
run_command('cd /tmp/paths_cockpit_extract/; unzip cockpit.zip 1>/dev/null', options.verbose) | ||
|
||
if options.verbose: | ||
print(" [>] Getting wordlist ...") | ||
save_wordlist(run_command('cd /tmp/paths_cockpit_extract/*/; find .').stdout, version, filename="cockpit.txt") | ||
save_wordlist(run_command('cd /tmp/paths_cockpit_extract/*/; find . -type f').stdout, version, filename="cockpit_files.txt") | ||
save_wordlist(run_command('cd /tmp/paths_cockpit_extract/*/; find . -type d').stdout, version, filename="cockpit_dirs.txt") | ||
|
||
if not options.no_commit: | ||
if os.path.exists("./versions/"): | ||
run_command(f'git add ./versions/{version}/*; git commit -m "Added wordlists for Cockpit version {version}";', options.verbose) | ||
|
||
if os.path.exists("./versions/"): | ||
if options.verbose: | ||
print(" [>] Creating common wordlists ...") | ||
run_command('find ./versions/ -type f -name "cockpit.txt" -exec cat {} \\; | sort -u > cockpit.txt', options.verbose) | ||
run_command('find ./versions/ -type f -name "cockpit_files.txt" -exec cat {} \\; | sort -u > cockpit_files.txt', options.verbose) | ||
run_command('find ./versions/ -type f -name "cockpit_dirs.txt" -exec cat {} \\; | sort -u > cockpit_dirs.txt', options.verbose) | ||
|
||
if not options.no_commit: | ||
run_command('git add *.txt; git commit -m "Added general wordlists for Cockpit";', options.verbose) |
Oops, something went wrong.