├── .gitignore ├── LICENSE ├── MANIFEST.in ├── README.md ├── requirements.txt ├── setup.py ├── subbrute ├── __init__.py ├── names.txt ├── resolvers.txt └── subbrute.py └── sublist3r.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | 341 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE README.md 2 | include subbrute/*.txt 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## About Sublist3r 2 | 3 | Sublist3r is a python tool designed to enumerate subdomains of websites using OSINT. It helps penetration testers and bug hunters collect and gather subdomains for the domain they are targeting. Sublist3r enumerates subdomains using many search engines such as Google, Yahoo, Bing, Baidu and Ask. Sublist3r also enumerates subdomains using Netcraft, Virustotal, ThreatCrowd, DNSdumpster and ReverseDNS. 4 | 5 | [subbrute](https://github.com/TheRook/subbrute) was integrated with Sublist3r to increase the possibility of finding more subdomains using bruteforce with an improved wordlist. The credit goes to TheRook who is the author of subbrute. 6 | 7 | ## Screenshots 8 | 9 | ![Sublist3r](http://www.secgeek.net/images/Sublist3r.png "Sublist3r in action") 10 | 11 | 12 | ## Installation 13 | 14 | ``` 15 | git clone https://github.com/aboul3la/Sublist3r.git 16 | ``` 17 | 18 | ## Recommended Python Version: 19 | 20 | Sublist3r currently supports **Python 2** and **Python 3**. 21 | 22 | * The recommended version for Python 2 is **2.7.x** 23 | * The recommended version for Python 3 is **3.4.x** 24 | 25 | ## Dependencies: 26 | 27 | Sublist3r depends on the `requests`, `dnspython` and `argparse` python modules. 28 | 29 | These dependencies can be installed using the requirements file: 30 | 31 | - Installation on Windows: 32 | ``` 33 | c:\python27\python.exe -m pip install -r requirements.txt 34 | ``` 35 | - Installation on Linux 36 | ``` 37 | sudo pip install -r requirements.txt 38 | ``` 39 | 40 | Alternatively, each module can be installed independently as shown below. 41 | 42 | #### Requests Module (http://docs.python-requests.org/en/latest/) 43 | 44 | - Install for Windows: 45 | ``` 46 | c:\python27\python.exe -m pip install requests 47 | ``` 48 | 49 | - Install for Ubuntu/Debian: 50 | ``` 51 | sudo apt-get install python-requests 52 | ``` 53 | 54 | - Install for Centos/Redhat: 55 | ``` 56 | sudo yum install python-requests 57 | ``` 58 | 59 | - Install using pip on Linux: 60 | ``` 61 | sudo pip install requests 62 | ``` 63 | 64 | #### dnspython Module (http://www.dnspython.org/) 65 | 66 | - Install for Windows: 67 | ``` 68 | c:\python27\python.exe -m pip install dnspython 69 | ``` 70 | 71 | - Install for Ubuntu/Debian: 72 | ``` 73 | sudo apt-get install python-dnspython 74 | ``` 75 | 76 | - Install using pip: 77 | ``` 78 | sudo pip install dnspython 79 | ``` 80 | 81 | #### argparse Module 82 | 83 | - Install for Ubuntu/Debian: 84 | ``` 85 | sudo apt-get install python-argparse 86 | ``` 87 | 88 | - Install for Centos/Redhat: 89 | ``` 90 | sudo yum install python-argparse 91 | ``` 92 | 93 | - Install using pip: 94 | ``` 95 | sudo pip install argparse 96 | ``` 97 | 98 | **for coloring in windows install the following libraries** 99 | ``` 100 | c:\python27\python.exe -m pip install win_unicode_console colorama 101 | ``` 102 | 103 | ## Usage 104 | 105 | Short Form | Long Form | Description 106 | ------------- | ------------- |------------- 107 | -d | --domain | Domain name to enumerate subdomains of 108 | -b | --bruteforce | Enable the subbrute bruteforce module 109 | -p | --ports | Scan the found subdomains against specific tcp ports 110 | -v | --verbose | Enable the verbose mode and display results in realtime 111 | -t | --threads | Number of threads to use for subbrute bruteforce 112 | -e | --engines | Specify a comma-separated list of search engines 113 | -o | --output | Save the results to text file 114 | -h | --help | show the help message and exit 115 | 116 | ### Examples 117 | 118 | * To list all the basic options and switches use -h switch: 119 | 120 | ```python sublist3r.py -h``` 121 | 122 | * To enumerate subdomains of specific domain: 123 | 124 | ``python sublist3r.py -d example.com`` 125 | 126 | * To enumerate subdomains of specific domain and show only subdomains which have open ports 80 and 443 : 127 | 128 | ``python sublist3r.py -d example.com -p 80,443`` 129 | 130 | * To enumerate subdomains of specific domain and show the results in realtime: 131 | 132 | ``python sublist3r.py -v -d example.com`` 133 | 134 | * To enumerate subdomains and enable the bruteforce module: 135 | 136 | ``python sublist3r.py -b -d example.com`` 137 | 138 | * To enumerate subdomains and use specific engines such Google, Yahoo and Virustotal engines 139 | 140 | ``python sublist3r.py -e google,yahoo,virustotal -d example.com`` 141 | 142 | 143 | ## Using Sublist3r as a module in your python scripts 144 | 145 | **Example** 146 | 147 | ```python 148 | import sublist3r 149 | subdomains = sublist3r.main(domain, no_threads, savefile, ports, silent, verbose, enable_bruteforce, engines) 150 | ``` 151 | The main function will return a set of unique subdomains found by Sublist3r 152 | 153 | **Function Usage:** 154 | * **domain**: The domain you want to enumerate subdomains of. 155 | * **savefile**: save the output into text file. 156 | * **ports**: specify a comma-sperated list of the tcp ports to scan. 157 | * **silent**: set sublist3r to work in silent mode during the execution (helpful when you don't need a lot of noise). 158 | * **verbose**: display the found subdomains in real time. 159 | * **enable_bruteforce**: enable the bruteforce module. 160 | * **engines**: (Optional) to choose specific engines. 161 | 162 | Example to enumerate subdomains of Yahoo.com: 163 | ```python 164 | import sublist3r 165 | subdomains = sublist3r.main('yahoo.com', 40, 'yahoo_subdomains.txt', ports= None, silent=False, verbose= False, enable_bruteforce= False, engines=None) 166 | ``` 167 | 168 | ## License 169 | 170 | Sublist3r is licensed under the GNU GPL license. take a look at the [LICENSE](https://github.com/aboul3la/Sublist3r/blob/master/LICENSE) for more information. 171 | 172 | 173 | ## Credits 174 | 175 | * [TheRook](https://github.com/TheRook) - The bruteforce module was based on his script **subbrute**. 176 | * [Bitquark](https://github.com/bitquark) - The Subbrute's wordlist was based on his research **dnspop**. 177 | 178 | ## Thanks 179 | 180 | * Special Thanks to [Ibrahim Mosaad](https://twitter.com/ibrahim_mosaad) for his great contributions that helped in improving the tool. 181 | 182 | ## Version 183 | **Current version is 1.0** 184 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | argparse 2 | dnspython 3 | requests 4 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup, find_packages 2 | 3 | setup( 4 | name='Sublist3r', 5 | version='1.0', 6 | python_requires='>=2.7', 7 | install_requires=['dnspython', 'requests', 'argparse; python_version==\'2.7\''], 8 | packages=find_packages()+['.'], 9 | include_package_data=True, 10 | url='https://github.com/aboul3la/Sublist3r', 11 | license='GPL-2.0', 12 | description='Subdomains enumeration tool for penetration testers', 13 | classifiers=[ 14 | 'Development Status :: 5 - Production/Stable', 15 | 'Environment :: Console', 16 | 'Intended Audience :: Information Technology', 17 | 'Intended Audience :: System Administrators', 18 | 'Intended Audience :: Telecommunications Industry', 19 | 'License :: OSI Approved :: GNU General Public License v2', 20 | 'Operating System :: POSIX :: Linux', 21 | 'Programming Language :: Python', 22 | 'Programming Language :: Python :: 2', 23 | 'Programming Language :: Python :: 3', 24 | 'Programming Language :: Python :: 2.7', 25 | 'Programming Language :: Python :: 3.4', 26 | 'Programming Language :: Python :: 3.5', 27 | 'Programming Language :: Python :: 3.6', 28 | 'Topic :: Security', 29 | ], 30 | keywords='subdomain dns detection', 31 | entry_points={ 32 | 'console_scripts': [ 33 | 'sublist3r = sublist3r:interactive', 34 | ], 35 | }, 36 | ) 37 | -------------------------------------------------------------------------------- /subbrute/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aboul3la/Sublist3r/729d649ec5370730172bf6f5314aafd68c874124/subbrute/__init__.py -------------------------------------------------------------------------------- /subbrute/resolvers.txt: -------------------------------------------------------------------------------- 1 | 103.20.188.35 2 | 103.20.188.83 3 | 103.22.248.62 4 | 103.3.46.105 5 | 106.186.17.181 6 | 106.51.255.133 7 | 109.69.8.34 8 | 109.69.8.51 9 | 110.170.117.15 10 | 110.76.151.17 11 | 114.114.114.114 12 | 114.114.114.119 13 | 114.114.115.115 14 | 114.114.115.119 15 | 115.68.100.102 16 | 115.68.100.103 17 | 115.68.62.210 18 | 115.68.62.222 19 | 115.85.69.162 20 | 117.102.224.154 21 | 117.102.224.230 22 | 119.160.208.251 23 | 119.160.208.252 24 | 119.18.159.222 25 | 119.252.167.229 26 | 121.152.231.196 27 | 121.194.2.2 28 | 12.127.16.67 29 | 12.127.17.72 30 | 121.52.206.130 31 | 121.52.87.128 32 | 122.0.0.12 33 | 122.155.12.41 34 | 122.155.167.38 35 | 122.155.167.70 36 | 122.155.3.119 37 | 122.210.229.161 38 | 122.255.96.132 39 | 124.107.135.126 40 | 1.2.4.8 41 | 128.199.248.105 42 | 129.250.35.250 43 | 129.250.35.251 44 | 129.7.1.1 45 | 129.7.1.6 46 | 130.180.228.2 47 | 131.155.140.130 48 | 131.191.7.12 49 | 134.48.1.32 50 | 134.60.1.111 51 | 137.82.1.1 52 | 139.0.27.186 53 | 139.130.4.4 54 | 139.175.55.244 55 | 141.1.1.1 56 | 141.1.27.249 57 | 141.211.125.15 58 | 141.211.125.17 59 | 141.211.144.15 60 | 141.211.144.17 61 | 142.103.1.1 62 | 142.46.1.130 63 | 142.46.128.130 64 | 144.76.202.253 65 | 147.235.250.2 66 | 147.235.251.3 67 | 147.29.10.55 68 | 147.29.10.6 69 | 148.233.151.6 70 | 148.233.151.8 71 | 148.243.65.17 72 | 149.156.64.210 73 | 149.211.153.50 74 | 151.11.85.5 75 | 152.99.1.10 76 | 152.99.200.6 77 | 152.99.78.136 78 | 153.19.1.254 79 | 158.43.128.1 80 | 158.43.128.72 81 | 158.43.192.1 82 | 158.43.240.3 83 | 158.43.240.4 84 | 159.90.200.7 85 | 160.7.240.20 86 | 164.124.101.2 87 | 164.124.107.9 88 | 165.166.142.42 89 | 165.21.100.88 90 | 165.21.83.88 91 | 165.87.13.129 92 | 165.87.201.244 93 | 168.126.63.1 94 | 168.188.1.1 95 | 168.213.3.10 96 | 168.213.3.11 97 | 168.215.165.186 98 | 168.215.210.50 99 | 168.95.1.1 100 | 170.51.255.100 101 | 170.56.58.53 102 | 173.44.32.2 103 | 174.34.129.34 104 | 178.151.86.169 105 | 178.161.146.10 106 | 178.254.21.113 107 | 180.211.129.42 108 | 185.46.7.100 109 | 185.46.7.110 110 | 187.115.52.83 111 | 187.73.241.67 112 | 189.90.16.20 113 | 190.11.32.199 114 | 192.116.16.26 115 | 192.172.250.8 116 | 192.190.173.40 117 | 192.43.161.22 118 | 192.76.144.66 119 | 193.101.111.10 120 | 193.111.144.145 121 | 193.111.144.161 122 | 193.111.200.191 123 | 193.111.238.5 124 | 193.138.78.117 125 | 193.142.218.3 126 | 193.148.29.100 127 | 193.148.29.103 128 | 193.151.32.40 129 | 193.16.255.2 130 | 193.17.213.10 131 | 193.189.114.254 132 | 193.200.68.230 133 | 193.201.185.3 134 | 193.205.136.1 135 | 193.22.119.195 136 | 193.226.128.129 137 | 193.226.61.1 138 | 193.228.86.5 139 | 193.230.161.3 140 | 193.230.161.4 141 | 193.230.183.201 142 | 193.230.230.1 143 | 193.231.112.1 144 | 193.231.249.1 145 | 193.231.80.7 146 | 193.232.69.22 147 | 193.252.247.52 148 | 193.252.247.53 149 | 193.254.232.1 150 | 193.255.146.53 151 | 193.26.6.130 152 | 193.27.192.98 153 | 193.33.114.2 154 | 193.33.220.3 155 | 193.33.236.1 156 | 193.41.10.1 157 | 193.41.59.151 158 | 193.43.108.3 159 | 193.43.108.62 160 | 193.43.17.4 161 | 193.58.204.59 162 | 193.58.251.251 163 | 193.67.79.39 164 | 193.78.240.12 165 | 193.86.86.2 166 | 193.89.221.124 167 | 193.89.221.2 168 | 193.89.248.1 169 | 193.95.93.243 170 | 193.95.93.77 171 | 194.102.106.1 172 | 194.113.160.68 173 | 194.1.154.37 174 | 194.117.245.2 175 | 194.12.224.34 176 | 194.126.130.7 177 | 194.132.119.151 178 | 194.132.32.32 179 | 194.141.12.1 180 | 194.141.45.4 181 | 194.145.147.194 182 | 194.145.240.6 183 | 194.146.136.1 184 | 194.149.133.11 185 | 194.149.146.2 186 | 194.149.156.140 187 | 194.150.168.168 188 | 194.153.232.17 189 | 194.158.206.205 190 | 194.158.206.206 191 | 194.164.181.2 192 | 194.169.239.10 193 | 194.169.244.33 194 | 194.169.244.34 195 | 194.172.160.4 196 | 194.179.109.10 197 | 194.179.1.100 198 | 194.18.231.5 199 | 194.187.164.20 200 | 194.190.225.2 201 | 194.20.0.24 202 | 194.213.193.5 203 | 194.226.211.11 204 | 194.246.126.68 205 | 194.246.127.11 206 | 194.250.223.1 207 | 194.250.223.2 208 | 194.25.0.52 209 | 194.25.0.60 210 | 194.39.185.10 211 | 194.50.10.2 212 | 194.52.202.98 213 | 194.54.181.90 214 | 194.6.240.1 215 | 194.72.9.61 216 | 194.75.147.212 217 | 194.77.8.1 218 | 194.88.202.11 219 | 194.88.203.6 220 | 194.98.65.165 221 | 195.112.96.34 222 | 195.113.144.194 223 | 195.114.173.153 224 | 195.12.4.247 225 | 195.129.12.114 226 | 195.129.12.122 227 | 195.129.12.83 228 | 195.13.38.3 229 | 195.137.162.149 230 | 195.140.236.250 231 | 195.140.236.253 232 | 195.14.50.21 233 | 195.146.81.130 234 | 195.153.19.10 235 | 195.153.19.5 236 | 195.158.239.4 237 | 195.167.98.3 238 | 195.170.96.2 239 | 195.170.97.254 240 | 195.175.121.10 241 | 195.175.39.39 242 | 195.175.39.40 243 | 195.177.223.3 244 | 195.177.240.3 245 | 195.178.123.130 246 | 195.182.110.132 247 | 195.182.192.10 248 | 195.182.192.2 249 | 195.186.1.110 250 | 195.186.1.111 251 | 195.186.4.110 252 | 195.186.4.111 253 | 195.189.130.1 254 | 195.189.131.1 255 | 195.198.214.72 256 | 195.20.193.11 257 | 195.2.195.1 258 | 195.22.192.252 259 | 195.24.228.3 260 | 195.243.214.4 261 | 195.244.25.3 262 | 195.245.76.6 263 | 195.27.1.1 264 | 195.35.110.4 265 | 195.5.125.3 266 | 195.60.70.5 267 | 195.67.15.102 268 | 195.67.15.73 269 | 195.67.160.3 270 | 195.67.27.18 271 | 195.69.65.98 272 | 195.70.237.42 273 | 195.70.248.1 274 | 195.74.128.6 275 | 195.7.64.3 276 | 195.88.84.100 277 | 195.96.208.1 278 | 195.99.66.220 279 | 196.41.225.11 280 | 198.60.22.2 281 | 198.82.247.34 282 | 199.249.18.1 283 | 199.249.19.2 284 | 199.44.194.2 285 | 199.80.64.202 286 | 200.113.185.227 287 | 200.118.2.88 288 | 200.175.3.232 289 | 200.221.11.100 290 | 200.221.11.101 291 | 200.221.137.40 292 | 200.221.137.41 293 | 200.221.137.42 294 | 200.221.137.43 295 | 200.221.137.44 296 | 200.221.137.45 297 | 200.221.137.46 298 | 200.221.137.47 299 | 200.35.174.126 300 | 200.40.230.36 301 | 200.49.160.31 302 | 200.49.160.35 303 | 200.53.250.1 304 | 200.56.224.11 305 | 200.57.2.108 306 | 200.57.7.61 307 | 200.69.193.2 308 | 200.85.0.105 309 | 200.85.35.158 310 | 200.85.61.90 311 | 200.88.127.22 312 | 200.88.127.23 313 | 200.95.144.3 314 | 201.131.4.5 315 | 201.131.4.9 316 | 202.120.111.3 317 | 202.130.97.65 318 | 202.130.97.66 319 | 202.136.162.11 320 | 202.138.120.4 321 | 202.138.120.6 322 | 202.138.120.87 323 | 202.148.202.3 324 | 202.148.202.4 325 | 202.152.162.66 326 | 202.180.160.1 327 | 202.181.224.2 328 | 202.199.160.206 329 | 202.248.20.133 330 | 202.248.37.74 331 | 202.28.162.1 332 | 202.30.143.11 333 | 202.38.128.58 334 | 202.43.178.244 335 | 202.43.178.245 336 | 202.44.204.63 337 | 202.44.55.193 338 | 202.46.1.2 339 | 202.51.96.5 340 | 202.62.224.2 341 | 202.83.20.101 342 | 202.83.30.5 343 | 202.86.8.100 344 | 202.91.8.234 345 | 203.109.129.67 346 | 203.109.129.68 347 | 203.113.11.37 348 | 203.115.130.74 349 | 203.115.71.66 350 | 203.115.81.38 351 | 203.119.36.106 352 | 203.119.8.106 353 | 203.130.2.3 354 | 203.133.1.7 355 | 203.133.1.8 356 | 203.146.237.222 357 | 203.146.237.237 358 | 203.156.104.21 359 | 203.176.144.12 360 | 203.176.144.20 361 | 203.189.88.10 362 | 203.189.88.11 363 | 203.189.88.133 364 | 203.189.88.148 365 | 203.189.88.151 366 | 203.189.88.152 367 | 203.189.88.154 368 | 203.189.88.156 369 | 203.189.88.211 370 | 203.189.88.212 371 | 203.189.88.213 372 | 203.189.88.214 373 | 203.189.88.54 374 | 203.189.89.1 375 | 203.189.89.134 376 | 203.189.89.15 377 | 203.189.89.209 378 | 203.189.89.241 379 | 203.189.89.36 380 | 203.189.89.65 381 | 203.193.139.150 382 | 203.196.0.6 383 | 203.198.7.66 384 | 203.2.193.67 385 | 203.239.131.1 386 | 203.248.252.2 387 | 203.250.129.214 388 | 203.253.31.1 389 | 203.41.44.20 390 | 203.63.8.27 391 | 203.80.96.10 392 | 203.89.226.24 393 | 203.89.226.26 394 | 203.90.78.65 395 | 204.116.57.2 396 | 204.117.214.10 397 | 204.174.120.45 398 | 204.95.160.2 399 | 205.134.162.209 400 | 205.151.222.250 401 | 205.152.6.20 402 | 205.171.2.65 403 | 205.172.19.193 404 | 205.172.19.79 405 | 205.236.148.130 406 | 205.236.148.131 407 | 205.242.187.234 408 | 206.124.0.254 409 | 206.124.1.254 410 | 206.124.64.1 411 | 206.124.64.253 412 | 206.248.95.194 413 | 206.253.194.65 414 | 206.253.33.130 415 | 206.253.33.131 416 | 206.51.143.55 417 | 206.80.254.4 418 | 206.80.254.68 419 | 207.17.190.5 420 | 207.17.190.7 421 | 207.179.3.25 422 | 207.241.160.34 423 | 207.248.224.71 424 | 207.248.224.72 425 | 207.248.57.10 426 | 207.249.163.155 427 | 207.91.130.4 428 | 207.91.250.34 429 | 208.116.30.21 430 | 208.38.1.15 431 | 208.48.253.106 432 | 208.59.89.20 433 | 208.67.220.220 434 | 208.67.220.222 435 | 208.67.222.220 436 | 208.67.222.222 437 | 208.72.120.204 438 | 208.78.24.238 439 | 208.79.56.204 440 | 208.90.237.9 441 | 209.0.205.11 442 | 209.143.0.10 443 | 209.143.22.182 444 | 209.172.128.2 445 | 209.191.129.65 446 | 209.195.95.95 447 | 209.197.128.2 448 | 209.213.223.18 449 | 209.216.160.131 450 | 209.216.160.2 451 | 209.252.33.101 452 | 209.51.161.14 453 | 209.51.161.58 454 | 209.55.0.110 455 | 209.55.1.220 456 | 209.63.0.18 457 | 209.87.64.70 458 | 209.87.79.232 459 | 210.180.98.69 460 | 210.220.163.82 461 | 210.2.4.8 462 | 210.29.96.33 463 | 210.34.0.18 464 | 210.34.48.34 465 | 210.44.112.66 466 | 210.80.58.3 467 | 210.80.58.66 468 | 210.94.0.7 469 | 211.115.194.2 470 | 211.115.194.3 471 | 211.161.46.84 472 | 211.172.208.2 473 | 211.175.82.66 474 | 211.237.65.21 475 | 211.237.65.31 476 | 211.41.128.70 477 | 211.41.128.71 478 | 211.60.155.5 479 | 211.63.64.11 480 | 211.67.112.1 481 | 211.78.130.10 482 | 211.78.130.11 483 | 211.78.130.3 484 | 212.102.225.2 485 | 212.110.122.132 486 | 212.1.118.3 487 | 212.112.39.22 488 | 212.112.39.25 489 | 212.116.76.76 490 | 212.118.0.2 491 | 212.118.241.1 492 | 212.118.241.33 493 | 212.122.224.10 494 | 212.14.253.242 495 | 212.15.86.12 496 | 212.181.124.8 497 | 212.19.149.226 498 | 212.192.128.3 499 | 212.19.96.2 500 | 212.203.32.11 501 | 212.203.33.12 502 | 212.211.132.4 503 | 212.214.229.170 504 | 212.216.172.222 505 | 212.230.255.1 506 | 212.230.255.129 507 | 212.236.250.4 508 | 212.245.158.66 509 | 212.26.6.11 510 | 212.28.34.90 511 | 212.30.96.211 512 | 212.31.253.69 513 | 212.31.32.130 514 | 212.31.32.131 515 | 212.34.194.211 516 | 212.36.24.3 517 | 212.37.208.3 518 | 212.40.0.10 519 | 212.40.5.50 520 | 212.40.5.51 521 | 212.49.128.65 522 | 212.51.16.1 523 | 212.51.17.1 524 | 212.54.160.7 525 | 212.57.190.166 526 | 212.58.3.2 527 | 212.58.3.7 528 | 212.58.3.8 529 | 212.59.199.2 530 | 212.59.199.6 531 | 212.62.98.10 532 | 212.66.0.1 533 | 212.66.1.1 534 | 212.66.129.98 535 | 212.66.160.2 536 | 212.67.131.4 537 | 212.73.209.34 538 | 212.73.65.40 539 | 212.82.225.7 540 | 212.82.226.212 541 | 212.85.112.32 542 | 212.85.32.3 543 | 212.89.130.180 544 | 212.9.160.1 545 | 212.94.162.33 546 | 212.94.32.32 547 | 212.94.34.34 548 | 212.96.1.70 549 | 212.97.32.2 550 | 212.98.160.50 551 | 212.98.160.65 552 | 213.0.76.5 553 | 213.0.77.5 554 | 213.0.77.8 555 | 213.115.244.69 556 | 213.128.194.2 557 | 213.131.178.10 558 | 213.135.67.1 559 | 213.151.109.1 560 | 213.157.0.194 561 | 213.157.196.130 562 | 213.157.196.131 563 | 213.157.196.132 564 | 213.158.72.1 565 | 213.16.104.61 566 | 213.164.38.66 567 | 213.171.220.209 568 | 213.172.33.34 569 | 213.178.66.2 570 | 213.184.242.6 571 | 213.211.50.1 572 | 213.211.50.2 573 | 213.218.117.85 574 | 213.234.128.211 575 | 213.235.248.228 576 | 213.239.204.35 577 | 213.241.193.250 578 | 213.244.72.31 579 | 213.27.209.53 580 | 213.27.209.8 581 | 213.55.96.166 582 | 213.8.145.133 583 | 213.88.195.146 584 | 213.88.195.147 585 | 213.88.195.148 586 | 216.106.1.2 587 | 216.106.184.6 588 | 216.131.94.5 589 | 216.131.95.20 590 | 216.136.95.2 591 | 216.138.119.6 592 | 216.146.35.230 593 | 216.147.131.33 594 | 216.17.128.1 595 | 216.17.128.2 596 | 216.175.203.51 597 | 216.181.31.11 598 | 216.184.96.4 599 | 216.184.96.5 600 | 216.184.96.6 601 | 216.185.64.6 602 | 216.186.27.15 603 | 216.194.28.33 604 | 216.198.139.68 605 | 216.21.128.22 606 | 216.21.129.22 607 | 216.218.221.6 608 | 216.218.226.238 609 | 216.235.1.3 610 | 216.237.221.42 611 | 216.244.192.3 612 | 216.244.192.32 613 | 216.254.141.13 614 | 216.254.141.2 615 | 216.254.95.2 616 | 216.27.175.2 617 | 216.47.160.12 618 | 216.47.160.13 619 | 216.52.126.1 620 | 216.52.129.1 621 | 216.52.161.33 622 | 216.52.169.1 623 | 216.52.190.33 624 | 216.52.254.1 625 | 216.52.254.33 626 | 216.52.41.1 627 | 216.52.41.33 628 | 216.52.65.1 629 | 216.52.65.33 630 | 216.52.94.1 631 | 216.52.94.33 632 | 216.52.97.33 633 | 216.54.201.11 634 | 216.58.97.20 635 | 216.58.97.21 636 | 216.66.22.2 637 | 216.66.38.58 638 | 216.66.80.26 639 | 216.66.80.30 640 | 216.66.80.98 641 | 216.81.128.132 642 | 216.81.96.67 643 | 216.81.96.68 644 | 217.107.10.254 645 | 217.107.11.35 646 | 217.113.48.1 647 | 217.115.16.2 648 | 217.115.16.3 649 | 217.117.0.38 650 | 217.117.111.1 651 | 217.144.144.211 652 | 217.144.6.6 653 | 217.148.0.17 654 | 217.149.155.180 655 | 217.149.17.1 656 | 217.15.17.2 657 | 217.156.106.1 658 | 217.173.198.3 659 | 217.17.34.68 660 | 217.174.252.116 661 | 217.18.206.12 662 | 217.18.206.22 663 | 217.18.80.105 664 | 217.18.90.105 665 | 217.196.1.5 666 | 217.196.1.6 667 | 217.219.236.8 668 | 217.22.209.254 669 | 217.24.112.2 670 | 217.27.240.20 671 | 217.28.113.13 672 | 217.28.98.62 673 | 217.31.204.130 674 | 217.32.105.66 675 | 217.64.163.1 676 | 217.64.167.1 677 | 217.65.192.1 678 | 217.66.226.8 679 | 217.69.160.18 680 | 217.69.169.25 681 | 217.72.1.2 682 | 217.72.168.34 683 | 217.73.17.110 684 | 217.76.240.2 685 | 217.78.80.70 686 | 217.78.80.74 687 | 217.79.225.8 688 | 217.8.180.98 689 | 218.102.23.228 690 | 218.192.240.2 691 | 218.223.32.1 692 | 218.232.110.36 693 | 218.232.110.37 694 | 219.250.36.130 695 | 219.252.2.100 696 | 220.128.173.228 697 | 220.227.60.12 698 | 220.233.0.1 699 | 221.139.13.130 700 | 24.154.1.4 701 | 24.154.1.5 702 | 35.8.2.41 703 | 35.8.2.42 704 | 35.8.2.45 705 | 35.8.98.43 706 | 37.19.5.135 707 | 37.235.1.174 708 | 37.235.1.177 709 | 42.62.176.30 710 | 4.79.132.219 711 | 50.21.174.18 712 | 58.68.121.230 713 | 58.96.3.34 714 | 61.19.252.238 715 | 61.208.115.242 716 | 61.56.211.185 717 | 61.63.0.66 718 | 61.70.87.96 719 | 62.105.17.252 720 | 62.108.161.161 721 | 62.109.182.2 722 | 62.116.30.200 723 | 62.128.1.42 724 | 62.128.1.53 725 | 62.129.252.215 726 | 62.129.252.252 727 | 62.134.11.4 728 | 62.140.239.1 729 | 62.141.38.230 730 | 62.149.128.2 731 | 62.165.32.250 732 | 62.165.33.250 733 | 62.168.59.67 734 | 62.177.42.174 735 | 62.196.2.70 736 | 62.20.15.234 737 | 62.20.57.226 738 | 62.231.76.49 739 | 62.233.128.17 740 | 62.24.228.202 741 | 62.33.203.33 742 | 62.3.32.16 743 | 62.3.32.17 744 | 62.36.225.150 745 | 62.37.225.56 746 | 62.37.225.57 747 | 62.37.228.20 748 | 62.40.32.34 749 | 62.76.76.62 750 | 62.77.85.100 751 | 62.77.85.98 752 | 62.77.94.72 753 | 62.8.96.38 754 | 62.94.0.41 755 | 62.94.0.42 756 | 62.95.15.107 757 | 62.97.84.4 758 | 63.105.204.164 759 | 63.171.232.38 760 | 63.171.232.39 761 | 63.218.44.186 762 | 63.251.129.33 763 | 63.251.161.1 764 | 63.251.161.33 765 | 63.251.62.1 766 | 63.251.62.33 767 | 64.105.163.106 768 | 64.105.172.26 769 | 64.105.179.138 770 | 64.105.189.26 771 | 64.105.199.74 772 | 64.105.199.76 773 | 64.105.202.138 774 | 64.105.97.90 775 | 64.119.60.5 776 | 64.119.60.9 777 | 64.13.115.12 778 | 64.132.61.131 779 | 64.132.94.250 780 | 64.13.48.12 781 | 64.135.1.20 782 | 64.135.1.22 783 | 64.254.99.13 784 | 64.56.129.2 785 | 64.61.99.2 786 | 64.79.224.3 787 | 64.81.127.2 788 | 64.81.159.2 789 | 64.94.1.1 790 | 64.94.1.33 791 | 64.94.33.33 792 | 65.163.107.11 793 | 65.203.109.2 794 | 65.39.139.53 795 | 65.74.130.5 796 | 65.74.130.6 797 | 66.118.80.4 798 | 66.119.93.10 799 | 66.119.93.4 800 | 66.163.0.161 801 | 66.163.0.173 802 | 66.165.177.69 803 | 66.165.183.87 804 | 66.182.208.5 805 | 66.203.72.10 806 | 66.207.160.111 807 | 66.216.18.222 808 | 66.218.245.13 809 | 66.218.44.5 810 | 66.232.139.10 811 | 66.252.170.3 812 | 66.28.0.45 813 | 66.28.0.61 814 | 66.51.206.100 815 | 66.80.130.18 816 | 66.81.0.252 817 | 66.92.159.2 818 | 66.92.224.2 819 | 66.92.64.2 820 | 66.93.87.2 821 | 67.100.88.27 822 | 67.214.64.6 823 | 68.179.203.94 824 | 69.146.17.3 825 | 69.16.169.11 826 | 69.16.170.11 827 | 69.24.112.11 828 | 69.25.1.1 829 | 69.25.1.33 830 | 69.26.129.2 831 | 69.28.104.5 832 | 69.28.136.102 833 | 69.28.148.102 834 | 69.28.97.4 835 | 69.54.70.15 836 | 69.67.97.18 837 | 69.7.192.1 838 | 69.7.192.2 839 | 70.36.0.5 840 | 70.36.0.6 841 | 72.11.150.10 842 | 72.11.150.74 843 | 72.52.104.74 844 | 74.222.30.2 845 | 74.82.46.6 846 | 75.94.255.12 847 | 76.73.18.50 848 | 77.240.144.164 849 | 77.241.112.23 850 | 77.247.176.114 851 | 77.41.229.2 852 | 77.72.192.3 853 | 77.73.104.3 854 | 77.87.152.9 855 | 77.88.8.1 856 | 77.88.8.2 857 | 77.88.8.8 858 | 77.88.8.88 859 | 78.159.224.224 860 | 78.159.232.232 861 | 78.31.96.2 862 | 79.132.192.2 863 | 79.141.81.250 864 | 79.141.82.250 865 | 79.141.83.250 866 | 80.149.86.20 867 | 80.254.79.157 868 | 80.67.169.12 869 | 80.72.146.2 870 | 80.73.1.1 871 | 80.74.160.11 872 | 80.79.179.2 873 | 80.84.72.20 874 | 80.88.171.16 875 | 80.92.178.98 876 | 80.94.48.254 877 | 81.17.66.14 878 | 81.17.72.70 879 | 81.180.201.98 880 | 81.18.242.100 881 | 81.189.212.129 882 | 81.18.97.50 883 | 81.200.80.11 884 | 81.222.80.2 885 | 81.23.144.250 886 | 81.24.128.146 887 | 81.25.152.2 888 | 81.27.133.50 889 | 81.27.135.50 890 | 81.28.128.34 891 | 8.15.12.5 892 | 81.7.200.80 893 | 81.92.96.22 894 | 81.92.97.12 895 | 81.95.128.218 896 | 82.115.163.2 897 | 82.141.136.2 898 | 82.144.181.1 899 | 82.145.160.140 900 | 82.145.163.1 901 | 82.151.90.1 902 | 82.198.129.138 903 | 82.199.32.36 904 | 82.212.67.100 905 | 82.212.67.101 906 | 82.96.65.2 907 | 82.96.81.10 908 | 82.96.86.20 909 | 82.99.211.195 910 | 83.137.41.8 911 | 83.137.41.9 912 | 83.142.192.2 913 | 83.142.9.30 914 | 83.143.12.246 915 | 83.143.8.220 916 | 83.149.244.194 917 | 83.151.112.193 918 | 83.166.8.18 919 | 83.240.154.200 920 | 83.242.140.10 921 | 83.97.97.3 922 | 84.200.69.80 923 | 84.200.70.40 924 | 84.8.2.11 925 | 85.114.105.3 926 | 85.115.224.18 927 | 85.119.136.158 928 | 85.119.72.2 929 | 85.124.252.33 930 | 85.132.32.41 931 | 85.132.32.42 932 | 85.158.50.50 933 | 85.174.190.2 934 | 8.5.244.5 935 | 85.88.19.10 936 | 85.88.19.11 937 | 87.103.133.167 938 | 87.104.254.135 939 | 87.104.254.39 940 | 87.197.40.58 941 | 87.204.12.130 942 | 87.204.28.12 943 | 87.229.99.1 944 | 88.147.158.1 945 | 88.255.242.6 946 | 88.255.96.196 947 | 8.8.4.4 948 | 88.82.84.129 949 | 8.8.8.8 950 | 89.107.129.15 951 | 89.107.16.2 952 | 89.185.75.244 953 | 89.186.66.6 954 | 89.186.66.7 955 | 89.233.250.137 956 | 89.249.224.1 957 | 90.189.109.2 958 | 91.143.20.6 959 | 91.144.248.227 960 | 91.185.2.10 961 | 91.185.6.10 962 | 91.188.0.35 963 | 91.188.0.5 964 | 91.194.112.10 965 | 91.197.164.11 966 | 91.198.154.133 967 | 91.199.139.1 968 | 91.203.177.4 969 | 91.203.188.1 970 | 91.207.40.2 971 | 91.210.24.22 972 | 91.211.16.6 973 | 91.212.56.5 974 | 91.214.72.33 975 | 91.214.72.34 976 | 91.98.128.112 977 | 92.43.224.1 978 | 93.157.14.65 979 | 93.157.233.3 980 | 93.188.152.3 981 | 94.247.200.2 982 | 94.247.200.3 983 | 95.158.128.2 984 | 95.158.129.2 985 | 95.173.193.3 986 | 95.85.9.86 987 | -------------------------------------------------------------------------------- /subbrute/subbrute.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | #SubBrute v1.2 4 | #A (very) fast subdomain enumeration tool. 5 | # 6 | #Maintained by rook 7 | #Contributors: 8 | #JordanMilne, KxCode, rc0r, memoryprint, ppaulojr 9 | # 10 | import re 11 | import optparse 12 | import os 13 | import signal 14 | import sys 15 | import uuid 16 | import random 17 | import ctypes 18 | import dns.resolver 19 | import dns.rdatatype 20 | import json 21 | 22 | #Python 2.x and 3.x compatiablity 23 | #We need the Queue library for exception handling 24 | try: 25 | import queue as Queue 26 | except: 27 | import Queue 28 | 29 | #The 'multiprocessing' library does not rely upon a Global Interpreter Lock (GIL) 30 | import multiprocessing 31 | 32 | #Microsoft compatiablity 33 | if sys.platform.startswith('win'): 34 | #Drop-in replacement, subbrute + multiprocessing throws exceptions on windows. 35 | import threading 36 | multiprocessing.Process = threading.Thread 37 | 38 | class verify_nameservers(multiprocessing.Process): 39 | 40 | def __init__(self, target, record_type, resolver_q, resolver_list, wildcards): 41 | multiprocessing.Process.__init__(self, target = self.run) 42 | self.daemon = True 43 | signal_init() 44 | 45 | self.time_to_die = False 46 | self.resolver_q = resolver_q 47 | self.wildcards = wildcards 48 | #Do we need wildcards for other types of records? 49 | #This needs testing! 50 | self.record_type = "A" 51 | if record_type == "AAAA": 52 | self.record_type = record_type 53 | self.resolver_list = resolver_list 54 | resolver = dns.resolver.Resolver() 55 | #The domain provided by the user. 56 | self.target = target 57 | #1 website in the world, modify the following line when this status changes. 58 | #www.google.cn, I'm looking at you ;) 59 | self.most_popular_website = "www.google.com" 60 | #We shouldn't need the backup_resolver, but we we can use them if need be. 61 | #We must have a resolver, and localhost can work in some environments. 62 | self.backup_resolver = resolver.nameservers + ['127.0.0.1', '8.8.8.8', '8.8.4.4'] 63 | #Ideally a nameserver should respond in less than 1 sec. 64 | resolver.timeout = 1 65 | resolver.lifetime = 1 66 | try: 67 | #Lets test the letancy of our connection. 68 | #Google's DNS server should be an ideal time test. 69 | resolver.nameservers = ['8.8.8.8'] 70 | resolver.query(self.most_popular_website, self.record_type) 71 | except: 72 | #Our connection is slower than a junebug in molasses 73 | resolver = dns.resolver.Resolver() 74 | self.resolver = resolver 75 | 76 | def end(self): 77 | self.time_to_die = True 78 | 79 | #This process cannot block forever, it needs to check if its time to die. 80 | def add_nameserver(self, nameserver): 81 | keep_trying = True 82 | while not self.time_to_die and keep_trying: 83 | try: 84 | self.resolver_q.put(nameserver, timeout = 1) 85 | trace("Added nameserver:", nameserver) 86 | keep_trying = False 87 | except Exception as e: 88 | if type(e) == Queue.Full or str(type(e)) == "": 89 | keep_trying = True 90 | 91 | def verify(self, nameserver_list): 92 | added_resolver = False 93 | for server in nameserver_list: 94 | if self.time_to_die: 95 | #We are done here. 96 | break 97 | server = server.strip() 98 | if server: 99 | self.resolver.nameservers = [server] 100 | try: 101 | #test_result = self.resolver.query(self.most_popular_website, "A") 102 | #should throw an exception before this line. 103 | if True:#test_result: 104 | #Only add the nameserver to the queue if we can detect wildcards. 105 | if(self.find_wildcards(self.target)):# and self.find_wildcards(".com") 106 | #wildcards have been added to the set, it is now safe to be added to the queue. 107 | #blocking queue, this process will halt on put() when the queue is full: 108 | self.add_nameserver(server) 109 | added_resolver = True 110 | else: 111 | trace("Rejected nameserver - wildcard:", server) 112 | except Exception as e: 113 | #Rejected server :( 114 | trace("Rejected nameserver - unreliable:", server, type(e)) 115 | return added_resolver 116 | 117 | def run(self): 118 | #Every user will get a different set of resovlers, this helps redistribute traffic. 119 | random.shuffle(self.resolver_list) 120 | if not self.verify(self.resolver_list): 121 | #This should never happen, inform the user. 122 | sys.stderr.write('Warning: No nameservers found, trying fallback list.\n') 123 | #Try and fix it for the user: 124 | self.verify(self.backup_resolver) 125 | #End of the resolvers list. 126 | try: 127 | self.resolver_q.put(False, timeout = 1) 128 | except: 129 | pass 130 | 131 | #Only add the nameserver to the queue if we can detect wildcards. 132 | #Returns False on error. 133 | def find_wildcards(self, host): 134 | #We want sovle the following three problems: 135 | #1)The target might have a wildcard DNS record. 136 | #2)The target maybe using geolocaiton-aware DNS. 137 | #3)The DNS server we are testing may respond to non-exsistant 'A' records with advertizements. 138 | #I have seen a CloudFlare Enterprise customer with the first two conditions. 139 | try: 140 | #This is case #3, these spam nameservers seem to be more trouble then they are worth. 141 | wildtest = self.resolver.query(uuid.uuid4().hex + ".com", "A") 142 | if len(wildtest): 143 | trace("Spam DNS detected:", host) 144 | return False 145 | except: 146 | pass 147 | test_counter = 8 148 | looking_for_wildcards = True 149 | while looking_for_wildcards and test_counter >= 0 : 150 | looking_for_wildcards = False 151 | #Don't get lost, this nameserver could be playing tricks. 152 | test_counter -= 1 153 | try: 154 | testdomain = "%s.%s" % (uuid.uuid4().hex, host) 155 | wildtest = self.resolver.query(testdomain, self.record_type) 156 | #This 'A' record may contain a list of wildcards. 157 | if wildtest: 158 | for w in wildtest: 159 | w = str(w) 160 | if w not in self.wildcards: 161 | #wildcards were detected. 162 | self.wildcards[w] = None 163 | #We found atleast one wildcard, look for more. 164 | looking_for_wildcards = True 165 | except Exception as e: 166 | if type(e) == dns.resolver.NXDOMAIN or type(e) == dns.name.EmptyLabel: 167 | #not found 168 | return True 169 | else: 170 | #This resolver maybe flakey, we don't want it for our tests. 171 | trace("wildcard exception:", self.resolver.nameservers, type(e)) 172 | return False 173 | #If we hit the end of our depth counter and, 174 | #there are still wildcards, then reject this nameserver because it smells bad. 175 | return (test_counter >= 0) 176 | 177 | class lookup(multiprocessing.Process): 178 | 179 | def __init__(self, in_q, out_q, resolver_q, domain, wildcards, spider_blacklist): 180 | multiprocessing.Process.__init__(self, target = self.run) 181 | signal_init() 182 | self.required_nameservers = 16 183 | self.in_q = in_q 184 | self.out_q = out_q 185 | self.resolver_q = resolver_q 186 | self.domain = domain 187 | self.wildcards = wildcards 188 | self.spider_blacklist = spider_blacklist 189 | self.resolver = dns.resolver.Resolver() 190 | #Force pydns to use our nameservers 191 | self.resolver.nameservers = [] 192 | 193 | def get_ns(self): 194 | ret = [] 195 | try: 196 | ret = [self.resolver_q.get_nowait()] 197 | if ret == False: 198 | #Queue is empty, inform the rest. 199 | self.resolver_q.put(False) 200 | ret = [] 201 | except: 202 | pass 203 | return ret 204 | 205 | def get_ns_blocking(self): 206 | ret = [] 207 | ret = [self.resolver_q.get()] 208 | if ret == False: 209 | trace("get_ns_blocking - Resolver list is empty.") 210 | #Queue is empty, inform the rest. 211 | self.resolver_q.put(False) 212 | ret = [] 213 | return ret 214 | 215 | def check(self, host, record_type = "A", retries = 0): 216 | trace("Checking:", host) 217 | cname_record = [] 218 | retries = 0 219 | if len(self.resolver.nameservers) <= self.required_nameservers: 220 | #This process needs more nameservers, lets see if we have one avaible 221 | self.resolver.nameservers += self.get_ns() 222 | #Ok we should be good to go. 223 | while True: 224 | try: 225 | #Query the nameserver, this is not simple... 226 | if not record_type or record_type == "A": 227 | resp = self.resolver.query(host) 228 | #Crawl the response 229 | hosts = extract_hosts(str(resp.response), self.domain) 230 | for h in hosts: 231 | if h not in self.spider_blacklist: 232 | self.spider_blacklist[h]=None 233 | trace("Found host with spider:", h) 234 | self.in_q.put((h, record_type, 0)) 235 | return resp 236 | if record_type == "CNAME": 237 | #A max 20 lookups 238 | for x in range(20): 239 | try: 240 | resp = self.resolver.query(host, record_type) 241 | except dns.resolver.NoAnswer: 242 | resp = False 243 | pass 244 | if resp and resp[0]: 245 | host = str(resp[0]).rstrip(".") 246 | cname_record.append(host) 247 | else: 248 | return cname_record 249 | else: 250 | #All other records: 251 | return self.resolver.query(host, record_type) 252 | 253 | except Exception as e: 254 | if type(e) == dns.resolver.NoNameservers: 255 | #We should never be here. 256 | #We must block, another process should try this host. 257 | #do we need a limit? 258 | self.in_q.put((host, record_type, 0)) 259 | self.resolver.nameservers += self.get_ns_blocking() 260 | return False 261 | elif type(e) == dns.resolver.NXDOMAIN: 262 | #"Non-existent domain name." 263 | return False 264 | elif type(e) == dns.resolver.NoAnswer: 265 | #"The response did not contain an answer." 266 | if retries >= 1: 267 | trace("NoAnswer retry") 268 | return False 269 | retries += 1 270 | elif type(e) == dns.resolver.Timeout: 271 | trace("lookup failure:", host, retries) 272 | #Check if it is time to give up. 273 | if retries >= 3: 274 | if retries > 3: 275 | #Sometimes 'internal use' subdomains will timeout for every request. 276 | #As far as I'm concerned, the authorative name server has told us this domain exists, 277 | #we just can't know the address value using this method. 278 | return ['Mutiple Query Timeout - External address resolution was restricted'] 279 | else: 280 | #Maybe another process can take a crack at it. 281 | self.in_q.put((host, record_type, retries + 1)) 282 | return False 283 | retries += 1 284 | #retry... 285 | elif type(e) == IndexError: 286 | #Some old versions of dnspython throw this error, 287 | #doesn't seem to affect the results, and it was fixed in later versions. 288 | pass 289 | elif type(e) == TypeError: 290 | # We'll get here if the number procs > number of resolvers. 291 | # This is an internal error do we need a limit? 292 | self.in_q.put((host, record_type, 0)) 293 | return False 294 | elif type(e) == dns.rdatatype.UnknownRdatatype: 295 | error("DNS record type not supported:", record_type) 296 | else: 297 | trace("Problem processing host:", host) 298 | #dnspython threw some strange exception... 299 | raise e 300 | 301 | def run(self): 302 | #This process needs one resolver before it can start looking. 303 | self.resolver.nameservers += self.get_ns_blocking() 304 | while True: 305 | found_addresses = [] 306 | work = self.in_q.get() 307 | #Check if we have hit the end marker 308 | while not work: 309 | #Look for a re-queued lookup 310 | try: 311 | work = self.in_q.get(blocking = False) 312 | #if we took the end marker of the queue we need to put it back 313 | if work: 314 | self.in_q.put(False) 315 | except:#Queue.Empty 316 | trace('End of work queue') 317 | #There isn't an item behind the end marker 318 | work = False 319 | break 320 | #Is this the end all work that needs to be done? 321 | if not work: 322 | #Perpetuate the end marker for all threads to see 323 | self.in_q.put(False) 324 | #Notify the parent that we have died of natural causes 325 | self.out_q.put(False) 326 | break 327 | else: 328 | if len(work) == 3: 329 | #keep track of how many times this lookup has timedout. 330 | (hostname, record_type, timeout_retries) = work 331 | response = self.check(hostname, record_type, timeout_retries) 332 | else: 333 | (hostname, record_type) = work 334 | response = self.check(hostname, record_type) 335 | sys.stdout.flush() 336 | trace(response) 337 | #self.wildcards is populated by the verify_nameservers() thread. 338 | #This variable doesn't need a muetex, because it has a queue. 339 | #A queue ensure nameserver cannot be used before it's wildcard entries are found. 340 | reject = False 341 | if response: 342 | for a in response: 343 | a = str(a) 344 | if a in self.wildcards: 345 | trace("resovled wildcard:", hostname) 346 | reject= True 347 | #reject this domain. 348 | break; 349 | else: 350 | found_addresses.append(a) 351 | if not reject: 352 | #This request is filled, send the results back 353 | result = (hostname, record_type, found_addresses) 354 | self.out_q.put(result) 355 | 356 | #Extract relevant hosts 357 | #The dot at the end of a domain signifies the root, 358 | #and all TLDs are subs of the root. 359 | host_match = re.compile(r"((?<=[\s])[a-zA-Z0-9_-]+\.(?:[a-zA-Z0-9_-]+\.?)+(?=[\s]))") 360 | def extract_hosts(data, hostname): 361 | #made a global to avoid re-compilation 362 | global host_match 363 | ret = [] 364 | hosts = re.findall(host_match, data) 365 | for fh in hosts: 366 | host = fh.rstrip(".") 367 | #Is this host in scope? 368 | if host.endswith(hostname): 369 | ret.append(host) 370 | return ret 371 | 372 | #Return a list of unique sub domains, sorted by frequency. 373 | #Only match domains that have 3 or more sections subdomain.domain.tld 374 | domain_match = re.compile("([a-zA-Z0-9_-]*\.[a-zA-Z0-9_-]*\.[a-zA-Z0-9_-]*)+") 375 | def extract_subdomains(file_name): 376 | #Avoid re-compilation 377 | global domain_match 378 | subs = {} 379 | sub_file = open(file_name).read() 380 | f_all = re.findall(domain_match, sub_file) 381 | del sub_file 382 | for i in f_all: 383 | if i.find(".") >= 0: 384 | p = i.split(".")[0:-1] 385 | #gobble everything that might be a TLD 386 | while p and len(p[-1]) <= 3: 387 | p = p[0:-1] 388 | #remove the domain name 389 | p = p[0:-1] 390 | #do we have a subdomain.domain left? 391 | if len(p) >= 1: 392 | trace(str(p), " : ", i) 393 | for q in p: 394 | if q : 395 | #domain names can only be lower case. 396 | q = q.lower() 397 | if q in subs: 398 | subs[q] += 1 399 | else: 400 | subs[q] = 1 401 | #Free some memory before the sort... 402 | del f_all 403 | #Sort by freq in desc order 404 | subs_sorted = sorted(subs.keys(), key = lambda x: subs[x], reverse = True) 405 | return subs_sorted 406 | 407 | def print_target(target, record_type = None, subdomains = "names.txt", resolve_list = "resolvers.txt", process_count = 16, output = False, json_output = False, found_subdomains=[],verbose=False): 408 | subdomains_list = [] 409 | results_temp = [] 410 | run(target, record_type, subdomains, resolve_list, process_count) 411 | for result in run(target, record_type, subdomains, resolve_list, process_count): 412 | (hostname, record_type, response) = result 413 | if not record_type: 414 | result = hostname 415 | else: 416 | result = "%s,%s" % (hostname, ",".join(response).strip(",")) 417 | if result not in found_subdomains: 418 | if verbose: 419 | print(result) 420 | subdomains_list.append(result) 421 | 422 | return set(subdomains_list) 423 | 424 | def run(target, record_type = None, subdomains = "names.txt", resolve_list = "resolvers.txt", process_count = 16): 425 | subdomains = check_open(subdomains) 426 | resolve_list = check_open(resolve_list) 427 | if (len(resolve_list) / 16) < process_count: 428 | sys.stderr.write('Warning: Fewer than 16 resovlers per thread, consider adding more nameservers to resolvers.txt.\n') 429 | if os.name == 'nt': 430 | wildcards = {} 431 | spider_blacklist = {} 432 | else: 433 | wildcards = multiprocessing.Manager().dict() 434 | spider_blacklist = multiprocessing.Manager().dict() 435 | in_q = multiprocessing.Queue() 436 | out_q = multiprocessing.Queue() 437 | #have a buffer of at most two new nameservers that lookup processes can draw from. 438 | resolve_q = multiprocessing.Queue(maxsize = 2) 439 | 440 | #Make a source of fast nameservers avaiable for other processes. 441 | verify_nameservers_proc = verify_nameservers(target, record_type, resolve_q, resolve_list, wildcards) 442 | verify_nameservers_proc.start() 443 | #The empty string 444 | in_q.put((target, record_type)) 445 | spider_blacklist[target]=None 446 | #A list of subdomains is the input 447 | for s in subdomains: 448 | s = str(s).strip() 449 | if s: 450 | if s.find(","): 451 | #SubBrute should be forgiving, a comma will never be in a url 452 | #but the user might try an use a CSV file as input. 453 | s=s.split(",")[0] 454 | if not s.endswith(target): 455 | hostname = "%s.%s" % (s, target) 456 | else: 457 | #A user might feed an output list as a subdomain list. 458 | hostname = s 459 | if hostname not in spider_blacklist: 460 | spider_blacklist[hostname]=None 461 | work = (hostname, record_type) 462 | in_q.put(work) 463 | #Terminate the queue 464 | in_q.put(False) 465 | for i in range(process_count): 466 | worker = lookup(in_q, out_q, resolve_q, target, wildcards, spider_blacklist) 467 | worker.start() 468 | threads_remaining = process_count 469 | while True: 470 | try: 471 | #The output is valid hostnames 472 | result = out_q.get(True, 10) 473 | #we will get an empty exception before this runs. 474 | if not result: 475 | threads_remaining -= 1 476 | else: 477 | #run() is a generator, and yields results from the work queue 478 | yield result 479 | except Exception as e: 480 | #The cx_freeze version uses queue.Empty instead of Queue.Empty :( 481 | if type(e) == Queue.Empty or str(type(e)) == "": 482 | pass 483 | else: 484 | raise(e) 485 | #make sure everyone is complete 486 | if threads_remaining <= 0: 487 | break 488 | trace("killing nameserver process") 489 | #We no longer require name servers. 490 | try: 491 | killproc(pid = verify_nameservers_proc.pid) 492 | except: 493 | #Windows threading.tread 494 | verify_nameservers_proc.end() 495 | trace("End") 496 | 497 | #exit handler for signals. So ctrl+c will work. 498 | #The 'multiprocessing' library each process is it's own process which side-steps the GIL 499 | #If the user wants to exit prematurely, each process must be killed. 500 | def killproc(signum = 0, frame = 0, pid = False): 501 | if not pid: 502 | pid = os.getpid() 503 | if sys.platform.startswith('win'): 504 | try: 505 | kernel32 = ctypes.windll.kernel32 506 | handle = kernel32.OpenProcess(1, 0, pid) 507 | kernel32.TerminateProcess(handle, 0) 508 | except: 509 | #Oah windows. 510 | pass 511 | else: 512 | os.kill(pid, 9) 513 | 514 | #Toggle debug output 515 | verbose = False 516 | def trace(*args, **kwargs): 517 | if verbose: 518 | for a in args: 519 | sys.stderr.write(str(a)) 520 | sys.stderr.write(" ") 521 | sys.stderr.write("\n") 522 | 523 | def error(*args, **kwargs): 524 | for a in args: 525 | sys.stderr.write(str(a)) 526 | sys.stderr.write(" ") 527 | sys.stderr.write("\n") 528 | sys.exit(1) 529 | 530 | def check_open(input_file): 531 | ret = [] 532 | #If we can't find a resolver from an input file, then we need to improvise. 533 | try: 534 | ret = open(input_file).readlines() 535 | except: 536 | error("File not found:", input_file) 537 | if not len(ret): 538 | error("File is empty:", input_file) 539 | return ret 540 | 541 | #Every 'multiprocessing' process needs a signal handler. 542 | #All processes need to die, we don't want to leave zombies. 543 | def signal_init(): 544 | #Escliate signal to prevent zombies. 545 | signal.signal(signal.SIGINT, killproc) 546 | try: 547 | signal.signal(signal.SIGTSTP, killproc) 548 | signal.signal(signal.SIGQUIT, killproc) 549 | except: 550 | #Windows 551 | pass 552 | 553 | if __name__ == "__main__": 554 | if getattr(sys, 'frozen', False): 555 | # cx_freeze windows: 556 | base_path = os.path.dirname(sys.executable) 557 | multiprocessing.freeze_support() 558 | else: 559 | #everything else: 560 | base_path = os.path.dirname(os.path.realpath(__file__)) 561 | parser = optparse.OptionParser("usage: %prog [options] target") 562 | parser.add_option("-s", "--subs", dest = "subs", default = os.path.join(base_path, "names.txt"), 563 | type = "string", help = "(optional) list of subdomains, default = 'names.txt'") 564 | parser.add_option("-r", "--resolvers", dest = "resolvers", default = os.path.join(base_path, "resolvers.txt"), 565 | type = "string", help = "(optional) A list of DNS resolvers, if this list is empty it will OS's internal resolver default = 'resolvers.txt'") 566 | parser.add_option("-t", "--targets_file", dest = "targets", default = "", 567 | type = "string", help = "(optional) A file containing a newline delimited list of domains to brute force.") 568 | parser.add_option("-o", "--output", dest = "output", default = False, help = "(optional) Output to file (Greppable Format)") 569 | parser.add_option("-j", "--json", dest="json", default = False, help="(optional) Output to file (JSON Format)") 570 | parser.add_option("-a", "-A", action = 'store_true', dest = "ipv4", default = False, 571 | help = "(optional) Print all IPv4 addresses for sub domains (default = off).") 572 | parser.add_option("--type", dest = "type", default = False, 573 | type = "string", help = "(optional) Print all reponses for an arbitrary DNS record type (CNAME, AAAA, TXT, SOA, MX...)") 574 | parser.add_option("-c", "--process_count", dest = "process_count", 575 | default = 16, type = "int", 576 | help = "(optional) Number of lookup theads to run. default = 16") 577 | parser.add_option("-f", "--filter_subs", dest = "filter", default = "", 578 | type = "string", help = "(optional) A file containing unorganized domain names which will be filtered into a list of subdomains sorted by frequency. This was used to build names.txt.") 579 | parser.add_option("-v", "--verbose", action = 'store_true', dest = "verbose", default = False, 580 | help = "(optional) Print debug information.") 581 | (options, args) = parser.parse_args() 582 | 583 | 584 | verbose = options.verbose 585 | 586 | if len(args) < 1 and options.filter == "" and options.targets == "": 587 | parser.error("You must provie a target. Use -h for help.") 588 | 589 | if options.filter != "": 590 | #cleanup this file and print it out 591 | for d in extract_subdomains(options.filter): 592 | print(d) 593 | sys.exit() 594 | 595 | if options.targets != "": 596 | targets = check_open(options.targets) #the domains 597 | else: 598 | targets = args #multiple arguments on the cli: ./subbrute.py google.com gmail.com yahoo.com if (len(resolver_list) / 16) < options.process_count: 599 | 600 | output = False 601 | if options.output: 602 | try: 603 | output = open(options.output, "w") 604 | except: 605 | error("Failed writing to file:", options.output) 606 | 607 | json_output = False 608 | if options.json: 609 | try: 610 | json_output = open(options.json, "w") 611 | except: 612 | error("Failed writing to file:", options.json) 613 | 614 | record_type = False 615 | if options.ipv4: 616 | record_type="A" 617 | if options.type: 618 | record_type = str(options.type).upper() 619 | 620 | threads = [] 621 | for target in targets: 622 | target = target.strip() 623 | if target: 624 | 625 | #target => domain 626 | #record_type => 627 | #options.subs => file the contain the subdomains list 628 | #options.process_count => process count default = 16 629 | #options.resolvers => the resolvers file 630 | #options.output 631 | #options.json 632 | print(target, record_type, options.subs, options.resolvers, options.process_count, output, json_output) 633 | print_target(target, record_type, options.subs, options.resolvers, options.process_count, output, json_output) 634 | 635 | 636 | -------------------------------------------------------------------------------- /sublist3r.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | # Sublist3r v1.0 4 | # By Ahmed Aboul-Ela - twitter.com/aboul3la 5 | 6 | # modules in standard library 7 | import re 8 | import sys 9 | import os 10 | import argparse 11 | import time 12 | import hashlib 13 | import random 14 | import multiprocessing 15 | import threading 16 | import socket 17 | import json 18 | from collections import Counter 19 | 20 | # external modules 21 | from subbrute import subbrute 22 | import dns.resolver 23 | import requests 24 | 25 | # Python 2.x and 3.x compatiablity 26 | if sys.version > '3': 27 | import urllib.parse as urlparse 28 | import urllib.parse as urllib 29 | else: 30 | import urlparse 31 | import urllib 32 | 33 | # In case you cannot install some of the required development packages 34 | # there's also an option to disable the SSL warning: 35 | try: 36 | import requests.packages.urllib3 37 | requests.packages.urllib3.disable_warnings() 38 | except: 39 | pass 40 | 41 | # Check if we are running this on windows platform 42 | is_windows = sys.platform.startswith('win') 43 | 44 | # Console Colors 45 | if is_windows: 46 | # Windows deserves coloring too :D 47 | G = '\033[92m' # green 48 | Y = '\033[93m' # yellow 49 | B = '\033[94m' # blue 50 | R = '\033[91m' # red 51 | W = '\033[0m' # white 52 | try: 53 | import win_unicode_console , colorama 54 | win_unicode_console.enable() 55 | colorama.init() 56 | #Now the unicode will work ^_^ 57 | except: 58 | print("[!] Error: Coloring libraries not installed, no coloring will be used [Check the readme]") 59 | G = Y = B = R = W = G = Y = B = R = W = '' 60 | 61 | 62 | else: 63 | G = '\033[92m' # green 64 | Y = '\033[93m' # yellow 65 | B = '\033[94m' # blue 66 | R = '\033[91m' # red 67 | W = '\033[0m' # white 68 | 69 | def no_color(): 70 | global G, Y, B, R, W 71 | G = Y = B = R = W = '' 72 | 73 | 74 | def banner(): 75 | print("""%s 76 | ____ _ _ _ _ _____ 77 | / ___| _ _| |__ | (_)___| |_|___ / _ __ 78 | \___ \| | | | '_ \| | / __| __| |_ \| '__| 79 | ___) | |_| | |_) | | \__ \ |_ ___) | | 80 | |____/ \__,_|_.__/|_|_|___/\__|____/|_|%s%s 81 | 82 | # Coded By Ahmed Aboul-Ela - @aboul3la 83 | """ % (R, W, Y)) 84 | 85 | 86 | def parser_error(errmsg): 87 | banner() 88 | print("Usage: python " + sys.argv[0] + " [Options] use -h for help") 89 | print(R + "Error: " + errmsg + W) 90 | sys.exit() 91 | 92 | 93 | def parse_args(): 94 | # parse the arguments 95 | parser = argparse.ArgumentParser(epilog='\tExample: \r\npython ' + sys.argv[0] + " -d google.com") 96 | parser.error = parser_error 97 | parser._optionals.title = "OPTIONS" 98 | parser.add_argument('-d', '--domain', help="Domain name to enumerate it's subdomains", required=True) 99 | parser.add_argument('-b', '--bruteforce', help='Enable the subbrute bruteforce module', nargs='?', default=False) 100 | parser.add_argument('-p', '--ports', help='Scan the found subdomains against specified tcp ports') 101 | parser.add_argument('-v', '--verbose', help='Enable Verbosity and display results in realtime', nargs='?', default=False) 102 | parser.add_argument('-t', '--threads', help='Number of threads to use for subbrute bruteforce', type=int, default=30) 103 | parser.add_argument('-e', '--engines', help='Specify a comma-separated list of search engines') 104 | parser.add_argument('-o', '--output', help='Save the results to text file') 105 | parser.add_argument('-n', '--no-color', help='Output without color', default=False, action='store_true') 106 | return parser.parse_args() 107 | 108 | 109 | def write_file(filename, subdomains): 110 | # saving subdomains results to output file 111 | print("%s[-] Saving results to file: %s%s%s%s" % (Y, W, R, filename, W)) 112 | with open(str(filename), 'wt') as f: 113 | for subdomain in subdomains: 114 | f.write(subdomain + os.linesep) 115 | 116 | 117 | def subdomain_sorting_key(hostname): 118 | """Sorting key for subdomains 119 | 120 | This sorting key orders subdomains from the top-level domain at the right 121 | reading left, then moving '^' and 'www' to the top of their group. For 122 | example, the following list is sorted correctly: 123 | 124 | [ 125 | 'example.com', 126 | 'www.example.com', 127 | 'a.example.com', 128 | 'www.a.example.com', 129 | 'b.a.example.com', 130 | 'b.example.com', 131 | 'example.net', 132 | 'www.example.net', 133 | 'a.example.net', 134 | ] 135 | 136 | """ 137 | parts = hostname.split('.')[::-1] 138 | if parts[-1] == 'www': 139 | return parts[:-1], 1 140 | return parts, 0 141 | 142 | 143 | class enumratorBase(object): 144 | def __init__(self, base_url, engine_name, domain, subdomains=None, silent=False, verbose=True): 145 | subdomains = subdomains or [] 146 | self.domain = urlparse.urlparse(domain).netloc 147 | self.session = requests.Session() 148 | self.subdomains = [] 149 | self.timeout = 25 150 | self.base_url = base_url 151 | self.engine_name = engine_name 152 | self.silent = silent 153 | self.verbose = verbose 154 | self.headers = { 155 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36', 156 | 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 157 | 'Accept-Language': 'en-US,en;q=0.8', 158 | 'Accept-Encoding': 'gzip', 159 | } 160 | self.print_banner() 161 | 162 | def print_(self, text): 163 | if not self.silent: 164 | print(text) 165 | return 166 | 167 | def print_banner(self): 168 | """ subclass can override this if they want a fancy banner :)""" 169 | self.print_(G + "[-] Searching now in %s.." % (self.engine_name) + W) 170 | return 171 | 172 | def send_req(self, query, page_no=1): 173 | 174 | url = self.base_url.format(query=query, page_no=page_no) 175 | try: 176 | resp = self.session.get(url, headers=self.headers, timeout=self.timeout) 177 | except Exception: 178 | resp = None 179 | return self.get_response(resp) 180 | 181 | def get_response(self, response): 182 | if response is None: 183 | return 0 184 | return response.text if hasattr(response, "text") else response.content 185 | 186 | def check_max_subdomains(self, count): 187 | if self.MAX_DOMAINS == 0: 188 | return False 189 | return count >= self.MAX_DOMAINS 190 | 191 | def check_max_pages(self, num): 192 | if self.MAX_PAGES == 0: 193 | return False 194 | return num >= self.MAX_PAGES 195 | 196 | # override 197 | def extract_domains(self, resp): 198 | """ chlid class should override this function """ 199 | return 200 | 201 | # override 202 | def check_response_errors(self, resp): 203 | """ chlid class should override this function 204 | The function should return True if there are no errors and False otherwise 205 | """ 206 | return True 207 | 208 | def should_sleep(self): 209 | """Some enumrators require sleeping to avoid bot detections like Google enumerator""" 210 | return 211 | 212 | def generate_query(self): 213 | """ chlid class should override this function """ 214 | return 215 | 216 | def get_page(self, num): 217 | """ chlid class that user different pagnation counter should override this function """ 218 | return num + 10 219 | 220 | def enumerate(self, altquery=False): 221 | flag = True 222 | page_no = 0 223 | prev_links = [] 224 | retries = 0 225 | 226 | while flag: 227 | query = self.generate_query() 228 | count = query.count(self.domain) # finding the number of subdomains found so far 229 | 230 | # if they we reached the maximum number of subdomains in search query 231 | # then we should go over the pages 232 | if self.check_max_subdomains(count): 233 | page_no = self.get_page(page_no) 234 | 235 | if self.check_max_pages(page_no): # maximum pages for Google to avoid getting blocked 236 | return self.subdomains 237 | resp = self.send_req(query, page_no) 238 | 239 | # check if there is any error occured 240 | if not self.check_response_errors(resp): 241 | return self.subdomains 242 | links = self.extract_domains(resp) 243 | 244 | # if the previous page hyperlinks was the similar to the current one, then maybe we have reached the last page 245 | if links == prev_links: 246 | retries += 1 247 | page_no = self.get_page(page_no) 248 | 249 | # make another retry maybe it isn't the last page 250 | if retries >= 3: 251 | return self.subdomains 252 | 253 | prev_links = links 254 | self.should_sleep() 255 | 256 | return self.subdomains 257 | 258 | 259 | class enumratorBaseThreaded(multiprocessing.Process, enumratorBase): 260 | def __init__(self, base_url, engine_name, domain, subdomains=None, q=None, silent=False, verbose=True): 261 | subdomains = subdomains or [] 262 | enumratorBase.__init__(self, base_url, engine_name, domain, subdomains, silent=silent, verbose=verbose) 263 | multiprocessing.Process.__init__(self) 264 | self.q = q 265 | return 266 | 267 | def run(self): 268 | domain_list = self.enumerate() 269 | for domain in domain_list: 270 | self.q.append(domain) 271 | 272 | 273 | class GoogleEnum(enumratorBaseThreaded): 274 | def __init__(self, domain, subdomains=None, q=None, silent=False, verbose=True): 275 | subdomains = subdomains or [] 276 | base_url = "https://google.com/search?q={query}&btnG=Search&hl=en-US&biw=&bih=&gbv=1&start={page_no}&filter=0" 277 | self.engine_name = "Google" 278 | self.MAX_DOMAINS = 11 279 | self.MAX_PAGES = 200 280 | super(GoogleEnum, self).__init__(base_url, self.engine_name, domain, subdomains, q=q, silent=silent, verbose=verbose) 281 | self.q = q 282 | return 283 | 284 | def extract_domains(self, resp): 285 | links_list = list() 286 | link_regx = re.compile('(.*?)<\/cite>') 287 | try: 288 | links_list = link_regx.findall(resp) 289 | for link in links_list: 290 | link = re.sub('', '', link) 291 | if not link.startswith('http'): 292 | link = "http://" + link 293 | subdomain = urlparse.urlparse(link).netloc 294 | if subdomain and subdomain not in self.subdomains and subdomain != self.domain: 295 | if self.verbose: 296 | self.print_("%s%s: %s%s" % (R, self.engine_name, W, subdomain)) 297 | self.subdomains.append(subdomain.strip()) 298 | except Exception: 299 | pass 300 | return links_list 301 | 302 | def check_response_errors(self, resp): 303 | if (type(resp) is str or type(resp) is unicode) and 'Our systems have detected unusual traffic' in resp: 304 | self.print_(R + "[!] Error: Google probably now is blocking our requests" + W) 305 | self.print_(R + "[~] Finished now the Google Enumeration ..." + W) 306 | return False 307 | return True 308 | 309 | def should_sleep(self): 310 | time.sleep(5) 311 | return 312 | 313 | def generate_query(self): 314 | if self.subdomains: 315 | fmt = 'site:{domain} -www.{domain} -{found}' 316 | found = ' -'.join(self.subdomains[:self.MAX_DOMAINS - 2]) 317 | query = fmt.format(domain=self.domain, found=found) 318 | else: 319 | query = "site:{domain} -www.{domain}".format(domain=self.domain) 320 | return query 321 | 322 | 323 | class YahooEnum(enumratorBaseThreaded): 324 | def __init__(self, domain, subdomains=None, q=None, silent=False, verbose=True): 325 | subdomains = subdomains or [] 326 | base_url = "https://search.yahoo.com/search?p={query}&b={page_no}" 327 | self.engine_name = "Yahoo" 328 | self.MAX_DOMAINS = 10 329 | self.MAX_PAGES = 0 330 | super(YahooEnum, self).__init__(base_url, self.engine_name, domain, subdomains, q=q, silent=silent, verbose=verbose) 331 | self.q = q 332 | return 333 | 334 | def extract_domains(self, resp): 335 | link_regx2 = re.compile('(.*?)') 336 | link_regx = re.compile('(.*?)') 337 | links_list = [] 338 | try: 339 | links = link_regx.findall(resp) 340 | links2 = link_regx2.findall(resp) 341 | links_list = links + links2 342 | for link in links_list: 343 | link = re.sub("<(\/)?b>", "", link) 344 | if not link.startswith('http'): 345 | link = "http://" + link 346 | subdomain = urlparse.urlparse(link).netloc 347 | if not subdomain.endswith(self.domain): 348 | continue 349 | if subdomain and subdomain not in self.subdomains and subdomain != self.domain: 350 | if self.verbose: 351 | self.print_("%s%s: %s%s" % (R, self.engine_name, W, subdomain)) 352 | self.subdomains.append(subdomain.strip()) 353 | except Exception: 354 | pass 355 | 356 | return links_list 357 | 358 | def should_sleep(self): 359 | return 360 | 361 | def get_page(self, num): 362 | return num + 10 363 | 364 | def generate_query(self): 365 | if self.subdomains: 366 | fmt = 'site:{domain} -domain:www.{domain} -domain:{found}' 367 | found = ' -domain:'.join(self.subdomains[:77]) 368 | query = fmt.format(domain=self.domain, found=found) 369 | else: 370 | query = "site:{domain}".format(domain=self.domain) 371 | return query 372 | 373 | 374 | class AskEnum(enumratorBaseThreaded): 375 | def __init__(self, domain, subdomains=None, q=None, silent=False, verbose=True): 376 | subdomains = subdomains or [] 377 | base_url = 'http://www.ask.com/web?q={query}&page={page_no}&qid=8D6EE6BF52E0C04527E51F64F22C4534&o=0&l=dir&qsrc=998&qo=pagination' 378 | self.engine_name = "Ask" 379 | self.MAX_DOMAINS = 11 380 | self.MAX_PAGES = 0 381 | enumratorBaseThreaded.__init__(self, base_url, self.engine_name, domain, subdomains, q=q, silent=silent, verbose=verbose) 382 | self.q = q 383 | return 384 | 385 | def extract_domains(self, resp): 386 | links_list = list() 387 | link_regx = re.compile('

(.*?)

') 388 | try: 389 | links_list = link_regx.findall(resp) 390 | for link in links_list: 391 | if not link.startswith('http'): 392 | link = "http://" + link 393 | subdomain = urlparse.urlparse(link).netloc 394 | if subdomain not in self.subdomains and subdomain != self.domain: 395 | if self.verbose: 396 | self.print_("%s%s: %s%s" % (R, self.engine_name, W, subdomain)) 397 | self.subdomains.append(subdomain.strip()) 398 | except Exception: 399 | pass 400 | 401 | return links_list 402 | 403 | def get_page(self, num): 404 | return num + 1 405 | 406 | def generate_query(self): 407 | if self.subdomains: 408 | fmt = 'site:{domain} -www.{domain} -{found}' 409 | found = ' -'.join(self.subdomains[:self.MAX_DOMAINS]) 410 | query = fmt.format(domain=self.domain, found=found) 411 | else: 412 | query = "site:{domain} -www.{domain}".format(domain=self.domain) 413 | 414 | return query 415 | 416 | 417 | class BingEnum(enumratorBaseThreaded): 418 | def __init__(self, domain, subdomains=None, q=None, silent=False, verbose=True): 419 | subdomains = subdomains or [] 420 | base_url = 'https://www.bing.com/search?q={query}&go=Submit&first={page_no}' 421 | self.engine_name = "Bing" 422 | self.MAX_DOMAINS = 30 423 | self.MAX_PAGES = 0 424 | enumratorBaseThreaded.__init__(self, base_url, self.engine_name, domain, subdomains, q=q, silent=silent) 425 | self.q = q 426 | self.verbose = verbose 427 | return 428 | 429 | def extract_domains(self, resp): 430 | links_list = list() 431 | link_regx = re.compile('
  • ||<|>', '', link) 440 | if not link.startswith('http'): 441 | link = "http://" + link 442 | subdomain = urlparse.urlparse(link).netloc 443 | if subdomain not in self.subdomains and subdomain != self.domain: 444 | if self.verbose: 445 | self.print_("%s%s: %s%s" % (R, self.engine_name, W, subdomain)) 446 | self.subdomains.append(subdomain.strip()) 447 | except Exception: 448 | pass 449 | 450 | return links_list 451 | 452 | def generate_query(self): 453 | if self.subdomains: 454 | fmt = 'domain:{domain} -www.{domain} -{found}' 455 | found = ' -'.join(self.subdomains[:self.MAX_DOMAINS]) 456 | query = fmt.format(domain=self.domain, found=found) 457 | else: 458 | query = "domain:{domain} -www.{domain}".format(domain=self.domain) 459 | return query 460 | 461 | 462 | class BaiduEnum(enumratorBaseThreaded): 463 | def __init__(self, domain, subdomains=None, q=None, silent=False, verbose=True): 464 | subdomains = subdomains or [] 465 | base_url = 'https://www.baidu.com/s?pn={page_no}&wd={query}&oq={query}' 466 | self.engine_name = "Baidu" 467 | self.MAX_DOMAINS = 2 468 | self.MAX_PAGES = 760 469 | enumratorBaseThreaded.__init__(self, base_url, self.engine_name, domain, subdomains, q=q, silent=silent, verbose=verbose) 470 | self.querydomain = self.domain 471 | self.q = q 472 | return 473 | 474 | def extract_domains(self, resp): 475 | links = list() 476 | found_newdomain = False 477 | subdomain_list = [] 478 | link_regx = re.compile('(.*?)') 479 | try: 480 | links = link_regx.findall(resp) 481 | for link in links: 482 | link = re.sub('<.*?>|>|<| ', '', link) 483 | if not link.startswith('http'): 484 | link = "http://" + link 485 | subdomain = urlparse.urlparse(link).netloc 486 | if subdomain.endswith(self.domain): 487 | subdomain_list.append(subdomain) 488 | if subdomain not in self.subdomains and subdomain != self.domain: 489 | found_newdomain = True 490 | if self.verbose: 491 | self.print_("%s%s: %s%s" % (R, self.engine_name, W, subdomain)) 492 | self.subdomains.append(subdomain.strip()) 493 | except Exception: 494 | pass 495 | if not found_newdomain and subdomain_list: 496 | self.querydomain = self.findsubs(subdomain_list) 497 | return links 498 | 499 | def findsubs(self, subdomains): 500 | count = Counter(subdomains) 501 | subdomain1 = max(count, key=count.get) 502 | count.pop(subdomain1, "None") 503 | subdomain2 = max(count, key=count.get) if count else '' 504 | return (subdomain1, subdomain2) 505 | 506 | def check_response_errors(self, resp): 507 | return True 508 | 509 | def should_sleep(self): 510 | time.sleep(random.randint(2, 5)) 511 | return 512 | 513 | def generate_query(self): 514 | if self.subdomains and self.querydomain != self.domain: 515 | found = ' -site:'.join(self.querydomain) 516 | query = "site:{domain} -site:www.{domain} -site:{found} ".format(domain=self.domain, found=found) 517 | else: 518 | query = "site:{domain} -site:www.{domain}".format(domain=self.domain) 519 | return query 520 | 521 | 522 | class NetcraftEnum(enumratorBaseThreaded): 523 | def __init__(self, domain, subdomains=None, q=None, silent=False, verbose=True): 524 | subdomains = subdomains or [] 525 | self.base_url = 'https://searchdns.netcraft.com/?restriction=site+ends+with&host={domain}' 526 | self.engine_name = "Netcraft" 527 | super(NetcraftEnum, self).__init__(self.base_url, self.engine_name, domain, subdomains, q=q, silent=silent, verbose=verbose) 528 | self.q = q 529 | return 530 | 531 | def req(self, url, cookies=None): 532 | cookies = cookies or {} 533 | try: 534 | resp = self.session.get(url, headers=self.headers, timeout=self.timeout, cookies=cookies) 535 | except Exception as e: 536 | self.print_(e) 537 | resp = None 538 | return resp 539 | 540 | def should_sleep(self): 541 | time.sleep(random.randint(1, 2)) 542 | return 543 | 544 | def get_next(self, resp): 545 | link_regx = re.compile('Next Page') 546 | link = link_regx.findall(resp) 547 | url = 'http://searchdns.netcraft.com' + link[0] 548 | return url 549 | 550 | def create_cookies(self, cookie): 551 | cookies = dict() 552 | cookies_list = cookie[0:cookie.find(';')].split("=") 553 | cookies[cookies_list[0]] = cookies_list[1] 554 | # hashlib.sha1 requires utf-8 encoded str 555 | cookies['netcraft_js_verification_response'] = hashlib.sha1(urllib.unquote(cookies_list[1]).encode('utf-8')).hexdigest() 556 | return cookies 557 | 558 | def get_cookies(self, headers): 559 | if 'set-cookie' in headers: 560 | cookies = self.create_cookies(headers['set-cookie']) 561 | else: 562 | cookies = {} 563 | return cookies 564 | 565 | def enumerate(self): 566 | start_url = self.base_url.format(domain='example.com') 567 | resp = self.req(start_url) 568 | cookies = self.get_cookies(resp.headers) 569 | url = self.base_url.format(domain=self.domain) 570 | while True: 571 | resp = self.get_response(self.req(url, cookies)) 572 | self.extract_domains(resp) 573 | if 'Next Page' not in resp: 574 | return self.subdomains 575 | break 576 | url = self.get_next(resp) 577 | self.should_sleep() 578 | 579 | def extract_domains(self, resp): 580 | links_list = list() 581 | link_regx = re.compile('', re.S) 641 | token = csrf_regex.findall(resp)[0] 642 | return token.strip() 643 | 644 | def enumerate(self): 645 | self.lock = threading.BoundedSemaphore(value=70) 646 | resp = self.req('GET', self.base_url) 647 | token = self.get_csrftoken(resp) 648 | params = {'csrfmiddlewaretoken': token, 'targetip': self.domain} 649 | post_resp = self.req('POST', self.base_url, params) 650 | self.extract_domains(post_resp) 651 | for subdomain in self.subdomains: 652 | t = threading.Thread(target=self.check_host, args=(subdomain,)) 653 | t.start() 654 | t.join() 655 | return self.live_subdomains 656 | 657 | def extract_domains(self, resp): 658 | tbl_regex = re.compile('<\/a>Host Records.*?(.*?)', re.S) 659 | link_regex = re.compile('(.*?)
    ', re.S) 660 | links = [] 661 | try: 662 | results_tbl = tbl_regex.findall(resp)[0] 663 | except IndexError: 664 | results_tbl = '' 665 | links_list = link_regex.findall(results_tbl) 666 | links = list(set(links_list)) 667 | for link in links: 668 | subdomain = link.strip() 669 | if not subdomain.endswith(self.domain): 670 | continue 671 | if subdomain and subdomain not in self.subdomains and subdomain != self.domain: 672 | self.subdomains.append(subdomain.strip()) 673 | return links 674 | 675 | 676 | class Virustotal(enumratorBaseThreaded): 677 | def __init__(self, domain, subdomains=None, q=None, silent=False, verbose=True): 678 | subdomains = subdomains or [] 679 | base_url = 'https://www.virustotal.com/ui/domains/{domain}/subdomains' 680 | self.engine_name = "Virustotal" 681 | self.q = q 682 | super(Virustotal, self).__init__(base_url, self.engine_name, domain, subdomains, q=q, silent=silent, verbose=verbose) 683 | self.url = self.base_url.format(domain=self.domain) 684 | return 685 | 686 | # the main send_req need to be rewritten 687 | def send_req(self, url): 688 | try: 689 | resp = self.session.get(url, headers=self.headers, timeout=self.timeout) 690 | except Exception as e: 691 | self.print_(e) 692 | resp = None 693 | 694 | return self.get_response(resp) 695 | 696 | # once the send_req is rewritten we don't need to call this function, the stock one should be ok 697 | def enumerate(self): 698 | while self.url != '': 699 | resp = self.send_req(self.url) 700 | resp = json.loads(resp) 701 | if 'error' in resp: 702 | self.print_(R + "[!] Error: Virustotal probably now is blocking our requests" + W) 703 | break 704 | if 'links' in resp and 'next' in resp['links']: 705 | self.url = resp['links']['next'] 706 | else: 707 | self.url = '' 708 | self.extract_domains(resp) 709 | return self.subdomains 710 | 711 | def extract_domains(self, resp): 712 | #resp is already parsed as json 713 | try: 714 | for i in resp['data']: 715 | if i['type'] == 'domain': 716 | subdomain = i['id'] 717 | if not subdomain.endswith(self.domain): 718 | continue 719 | if subdomain not in self.subdomains and subdomain != self.domain: 720 | if self.verbose: 721 | self.print_("%s%s: %s%s" % (R, self.engine_name, W, subdomain)) 722 | self.subdomains.append(subdomain.strip()) 723 | except Exception: 724 | pass 725 | 726 | 727 | class ThreatCrowd(enumratorBaseThreaded): 728 | def __init__(self, domain, subdomains=None, q=None, silent=False, verbose=True): 729 | subdomains = subdomains or [] 730 | base_url = 'https://www.threatcrowd.org/searchApi/v2/domain/report/?domain={domain}' 731 | self.engine_name = "ThreatCrowd" 732 | self.q = q 733 | super(ThreatCrowd, self).__init__(base_url, self.engine_name, domain, subdomains, q=q, silent=silent, verbose=verbose) 734 | return 735 | 736 | def req(self, url): 737 | try: 738 | resp = self.session.get(url, headers=self.headers, timeout=self.timeout) 739 | except Exception: 740 | resp = None 741 | 742 | return self.get_response(resp) 743 | 744 | def enumerate(self): 745 | url = self.base_url.format(domain=self.domain) 746 | resp = self.req(url) 747 | self.extract_domains(resp) 748 | return self.subdomains 749 | 750 | def extract_domains(self, resp): 751 | try: 752 | links = json.loads(resp)['subdomains'] 753 | for link in links: 754 | subdomain = link.strip() 755 | if not subdomain.endswith(self.domain): 756 | continue 757 | if subdomain not in self.subdomains and subdomain != self.domain: 758 | if self.verbose: 759 | self.print_("%s%s: %s%s" % (R, self.engine_name, W, subdomain)) 760 | self.subdomains.append(subdomain.strip()) 761 | except Exception as e: 762 | pass 763 | 764 | 765 | class CrtSearch(enumratorBaseThreaded): 766 | def __init__(self, domain, subdomains=None, q=None, silent=False, verbose=True): 767 | subdomains = subdomains or [] 768 | base_url = 'https://crt.sh/?q=%25.{domain}' 769 | self.engine_name = "SSL Certificates" 770 | self.q = q 771 | super(CrtSearch, self).__init__(base_url, self.engine_name, domain, subdomains, q=q, silent=silent, verbose=verbose) 772 | return 773 | 774 | def req(self, url): 775 | try: 776 | resp = self.session.get(url, headers=self.headers, timeout=self.timeout) 777 | except Exception: 778 | resp = None 779 | 780 | return self.get_response(resp) 781 | 782 | def enumerate(self): 783 | url = self.base_url.format(domain=self.domain) 784 | resp = self.req(url) 785 | if resp: 786 | self.extract_domains(resp) 787 | return self.subdomains 788 | 789 | def extract_domains(self, resp): 790 | link_regx = re.compile('(.*?)') 791 | try: 792 | links = link_regx.findall(resp) 793 | for link in links: 794 | link = link.strip() 795 | subdomains = [] 796 | if '
    ' in link: 797 | subdomains = link.split('
    ') 798 | else: 799 | subdomains.append(link) 800 | 801 | for subdomain in subdomains: 802 | if not subdomain.endswith(self.domain) or '*' in subdomain: 803 | continue 804 | 805 | if '@' in subdomain: 806 | subdomain = subdomain[subdomain.find('@')+1:] 807 | 808 | if subdomain not in self.subdomains and subdomain != self.domain: 809 | if self.verbose: 810 | self.print_("%s%s: %s%s" % (R, self.engine_name, W, subdomain)) 811 | self.subdomains.append(subdomain.strip()) 812 | except Exception as e: 813 | print(e) 814 | pass 815 | 816 | class PassiveDNS(enumratorBaseThreaded): 817 | def __init__(self, domain, subdomains=None, q=None, silent=False, verbose=True): 818 | subdomains = subdomains or [] 819 | base_url = 'https://api.sublist3r.com/search.php?domain={domain}' 820 | self.engine_name = "PassiveDNS" 821 | self.q = q 822 | super(PassiveDNS, self).__init__(base_url, self.engine_name, domain, subdomains, q=q, silent=silent, verbose=verbose) 823 | return 824 | 825 | def req(self, url): 826 | try: 827 | resp = self.session.get(url, headers=self.headers, timeout=self.timeout) 828 | except Exception as e: 829 | resp = None 830 | 831 | return self.get_response(resp) 832 | 833 | def enumerate(self): 834 | url = self.base_url.format(domain=self.domain) 835 | resp = self.req(url) 836 | if not resp: 837 | return self.subdomains 838 | 839 | self.extract_domains(resp) 840 | return self.subdomains 841 | 842 | def extract_domains(self, resp): 843 | try: 844 | subdomains = json.loads(resp) 845 | for subdomain in subdomains: 846 | if subdomain not in self.subdomains and subdomain != self.domain: 847 | if self.verbose: 848 | self.print_("%s%s: %s%s" % (R, self.engine_name, W, subdomain)) 849 | self.subdomains.append(subdomain.strip()) 850 | except Exception as e: 851 | pass 852 | 853 | 854 | class portscan(): 855 | def __init__(self, subdomains, ports): 856 | self.subdomains = subdomains 857 | self.ports = ports 858 | self.lock = None 859 | 860 | def port_scan(self, host, ports): 861 | openports = [] 862 | self.lock.acquire() 863 | for port in ports: 864 | try: 865 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 866 | s.settimeout(2) 867 | result = s.connect_ex((host, int(port))) 868 | if result == 0: 869 | openports.append(port) 870 | s.close() 871 | except Exception: 872 | pass 873 | self.lock.release() 874 | if len(openports) > 0: 875 | print("%s%s%s - %sFound open ports:%s %s%s%s" % (G, host, W, R, W, Y, ', '.join(openports), W)) 876 | 877 | def run(self): 878 | self.lock = threading.BoundedSemaphore(value=20) 879 | for subdomain in self.subdomains: 880 | t = threading.Thread(target=self.port_scan, args=(subdomain, self.ports)) 881 | t.start() 882 | 883 | 884 | def main(domain, threads, savefile, ports, silent, verbose, enable_bruteforce, engines): 885 | bruteforce_list = set() 886 | search_list = set() 887 | 888 | if is_windows: 889 | subdomains_queue = list() 890 | else: 891 | subdomains_queue = multiprocessing.Manager().list() 892 | 893 | # Check Bruteforce Status 894 | if enable_bruteforce or enable_bruteforce is None: 895 | enable_bruteforce = True 896 | 897 | # Validate domain 898 | domain_check = re.compile("^(http|https)?[a-zA-Z0-9]+([\-\.]{1}[a-zA-Z0-9]+)*\.[a-zA-Z]{2,}$") 899 | if not domain_check.match(domain): 900 | if not silent: 901 | print(R + "Error: Please enter a valid domain" + W) 902 | return [] 903 | 904 | if not domain.startswith('http://') or not domain.startswith('https://'): 905 | domain = 'http://' + domain 906 | 907 | parsed_domain = urlparse.urlparse(domain) 908 | 909 | if not silent: 910 | print(B + "[-] Enumerating subdomains now for %s" % parsed_domain.netloc + W) 911 | 912 | if verbose and not silent: 913 | print(Y + "[-] verbosity is enabled, will show the subdomains results in realtime" + W) 914 | 915 | supported_engines = {'baidu': BaiduEnum, 916 | 'yahoo': YahooEnum, 917 | 'google': GoogleEnum, 918 | 'bing': BingEnum, 919 | 'ask': AskEnum, 920 | 'netcraft': NetcraftEnum, 921 | 'dnsdumpster': DNSdumpster, 922 | 'virustotal': Virustotal, 923 | 'threatcrowd': ThreatCrowd, 924 | 'ssl': CrtSearch, 925 | 'passivedns': PassiveDNS 926 | } 927 | 928 | chosenEnums = [] 929 | 930 | if engines is None: 931 | chosenEnums = [ 932 | BaiduEnum, YahooEnum, GoogleEnum, BingEnum, AskEnum, 933 | NetcraftEnum, DNSdumpster, Virustotal, ThreatCrowd, 934 | CrtSearch, PassiveDNS 935 | ] 936 | else: 937 | engines = engines.split(',') 938 | for engine in engines: 939 | if engine.lower() in supported_engines: 940 | chosenEnums.append(supported_engines[engine.lower()]) 941 | 942 | # Start the engines enumeration 943 | enums = [enum(domain, [], q=subdomains_queue, silent=silent, verbose=verbose) for enum in chosenEnums] 944 | for enum in enums: 945 | enum.start() 946 | for enum in enums: 947 | enum.join() 948 | 949 | subdomains = set(subdomains_queue) 950 | for subdomain in subdomains: 951 | search_list.add(subdomain) 952 | 953 | if enable_bruteforce: 954 | if not silent: 955 | print(G + "[-] Starting bruteforce module now using subbrute.." + W) 956 | record_type = False 957 | path_to_file = os.path.dirname(os.path.realpath(__file__)) 958 | subs = os.path.join(path_to_file, 'subbrute', 'names.txt') 959 | resolvers = os.path.join(path_to_file, 'subbrute', 'resolvers.txt') 960 | process_count = threads 961 | output = False 962 | json_output = False 963 | bruteforce_list = subbrute.print_target(parsed_domain.netloc, record_type, subs, resolvers, process_count, output, json_output, search_list, verbose) 964 | 965 | subdomains = search_list.union(bruteforce_list) 966 | 967 | if subdomains: 968 | subdomains = sorted(subdomains, key=subdomain_sorting_key) 969 | 970 | if savefile: 971 | write_file(savefile, subdomains) 972 | 973 | if not silent: 974 | print(Y + "[-] Total Unique Subdomains Found: %s" % len(subdomains) + W) 975 | 976 | if ports: 977 | if not silent: 978 | print(G + "[-] Start port scan now for the following ports: %s%s" % (Y, ports) + W) 979 | ports = ports.split(',') 980 | pscan = portscan(subdomains, ports) 981 | pscan.run() 982 | 983 | elif not silent: 984 | for subdomain in subdomains: 985 | print(G + subdomain + W) 986 | return subdomains 987 | 988 | 989 | def interactive(): 990 | args = parse_args() 991 | domain = args.domain 992 | threads = args.threads 993 | savefile = args.output 994 | ports = args.ports 995 | enable_bruteforce = args.bruteforce 996 | verbose = args.verbose 997 | engines = args.engines 998 | if verbose or verbose is None: 999 | verbose = True 1000 | if args.no_color: 1001 | no_color() 1002 | banner() 1003 | res = main(domain, threads, savefile, ports, silent=False, verbose=verbose, enable_bruteforce=enable_bruteforce, engines=engines) 1004 | 1005 | if __name__ == "__main__": 1006 | interactive() 1007 | --------------------------------------------------------------------------------