├── README.md ├── requirements.txt └── routerdb.py /README.md: -------------------------------------------------------------------------------- 1 | # Pentest-chainsaw 2 | ![screen_1](https://i.imgur.com/YrUNZIv.png) 3 | 4 | Status: Development 5 | # About Pentest-chainsaw project 6 | A bunch of tiny scripts for a lazy pentester ,trying to automize some tasks ,getting easy access to the needed information ,repeat the same process . 7 | # What about ''Routerdb'' script !? 8 | Accessing devices using the default credentials is a daily habit for pentester .Routerdb is a python script based on routerpassword website that gather the default username/password for different routers products . 9 | You don't need to leave your terminal anymore . 10 | 11 | * 329 Router supported 12 | ## Usage 13 | 14 | ~~~ 15 | $ python routerdb.py -h 16 | [*] Get the Routers Default Passwords 17 | 18 | Options: 19 | -h, --help show this help message and exit 20 | -r ROUTER, --router=ROUTER 21 | router name 22 | -l, --list List of the routers 23 | 24 | ~~~ 25 | 26 | ## How to run : 27 | Get the router default password 28 | ``` -r option ``` 29 | ![Cisco router](https://i.imgur.com/lDsg1Sh.png) 30 | 31 | 32 | another router 33 | 34 | ![ZTE router](https://i.imgur.com/VtV3uw1.png) 35 | 36 | ``` -r ``` option is used to list the available routers products . 37 | 38 | 329 router available . 39 | 40 | 41 | ![ZTE router](https://i.imgur.com/4RFFYsx.png) 42 | 43 | ## How to install 44 | ```sh 45 | git clone https://github.com/ihebski/Pentest-chainsaw.git 46 | cd Pentest-chainsaw/ 47 | pip install -r requirements.txt 48 | python routerdb.py -r 49 | ``` 50 | ## Contribute with us 51 | 52 | ``` 53 | [+] AUTOR: Iheb Ben Salem (ihebski) 54 | [+] EMAIL: ihebbensalem.dev@gmail.com 55 | [+] GITHUB: https://github.com/ihebski 56 | ``` 57 | ## License 58 | The MIT License (MIT) 59 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests 2 | optparse 3 | BeautifulSoup 4 | BeautifulTable 5 | argparse 6 | -------------------------------------------------------------------------------- /routerdb.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | try: 4 | import re 5 | import requests 6 | from bs4 import BeautifulSoup 7 | import sys 8 | import os 9 | import argparse 10 | from beautifultable import BeautifulTable 11 | import optparse 12 | 13 | except Exception as err: 14 | print "[!] "+str(err) 15 | sys.exit(0) 16 | 17 | LIGHTRED = '\033[91m' 18 | YL = '\033[33m' 19 | GR = '\033[32m' 20 | BL = '\033[37m' 21 | baseUrl = "http://www.routerpasswords.com" 22 | 23 | def GetRouterPassword(routerName): 24 | r = requests.post(baseUrl, data = {'findpass':'1','router':routerName,'findpassword':'Find+Password'}) 25 | soup = BeautifulSoup(r.text,"lxml") 26 | """ 27 | for option in soup.find_all('option'): 28 | print "list" 29 | """ 30 | # Parse table specification 31 | table = soup.find("table") 32 | headings = [th.get_text() for th in table.find("tr").find_all("th")] 33 | datasets = [] 34 | mylist = [] 35 | for row in table.find_all("tr")[1:]: 36 | dataset = zip(headings, (td.get_text() for td in row.find_all("td"))) 37 | datasets.append(dataset) 38 | 39 | for dataset in datasets: 40 | for field in dataset: 41 | mylist.append(field[1]) 42 | # Group forms for the table rows 43 | tmp = [] 44 | s = [] 45 | i = 0 46 | for x in mylist: 47 | i +=1 48 | tmp.append(x) 49 | if i == 5: 50 | if len(mylist) > 5: 51 | tmp = [] 52 | i = 0 53 | s.append(tmp) 54 | else: 55 | s.append(tmp) 56 | # Draw the table rows and columns 57 | table = BeautifulTable() 58 | table.column_headers = ["Manufacturer", "Model", "Protocol","Username","Password"] 59 | for y in xrange(0,len(s)): 60 | if len(s[y]) > 0: 61 | table.append_row(s[y]) 62 | print table 63 | 64 | def banner(): 65 | print LIGHTRED+' ▄▄▄·▄▄▄ . ▐ ▄ ▄▄▄▄▄▄▄▄ ..▄▄ · ▄▄▄▄▄ ▄▄· ▄ .▄ ▄▄▄· ▪ ▐ ▄ .▄▄ · ▄▄▄· ▄▄▌ ▐ ▄▌' 66 | print'▐█ ▄█▀▄.▀·•█▌▐█•██ ▀▄.▀·▐█ ▀. •██ ▐█ ▌▪██▪▐█▐█ ▀█ ██ •█▌▐█▐█ ▀. ▐█ ▀█ ██· █▌▐█' 67 | print' ██▀·▐▀▀▪▄▐█▐▐▌ ▐█.▪▐▀▀▪▄▄▀▀▀█▄ ▐█.▪██ ▄▄██▀▐█▄█▀▀█ ▐█·▐█▐▐▌▄▀▀▀█▄▄█▀▀█ ██▪▐█▐▐▌' 68 | print'▐█▪·•▐█▄▄▌██▐█▌ ▐█▌·▐█▄▄▌▐█▄▪▐█ ▐█▌·▐███▌██▌▐▀▐█ ▪▐▌▐█▌██▐█▌▐█▄▪▐█▐█ ▪▐▌▐█▌██▐█▌' 69 | print'.▀ ▀▀▀ ▀▀ █▪ ▀▀▀ ▀▀▀ ▀▀▀▀ ▀▀▀ ·▀▀▀ ▀▀▀ · ▀ ▀ ▀▀▀▀▀ █▪ ▀▀▀▀ ▀ ▀ ▀▀▀▀ ▀▪' 70 | print '==============================> https://github.com/ihebski/Pentest-chainsaw'+GR 71 | 72 | 73 | def GetRouterList(): 74 | r = requests.post(baseUrl, data = {'findpass':'1','router':"CISCO",'findpassword':'Find+Password'}) 75 | soup = BeautifulSoup(r.text,"lxml") 76 | print BL+'============(=()=)===============' 77 | print ' =======(Routers List)======= ' 78 | print '============(=()=)===============' 79 | for option in soup.find_all('option'): 80 | print option["value"] 81 | 82 | def start(): 83 | banner() 84 | pars = optparse.OptionParser(description="[*] Get the Routers Default Passwords") 85 | pars.add_option('-r', '--router', type="string",dest="router", help="router name",default=None) 86 | pars.add_option("-l", "--list",action="store_true", dest="lists",help="List of the routers") 87 | opts, args = pars.parse_args() 88 | if opts.lists: 89 | GetRouterList() 90 | if opts.router: 91 | GetRouterPassword(opts.router.upper()) 92 | 93 | def main(inp): 94 | print inp 95 | 96 | if __name__ == '__main__': 97 | try: 98 | start() 99 | except KeyboardInterrupt as err: 100 | print "\n[!] By... :)" 101 | sys.exit(0) 102 | 103 | --------------------------------------------------------------------------------