├── README.md ├── linksF1nd3r.py └── requirements.txt /README.md: -------------------------------------------------------------------------------- 1 | # linksF1nd3r 2 | ![screen_1](http://i.imgur.com/2L7bFzQ.png) 3 | 4 | Status: **Development** 5 | ## About LinksF1nder 6 | Extracts links from an HTML page and display them with friendly way ,this tool could be used for web information gathering ,to get more details about the web application. 7 | 8 | ## Features 9 | 10 | * Extract all the links not only the a href="#" tags 11 | * Identifying the extention of the linked file 12 | * Generate report 13 | * Count the links based on the extension 14 | 15 | ## Usage 16 | 17 | ~~~ 18 | $ python linksF1nd3r.py URL 19 | 20 | ~~~ 21 | 22 | Example: 23 | * Testing on the local host 24 | ~~~ 25 | python linksF1nd3r.py http://127.0.0.1/links.php 26 | ~~~ 27 | ![screen_2](http://i.imgur.com/ifYafoX.png) 28 | 29 | * Testing on real website [stackoverflow.com] 30 | ~~~ 31 | python linksF1nd3r.py https://stackoverflow.com/questions/11487049/python-list-of-lists 32 | ~~~ 33 | ![screen_3](http://i.imgur.com/DdeK4bF.png) 34 | 35 | 36 | 37 | 38 | ## How to install 39 | ##### Clone 40 | - Clone the repository with: 41 | ```sh 42 | $ git clone https://github.com/ihebski/LinksF1nd3r.git 43 | $ cd LinksF1nd3r 44 | $ python linksF1nd3r.py 45 | ``` 46 | ##### Dependencies 47 | * Install the required dependencies with: 48 | ```bash 49 | $ sudo pip install -r requirements.txt 50 | ``` 51 | ## License 52 | The MIT License (MIT) -------------------------------------------------------------------------------- /linksF1nd3r.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | ''' 4 | Extracts links from an HTML page and display them with friendly way ,this tool could be used for web information gathering ,to get more details about the web 5 | application. 6 | ''' 7 | import imp 8 | __author__ = "Ihebski (S0ld1er)" 9 | __copyright__ = "Copyright 2017, Bugs_Bunny Team | Pentesting Tools" 10 | __version__ = "0.5" 11 | __email__ = "ihebbensalem.dev@gmail.com" 12 | __status__ = "Development" 13 | __codename__ = 'linksF1nd3r' 14 | __source__ ="https://github.com/ihebski/angryFuzzer" 15 | __info__ ="LinksF1nd3r" 16 | 17 | try: 18 | import sys 19 | import urllib.request, urllib.error, urllib.parse 20 | from bs4 import BeautifulSoup 21 | import re 22 | import os 23 | import colorama 24 | from colorama import Fore, Back, Style 25 | from colorama import init 26 | from urllib.parse import urlparse 27 | import time 28 | except Exception as err: 29 | print("[!] "+str(err)) 30 | sys.exit(0) 31 | 32 | LIGHTRED = '\033[91m' 33 | YL = '\033[33m' 34 | 35 | 36 | 37 | 38 | def banner(): 39 | print(Fore.BLUE+".__ .__ __ ___________.__ .___ ") 40 | print(LIGHTRED +"| | |__| ____ | | __ _____\_ _____/|__| ____ __| _/___________ ") 41 | print("| | | |/ \| |/ / / ___/| __) | |/ \ / __ |/ __ \_ __ \"") 42 | print("| |_| | | \ < \___ \ | \ | | | \/ /_/ \ ___/| | \/") 43 | print("|____/__|___| /__|_ \/____ >\___ / |__|___| /\____ |\___ >__| ") 44 | print(Fore.BLUE+ " \/ \/ \/ \/ \/ \/ \/ ") 45 | print(LIGHTRED+ " ==============================================> by S0ld1er \n") 46 | print(Fore.YELLOW+"[ JS ] "+Fore.CYAN+"[ PHP ]"+Fore.MAGENTA+"[ IMG ]"+YL+"[ HTML ]"+Fore.GREEN+"[ Unkown ]\n") 47 | 48 | def usage(): 49 | ''' 50 | Show the usage of the app 51 | ''' 52 | scr = os.path.basename(sys.argv[0]) 53 | banner() 54 | print(Fore.CYAN+"python links.py URL") 55 | 56 | def start(argv): 57 | if len(sys.argv) < 2: 58 | usage() 59 | sys.exit() 60 | url = argv[0] 61 | o = urlparse(url) 62 | if o[0] not in ['http','https', 'ftp']: 63 | banner() 64 | print(Fore.RED+"[!] Please checkout your URL http://, https:// or ftp://") 65 | sys.exit(0) 66 | banner() 67 | report(url) 68 | 69 | 70 | 71 | def serchLinks(url): 72 | ''' 73 | Search for all the urls with http:// or https:// regx and all the tags 74 | ''' 75 | website = urllib.request.urlopen(url) 76 | html = website.read() 77 | soup = BeautifulSoup(html,'lxml') 78 | #use re.findall to get all the links with http:// or https:// url 79 | mylinks =[] 80 | 81 | # Find all the href links in tags 82 | for link in soup.find_all('a', href=True): 83 | mylinks.append(link['href']) 84 | # Remove the redondant links 85 | k = list(dict.fromkeys(mylinks)) 86 | return k 87 | 88 | def report(url): 89 | ''' 90 | Show the final results with the extension of the url 91 | ''' 92 | js_= 0 93 | PHP_= 0 94 | IMG = 0 95 | Other = 0 96 | html = 0 97 | links = serchLinks(url) 98 | for link in links: 99 | if 'js' in link: 100 | print(Fore.YELLOW+"[{time}] -[ JS ] - {mylink}".format(mylink=link,time=time.strftime("%H:%M:%S"))) 101 | js_+=1 102 | elif 'php' in link: 103 | print(Fore.CYAN+"[{time}] -[ PHP ] - {mylink}".format(mylink=link,time=time.strftime("%H:%M:%S"))) 104 | PHP_+=1 105 | elif 'jpg' in link or 'png' in link or 'jpg' in link: 106 | print(Fore.MAGENTA+"[{time}] -[ IMG ] - {mylink}".format(mylink=link,time=time.strftime("%H:%M:%S"))) 107 | IMG+=1 108 | elif 'html' in link: 109 | print(YL+"[{time}] -[ HTML ] - {mylink}".format(mylink=link,time=time.strftime("%H:%M:%S"))) 110 | html +=1 111 | else: 112 | print(Fore.GREEN+"[{time}] - [ ! ] - {mylink}".format(mylink=link,time=time.strftime("%H:%M:%S"))) 113 | Other+=1 114 | print("================== Report ==================") 115 | print(Fore.WHITE+" URL => "+url) 116 | print(Fore.WHITE+"[TOTALE] => [ JS = {js} ] - [ PHP = {php} ] - [ IMG = {img} ] - [ HTML = {html} ] - [ Unknown = {unkonwn} ]".format(js=js_,php=PHP_,img=IMG,unkonwn=Other,html=html)) 117 | 118 | 119 | if __name__ == "__main__": 120 | try: 121 | start(sys.argv[1:]) 122 | except KeyboardInterrupt as err: 123 | print(r+"\n[!] By... :)"+t) 124 | sys.exit(0) 125 | 126 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | beautifulsoup4 2 | requests 3 | colorama 4 | urlparse --------------------------------------------------------------------------------