colloide

[historical] Web directory bruteforce script
git clone git://mcdim.xyz/colloide.git
Log | Files | Refs | README | LICENSE

colloide08.py (8437B)


      1 #!/usr/bin/python
      2 #
      3 # MCD's Colloide v0.8
      4 # GREECE 2017 - greekhacking.gr
      5 # GNU General Public Lisence
      6 # Pronounced: Kow Lawd
      7 #
      8 #     DO NOT USE FOR MALICIOUS PURPOSES! 
      9 #                THE DEVELOPER HAS NO RESPONSIBLITY FOR ANY DAMAGE CAUSED!
     10 #
     11 #
     12 #  				 _.:' VERSION DIARY ':._
     13 #
     14 # In version 0.1:
     15 #	Program is working!
     16 # In version 0.2:
     17 #	Minor bugs fixed
     18 #	Updated the links file
     19 # In version 0.3:
     20 #	Major bug fixed
     21 #	Minor bugs fixed as well
     22 #	Updated the links file
     23 # 	Added option / argument parsing
     24 #	Added legals
     25 # In version 0.4:
     26 #	Minor bugs fixed
     27 #	General stracture has been updated
     28 #	Wordlist option added - Only links.txt could be used before this update
     29 #	Added ASCII logo
     30 #	Added the sexy ASCII wolf
     31 # In version 0.5 MAJOR RELEASE
     32 #	Minor bugs fixed
     33 #	Major bug fixed
     34 #	Updated ASCII logo
     35 #	Updated ASCII wolf
     36 #	Program has been released to the masses!
     37 # In version 0.6:
     38 # 	Minor bugs fixed
     39 # 	Option to save the pages into a txt page added
     40 # 	Added some comments to help contributors read the code
     41 # 	Added a function that checks whether the URL is valid or not
     42 # In version 0.7:
     43 #	One major bug fixed
     44 #	Minor bugs fixed as well
     45 # In version 0.8:
     46 #	Added colors
     47 #
     48 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     49 #
     50 #   Project on GitHub:
     51 #	http://yamechanic.com/C3vc
     52 #   Website:
     53 #	http://yamechanic.com/C41V
     54 #
     55 #   Report bugs: anivsante2@gmail.com
     56 #   or /issues if you use github
     57 # 
     58 # # # # # # # # # # # # # # # # # # # # # # # #  
     59 
     60 # MODULES / LIBRARIES:
     61 
     62 from __future__ import print_function #because some print functions print quotation marks and commas
     63 import sys 
     64 import argparse
     65 import os
     66 import socket
     67 from urllib2 import Request, urlopen, URLError, HTTPError
     68 import colorama
     69 from colorama import Fore, Back, Style
     70 
     71 # CODE:
     72 
     73 def banner(): #banner with logo - patorjk.com
     74 	print("MCD's")
     75 	print("_________        .__  .__         .__    .___     ")
     76 	print("\_   ___ \  ____ |  | |  |   ____ |__| __| _/____  ")
     77 	print("/    \  \/ /  _ \|  | |  |  /  _ \|  |/ __ |/ __ \ ")
     78 	print("\     \___(  <_> )  |_|  |_(  <_> )  / /_/ \  ___/")
     79 	print(" \______  /\____/|____/____/\____/|__\____ |\___  >")
     80 	print("        \/                                \/    \/ ")
     81 	print("MCD's")
     82 	print("Colloide v 0.8")
     83 	print("MD 2017")
     84 	print("www.greekhacking.gr\n\n")
     85 def opts():
     86 	print("    -h --help     Display the help panel (Shown right now)")
     87 	print("    -u --URL      The URL to the website")
     88 	print("    -p --pages    Path to the wordlist with the page names / links")
     89 	print("    -l --legals   License & legal disclaimer")
     90 	print("    -s --save     Save pages on a text file (name of the file)")
     91 	print("    -L --limit    Add limit to the pages (Integer)")
     92 	print("    -v --verbose  Show all attempts\n\n")
     93 def legals():
     94 	#License
     95 	print("MCD's Colloide version 0.8 is free software. It can be re-distributed ")
     96 	print("and / or modified under the terms of the GNU General Public License")
     97 	print("as published by the Free Software Foundation; For more information")
     98 	print("read the GNU General Public License that comes")
     99 	print("along with this program.\n\n")
    100 	#Disclaimer
    101 	print("[!] Legal Disclaimer [!]")
    102 	print("Information distributed by this tool may be used maliciously.")
    103 	print("The developer has no responsibility for any damage caused by")
    104 	print("this script or any unauthorized use of it.\n") 
    105 def wolf():
    106 	#prints the ASCII colloide wolf
    107 	print(" ___________________      ,     ,")
    108 	print("[ COLLOIDE MISSION! ]     |\---/|       __--__")
    109 	print("                         /      [     ,:',.  (`. ")
    110 	print("                    __.-'|      /    |  `'_.   .|")
    111 	print("           __ ___.-'         \__)   |   _ : () _ |")
    112 	print("        .-'  '        :   :  _/      |    .  .  |")
    113 	print("       / ,    .        .   _ |        ':_)  ,_|'")
    114 	print("      :  ;    :        :   _/             --   ")
    115 	print("      |  |   .'     __:   /      ")
    116 	print("      |  :   /'----'| \  |              __________")
    117 	print("      \  |\  |      | /| |_______,-----'")
    118 	print("       '.'| /__,----| \ | ")
    119 	print("_______| /|.'       '.l \\\_") 
    120 	print("       || ||             '-'")
    121 	print("       '-''-'\n")
    122 def check_names(infile):    #Checking the path to the wordlist
    123 	if os.path.exists(infile):
    124 		banner()    #calls the banner function
    125 		wolf()      #calls the sexy ASCII wolf wallpaper
    126 		findAdmin() #calls the function that basically does the job 
    127 	else: #in case wordlist cant be found
    128 		banner()
    129 		opts()
    130 		print(Fore.RED + Style.BRIGHT + "[-] Invalid path to the wordlist. File could not be found.\n" + Style.RESET_ALL)
    131 	 
    132 def findAdmin():
    133 	if txt:
    134 		#print("Please type the name of the text file to save the pages to.")
    135 		#print("example: pages.txt")          COMMENTED CODE
    136 		#tfilename = raw_input(">> ")       WONT BE USED - YOU CAN REMOVE IT
    137 		tfilename = txt
    138 		f = open(str(tfilename) ,'w+')
    139 		f.write("Thessaloniki, Greece 2017\n")
    140 		f.write("greekhacking.gr\n")
    141 		print("\n")
    142 	print(Fore.RED + Style.BRIGHT + "[!] Report bugs: anivsante2@gmail.com \n" + Style.RESET_ALL) 
    143 					#OR https://github.com/MichaelDim02/colloide.py/issues
    144 	print(Fore.RED + Style.BRIGHT + "[!] Press Ctrl + C to terminate the process.\n" + Style.RESET_ALL)
    145 	try:	
    146 		IP = socket.gethostbyname(URL)
    147 		print(Fore.RED + Style.BRIGHT + "[!] Attacking host: ", IP, " - ", URL, "\n" + Style.RESET_ALL)
    148 		if txt:
    149 			f.write("Attacking:\n")
    150 			f.write("\n")
    151 			f.write(str(URL))
    152 			f.write("\n")
    153 			f.write(str(IP))
    154 			f.write("\n")
    155 	except socket.gaierror:
    156 		print(Fore.RED + Style.BRIGHT + "[!] Invalid URL address. Connection could not be established;\n" + Style.RESET_ALL)
    157 		sys.exit(0)
    158 	fi = open(links,"r");
    159 	found = 0
    160 	while (found <= int(limit)): 
    161 		try:
    162 			sub_link = fi.readline() #Page name
    163 			if not sub_link:
    164 				break
    165 			link = URL #website name
    166 			req_link = "http://"+link+"/"+sub_link #Final link for attempt
    167 			req = Request(req_link)
    168 			if ver:
    169 				notworking = "[ATTEMPT] - " + req_link
    170 				#notworking.rstrip() So it does not print lines between attempt output line
    171 			#identifies links that show up HTTP error
    172 			try:
    173 				response = urlopen(req)
    174 			except HTTPError as e:
    175 				if ver:
    176 					print(Fore.GREEN + notworking.rstrip() + Style.RESET_ALL) 
    177 				continue
    178 			except URLError as e:
    179 				if ver:
    180 					print(Fore.GREEN + notworking.rstrip() + Style.RESET_ALL)
    181 				continue 
    182 			else: #prints working link
    183 				if ver != True:
    184 					print("[+] Link Found -> " + req_link + "") 
    185 					# if verbose if off 
    186 				if ver:
    187 					print("\n[+] Link Found -> " + req_link + "") 
    188 					#because in verbose mode failed attempts don't have \n at the end
    189 				found = found + 1
    190 				if txt:
    191 					f = open(str(tfilename) ,'a')
    192 					f.write(req_link + "\n")
    193 				else:
    194 					pass
    195 		except KeyboardInterrupt:
    196 			print(Fore.RED + Style.BRIGHT + "\n[!] Process has been terminated - Ctrl + C has been pressed.\n" + Style.RESET_ALL)
    197 			if txt:
    198 				print("All working pages have been saved at: ", tfilename, "\n")	
    199 			sys.exit(0)
    200 	if found > int(limit):
    201 		print(Fore.RED + Style.BRIGHT + "[!] Process has been terminated due to the limitation that has been set\n" + Style.RESET_ALL)
    202 	if txt:
    203 		print("All working pages have been saved at: ", tfilename, "\n")
    204 
    205 #Argument parsing 
    206 parser = argparse.ArgumentParser()
    207 parser.add_argument("-u", "--URL", help="The URL to the website")
    208 parser.add_argument("-p", "--pages", help="Path to the wordlist with the page names / links") 
    209 parser.add_argument("-l", "--legals", action='store_true', help="License & legal disclaimer")
    210 parser.add_argument("-s", "--save", help="Save all working pages on a text file")
    211 parser.add_argument("-L", "--limit", help="Add limit to the pages. Integer", default="10")
    212 parser.add_argument("-v", "--verbose", help="Show all attempts", action="store_true")
    213 
    214 #Declaring Argument Variables
    215 args = parser.parse_args()
    216 links = args.pages
    217 URL = args.URL
    218 txt = args.save
    219 limit = args.limit
    220 ver = args.verbose
    221 
    222 if args.URL and args.pages:
    223 	check_names(links)
    224 elif args.legals:
    225 	banner()
    226 	legals()
    227 else:
    228 	banner()
    229 	opts()
    230 print("Usage: python colloide.py -u [URL] -p [WORDLIST] -s [TEXT FILE] -L [NUMBER]")
    231 
    232 #
    233 #   MCD's
    234 #   Colloide v0.8
    235 #   Can be modified 
    236 #   Can be distributed commercially
    237 #   Can be distributed non-commercially 
    238 #   Under the terms of the GNU general public license (2007)
    239 #   Project on GitHub:
    240 #	http://yamechanic.com/C3vc
    241 #   Website:
    242 #	http://yamechanic.com/C41V
    243 #
    244 # # # # # # # # # # # # # # # # # # # # # # # # #