commit df23c0b29a9244e754715cce9b07ef12948ac6ec Author: AggressiveUser Date: Fri May 19 21:51:59 2023 +0530 Initial commit diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/AllForOne.py b/AllForOne.py new file mode 100644 index 0000000..0355d7b --- /dev/null +++ b/AllForOne.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python3 + +import os +import subprocess +import shutil +import time +import requests +from tqdm import tqdm +from concurrent.futures import ThreadPoolExecutor, wait +# SCRIPT BY AGGRESSIVEUSER +# GITHUB: https://github.com/Aggressiveuser +# Linkedin: https://www.linkedin.com/in/AggressiveUser/ +# Twitter: https://twitter.com/AggressiveUserX +# HackTheBox: https://app.hackthebox.com/profile/17569 +print("\033[91m\033[93m ,-. _,---._ __ / \ _ _ _ ___ ___ ") +print(r" / ) .-' `./ / \ /_\ | | | / __\__ _ __ /___\_ __ ___ ") +print(r"( ( ,' `/ /| //_\\| | | / _\/ _ \| '__| // // '_ \ / _ \ ") +print(r' \ `-" \ \ / | / _ \ | | / / | (_) | | / \_//| | | | __/ ') +print(r" `. , \ \ / | \_/ \_/_|_| \/ \___/|_| \___/ |_| |_|\___| ") +print(r" /`. ,'-`----Y | ") +print(r" ( ; | ' ") +print(r" | ,-. ,-' Git-HUB | / Nuclei Template Collector ") +print(r" | | ( | BoX | / - AggressiveUser ") +print(r" ) | \ `.___________|/ ") +print(" `--' `--' \033[0m") + +def git_clone(url, destination): + env = os.environ.copy() + env['GIT_TERMINAL_PROMPT'] = '0' # Disable prompting for username/password + result = subprocess.run(['git', 'clone', url, destination], stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, env=env) + return result.returncode, result.stderr.decode().strip() + +def generate_destination_folder(url): + folder_name = os.path.basename(url.rstrip('.git')) + counter = 1 + while os.path.exists(os.path.join('TRASH', folder_name)): + folder_name = f"{os.path.basename(url.rstrip('.git'))}_{counter}" + counter += 1 + return folder_name + +def clone_repository(repo): + destination = generate_destination_folder(repo) + return_code, error_msg = git_clone(repo, os.path.join('TRASH', destination)) + if return_code != 0 or 'Username for' in error_msg: + return repo + return None + +def clone_repositories(file_url): + # Retrieve repo list from the server + response = requests.get(file_url) + if response.status_code == 200: + repositories = response.text.strip().split('\n') + else: + print('Failed to retrieve Repo List from the server.') + return + + total_repos = len(repositories) + + os.makedirs('TRASH', exist_ok=True) # Create 'TRASH' folder if it doesn't exist + + failed_repos = [] + + with ThreadPoolExecutor(max_workers=8) as executor: + futures = [executor.submit(clone_repository, repo) for repo in repositories] + + with tqdm(total=total_repos, unit='repo', desc='Cloning repositories', ncols=80) as progress_bar: + completed = 0 + while completed < total_repos: + done, _ = wait(futures, return_when='FIRST_COMPLETED') + completed += len(done) + for future in done: + failed_repo = future.result() + if failed_repo: + failed_repos.append(failed_repo) + progress_bar.update(1) + progress = progress_bar.n / total_repos * 100 + progress_bar.set_postfix({'Progress': f'{progress:.2f}%'}) + futures = [future for future in futures if not future.done()] + + print('Cloning process complete!\n') + + if failed_repos: + print("\033[91mFailed to clone the following repositories:\033[0m") + for repo in failed_repos: + print(repo) + + # Check if the 'Template' folder exists, and create it if it doesn't + template_folder = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'Template') + if not os.path.exists(template_folder): + os.makedirs(template_folder) + + # Copy YAML files to Template folder + yaml_count = 0 + for root, dirs, files in os.walk('TRASH'): + for file in files: + if file.endswith('.yaml'): + source_path = os.path.join(root, file) + destination_path = os.path.join(template_folder, file) + shutil.copy2(source_path, destination_path) + yaml_count += 1 + + print(f'\033[92m \n{yaml_count} Nuclei Templates files copied to the Template folder.\033[0m') + + # Remove the TRASH folder + shutil.rmtree('TRASH') + print('\nRemoving caches and temporary files.\n') + time.sleep(2) + print('\033[91m\033[93mPlease show your support by starring my GitHub repository AllForOne.') + print('GITHUB: https://github.com/AggressiveUser\033[0m') + +# Provide the path to your text file containing repository URLs +#file_path = 'repo_list.txt' + +# URL of the repo_list.txt file on the web server +file_url = 'https://raw.githubusercontent.com/AggressiveUser/AggressiveUser.github.io/main/PleaseUpdateMe.txt' + +clone_repositories(file_url) diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ac0e369 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 AggressiveUser + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..f85614b --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# AllForOne + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..329890b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +tqdm +requests