├── .github ├── FUNDING.yml └── workflows │ └── lint_python.yml ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── autorecon.py ├── autorecon ├── __init__.py ├── config.py ├── config.toml ├── default-plugins │ ├── __init__.py │ ├── bruteforce-ftp.py │ ├── bruteforce-http.py │ ├── bruteforce-rdp.py │ ├── bruteforce-smb.py │ ├── bruteforce-ssh.py │ ├── curl-known-security.py │ ├── curl-robots.py │ ├── curl.py │ ├── dirbuster.py │ ├── dns-reverse-lookup.py │ ├── dns-zone-transfer.py │ ├── dnsrecon-subdomain-bruteforce.py │ ├── dnsrecon.py │ ├── enum4linux.py │ ├── get-arch.py │ ├── hostname-discovery.py │ ├── ldap-search.py │ ├── lookup-sid.py │ ├── nbtscan.py │ ├── nikto.py │ ├── nmap-ajp.py │ ├── nmap-cassandra.py │ ├── nmap-cups.py │ ├── nmap-distccd.py │ ├── nmap-dns.py │ ├── nmap-finger.py │ ├── nmap-ftp.py │ ├── nmap-http.py │ ├── nmap-imap.py │ ├── nmap-irc.py │ ├── nmap-kerberos.py │ ├── nmap-ldap.py │ ├── nmap-mongodb.py │ ├── nmap-mountd.py │ ├── nmap-msrpc.py │ ├── nmap-mssql.py │ ├── nmap-multicast-dns.py │ ├── nmap-mysql.py │ ├── nmap-nfs.py │ ├── nmap-nntp.py │ ├── nmap-ntp.py │ ├── nmap-oracle.py │ ├── nmap-pop3.py │ ├── nmap-rdp.py │ ├── nmap-redis.py │ ├── nmap-rmi.py │ ├── nmap-rsync.py │ ├── nmap-sip.py │ ├── nmap-smb.py │ ├── nmap-smtp.py │ ├── nmap-snmp.py │ ├── nmap-ssh.py │ ├── nmap-telnet.py │ ├── nmap-tftp.py │ ├── nmap-vnc.py │ ├── onesixtyone.py │ ├── oracle-odat.py │ ├── oracle-patator.py │ ├── oracle-scanner.py │ ├── oracle-tnscmd.py │ ├── portscan-all-tcp-ports.py │ ├── portscan-guess-tcp-ports.py │ ├── portscan-top-100-udp-ports.py │ ├── portscan-top-tcp-ports.py │ ├── redis-cli.py │ ├── reporting-cherrytree.py │ ├── reporting-markdown.py │ ├── rpcclient.py │ ├── rpcdump.py │ ├── rsync-list-files.py │ ├── showmount.py │ ├── sipvicious.py │ ├── smb-vuln.py │ ├── smbclient.py │ ├── smbmap.py │ ├── smtp-user-enum.py │ ├── snmpwalk.py │ ├── sslscan.py │ ├── subdomain-enumeration.py │ ├── virtual-host-enumeration.py │ ├── whatweb.py │ ├── winrm-detection.py │ └── wpscan.py ├── global.toml ├── io.py ├── main.py ├── plugins.py ├── targets.py └── wordlists │ └── dirbuster.txt ├── pyproject.toml └── requirements.txt /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [tib3rius] 2 | custom: ['https://www.buymeacoffee.com/tib3rius'] 3 | -------------------------------------------------------------------------------- /.github/workflows/lint_python.yml: -------------------------------------------------------------------------------- 1 | name: lint_python 2 | on: [pull_request, push] 3 | jobs: 4 | lint_python: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v3 8 | - uses: actions/setup-python@v4 9 | with: 10 | python-version: | 11 | 3.8 12 | 3.9 13 | 3.10 14 | 3.11 15 | - run: pip install --upgrade pip poetry 16 | - run: pip install bandit black codespell flake8 flake8-bugbear flake8-comprehensions isort mypy pytest pyupgrade safety requests 17 | - run: bandit --recursive --skip B101 . || true # B101 is assert statements 18 | - run: black --check . || true 19 | - run: codespell --skip="./autorecon/wordlists" --ignore-regex="\bCouldn\b" # --ignore-words-list="" --skip="*.css,*.js,*.lock" 20 | - run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics 21 | - run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 22 | --show-source --statistics 23 | - run: isort --check-only --profile black . || true 24 | - run: pip install -r requirements.txt 25 | - run: mkdir --parents --verbose .mypy_cache 26 | - run: mypy --ignore-missing-imports --install-types --non-interactive . || true 27 | - run: pytest . || true 28 | - run: pytest --doctest-modules . || true 29 | - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true 30 | - run: safety check -r requirements.txt 31 | - run: python3 autorecon.py 127.0.0.1 || true 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | *.pyc 3 | results/ 4 | poetry.* -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:latest 2 | 3 | RUN apt-get update 4 | RUN apt-get install -y ca-certificates gnupg wget 5 | 6 | RUN wget -q -O - https://archive.kali.org/archive-key.asc | apt-key add - 7 | RUN echo "deb http://http.kali.org/kali kali-rolling main contrib non-free" >> /etc/apt/sources.list 8 | RUN apt-get update 9 | 10 | RUN apt-get install -y python3 python3-pip git seclists curl dnsrecon enum4linux feroxbuster gobuster impacket-scripts nbtscan nikto nmap onesixtyone oscanner redis-tools smbclient smbmap snmp sslscan sipvicious tnscmd10g whatweb 11 | RUN python3 -m pip install git+https://github.com/Tib3rius/AutoRecon.git 12 | 13 | 14 | CMD ["/bin/bash"] 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > It's like bowling with bumpers. - [@ippsec](https://twitter.com/ippsec) 2 | 3 | # AutoRecon 4 | 5 | AutoRecon is a multi-threaded network reconnaissance tool which performs automated enumeration of services. It is intended as a time-saving tool for use in CTFs and other penetration testing environments (e.g. OSCP). It may also be useful in real-world engagements. 6 | 7 | The tool works by firstly performing port scans / service detection scans. From those initial results, the tool will launch further enumeration scans of those services using a number of different tools. For example, if HTTP is found, feroxbuster will be launched (as well as many others). 8 | 9 | Everything in the tool is highly configurable. The default configuration performs **no automated exploitation** to keep the tool in line with OSCP exam rules. If you wish to add automatic exploit tools to the configuration, you do so at your own risk. The author will not be held responsible for negative actions that result from the mis-use of this tool. 10 | 11 | **Disclaimer: While AutoRecon endeavors to perform as much identification and enumeration of services as possible, there is no guarantee that every service will be identified, or that every service will be fully enumerated. Users of AutoRecon (especially students) should perform their own manual enumeration alongside AutoRecon. Do not rely on this tool alone for exams, CTFs, or other engagements.** 12 | 13 | ## Origin 14 | 15 | AutoRecon was inspired by three tools which the author used during the OSCP labs: [Reconnoitre](https://github.com/codingo/Reconnoitre), [ReconScan](https://github.com/RoliSoft/ReconScan), and [bscan](https://github.com/welchbj/bscan). While all three tools were useful, none of the three alone had the functionality desired. AutoRecon combines the best features of the aforementioned tools while also implementing many new features to help testers with enumeration of multiple targets. 16 | 17 | ## Features 18 | 19 | * Supports multiple targets in the form of IP addresses, IP ranges (CIDR notation), and resolvable hostnames. IPv6 is also supported. 20 | * Can scan multiple targets concurrently, utilizing multiple processors if they are available. 21 | * Advanced plugin system allowing for easy creation of new scans. 22 | * Customizable port scanning plugins for flexibility in your initial scans. 23 | * Customizable service scanning plugins for further enumeration. 24 | * Suggested manual follow-up commands for when automation makes little sense. 25 | * Ability to limit port scanning to a combination of TCP/UDP ports. 26 | * Ability to skip port scanning phase by supplying information about services which should be open. 27 | * Global and per-scan pattern matching which highlights and extracts important information from the noise. 28 | * An intuitive directory structure for results gathering. 29 | * Full logging of commands that were run, along with errors if they fail. 30 | * A powerful config file lets you use your favorite settings every time. 31 | * A tagging system that lets you include or exclude certain plugins. 32 | * Global and per-target timeouts in case you only have limited time. 33 | * Four levels of verbosity, controllable by command-line options, and during scans using Up/Down arrows. 34 | * Colorized output for distinguishing separate pieces of information. Can be turned off for accessibility reasons. 35 | 36 | ## Installation 37 | 38 | There are three ways to install AutoRecon: pipx, pip, and manually. Before installation using any of these methods, certain requirements need to be fulfilled. If you have not refreshed your apt cache recently, run the following command so you are installing the latest available packages: 39 | 40 | ```bash 41 | sudo apt update 42 | ``` 43 | 44 | ### Python 3 45 | 46 | AutoRecon requires the usage of Python 3.8+ and pip, which can be installed on Kali Linux using the following commands: 47 | 48 | ```bash 49 | sudo apt install python3 50 | sudo apt install python3-pip 51 | ``` 52 | 53 | ### Supporting Packages 54 | 55 | Several commands used in AutoRecon reference the SecLists project, in the directory /usr/share/seclists/. You can either manually download the SecLists project to this directory (https://github.com/danielmiessler/SecLists), or if you are using Kali Linux (**highly recommended**) you can run the following commands: 56 | 57 | ```bash 58 | sudo apt install seclists 59 | ``` 60 | 61 | AutoRecon will still run if you do not install SecLists, though several commands may fail, and some manual commands may not run either. 62 | 63 | Additionally the following commands may need to be installed, depending on your OS: 64 | 65 | ``` 66 | curl 67 | dnsrecon 68 | enum4linux 69 | feroxbuster 70 | gobuster 71 | impacket-scripts 72 | nbtscan 73 | nikto 74 | nmap 75 | onesixtyone 76 | oscanner 77 | redis-tools 78 | smbclient 79 | smbmap 80 | snmpwalk 81 | sslscan 82 | svwar 83 | tnscmd10g 84 | whatweb 85 | ``` 86 | 87 | On Kali Linux, you can ensure these are all installed using the following commands: 88 | 89 | ```bash 90 | sudo apt install seclists curl dnsrecon enum4linux feroxbuster gobuster impacket-scripts nbtscan nikto nmap onesixtyone oscanner redis-tools smbclient smbmap snmp sslscan sipvicious tnscmd10g whatweb 91 | ``` 92 | 93 | ### Installation Method #1: pipx (Recommended) 94 | 95 | It is recommended you use `pipx` to install AutoRecon. pipx will install AutoRecon in it's own virtual environment, and make it available in the global context, avoiding conflicting package dependencies and the resulting instability. First, install pipx using the following commands: 96 | 97 | 98 | ```bash 99 | sudo apt install python3-venv 100 | python3 -m pip install --user pipx 101 | python3 -m pipx ensurepath 102 | ``` 103 | 104 | You will have to re-source your ~/.bashrc or ~/.zshrc file (or open a new tab) after running these commands in order to use pipx. 105 | 106 | Install AutoRecon using the following command: 107 | 108 | ```bash 109 | pipx install git+https://github.com/Tib3rius/AutoRecon.git 110 | ``` 111 | 112 | Note that if you want to run AutoRecon using sudo (required for faster SYN scanning and UDP scanning), you have to use _one_ of the following examples: 113 | 114 | ```bash 115 | sudo env "PATH=$PATH" autorecon [OPTIONS] 116 | sudo $(which autorecon) [OPTIONS] 117 | ``` 118 | 119 | ### Installation Method #2: pip 120 | 121 | Alternatively you can use `pip` to install AutoRecon using the following command: 122 | 123 | ```bash 124 | python3 -m pip install git+https://github.com/Tib3rius/AutoRecon.git 125 | ``` 126 | 127 | Note that if you want to run AutoRecon using sudo (required for faster SYN scanning and UDP scanning), you will have to run the above command as the root user (or using sudo). 128 | 129 | Similarly to `pipx`, if installed using `pip` you can run AutoRecon by simply executing `autorecon`. 130 | 131 | ### Installation Method #3: Manually 132 | 133 | If you'd prefer not to use `pip` or `pipx`, you can always still install and execute `autorecon.py` manually as a script. From within the AutoRecon directory, install the dependencies: 134 | 135 | ```bash 136 | python3 -m pip install -r requirements.txt 137 | ``` 138 | 139 | You will then be able to run the `autorecon.py` script: 140 | 141 | ```bash 142 | python3 autorecon.py [OPTIONS] 127.0.0.1 143 | ``` 144 | 145 | ## Upgrading 146 | 147 | ### pipx 148 | 149 | Upgrading AutoRecon when it has been installed with pipx is the easiest, and is why the method is recommended. Simply run the following command: 150 | 151 | ```bash 152 | pipx upgrade autorecon 153 | ``` 154 | 155 | ### pip 156 | 157 | If you've installed AutoRecon using pip, you will first have to uninstall AutoRecon and then re-install using the same install command: 158 | 159 | ```bash 160 | python3 -m pip uninstall autorecon 161 | python3 -m pip install git+https://github.com/Tib3rius/AutoRecon.git 162 | ``` 163 | 164 | ### Manually 165 | 166 | If you've installed AutoRecon manually, simply change to the AutoRecon directory and run the following command: 167 | 168 | ```bash 169 | git pull 170 | ``` 171 | 172 | Assuming you did not modify any of the content in the AutoRecon directory, this should pull the latest code from this GitHub repo, after which you can run AutoRecon using the autorecon.py script as per usual. 173 | 174 | ### Plugins 175 | 176 | A plugin update process is in the works. Until then, after upgrading, remove the ~/.local/share/AutoRecon directory and run AutoRecon with any argument to repopulate with the latest files. 177 | 178 | ## Usage 179 | 180 | AutoRecon uses Python 3 specific functionality and does not support Python 2. 181 | 182 | ``` 183 | usage: autorecon [-t TARGET_FILE] [-p PORTS] [-m MAX_SCANS] [-mp MAX_PORT_SCANS] [-c CONFIG_FILE] [-g GLOBAL_FILE] [--tags TAGS] 184 | [--exclude-tags TAGS] [--port-scans PLUGINS] [--service-scans PLUGINS] [--reports PLUGINS] [--plugins-dir PLUGINS_DIR] 185 | [--add-plugins-dir PLUGINS_DIR] [-l [TYPE]] [-o OUTPUT] [--single-target] [--only-scans-dir] [--no-port-dirs] 186 | [--heartbeat HEARTBEAT] [--timeout TIMEOUT] [--target-timeout TARGET_TIMEOUT] [--nmap NMAP | --nmap-append NMAP_APPEND] 187 | [--proxychains] [--disable-sanity-checks] [--disable-keyboard-control] [--force-services SERVICE [SERVICE ...]] [--accessible] 188 | [-v] [--version] [--curl.path VALUE] [--dirbuster.tool {feroxbuster,gobuster,dirsearch,ffuf,dirb}] 189 | [--dirbuster.wordlist VALUE [VALUE ...]] [--dirbuster.threads VALUE] [--dirbuster.ext VALUE] 190 | [--onesixtyone.community-strings VALUE] [--global.username-wordlist VALUE] [--global.password-wordlist VALUE] 191 | [--global.domain VALUE] [-h] 192 | [targets ...] 193 | 194 | Network reconnaissance tool to port scan and automatically enumerate services found on multiple targets. 195 | 196 | positional arguments: 197 | targets IP addresses (e.g. 10.0.0.1), CIDR notation (e.g. 10.0.0.1/24), or resolvable hostnames (e.g. foo.bar) to scan. 198 | 199 | optional arguments: 200 | -t TARGET_FILE, --target-file TARGET_FILE 201 | Read targets from file. 202 | -p PORTS, --ports PORTS 203 | Comma separated list of ports / port ranges to scan. Specify TCP/UDP ports by prepending list with T:/U: To scan both 204 | TCP/UDP, put port(s) at start or specify B: e.g. 53,T:21-25,80,U:123,B:123. Default: None 205 | -m MAX_SCANS, --max-scans MAX_SCANS 206 | The maximum number of concurrent scans to run. Default: 50 207 | -mp MAX_PORT_SCANS, --max-port-scans MAX_PORT_SCANS 208 | The maximum number of concurrent port scans to run. Default: 10 (approx 20% of max-scans unless specified) 209 | -c CONFIG_FILE, --config CONFIG_FILE 210 | Location of AutoRecon's config file. Default: ~/.config/AutoRecon/config.toml 211 | -g GLOBAL_FILE, --global-file GLOBAL_FILE 212 | Location of AutoRecon's global file. Default: ~/.config/AutoRecon/global.toml 213 | --tags TAGS Tags to determine which plugins should be included. Separate tags by a plus symbol (+) to group tags together. Separate 214 | groups with a comma (,) to create multiple groups. For a plugin to be included, it must have all the tags specified in 215 | at least one group. Default: default 216 | --exclude-tags TAGS Tags to determine which plugins should be excluded. Separate tags by a plus symbol (+) to group tags together. Separate 217 | groups with a comma (,) to create multiple groups. For a plugin to be excluded, it must have all the tags specified in 218 | at least one group. Default: None 219 | --port-scans PLUGINS Override --tags / --exclude-tags for the listed PortScan plugins (comma separated). Default: None 220 | --service-scans PLUGINS 221 | Override --tags / --exclude-tags for the listed ServiceScan plugins (comma separated). Default: None 222 | --reports PLUGINS Override --tags / --exclude-tags for the listed Report plugins (comma separated). Default: None 223 | --plugins-dir PLUGINS_DIR 224 | The location of the plugins directory. Default: ~/.local/share/AutoRecon/plugins 225 | --add-plugins-dir PLUGINS_DIR 226 | The location of an additional plugins directory to add to the main one. Default: None 227 | -l [TYPE], --list [TYPE] 228 | List all plugins or plugins of a specific type. e.g. --list, --list port, --list service 229 | -o OUTPUT, --output OUTPUT 230 | The output directory for results. Default: results 231 | --single-target Only scan a single target. A directory named after the target will not be created. Instead, the directory structure will 232 | be created within the output directory. Default: False 233 | --only-scans-dir Only create the "scans" directory for results. Other directories (e.g. exploit, loot, report) will not be created. 234 | Default: False 235 | --no-port-dirs Don't create directories for ports (e.g. scans/tcp80, scans/udp53). Instead store all results in the "scans" directory 236 | itself. Default: False 237 | --heartbeat HEARTBEAT 238 | Specifies the heartbeat interval (in seconds) for scan status messages. Default: 60 239 | --timeout TIMEOUT Specifies the maximum amount of time in minutes that AutoRecon should run for. Default: None 240 | --target-timeout TARGET_TIMEOUT 241 | Specifies the maximum amount of time in minutes that a target should be scanned for before abandoning it and moving on. 242 | Default: None 243 | --nmap NMAP Override the {nmap_extra} variable in scans. Default: -vv --reason -Pn -T4 244 | --nmap-append NMAP_APPEND 245 | Append to the default {nmap_extra} variable in scans. Default: 246 | --proxychains Use if you are running AutoRecon via proxychains. Default: False 247 | --disable-sanity-checks 248 | Disable sanity checks that would otherwise prevent the scans from running. Default: False 249 | --disable-keyboard-control 250 | Disables keyboard control ([s]tatus, Up, Down) if you are in SSH or Docker. 251 | --force-services SERVICE [SERVICE ...] 252 | A space separated list of services in the following style: tcp/80/http tcp/443/https/secure 253 | --accessible Attempts to make AutoRecon output more accessible to screenreaders. Default: False 254 | -v, --verbose Enable verbose output. Repeat for more verbosity. 255 | --version Prints the AutoRecon version and exits. 256 | -h, --help Show this help message and exit. 257 | 258 | plugin arguments: 259 | These are optional arguments for certain plugins. 260 | 261 | --curl.path VALUE The path on the web server to curl. Default: / 262 | --dirbuster.tool {feroxbuster,gobuster,dirsearch,ffuf,dirb} 263 | The tool to use for directory busting. Default: feroxbuster 264 | --dirbuster.wordlist VALUE [VALUE ...] 265 | The wordlist(s) to use when directory busting. Separate multiple wordlists with spaces. Default: 266 | ['~/.local/share/AutoRecon/wordlists/dirbuster.txt'] 267 | --dirbuster.threads VALUE 268 | The number of threads to use when directory busting. Default: 10 269 | --dirbuster.ext VALUE 270 | The extensions you wish to fuzz (no dot, comma separated). Default: txt,html,php,asp,aspx,jsp 271 | --onesixtyone.community-strings VALUE 272 | The file containing a list of community strings to try. Default: /usr/share/seclists/Discovery/SNMP/common-snmp- 273 | community-strings-onesixtyone.txt 274 | 275 | global plugin arguments: 276 | These are optional arguments that can be used by all plugins. 277 | 278 | --global.username-wordlist VALUE 279 | A wordlist of usernames, useful for bruteforcing. Default: /usr/share/seclists/Usernames/top-usernames-shortlist.txt 280 | --global.password-wordlist VALUE 281 | A wordlist of passwords, useful for bruteforcing. Default: /usr/share/seclists/Passwords/darkweb2017-top100.txt 282 | --global.domain VALUE 283 | The domain to use (if known). Used for DNS and/or Active Directory. Default: None 284 | ``` 285 | 286 | ### Verbosity 287 | 288 | AutoRecon supports four levels of verbosity: 289 | 290 | * (none) Minimal output. AutoRecon will announce when scanning targets starts / ends. 291 | * (-v) Verbose output. AutoRecon will additionally announce when plugins start running, and report open ports and identified services. 292 | * (-vv) Very verbose output. AutoRecon will additionally specify the exact commands which are being run by plugins, highlight any patterns which are matched in command output, and announce when plugins end. 293 | * (-vvv) Very, very verbose output. AutoRecon will output everything. Literally every line from all commands which are currently running. When scanning multiple targets concurrently, this can lead to a ridiculous amount of output. It is not advised to use -vvv unless you absolutely need to see live output from commands. 294 | 295 | Note: You can change the verbosity of AutoRecon mid-scan by pressing the up and down arrow keys. 296 | 297 | ### Results 298 | 299 | By default, results will be stored in the ./results directory. A new sub directory is created for every target. The structure of this sub directory is: 300 | 301 | ``` 302 | . 303 | ├── exploit/ 304 | ├── loot/ 305 | ├── report/ 306 | │   ├── local.txt 307 | │   ├── notes.txt 308 | │   ├── proof.txt 309 | │   └── screenshots/ 310 | └── scans/ 311 | ├── _commands.log 312 | ├── _manual_commands.txt 313 | ├── tcp80/ 314 | ├── udp53/ 315 | └── xml/ 316 | ``` 317 | 318 | The exploit directory is intended to contain any exploit code you download / write for the target. 319 | 320 | The loot directory is intended to contain any loot (e.g. hashes, interesting files) you find on the target. 321 | 322 | The report directory contains some auto-generated files and directories that are useful for reporting: 323 | * local.txt can be used to store the local.txt flag found on targets. 324 | * notes.txt should contain a basic template where you can write notes for each service discovered. 325 | * proof.txt can be used to store the proof.txt flag found on targets. 326 | * The screenshots directory is intended to contain the screenshots you use to document the exploitation of the target. 327 | 328 | The scans directory is where all results from scans performed by AutoRecon will go. This includes port scans / service detection scans, as well as any service enumeration scans. It also contains two other files: 329 | * \_commands.log contains a list of every command AutoRecon ran against the target. This is useful if one of the commands fails and you want to run it again with modifications. 330 | * \_manual_commands.txt contains any commands that are deemed "too dangerous" to run automatically, either because they are too intrusive, require modification based on human analysis, or just work better when there is a human monitoring them. 331 | 332 | By default, directories are created for each open port (e.g. tcp80, udp53) and scan results for the services found on those ports are stored in their respective directories. You can disable this behavior using the --no-port-dirs command line option, and scan results will instead be stored in the scans directory itself. 333 | 334 | If a scan results in an error, a file called \_errors.log will also appear in the scans directory with some details to alert the user. 335 | 336 | If output matches a defined pattern, a file called \_patterns.log will also appear in the scans directory with details about the matched output. 337 | 338 | The scans/xml directory stores any XML output (e.g. from Nmap scans) separately from the main scan outputs, so that the scans directory itself does not get too cluttered. 339 | 340 | ## Testimonials 341 | 342 | > AutoRecon was invaluable during my OSCP exam, in that it saved me from the tedium of executing my active information gathering commands myself. I was able to start on a target with all of the information I needed clearly laid in front of me. I would strongly recommend this utility for anyone in the PWK labs, the OSCP exam, or other environments such as VulnHub or HTB. It is a great tool for both people just starting down their journey into OffSec and seasoned veterans alike. Just make sure that somewhere between those two points you take the time to learn what's going on "under the hood" and how / why it scans what it does. 343 | > 344 | >\- b0ats (rooted 5/5 exam hosts) 345 | 346 | > Wow, what a great find! Before using AutoRecon, ReconScan was my goto enumeration script for targets because it automatically ran the enumeration commands after it finds open ports. The only thing missing was the automatic creation of key directories a pentester might need during an engagement (exploit, loot, report, scans). Reconnoitre did this but didn't automatically run those commands for you. I thought ReconScan that was the bee's knees until I gave AutoRecon a try. It's awesome! It combines the best features of Reconnoitre (auto directory creation) and ReconScan (automatically executing the enumeration commands). All I have to do is run it on a target or a set of targets and start going over the information it has already collected while it continues the rest of scan. The proof is in the pudding :) Passed the OSCP exam! Kudos to Tib3rius! 347 | > 348 | >\- werk0ut 349 | 350 | > A friend told me about AutoRecon, so I gave it a try in the PWK labs. AutoRecon launches the common tools we all always use, whether it be nmap or nikto, and also creates a nice subfolder system based on the targets you are attacking. The strongest feature of AutoRecon is the speed; on the OSCP exam I left the tool running in the background while I started with another target, and in a matter of minutes I had all of the AutoRecon output waiting for me. AutoRecon creates a file full of commands that you should try manually, some of which may require tweaking (for example, hydra bruteforcing commands). It's good to have that extra checklist. 351 | > 352 | >\- tr3mb0 (rooted 4/5 exam hosts) 353 | 354 | > Being introduced to AutoRecon was a complete game changer for me while taking the OSCP and establishing my penetration testing methodology. AutoRecon is a multi-threaded reconnaissance tool that combines and automates popular enumeration tools to do most of the hard work for you. You can't get much better than that! After running AutoRecon on my OSCP exam hosts, I was given a treasure chest full of information that helped me to start on each host and pass on my first try. The best part of the tool is that it automatically launches further enumeration scans based on the initial port scans (e.g. run enum4linux if SMB is detected). The only bad part is that I did not use this tool sooner! Thanks Tib3rius. 355 | > 356 | >\- rufy (rooted 4/5 exam hosts) 357 | 358 | > AutoRecon allows a security researcher to iteratively scan hosts and identify potential attack vectors. Its true power comes in the form of performing scans in the background while the attacker is working on another host. I was able to start my scans and finish a specific host I was working on - and then return to find all relevant scans completed. I was then able to immediately begin trying to gain initial access instead of manually performing the active scanning process. I will continue to use AutoRecon in future penetration tests and CTFs, and highly recommend you do the same. 359 | > 360 | >\- waar (rooted 4.99/5 exam hosts) 361 | 362 | > "If you have to do a task more than twice a day, you need to automate it." That's a piece of advice that an old boss gave to me. AutoRecon takes that lesson to heart. Whether you're sitting in the exam, or in the PWK labs, you can fire off AutoRecon and let it work its magic. I had it running during my last exam while I worked on the buffer overflow. By the time I finished, all the enum data I needed was there for me to go through. 10/10 would recommend for anyone getting into CTF, and anyone who has been at this a long time. 363 | > 364 | >\- whoisflynn 365 | 366 | > I love this tool so much I wrote it. 367 | > 368 | >\- Tib3rius (rooted 5/5 exam hosts) 369 | 370 | > I highly recommend anyone going for their OSCP, doing CTFs or on HTB to checkout this tool. Been using AutoRecon on HTB for a month before using it over on the PWK labs and it helped me pass my OSCP exam. If you're having a hard time getting settled with an enumeration methodology I encourage you to follow the flow and techniques this script uses. It takes out a lot of the tedious work that you're probably used to while at the same time provide well-organized subdirectories to quickly look over so you don't lose your head. The manual commands it provides are great for those specific situations that need it when you have run out of options. It's a very valuable tool, cannot recommend enough. 371 | > 372 | >\- d0hnuts (rooted 5/5 exam hosts) 373 | 374 | > Autorecon is not just any other tool, it is a recon correlation framweork for engagements. This helped me fire a whole bunch of scans while I was working on other targets. This can help a lot in time management. This assisted me to own 4/5 boxes in pwk exam! Result: Passed! 375 | > 376 | >\- Wh0ami (rooted 4/5 exam hosts) 377 | 378 | > The first time I heard of AutoRecon I asked whether I actually needed this, my enumeration was OK... I tried it with an open mind and straight away was a little floored on the amount of information that it would generate. Once I got used to it, and started reading the output I realized how much I was missing. I used it for the OSCP exam, and it found things I would never have otherwise found. I firmly believe, without AutoRecon I would have failed. It's a great tool, and I'm very impressed what Tib3rius was able to craft up. Definitely something I'm already recommending to others, including you! 379 | > 380 | >\- othornew 381 | 382 | > AutoRecon helped me save valuable time in my OSCP exam, allowing me to spend less time scanning systems and more time breaking into them. This software is worth its weight in gold! 383 | > 384 | >\- TorHackr 385 | 386 | > The magical tool that made enumeration a piece of cake, just fire it up and watch the beauty of multi-threading spitting a ton of information that would have taken loads of commands to execute. I certainly believe that by just using AutoRecon in the OSCP exam, half of the effort would already be done. Strongly recommended! 387 | > 388 | >\- Arman (solved 4.5/5 exam hosts) 389 | -------------------------------------------------------------------------------- /autorecon.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | from autorecon.main import main 4 | 5 | if __name__ == '__main__': 6 | main() 7 | -------------------------------------------------------------------------------- /autorecon/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tib3rius/AutoRecon/fd87c99abc5ef8534f6caba2f3b2309308f5e962/autorecon/__init__.py -------------------------------------------------------------------------------- /autorecon/config.py: -------------------------------------------------------------------------------- 1 | import platformdirs, os 2 | 3 | config_dir = platformdirs.user_config_dir('AutoRecon') 4 | data_dir = platformdirs.user_data_dir('AutoRecon') 5 | 6 | configurable_keys = [ 7 | 'ports', 8 | 'max_scans', 9 | 'max_port_scans', 10 | 'tags', 11 | 'exclude_tags', 12 | 'port_scans', 13 | 'service_scans', 14 | 'reports', 15 | 'plugins_dir', 16 | 'add_plugins-dir', 17 | 'output', 18 | 'single_target', 19 | 'only_scans_dir', 20 | 'no_port_dirs', 21 | 'heartbeat', 22 | 'timeout', 23 | 'target_timeout', 24 | 'nmap', 25 | 'nmap_append', 26 | 'proxychains', 27 | 'disable_sanity_checks', 28 | 'disable_keyboard_control', 29 | 'ignore_plugin_checks', 30 | 'force_services', 31 | 'max_plugin_target_instances', 32 | 'max_plugin_global_instances', 33 | 'accessible', 34 | 'verbose' 35 | ] 36 | 37 | configurable_boolean_keys = [ 38 | 'single_target', 39 | 'only_scans_dir', 40 | 'no_port_dirs', 41 | 'proxychains', 42 | 'disable_sanity_checks', 43 | 'ignore_plugin_checks', 44 | 'accessible' 45 | ] 46 | 47 | config = { 48 | 'protected_classes': ['autorecon', 'target', 'service', 'commandstreamreader', 'plugin', 'portscan', 'report', 'servicescan', 'global', 'pattern'], 49 | 'service_exceptions': ['infocrypt', 'mc-nmf', 'ncacn_http', 'smux', 'status', 'tcpwrapped', 'unknown'], 50 | 'config_dir': config_dir, 51 | 'data_dir': data_dir, 52 | 'global_file': None, 53 | 'ports': None, 54 | 'max_scans': 50, 55 | 'max_port_scans': None, 56 | 'tags': 'default', 57 | 'exclude_tags': None, 58 | 'port_scans': None, 59 | 'service_scans': None, 60 | 'reports': None, 61 | 'plugins_dir': None, 62 | 'add_plugins_dir': None, 63 | 'output': 'results', 64 | 'single_target': False, 65 | 'only_scans_dir': False, 66 | 'no_port_dirs': False, 67 | 'heartbeat': 60, 68 | 'timeout': None, 69 | 'target_timeout': None, 70 | 'nmap': '-vv --reason -Pn -T4', 71 | 'nmap_append': '', 72 | 'proxychains': False, 73 | 'disable_sanity_checks': False, 74 | 'disable_keyboard_control': False, 75 | 'ignore_plugin_checks': False, 76 | 'force_services': None, 77 | 'max_plugin_target_instances': None, 78 | 'max_plugin_global_instances': None, 79 | 'accessible': False, 80 | 'verbose': 0 81 | } 82 | -------------------------------------------------------------------------------- /autorecon/config.toml: -------------------------------------------------------------------------------- 1 | # Configure regular AutoRecon options at the top of this file. 2 | 3 | # nmap-append = '-T3' 4 | # verbose = 1 5 | # max-scans = 30 6 | 7 | # Configure global options here. 8 | # [global] 9 | # username-wordlist = '/usr/share/seclists/Usernames/cirt-default-usernames.txt' 10 | 11 | # Configure plugin options here. 12 | # [dirbuster] 13 | # threads = 50 14 | # wordlist = [ 15 | # '/usr/share/seclists/Discovery/Web-Content/common.txt', 16 | # '/usr/share/seclists/Discovery/Web-Content/big.txt', 17 | # '/usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt' 18 | # ] 19 | -------------------------------------------------------------------------------- /autorecon/default-plugins/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tib3rius/AutoRecon/fd87c99abc5ef8534f6caba2f3b2309308f5e962/autorecon/default-plugins/__init__.py -------------------------------------------------------------------------------- /autorecon/default-plugins/bruteforce-ftp.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class BruteforceFTP(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Bruteforce FTP" 8 | self.tags = ['default', 'ftp'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^ftp', '^ftp\-data']) 12 | 13 | def manual(self, service, plugin_was_run): 14 | service.add_manual_commands('Bruteforce logins:', [ 15 | 'hydra -L "' + self.get_global('username_wordlist', default='/usr/share/seclists/Usernames/top-usernames-shortlist.txt') + '" -P "' + self.get_global('password_wordlist', default='/usr/share/seclists/Passwords/darkweb2017-top100.txt') + '" -e nsr -s {port} -o "{scandir}/{protocol}_{port}_ftp_hydra.txt" ftp://{addressv6}', 16 | 'medusa -U "' + self.get_global('username_wordlist', default='/usr/share/seclists/Usernames/top-usernames-shortlist.txt') + '" -P "' + self.get_global('password_wordlist', default='/usr/share/seclists/Passwords/darkweb2017-top100.txt') + '" -e ns -n {port} -O "{scandir}/{protocol}_{port}_ftp_medusa.txt" -M ftp -h {addressv6}' 17 | ]) 18 | -------------------------------------------------------------------------------- /autorecon/default-plugins/bruteforce-http.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class BruteforceHTTP(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Bruteforce HTTP" 8 | self.tags = ['default', 'http'] 9 | 10 | def configure(self): 11 | self.match_service_name('^http') 12 | self.match_service_name('^nacn_http$', negative_match=True) 13 | 14 | def manual(self, service, plugin_was_run): 15 | service.add_manual_commands('Credential bruteforcing commands (don\'t run these without modifying them):', [ 16 | 'hydra -L "' + self.get_global('username_wordlist', default='/usr/share/seclists/Usernames/top-usernames-shortlist.txt') + '" -P "' + self.get_global('password_wordlist', default='/usr/share/seclists/Passwords/darkweb2017-top100.txt') + '" -e nsr -s {port} -o "{scandir}/{protocol}_{port}_{http_scheme}_auth_hydra.txt" {http_scheme}-get://{addressv6}/path/to/auth/area', 17 | 'medusa -U "' + self.get_global('username_wordlist', default='/usr/share/seclists/Usernames/top-usernames-shortlist.txt') + '" -P "' + self.get_global('password_wordlist', default='/usr/share/seclists/Passwords/darkweb2017-top100.txt') + '" -e ns -n {port} -O "{scandir}/{protocol}_{port}_{http_scheme}_auth_medusa.txt" -M http -h {addressv6} -m DIR:/path/to/auth/area', 18 | 'hydra -L "' + self.get_global('username_wordlist', default='/usr/share/seclists/Usernames/top-usernames-shortlist.txt') + '" -P "' + self.get_global('password_wordlist', default='/usr/share/seclists/Passwords/darkweb2017-top100.txt') + '" -e nsr -s {port} -o "{scandir}/{protocol}_{port}_{http_scheme}_form_hydra.txt" {http_scheme}-post-form://{addressv6}/path/to/login.php:"username=^USER^&password=^PASS^":"invalid-login-message"', 19 | 'medusa -U "' + self.get_global('username_wordlist', default='/usr/share/seclists/Usernames/top-usernames-shortlist.txt') + '" -P "' + self.get_global('password_wordlist', default='/usr/share/seclists/Passwords/darkweb2017-top100.txt') + '" -e ns -n {port} -O "{scandir}/{protocol}_{port}_{http_scheme}_form_medusa.txt" -M web-form -h {addressv6} -m FORM:/path/to/login.php -m FORM-DATA:"post?username=&password=" -m DENY-SIGNAL:"invalid login message"' 20 | ]) 21 | -------------------------------------------------------------------------------- /autorecon/default-plugins/bruteforce-rdp.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class BruteforceRDP(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Bruteforce RDP" 8 | self.tags = ['default', 'rdp'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^rdp', '^ms\-wbt\-server', '^ms\-term\-serv']) 12 | 13 | def manual(self, service, plugin_was_run): 14 | service.add_manual_commands('Bruteforce logins:', [ 15 | 'hydra -L "' + self.get_global('username_wordlist', default='/usr/share/seclists/Usernames/top-usernames-shortlist.txt') + '" -P "' + self.get_global('password_wordlist', default='/usr/share/seclists/Passwords/darkweb2017-top100.txt') + '" -e nsr -s {port} -o "{scandir}/{protocol}_{port}_rdp_hydra.txt" rdp://{addressv6}', 16 | 'medusa -U "' + self.get_global('username_wordlist', default='/usr/share/seclists/Usernames/top-usernames-shortlist.txt') + '" -P "' + self.get_global('password_wordlist', default='/usr/share/seclists/Passwords/darkweb2017-top100.txt') + '" -e ns -n {port} -O "{scandir}/{protocol}_{port}_rdp_medusa.txt" -M rdp -h {addressv6}' 17 | ]) 18 | -------------------------------------------------------------------------------- /autorecon/default-plugins/bruteforce-smb.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class BruteforceSMB(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'Bruteforce SMB' 8 | self.tags = ['default', 'safe', 'active-directory'] 9 | 10 | def configure(self): 11 | self.match_service('tcp', 445, '^microsoft\-ds') 12 | self.match_service('tcp', 139, '^netbios') 13 | 14 | def manual(self, service, plugin_was_run): 15 | service.add_manual_command('Bruteforce SMB', [ 16 | 'crackmapexec smb {address} --port={port} -u "' + self.get_global('username_wordlist', default='/usr/share/seclists/Usernames/top-usernames-shortlist.txt') + '" -p "' + self.get_global('password_wordlist', default='/usr/share/seclists/Passwords/darkweb2017-top100.txt') + '"' 17 | ]) 18 | -------------------------------------------------------------------------------- /autorecon/default-plugins/bruteforce-ssh.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class BruteforceSSH(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Bruteforce SSH" 8 | self.tags = ['default', 'ssh'] 9 | 10 | def configure(self): 11 | self.match_service_name('ssh') 12 | 13 | def manual(self, service, plugin_was_run): 14 | service.add_manual_command('Bruteforce logins:', [ 15 | 'hydra -L "' + self.get_global('username_wordlist', default='/usr/share/seclists/Usernames/top-usernames-shortlist.txt') + '" -P "' + self.get_global('password_wordlist', default='/usr/share/seclists/Passwords/darkweb2017-top100.txt') + '" -e nsr -s {port} -o "{scandir}/{protocol}_{port}_ssh_hydra.txt" ssh://{addressv6}', 16 | 'medusa -U "' + self.get_global('username_wordlist', default='/usr/share/seclists/Usernames/top-usernames-shortlist.txt') + '" -P "' + self.get_global('password_wordlist', default='/usr/share/seclists/Passwords/darkweb2017-top100.txt') + '" -e ns -n {port} -O "{scandir}/{protocol}_{port}_ssh_medusa.txt" -M ssh -h {addressv6}' 17 | ]) 18 | -------------------------------------------------------------------------------- /autorecon/default-plugins/curl-known-security.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | from autorecon.io import fformat 3 | 4 | class CurlKnownSecurity(ServiceScan): 5 | 6 | def __init__(self): 7 | super().__init__() 8 | self.name = "Known Security" 9 | self.tags = ['default', 'safe', 'http'] 10 | 11 | def configure(self): 12 | self.match_service_name('^http') 13 | self.match_service_name('^nacn_http$', negative_match=True) 14 | 15 | async def run(self, service): 16 | if service.protocol == 'tcp': 17 | process, stdout, _ = await service.execute('curl -sSikf {http_scheme}://{addressv6}:{port}/.well-known/security.txt', future_outfile='{protocol}_{port}_{http_scheme}_known-security.txt') 18 | 19 | lines = await stdout.readlines() 20 | 21 | if process.returncode == 0 and lines: 22 | filename = fformat('{scandir}/{protocol}_{port}_{http_scheme}_known-security.txt') 23 | with open(filename, mode='wt', encoding='utf8') as robots: 24 | robots.write('\n'.join(lines)) 25 | else: 26 | service.info('{bblue}[' + fformat('{tag}') + ']{rst} There did not appear to be a .well-known/security.txt file in the webroot (/).') 27 | -------------------------------------------------------------------------------- /autorecon/default-plugins/curl-robots.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | from autorecon.io import fformat 3 | 4 | class CurlRobots(ServiceScan): 5 | 6 | def __init__(self): 7 | super().__init__() 8 | self.name = "Curl Robots" 9 | self.tags = ['default', 'safe', 'http'] 10 | 11 | def configure(self): 12 | self.match_service_name('^http') 13 | self.match_service_name('^nacn_http$', negative_match=True) 14 | 15 | async def run(self, service): 16 | if service.protocol == 'tcp': 17 | process, stdout, _ = await service.execute('curl -sSikf {http_scheme}://{addressv6}:{port}/robots.txt', future_outfile='{protocol}_{port}_{http_scheme}_curl-robots.txt') 18 | 19 | lines = await stdout.readlines() 20 | 21 | if process.returncode == 0 and lines: 22 | filename = fformat('{scandir}/{protocol}_{port}_{http_scheme}_curl-robots.txt') 23 | with open(filename, mode='wt', encoding='utf8') as robots: 24 | robots.write('\n'.join(lines)) 25 | else: 26 | service.info('{bblue}[' + fformat('{tag}') + ']{rst} There did not appear to be a robots.txt file in the webroot (/).') 27 | -------------------------------------------------------------------------------- /autorecon/default-plugins/curl.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class Curl(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Curl" 8 | self.tags = ['default', 'safe', 'http'] 9 | 10 | def configure(self): 11 | self.add_option("path", default="/", help="The path on the web server to curl. Default: %(default)s") 12 | self.match_service_name('^http') 13 | self.match_service_name('^nacn_http$', negative_match=True) 14 | self.add_pattern('(?i)powered[ -]by[^\n]+') 15 | 16 | async def run(self, service): 17 | if service.protocol == 'tcp': 18 | await service.execute('curl -sSik {http_scheme}://{addressv6}:{port}' + self.get_option('path'), outfile='{protocol}_{port}_{http_scheme}_curl.html') 19 | -------------------------------------------------------------------------------- /autorecon/default-plugins/dirbuster.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | from autorecon.config import config 3 | from shutil import which 4 | import os 5 | 6 | class DirBuster(ServiceScan): 7 | 8 | def __init__(self): 9 | super().__init__() 10 | self.name = "Directory Buster" 11 | self.slug = 'dirbuster' 12 | self.priority = 0 13 | self.tags = ['default', 'safe', 'long', 'http'] 14 | 15 | def configure(self): 16 | self.add_choice_option('tool', default='feroxbuster', choices=['feroxbuster', 'gobuster', 'dirsearch', 'ffuf', 'dirb'], help='The tool to use for directory busting. Default: %(default)s') 17 | self.add_list_option('wordlist', default=[os.path.join(config['data_dir'], 'wordlists', 'dirbuster.txt')], help='The wordlist(s) to use when directory busting. Separate multiple wordlists with spaces. Default: %(default)s') 18 | self.add_option('threads', default=10, help='The number of threads to use when directory busting. Default: %(default)s') 19 | self.add_option('ext', default='txt,html,php,asp,aspx,jsp', help='The extensions you wish to fuzz (no dot, comma separated). Default: %(default)s') 20 | self.add_true_option('recursive', help='Enables recursive searching (where available). Warning: This may cause significant increases to scan times. Default: %(default)s') 21 | self.add_option('extras', default='', help='Any extra options you wish to pass to the tool when it runs. e.g. --dirbuster.extras=\'-s 200,301 --discover-backup\'') 22 | self.match_service_name('^http') 23 | self.match_service_name('^nacn_http$', negative_match=True) 24 | 25 | def check(self): 26 | tool = self.get_option('tool') 27 | if tool == 'feroxbuster' and which('feroxbuster') is None: 28 | self.error('The feroxbuster program could not be found. Make sure it is installed. (On Kali, run: sudo apt install feroxbuster)') 29 | return False 30 | elif tool == 'gobuster' and which('gobuster') is None: 31 | self.error('The gobuster program could not be found. Make sure it is installed. (On Kali, run: sudo apt install gobuster)') 32 | return False 33 | elif tool == 'dirsearch' and which('dirsearch') is None: 34 | self.error('The dirsearch program could not be found. Make sure it is installed. (On Kali, run: sudo apt install dirsearch)') 35 | return False 36 | elif tool == 'ffuf' and which('ffuf') is None: 37 | self.error('The ffuf program could not be found. Make sure it is installed. (On Kali, run: sudo apt install ffuf)') 38 | return False 39 | elif tool == 'dirb' and which('dirb') is None: 40 | self.error('The dirb program could not be found. Make sure it is installed. (On Kali, run: sudo apt install dirb)') 41 | return False 42 | 43 | async def run(self, service): 44 | dot_extensions = ','.join(['.' + x for x in self.get_option('ext').split(',')]) 45 | for wordlist in self.get_option('wordlist'): 46 | name = os.path.splitext(os.path.basename(wordlist))[0] 47 | if self.get_option('tool') == 'feroxbuster': 48 | await service.execute('feroxbuster -u {http_scheme}://{addressv6}:{port}/ -t ' + str(self.get_option('threads')) + ' -w ' + wordlist + ' -x "' + self.get_option('ext') + '" -v -k ' + ('' if self.get_option('recursive') else '-n ') + '-q -e -r -o "{scandir}/{protocol}_{port}_{http_scheme}_feroxbuster_' + name + '.txt"' + (' ' + self.get_option('extras') if self.get_option('extras') else '')) 49 | 50 | elif self.get_option('tool') == 'gobuster': 51 | await service.execute('gobuster dir -u {http_scheme}://{addressv6}:{port}/ -t ' + str(self.get_option('threads')) + ' -w ' + wordlist + ' -e -k -x "' + self.get_option('ext') + '" -z -r -o "{scandir}/{protocol}_{port}_{http_scheme}_gobuster_' + name + '.txt"' + (' ' + self.get_option('extras') if self.get_option('extras') else '')) 52 | 53 | elif self.get_option('tool') == 'dirsearch': 54 | if service.target.ipversion == 'IPv6': 55 | service.error('dirsearch does not support IPv6.') 56 | else: 57 | await service.execute('dirsearch -u {http_scheme}://{address}:{port}/ -t ' + str(self.get_option('threads')) + ' -e "' + self.get_option('ext') + '" -f -q -F ' + ('-r ' if self.get_option('recursive') else '') + '-w ' + wordlist + ' --format=plain -o "{scandir}/{protocol}_{port}_{http_scheme}_dirsearch_' + name + '.txt"' + (' ' + self.get_option('extras') if self.get_option('extras') else '')) 58 | 59 | elif self.get_option('tool') == 'ffuf': 60 | await service.execute('ffuf -u {http_scheme}://{addressv6}:{port}/FUZZ -t ' + str(self.get_option('threads')) + ' -w ' + wordlist + ' -e "' + dot_extensions + '" -v -r ' + ('-recursion ' if self.get_option('recursive') else '') + '-noninteractive' + (' ' + self.get_option('extras') if self.get_option('extras') else '') + ' | tee {scandir}/{protocol}_{port}_{http_scheme}_ffuf_' + name + '.txt') 61 | 62 | elif self.get_option('tool') == 'dirb': 63 | await service.execute('dirb {http_scheme}://{addressv6}:{port}/ ' + wordlist + ' -l ' + ('' if self.get_option('recursive') else '-r ') + '-S -X ",' + dot_extensions + '" -f -o "{scandir}/{protocol}_{port}_{http_scheme}_dirb_' + name + '.txt"' + (' ' + self.get_option('extras') if self.get_option('extras') else '')) 64 | 65 | def manual(self, service, plugin_was_run): 66 | dot_extensions = ','.join(['.' + x for x in self.get_option('ext').split(',')]) 67 | if self.get_option('tool') == 'feroxbuster': 68 | service.add_manual_command('(feroxbuster) Multi-threaded recursive directory/file enumeration for web servers using various wordlists:', [ 69 | 'feroxbuster -u {http_scheme}://{addressv6}:{port} -t ' + str(self.get_option('threads')) + ' -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x "' + self.get_option('ext') + '" -v -k ' + ('' if self.get_option('recursive') else '-n ') + '-e -r -o {scandir}/{protocol}_{port}_{http_scheme}_feroxbuster_dirbuster.txt' + (' ' + self.get_option('extras') if self.get_option('extras') else '') 70 | ]) 71 | elif self.get_option('tool') == 'gobuster': 72 | service.add_manual_command('(gobuster v3) Multi-threaded directory/file enumeration for web servers using various wordlists:', [ 73 | 'gobuster dir -u {http_scheme}://{addressv6}:{port}/ -t ' + str(self.get_option('threads')) + ' -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -e -k -x "' + self.get_option('ext') + '" -r -o "{scandir}/{protocol}_{port}_{http_scheme}_gobuster_dirbuster.txt"' + (' ' + self.get_option('extras') if self.get_option('extras') else '') 74 | ]) 75 | elif self.get_option('tool') == 'dirsearch': 76 | if service.target.ipversion == 'IPv4': 77 | service.add_manual_command('(dirsearch) Multi-threaded recursive directory/file enumeration for web servers using various wordlists:', [ 78 | 'dirsearch -u {http_scheme}://{address}:{port}/ -t ' + str(self.get_option('threads')) + ' -e "' + self.get_option('ext') + '" -f -F ' + ('-r ' if self.get_option('recursive') else '') + '-w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt --format=plain --output="{scandir}/{protocol}_{port}_{http_scheme}_dirsearch_dirbuster.txt"' + (' ' + self.get_option('extras') if self.get_option('extras') else '') 79 | ]) 80 | elif self.get_option('tool') == 'ffuf': 81 | service.add_manual_command('(ffuf) Multi-threaded recursive directory/file enumeration for web servers using various wordlists:', [ 82 | 'ffuf -u {http_scheme}://{addressv6}:{port}/FUZZ -t ' + str(self.get_option('threads')) + ' -w /usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt -e "' + dot_extensions + '" -v -r ' + ('-recursion ' if self.get_option('recursive') else '') + '-noninteractive' + (' ' + self.get_option('extras') if self.get_option('extras') else '') + ' | tee {scandir}/{protocol}_{port}_{http_scheme}_ffuf_dirbuster.txt' 83 | ]) 84 | elif self.get_option('tool') == 'dirb': 85 | service.add_manual_command('(dirb) Recursive directory/file enumeration for web servers using various wordlists:', [ 86 | 'dirb {http_scheme}://{addressv6}:{port}/ /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -l ' + ('' if self.get_option('recursive') else '-r ') + '-X ",' + dot_extensions + '" -f -o "{scandir}/{protocol}_{port}_{http_scheme}_dirb_dirbuster.txt"' + (' ' + self.get_option('extras') if self.get_option('extras') else '') 87 | ]) 88 | -------------------------------------------------------------------------------- /autorecon/default-plugins/dns-reverse-lookup.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class DNSReverseLookup(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'DNS Reverse Lookup' 8 | self.tags = ['default', 'safe', 'dns'] 9 | 10 | def configure(self): 11 | self.match_service_name('^domain') 12 | 13 | async def run(self, service): 14 | await service.execute('dig -p {port} -x {address} @{address}', outfile='{protocol}_{port}_dns_reverse-lookup.txt') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/dns-zone-transfer.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class DNSZoneTransfer(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'DNS Zone Transfer' 8 | self.tags = ['default', 'safe', 'dns'] 9 | 10 | def configure(self): 11 | self.match_service_name('^domain') 12 | 13 | async def run(self, service): 14 | if self.get_global('domain'): 15 | await service.execute('dig AXFR -p {port} @{address} ' + self.get_global('domain'), outfile='{protocol}_{port}_dns_zone-transfer-domain.txt') 16 | if service.target.type == 'hostname': 17 | await service.execute('dig AXFR -p {port} @{address} {address}', outfile='{protocol}_{port}_dns_zone-transfer-hostname.txt') 18 | await service.execute('dig AXFR -p {port} @{address}', outfile='{protocol}_{port}_dns_zone-transfer.txt') 19 | -------------------------------------------------------------------------------- /autorecon/default-plugins/dnsrecon-subdomain-bruteforce.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | from shutil import which 3 | 4 | class DnsReconSubdomainBruteforce(ServiceScan): 5 | 6 | def __init__(self): 7 | super().__init__() 8 | self.name = "DnsRecon Bruteforce Subdomains" 9 | self.slug = 'dnsrecon-brute' 10 | self.priority = 0 11 | self.tags = ['default', 'safe', 'long', 'dns'] 12 | 13 | def configure(self): 14 | self.match_service_name('^domain') 15 | 16 | def check(self): 17 | if which('dnsrecon') is None: 18 | self.error('The program dnsrecon could not be found. Make sure it is installed. (On Kali, run: sudo apt install dnsrecon)') 19 | return False 20 | 21 | def manual(self, service, plugin_was_run): 22 | domain_name = '' 23 | if self.get_global('domain'): 24 | domain_name = self.get_global('domain') 25 | service.add_manual_command('Use dnsrecon to bruteforce subdomains of a DNS domain.', [ 26 | 'dnsrecon -n {address} -d ' + domain_name + ' -D /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt -t brt 2>&1 | tee {scandir}/{protocol}_{port}_dnsrecon_subdomain_bruteforce.txt', 27 | ]) 28 | -------------------------------------------------------------------------------- /autorecon/default-plugins/dnsrecon.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | from shutil import which 3 | 4 | class DnsRecon(ServiceScan): 5 | 6 | def __init__(self): 7 | super().__init__() 8 | self.name = "DnsRecon Default Scan" 9 | self.slug = 'dnsrecon' 10 | self.priority = 0 11 | self.tags = ['default', 'safe', 'dns'] 12 | 13 | def configure(self): 14 | self.match_service_name('^domain') 15 | 16 | def check(self): 17 | if which('dnsrecon') is None: 18 | self.error('The program dnsrecon could not be found. Make sure it is installed. (On Kali, run: sudo apt install dnsrecon)') 19 | return False 20 | 21 | def manual(self, service, plugin_was_run): 22 | service.add_manual_command('Use dnsrecon to automatically query data from the DNS server. You must specify the target domain name.', [ 23 | 'dnsrecon -n {address} -d 2>&1 | tee {scandir}/{protocol}_{port}_dnsrecon_default_manual.txt' 24 | ]) 25 | 26 | async def run(self, service): 27 | if self.get_global('domain'): 28 | await service.execute('dnsrecon -n {address} -d ' + self.get_global('domain') + ' 2>&1', outfile='{protocol}_{port}_dnsrecon_default.txt') 29 | else: 30 | service.error('A domain name was not specified in the command line options (--global.domain). If you know the domain name, look in the _manual_commands.txt file for the dnsrecon command.') 31 | -------------------------------------------------------------------------------- /autorecon/default-plugins/enum4linux.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | from shutil import which 3 | 4 | class Enum4Linux(ServiceScan): 5 | 6 | def __init__(self): 7 | super().__init__() 8 | self.name = "Enum4Linux" 9 | self.tags = ['default', 'safe', 'active-directory'] 10 | 11 | def configure(self): 12 | self.add_choice_option('tool', default=('enum4linux-ng' if which('enum4linux-ng') else 'enum4linux'), choices=['enum4linux-ng', 'enum4linux'], help='The tool to use for doing Windows and Samba enumeration. Default: %(default)s') 13 | self.match_service_name(['^ldap', '^smb', '^microsoft\-ds', '^netbios']) 14 | self.match_port('tcp', [139, 389, 445]) 15 | self.match_port('udp', 137) 16 | self.run_once(True) 17 | 18 | def check(self): 19 | tool = self.get_option('tool') 20 | if tool == 'enum4linux' and which('enum4linux') is None: 21 | self.error('The enum4linux program could not be found. Make sure it is installed. (On Kali, run: sudo apt install enum4linux)') 22 | return False 23 | elif tool == 'enum4linux-ng' and which('enum4linux-ng') is None: 24 | self.error('The enum4linux-ng program could not be found. Make sure it is installed. (https://github.com/cddmp/enum4linux-ng)') 25 | return False 26 | 27 | async def run(self, service): 28 | if service.target.ipversion == 'IPv4': 29 | tool = self.get_option('tool') 30 | if tool is not None: 31 | if tool == 'enum4linux': 32 | await service.execute('enum4linux -a -M -l -d {address} 2>&1', outfile='enum4linux.txt') 33 | elif tool == 'enum4linux-ng': 34 | await service.execute('enum4linux-ng -A -d -v {address} 2>&1', outfile='enum4linux-ng.txt') 35 | -------------------------------------------------------------------------------- /autorecon/default-plugins/get-arch.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class GetArch(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'get-arch' 8 | self.tags = ['default', 'safe', 'rpc'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^msrpc']) 12 | self.match_port('tcp', 135) 13 | self.add_pattern(' is ((32|64)-bit)', description='Identified Architecture: {match1}') 14 | 15 | async def run(self, service): 16 | await service.execute('impacket-getArch -target {address}', outfile='{protocol}_{port}_rpc_architecture.txt') 17 | -------------------------------------------------------------------------------- /autorecon/default-plugins/hostname-discovery.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | import requests 3 | from urllib.parse import urlparse 4 | import urllib3 5 | 6 | urllib3.disable_warnings() 7 | 8 | class RedirectHostnameDiscovery(ServiceScan): 9 | 10 | def __init__(self): 11 | super().__init__() 12 | self.name = 'Redirect Hostname Discovery' 13 | self.slug = 'redirect-host-discovery' 14 | self.tags = ['default', 'http', 'quick'] 15 | 16 | def configure(self): 17 | self.match_service_name('^http') 18 | self.match_service_name('^nacn_http$', negative_match=True) 19 | 20 | async def run(self, service): 21 | try: 22 | url = f"{'https' if service.secure else 'http'}://{service.target.address}:{service.port}/" 23 | resp = requests.get(url, verify=False, allow_redirects=False) 24 | 25 | if 'Location' in resp.headers: 26 | location = resp.headers['Location'] 27 | parsed = urlparse(location) 28 | redirect_host = parsed.hostname 29 | 30 | if redirect_host: 31 | service.info(f"[+] Redirect detected: {url} → {location}") 32 | service.info(f"[+] Hostname found in redirect: {redirect_host}") 33 | else: 34 | service.info(f"[+] Redirect detected, but no hostname could be parsed: {location}") 35 | else: 36 | service.info(f"[-] No redirect detected at {url}") 37 | 38 | except Exception as e: 39 | service.error(f"[!] Error during redirect check on {service.target.address}:{service.port} — {e}") 40 | -------------------------------------------------------------------------------- /autorecon/default-plugins/ldap-search.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class LDAPSearch(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'LDAP Search' 8 | self.tags = ['default', 'safe', 'ldap', 'active-directory'] 9 | 10 | def configure(self): 11 | self.match_service_name('^ldap') 12 | 13 | def manual(self, service, plugin_was_run): 14 | service.add_manual_command('ldapsearch command (modify before running):', [ 15 | 'ldapsearch -x -D "" -w "" -H ldap://{address}:{port} -b "dc=example,dc=com" -s sub "(objectclass=*)" 2>&1 | tee > "{scandir}/{protocol}_{port}_ldap_all-entries.txt"' 16 | ]) 17 | -------------------------------------------------------------------------------- /autorecon/default-plugins/lookup-sid.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class LookupSID(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'lookupsid' 8 | self.tags = ['default', 'safe', 'active-directory'] 9 | 10 | def configure(self): 11 | self.match_service('tcp', 445, '^microsoft\-ds') 12 | 13 | def manual(self, service, plugin_was_run): 14 | service.add_manual_command('Lookup SIDs', [ 15 | 'impacket-lookupsid \'[username]:[password]@{address}\'' 16 | ]) 17 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nbtscan.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NBTScan(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'nbtscan' 8 | self.tags = ['default', 'safe', 'netbios', 'active-directory'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^smb', '^microsoft\-ds', '^netbios']) 12 | self.match_port('udp', 137) 13 | self.run_once(True) 14 | 15 | async def run(self, service): 16 | if service.target.ipversion == 'IPv4': 17 | await service.execute('nbtscan -rvh {ipaddress} 2>&1', outfile='nbtscan.txt') 18 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nikto.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class Nikto(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'nikto' 8 | self.tags = ['default', 'safe', 'long', 'http'] 9 | 10 | def configure(self): 11 | self.match_service_name('^http') 12 | self.match_service_name('^nacn_http$', negative_match=True) 13 | 14 | async def run(self, service): 15 | if service.target.ipversion == 'IPv4': 16 | await service.execute('nikto -ask=no -Tuning=x4567890ac -nointeractive -host {http_scheme}://{address}:{port} 2>&1 | tee "{scandir}/{protocol}_{port}_{http_scheme}_nikto.txt"') 17 | 18 | def manual(self, service, plugin_was_run): 19 | if service.target.ipversion == 'IPv4' and not plugin_was_run: 20 | service.add_manual_command('(nikto) old but generally reliable web server enumeration tool:', 'nikto -ask=no -h {http_scheme}://{address}:{port} 2>&1 | tee "{scandir}/{protocol}_{port}_{http_scheme}_nikto.txt"') 21 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-ajp.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapAJP(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'Nmap AJP' 8 | self.tags = ['default', 'safe', 'ajp'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^ajp13']) 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(ajp-* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_ajp_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_ajp_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-cassandra.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapCassandra(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap Cassandra" 8 | self.tags = ['default', 'safe', 'cassandra'] 9 | 10 | def configure(self): 11 | self.match_service_name('^apani1') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(cassandra* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_cassandra_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_cassandra_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-cups.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapCUPS(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap CUPS" 8 | self.tags = ['default', 'safe', 'cups'] 9 | 10 | def configure(self): 11 | self.match_service_name('^ipp') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(cups* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_cups_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_cups_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-distccd.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapDistccd(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap distccd" 8 | self.tags = ['default', 'safe', 'distccd'] 9 | 10 | def configure(self): 11 | self.match_service_name('^distccd') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,distcc-cve2004-2687" --script-args="distcc-cve2004-2687.cmd=id" -oN "{scandir}/{protocol}_{port}_distcc_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_distcc_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-dns.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapDNS(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'Nmap DNS' 8 | self.tags = ['default', 'safe', 'dns'] 9 | 10 | def configure(self): 11 | self.match_service_name('^domain') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(dns* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_dns_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_dns_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-finger.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapFinger(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap finger" 8 | self.tags = ['default', 'safe', 'finger'] 9 | 10 | def configure(self): 11 | self.match_service_name('^finger') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,finger" -oN "{scandir}/{protocol}_{port}_finger_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_finger_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-ftp.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapFTP(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'Nmap FTP' 8 | self.tags = ['default', 'safe', 'ftp'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^ftp', '^ftp\-data']) 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(ftp* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_ftp_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_ftp_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-http.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapHTTP(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap HTTP" 8 | self.tags = ['default', 'safe', 'http'] 9 | 10 | def configure(self): 11 | self.match_service_name('^http') 12 | self.match_service_name('^nacn_http$', negative_match=True) 13 | self.add_pattern('Server: ([^\n]+)', description='Identified HTTP Server: {match1}') 14 | self.add_pattern('WebDAV is ENABLED', description='WebDAV is enabled') 15 | 16 | async def run(self, service): 17 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(http* or ssl*) and not (brute or broadcast or dos or external or http-slowloris* or fuzzer)" -oN "{scandir}/{protocol}_{port}_{http_scheme}_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_{http_scheme}_nmap.xml" {address}') 18 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-imap.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapIMAP(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap IMAP" 8 | self.tags = ['default', 'safe', 'imap', 'email'] 9 | 10 | def configure(self): 11 | self.match_service_name('^imap') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(imap* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_imap_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_imap_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-irc.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapIrc(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'Nmap IRC' 8 | self.tags = ['default', 'safe', 'irc'] 9 | 10 | def configure(self): 11 | self.match_service_name('^irc') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV --script irc-botnet-channels,irc-info,irc-unrealircd-backdoor -oN "{scandir}/{protocol}_{port}_irc_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_irc_nmap.xml" -p {port} {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-kerberos.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapKerberos(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap Kerberos" 8 | self.tags = ['default', 'safe', 'kerberos', 'active-directory'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^kerberos', '^kpasswd']) 12 | 13 | async def run(self, service): 14 | if self.get_global('domain') and self.get_global('username-wordlist'): 15 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,krb5-enum-users" --script-args krb5-enum-users.realm="' + self.get_global('domain') + '",userdb="' + self.get_global('username-wordlist') + '" -oN "{scandir}/{protocol}_{port}_kerberos_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_kerberos_nmap.xml" {address}') 16 | else: 17 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,krb5-enum-users" -oN "{scandir}/{protocol}_{port}_kerberos_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_kerberos_nmap.xml" {address}') 18 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-ldap.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapLDAP(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap LDAP" 8 | self.tags = ['default', 'safe', 'ldap', 'active-directory'] 9 | 10 | def configure(self): 11 | self.match_service_name('^ldap') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(ldap* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_ldap_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_ldap_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-mongodb.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapMongoDB(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap MongoDB" 8 | self.tags = ['default', 'safe', 'databases'] 9 | 10 | def configure(self): 11 | self.match_service_name('^mongod') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(mongodb* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_mongodb_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_mongodb_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-mountd.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapMountd(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap Mountd" 8 | self.tags = ['default', 'safe', 'nfs'] 9 | 10 | def configure(self): 11 | self.match_service_name('^mountd') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,nfs* and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_mountd_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_mountd_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-msrpc.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapRPC(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap MSRPC" 8 | self.tags = ['default', 'rpc'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^msrpc', '^rpcbind', '^erpc']) 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,msrpc-enum,rpc-grind,rpcinfo" -oN "{scandir}/{protocol}_{port}_rpc_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_rpc_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-mssql.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapMSSQL(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap MSSQL" 8 | self.tags = ['default', 'safe', 'databases'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^mssql', '^ms\-sql']) 12 | 13 | def manual(self, service, plugin_was_run): 14 | if service.target.ipversion == 'IPv4': 15 | service.add_manual_command('(sqsh) interactive database shell:', 'sqsh -U -P -S {address}:{port}') 16 | 17 | async def run(self, service): 18 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(ms-sql* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" --script-args="mssql.instance-port={port},mssql.username=sa,mssql.password=sa" -oN "{scandir}/{protocol}_{port}_mssql_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_mssql_nmap.xml" {address}') 19 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-multicast-dns.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapMulticastDNS(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'Nmap Multicast DNS' 8 | self.tags = ['default', 'safe', 'dns'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^mdns', '^zeroconf']) 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(dns* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_multicastdns_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_multicastdns_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-mysql.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapMYSQL(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap MYSQL" 8 | self.tags = ['default', 'safe', 'databases'] 9 | 10 | def configure(self): 11 | self.match_service_name('^mysql') 12 | 13 | def manual(self, service, plugin_was_run): 14 | if service.target.ipversion == 'IPv4': 15 | service.add_manual_command('(sqsh) interactive database shell:', 'sqsh -U -P -S {address}:{port}') 16 | 17 | async def run(self, service): 18 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(mysql* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_mysql_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_mysql_nmap.xml" {address}') 19 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-nfs.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapNFS(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap NFS" 8 | self.tags = ['default', 'safe', 'nfs'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^nfs', '^rpcbind']) 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(rpcinfo or nfs*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_nfs_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_nfs_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-nntp.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapNNTP(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap NNTP" 8 | self.tags = ['default', 'safe', 'nntp'] 9 | 10 | def configure(self): 11 | self.match_service_name('^nntp') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,nntp-ntlm-info" -oN "{scandir}/{protocol}_{port}_nntp_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_nntp_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-ntp.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapNTP(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap NTP" 8 | self.tags = ['default', 'safe', 'ntp'] 9 | 10 | def configure(self): 11 | self.match_service_name('^ntp') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(ntp* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_ntp_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_ntp_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-oracle.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapOracle(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap Oracle" 8 | self.tags = ['default', 'safe', 'databases'] 9 | 10 | def configure(self): 11 | self.match_service_name('^oracle') 12 | 13 | def manual(self, service, plugin_was_run): 14 | service.add_manual_command('Brute-force SIDs using Nmap:', 'nmap {nmap_extra} -sV -p {port} --script="banner,oracle-sid-brute" -oN "{scandir}/{protocol}_{port}_oracle_sid-brute_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_oracle_sid-brute_nmap.xml" {address}') 15 | 16 | async def run(self, service): 17 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(oracle* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_oracle_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_oracle_nmap.xml" {address}') 18 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-pop3.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapPOP3(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap POP3" 8 | self.tags = ['default', 'safe', 'pop3', 'email'] 9 | 10 | def configure(self): 11 | self.match_service_name('^pop3') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(pop3* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_pop3_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_pop3_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-rdp.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapRDP(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap RDP" 8 | self.tags = ['default', 'safe', 'rdp'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^rdp', '^ms\-wbt\-server', '^ms\-term\-serv']) 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(rdp* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_rdp_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_rdp_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-redis.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapRedis(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'Nmap Redis' 8 | self.tags = ['default', 'safe', 'redis'] 9 | 10 | def configure(self): 11 | self.match_service_name('^redis$') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,redis-info" -oN "{scandir}/{protocol}_{port}_redis_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_redis_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-rmi.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapRMI(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap RMI" 8 | self.tags = ['default', 'safe', 'rmi'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^java\-rmi', '^rmiregistry']) 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,rmi-vuln-classloader,rmi-dumpregistry" -oN "{scandir}/{protocol}_{port}_rmi_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_rmi_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-rsync.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapRsync(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'Nmap Rsync' 8 | self.tags = ['default', 'safe', 'rsync'] 9 | 10 | def configure(self): 11 | self.match_service_name('^rsync') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(rsync* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_rsync_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_rsync_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-sip.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapSIP(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap SIP" 8 | self.tags = ['default', 'safe', 'sip'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^asterisk', '^sip']) 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,sip-enum-users,sip-methods" -oN "{scandir}/{protocol}_{port}_sip_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_sip_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-smb.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapSMB(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap SMB" 8 | self.tags = ['default', 'safe', 'smb', 'active-directory'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^smb', '^microsoft\-ds', '^netbios']) 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(nbstat or smb* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_smb_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_smb_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-smtp.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapSMTP(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap SMTP" 8 | self.tags = ['default', 'safe', 'smtp', 'email'] 9 | 10 | def configure(self): 11 | self.match_service_name('^smtp') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(smtp* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_smtp_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_smtp_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-snmp.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapSNMP(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap SNMP" 8 | self.tags = ['default', 'safe', 'snmp'] 9 | 10 | def configure(self): 11 | self.match_service_name('^snmp') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(snmp* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" -oN "{scandir}/{protocol}_{port}_snmp-nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_snmp_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-ssh.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapSSH(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Nmap SSH" 8 | self.tags = ['default', 'safe', 'ssh'] 9 | 10 | def configure(self): 11 | self.match_service_name('^ssh') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,ssh2-enum-algos,ssh-hostkey,ssh-auth-methods" -oN "{scandir}/{protocol}_{port}_ssh_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_ssh_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-telnet.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapTelnet(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'Nmap Telnet' 8 | self.tags = ['default', 'safe', 'telnet'] 9 | 10 | def configure(self): 11 | self.match_service_name('^telnet') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,telnet-encryption,telnet-ntlm-info" -oN "{scandir}/{protocol}_{port}_telnet-nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_telnet_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-tftp.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapTFTP(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'Nmap TFTP' 8 | self.tags = ['default', 'safe', 'tftp'] 9 | 10 | def configure(self): 11 | self.match_service_name('^tftp') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,tftp-enum" -oN "{scandir}/{protocol}_{port}_tftp-nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_tftp_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/nmap-vnc.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class NmapVNC(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'Nmap VNC' 8 | self.tags = ['default', 'safe', 'vnc'] 9 | 10 | def configure(self): 11 | self.match_service_name('^vnc') 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="banner,(vnc* or realvnc* or ssl*) and not (brute or broadcast or dos or external or fuzzer)" --script-args="unsafe=1" -oN "{scandir}/{protocol}_{port}_vnc_nmap.txt" -oX "{scandir}/xml/{protocol}_{port}_vnc_nmap.xml" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/onesixtyone.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class OneSixtyOne(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "OneSixtyOne" 8 | self.tags = ['default', 'safe', 'snmp'] 9 | 10 | def configure(self): 11 | self.match_service_name('^snmp') 12 | self.match_port('udp', 161) 13 | self.run_once(True) 14 | self.add_option('community-strings', default='/usr/share/seclists/Discovery/SNMP/common-snmp-community-strings-onesixtyone.txt', help='The file containing a list of community strings to try. Default: %(default)s') 15 | 16 | async def run(self, service): 17 | if service.target.ipversion == 'IPv4': 18 | await service.execute('onesixtyone -c ' + self.get_option('community-strings') + ' -dd {address} 2>&1', outfile='{protocol}_{port}_snmp_onesixtyone.txt') 19 | -------------------------------------------------------------------------------- /autorecon/default-plugins/oracle-odat.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class OracleODAT(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Oracle ODAT" 8 | self.tags = ['default', 'safe', 'databases'] 9 | 10 | def configure(self): 11 | self.match_service_name('^oracle') 12 | 13 | def manual(self, service, plugin_was_run): 14 | service.add_manual_commands('Install ODAT (https://github.com/quentinhardy/odat) and run the following commands:', [ 15 | 'python odat.py tnscmd -s {address} -p {port} --ping', 16 | 'python odat.py tnscmd -s {address} -p {port} --version', 17 | 'python odat.py tnscmd -s {address} -p {port} --status', 18 | 'python odat.py sidguesser -s {address} -p {port}', 19 | 'python odat.py passwordguesser -s {address} -p {port} -d --accounts-file accounts/accounts_multiple.txt', 20 | 'python odat.py tnspoison -s {address} -p {port} -d --test-module' 21 | ]) 22 | -------------------------------------------------------------------------------- /autorecon/default-plugins/oracle-patator.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class OraclePatator(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "Oracle Patator" 8 | self.tags = ['default', 'databases'] 9 | 10 | def configure(self): 11 | self.match_service_name('^oracle') 12 | 13 | def manual(self, service, plugin_was_run): 14 | service.add_manual_command('Install Oracle Instant Client (https://github.com/rapid7/metasploit-framework/wiki/How-to-get-Oracle-Support-working-with-Kali-Linux) and then bruteforce with patator:', 'patator oracle_login host={address} port={port} user=COMBO00 password=COMBO01 0=/usr/share/seclists/Passwords/Default-Credentials/oracle-betterdefaultpasslist.txt -x ignore:code=ORA-01017 -x ignore:code=ORA-28000') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/oracle-scanner.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | from shutil import which 3 | 4 | class OracleScanner(ServiceScan): 5 | 6 | def __init__(self): 7 | super().__init__() 8 | self.name = "Oracle Scanner" 9 | self.tags = ['default', 'safe', 'databases'] 10 | 11 | def configure(self): 12 | self.match_service_name('^oracle') 13 | 14 | def check(self): 15 | if which('oscanner') is None: 16 | self.error('The oscanner program could not be found. Make sure it is installed. (On Kali, run: sudo apt install oscanner)') 17 | return False 18 | 19 | async def run(self, service): 20 | await service.execute('oscanner -v -s {address} -P {port} 2>&1', outfile='{protocol}_{port}_oracle_scanner.txt') 21 | -------------------------------------------------------------------------------- /autorecon/default-plugins/oracle-tnscmd.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | from shutil import which 3 | 4 | class OracleTNScmd(ServiceScan): 5 | 6 | def __init__(self): 7 | super().__init__() 8 | self.name = "Oracle TNScmd" 9 | self.tags = ['default', 'safe', 'databases'] 10 | 11 | def configure(self): 12 | self.match_service_name('^oracle') 13 | 14 | def check(self): 15 | if which('tnscmd10g') is None: 16 | self.error('The tnscmd10g program could not be found. Make sure it is installed. (On Kali, run: sudo apt install tnscmd10g)') 17 | return False 18 | 19 | async def run(self, service): 20 | if service.target.ipversion == 'IPv4': 21 | await service.execute('tnscmd10g ping -h {address} -p {port} 2>&1', outfile='{protocol}_{port}_oracle_tnscmd_ping.txt') 22 | await service.execute('tnscmd10g version -h {address} -p {port} 2>&1', outfile='{protocol}_{port}_oracle_tnscmd_version.txt') 23 | -------------------------------------------------------------------------------- /autorecon/default-plugins/portscan-all-tcp-ports.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import PortScan 2 | from autorecon.config import config 3 | import re, requests 4 | 5 | class AllTCPPortScan(PortScan): 6 | 7 | def __init__(self): 8 | super().__init__() 9 | self.name = 'All TCP Ports' 10 | self.description = 'Performs an Nmap scan of all TCP ports.' 11 | self.type = 'tcp' 12 | self.specific_ports = True 13 | self.tags = ['default', 'default-port-scan', 'long'] 14 | 15 | async def run(self, target): 16 | if config['proxychains']: 17 | traceroute_os = '' 18 | else: 19 | traceroute_os = ' -A --osscan-guess' 20 | 21 | if target.ports: 22 | if target.ports['tcp']: 23 | process, stdout, stderr = await target.execute('nmap {nmap_extra} -sV -sC --version-all' + traceroute_os + ' -p ' + target.ports['tcp'] + ' -oN "{scandir}/_full_tcp_nmap.txt" -oX "{scandir}/xml/_full_tcp_nmap.xml" {address}', blocking=False) 24 | else: 25 | return [] 26 | else: 27 | process, stdout, stderr = await target.execute('nmap {nmap_extra} -sV -sC --version-all' + traceroute_os + ' -p- -oN "{scandir}/_full_tcp_nmap.txt" -oX "{scandir}/xml/_full_tcp_nmap.xml" {address}', blocking=False) 28 | services = [] 29 | while True: 30 | line = await stdout.readline() 31 | if line is not None: 32 | match = re.search('^Discovered open port ([0-9]+)/tcp', line) 33 | if match: 34 | target.info('Discovered open port {bmagenta}tcp/' + match.group(1) + '{rst} on {byellow}' + target.address + '{rst}', verbosity=1) 35 | service = target.extract_service(line) 36 | 37 | if service: 38 | # Check if HTTP service appears to be WinRM. If so, override service name as wsman. 39 | if service.name == 'http' and service.port in [5985, 5986]: 40 | wsman = requests.get(('https' if service.secure else 'http') + '://' + target.address + ':' + str(service.port) + '/wsman', verify=False) 41 | if wsman.status_code == 405: 42 | service.name = 'wsman' 43 | wsman = requests.post(('https' if service.secure else 'http') + '://' + target.address + ':' + str(service.port) + '/wsman', verify=False) 44 | else: 45 | if wsman.status_code == 401: 46 | service.name = 'wsman' 47 | 48 | services.append(service) 49 | else: 50 | break 51 | await process.wait() 52 | return services 53 | -------------------------------------------------------------------------------- /autorecon/default-plugins/portscan-guess-tcp-ports.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import PortScan 2 | from autorecon.targets import Service 3 | import re 4 | 5 | class GuessPortScan(PortScan): 6 | 7 | def __init__(self): 8 | super().__init__() 9 | self.name = 'Guess TCP Ports' 10 | self.type = 'tcp' 11 | self.description = 'Performs an Nmap scan of the all TCP ports but guesses services based off the port found. Can be quicker. Proper service matching is performed at the end of the scan.' 12 | self.tags = ['guess-port-scan', 'long'] 13 | self.priority = 0 14 | 15 | async def run(self, target): 16 | if target.ports: 17 | if target.ports['tcp']: 18 | process, stdout, stderr = await target.execute('nmap {nmap_extra} -A --osscan-guess --version-all -p ' + target.ports['tcp'] + ' -oN "{scandir}/_custom_ports_tcp_nmap.txt" -oX "{scandir}/xml/_custom_ports_tcp_nmap.xml" {address}', blocking=False) 19 | else: 20 | return [] 21 | else: 22 | process, stdout, stderr = await target.execute('nmap {nmap_extra} -A --osscan-guess --version-all -p- -oN "{scandir}/_quick_tcp_nmap.txt" -oX "{scandir}/xml/_quick_tcp_nmap.xml" {address}', blocking=False) 23 | 24 | insecure_ports = { 25 | '20':'ftp', '21':'ftp', '22':'ssh', '23':'telnet', '25':'smtp', '53':'domain', '69':'tftp', '79':'finger', '80':'http', '88':'kerberos', '109':'pop3', '110':'pop3', '111':'rpcbind', '119':'nntp', '135':'msrpc', '139':'netbios-ssn', '143':'imap', '161':'snmp', '220':'imap', '389':'ldap', '433':'nntp', '445':'smb', '587':'smtp', '631':'ipp', '873':'rsync', '1098':'java-rmi', '1099':'java-rmi', '1433':'mssql', '1521':'oracle', '2049':'nfs', '2483':'oracle', '3020':'smb', '3306':'mysql', '3389':'rdp', '3632':'distccd', '5060':'asterisk', '5500':'vnc', '5900':'vnc', '5985':'wsman', '6379':'redis', '8080':'http-proxy', '27017':'mongod', '27018':'mongod', '27019':'mongod' 26 | } 27 | secure_ports = { 28 | '443':'https', '465':'smtp', '563':'nntp', '585':'imaps', '593':'msrpc', '636':'ldap', '989':'ftp', '990':'ftp', '992':'telnet', '993':'imaps', '995':'pop3s', '2484':'oracle', '5061':'asterisk', '5986':'wsman' 29 | } 30 | 31 | services = [] 32 | while True: 33 | line = await stdout.readline() 34 | if line is not None: 35 | match = re.match('^Discovered open port ([0-9]+)/tcp', line) 36 | if match: 37 | if match.group(1) in insecure_ports.keys(): 38 | await target.add_service(Service('tcp', match.group(1), insecure_ports[match.group(1)])) 39 | elif match.group(1) in secure_ports.keys(): 40 | await target.add_service(Service('tcp', match.group(1), secure_ports[match.group(1)], True)) 41 | service = target.extract_service(line) 42 | if service is not None: 43 | services.append(service) 44 | else: 45 | break 46 | 47 | await process.wait() 48 | return services 49 | -------------------------------------------------------------------------------- /autorecon/default-plugins/portscan-top-100-udp-ports.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import PortScan 2 | from autorecon.config import config 3 | import os, re 4 | 5 | class Top100UDPPortScan(PortScan): 6 | 7 | def __init__(self): 8 | super().__init__() 9 | self.name = 'Top 100 UDP Ports' 10 | self.description = 'Performs an Nmap scan of the top 100 UDP ports.' 11 | self.type = 'udp' 12 | self.specific_ports = True 13 | self.tags = ['default', 'default-port-scan', 'long'] 14 | 15 | async def run(self, target): 16 | # Only run UDP scan if user is root. 17 | if os.getuid() == 0 or config['disable_sanity_checks']: 18 | if target.ports: 19 | if target.ports['udp']: 20 | process, stdout, stderr = await target.execute('nmap {nmap_extra} -sU -A --osscan-guess -p ' + target.ports['udp'] + ' -oN "{scandir}/_custom_ports_udp_nmap.txt" -oX "{scandir}/xml/_custom_ports_udp_nmap.xml" {address}', blocking=False) 21 | else: 22 | return [] 23 | else: 24 | process, stdout, stderr = await target.execute('nmap {nmap_extra} -sU -A --top-ports 100 -oN "{scandir}/_top_100_udp_nmap.txt" -oX "{scandir}/xml/_top_100_udp_nmap.xml" {address}', blocking=False) 25 | services = [] 26 | while True: 27 | line = await stdout.readline() 28 | if line is not None: 29 | match = re.search('^Discovered open port ([0-9]+)/udp', line) 30 | if match: 31 | target.info('Discovered open port {bmagenta}udp/' + match.group(1) + '{rst} on {byellow}' + target.address + '{rst}', verbosity=1) 32 | service = target.extract_service(line) 33 | if service: 34 | services.append(service) 35 | else: 36 | break 37 | await process.wait() 38 | return services 39 | else: 40 | target.error('UDP scan requires AutoRecon be run with root privileges.') 41 | -------------------------------------------------------------------------------- /autorecon/default-plugins/portscan-top-tcp-ports.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import PortScan 2 | from autorecon.config import config 3 | import requests 4 | 5 | class QuickTCPPortScan(PortScan): 6 | 7 | def __init__(self): 8 | super().__init__() 9 | self.name = 'Top TCP Ports' 10 | self.description = 'Performs an Nmap scan of the top 1000 TCP ports.' 11 | self.type = 'tcp' 12 | self.tags = ['default', 'default-port-scan'] 13 | self.priority = 0 14 | 15 | async def run(self, target): 16 | if target.ports: # Don't run this plugin if there are custom ports. 17 | return [] 18 | 19 | if config['proxychains']: 20 | traceroute_os = '' 21 | else: 22 | traceroute_os = ' -A --osscan-guess' 23 | 24 | process, stdout, stderr = await target.execute('nmap {nmap_extra} -sV -sC --version-all' + traceroute_os + ' -oN "{scandir}/_quick_tcp_nmap.txt" -oX "{scandir}/xml/_quick_tcp_nmap.xml" {address}', blocking=False) 25 | services = await target.extract_services(stdout) 26 | 27 | for service in services: 28 | # Check if HTTP service appears to be WinRM. If so, override service name as wsman. 29 | if service.name == 'http' and service.port in [5985, 5986]: 30 | wsman = requests.get(('https' if service.secure else 'http') + '://' + target.address + ':' + str(service.port) + '/wsman', verify=False) 31 | if wsman.status_code == 405: 32 | service.name = 'wsman' 33 | wsman = requests.post(('https' if service.secure else 'http') + '://' + target.address + ':' + str(service.port) + '/wsman', verify=False) 34 | else: 35 | if wsman.status_code == 401: 36 | service.name = 'wsman' 37 | 38 | await process.wait() 39 | return services 40 | -------------------------------------------------------------------------------- /autorecon/default-plugins/redis-cli.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | from shutil import which 3 | 4 | class RedisCli(ServiceScan): 5 | 6 | def __init__(self): 7 | super().__init__() 8 | self.name = 'Redis Cli' 9 | self.tags = ['default', 'safe', 'redis'] 10 | 11 | def configure(self): 12 | self.match_service_name('^redis$') 13 | 14 | def check(self): 15 | if which('redis-cli') is None: 16 | self.error('The redis-cli program could not be found. Make sure it is installed. (On Kali, run: sudo apt install redis-tools)') 17 | return False 18 | 19 | async def run(self, service): 20 | if which('redis-cli') is not None: 21 | _, stdout, _ = await service.execute('redis-cli -p {port} -h {address} INFO', outfile='{protocol}_{port}_redis_info.txt') 22 | if not (await stdout.readline()).startswith('NOAUTH Authentication required'): 23 | await service.execute('redis-cli -p {port} -h {address} CONFIG GET \'*\'', outfile='{protocol}_{port}_redis_config.txt') 24 | await service.execute('redis-cli -p {port} -h {address} CLIENT LIST', outfile='{protocol}_{port}_redis_client-list.txt') 25 | -------------------------------------------------------------------------------- /autorecon/default-plugins/reporting-cherrytree.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import Report 2 | from autorecon.config import config 3 | from xml.sax.saxutils import escape 4 | import os, glob 5 | 6 | class CherryTree(Report): 7 | 8 | def __init__(self): 9 | super().__init__() 10 | self.name = 'CherryTree' 11 | self.tags = [] 12 | 13 | async def run(self, targets): 14 | if len(targets) > 1: 15 | report = os.path.join(config['output'], 'report.xml.ctd') 16 | elif len(targets) == 1: 17 | report = os.path.join(targets[0].reportdir, 'report.xml.ctd') 18 | else: 19 | return 20 | 21 | with open(report, 'w') as output: 22 | output.writelines('\n\n') 23 | for target in targets: 24 | output.writelines('\n') 25 | 26 | files = [os.path.abspath(filename) for filename in glob.iglob(os.path.join(target.scandir, '**/*'), recursive=True) if os.path.isfile(filename) and filename.endswith(('.txt', '.html'))] 27 | 28 | if target.scans['ports']: 29 | output.writelines('\n') 30 | for scan in target.scans['ports'].keys(): 31 | if len(target.scans['ports'][scan]['commands']) > 0: 32 | output.writelines('\n') 33 | for command in target.scans['ports'][scan]['commands']: 34 | output.writelines('' + escape(command[0])) 35 | for filename in files: 36 | if filename in command[0] or (command[1] is not None and filename == command[1]) or (command[2] is not None and filename == command[2]): 37 | output.writelines('\n\n' + escape(filename) + ':\n\n') 38 | with open(filename, 'r') as file: 39 | output.writelines(escape(file.read()) + '\n') 40 | output.writelines('\n') 41 | output.writelines('\n') 42 | output.writelines('\n') 43 | if target.scans['services']: 44 | output.writelines('\n') 45 | for service in target.scans['services'].keys(): 46 | output.writelines('\n') 47 | for plugin in target.scans['services'][service].keys(): 48 | if len(target.scans['services'][service][plugin]['commands']) > 0: 49 | output.writelines('\n') 50 | for command in target.scans['services'][service][plugin]['commands']: 51 | output.writelines('' + escape(command[0])) 52 | for filename in files: 53 | if filename in command[0] or (command[1] is not None and filename == command[1]) or (command[2] is not None and filename == command[2]): 54 | output.writelines('\n\n' + escape(filename) + ':\n\n') 55 | with open(filename, 'r') as file: 56 | output.writelines(escape(file.read()) + '\n') 57 | output.writelines('\n') 58 | output.writelines('\n') 59 | output.writelines('\n') 60 | output.writelines('\n') 61 | 62 | manual_commands = os.path.join(target.scandir, '_manual_commands.txt') 63 | if os.path.isfile(manual_commands): 64 | output.writelines('\n') 65 | with open(manual_commands, 'r') as file: 66 | output.writelines('' + escape(file.read()) + '\n') 67 | output.writelines('\n') 68 | 69 | patterns = os.path.join(target.scandir, '_patterns.log') 70 | if os.path.isfile(patterns): 71 | output.writelines('\n') 72 | with open(patterns, 'r') as file: 73 | output.writelines('' + escape(file.read()) + '\n') 74 | output.writelines('\n') 75 | 76 | commands = os.path.join(target.scandir, '_commands.log') 77 | if os.path.isfile(commands): 78 | output.writelines('\n') 79 | with open(commands, 'r') as file: 80 | output.writelines('' + escape(file.read()) + '\n') 81 | output.writelines('\n') 82 | 83 | errors = os.path.join(target.scandir, '_errors.log') 84 | if os.path.isfile(errors): 85 | output.writelines('\n') 86 | with open(errors, 'r') as file: 87 | output.writelines('' + escape(file.read()) + '\n') 88 | output.writelines('\n') 89 | output.writelines('\n') 90 | 91 | output.writelines('') 92 | -------------------------------------------------------------------------------- /autorecon/default-plugins/reporting-markdown.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import Report 2 | from autorecon.config import config 3 | import os, glob 4 | 5 | class Markdown(Report): 6 | 7 | def __init__(self): 8 | super().__init__() 9 | self.name = 'Markdown' 10 | 11 | async def run(self, targets): 12 | if len(targets) > 1: 13 | report = os.path.join(config['output'], 'report.md') 14 | elif len(targets) == 1: 15 | report = os.path.join(targets[0].reportdir, 'report.md') 16 | else: 17 | return 18 | 19 | os.makedirs(report, exist_ok=True) 20 | 21 | for target in targets: 22 | os.makedirs(os.path.join(report, target.address), exist_ok=True) 23 | 24 | files = [os.path.abspath(filename) for filename in glob.iglob(os.path.join(target.scandir, '**/*'), recursive=True) if os.path.isfile(filename) and filename.endswith(('.txt', '.html'))] 25 | 26 | if target.scans['ports']: 27 | os.makedirs(os.path.join(report, target.address, 'Port Scans'), exist_ok=True) 28 | for scan in target.scans['ports'].keys(): 29 | if len(target.scans['ports'][scan]['commands']) > 0: 30 | with open(os.path.join(report, target.address, 'Port Scans', 'PortScan - ' + target.scans['ports'][scan]['plugin'].name + '.md'), 'w') as output: 31 | for command in target.scans['ports'][scan]['commands']: 32 | output.writelines('```bash\n' + command[0] + '\n```') 33 | for filename in files: 34 | if filename in command[0] or (command[1] is not None and filename == command[1]) or (command[2] is not None and filename == command[2]): 35 | output.writelines('\n\n[' + filename + '](file://' + filename + '):\n\n') 36 | with open(filename, 'r') as file: 37 | output.writelines('```\n' + file.read() + '\n```\n') 38 | if target.scans['services']: 39 | os.makedirs(os.path.join(report, target.address, 'Services'), exist_ok=True) 40 | for service in target.scans['services'].keys(): 41 | os.makedirs(os.path.join(report, target.address, 'Services', 'Service - ' + service.tag().replace('/', '-')), exist_ok=True) 42 | for plugin in target.scans['services'][service].keys(): 43 | if len(target.scans['services'][service][plugin]['commands']) > 0: 44 | with open(os.path.join(report, target.address, 'Services', 'Service - ' + service.tag().replace('/', '-'), target.scans['services'][service][plugin]['plugin'].name + '.md'), 'w') as output: 45 | for command in target.scans['services'][service][plugin]['commands']: 46 | output.writelines('```bash\n' + command[0] + '\n```') 47 | for filename in files: 48 | if filename in command[0] or (command[1] is not None and filename == command[1]) or (command[2] is not None and filename == command[2]): 49 | output.writelines('\n\n[' + filename + '](file://' + filename + '):\n\n') 50 | with open(filename, 'r') as file: 51 | output.writelines('```\n' + file.read() + '\n```\n') 52 | 53 | manual_commands = os.path.join(target.scandir, '_manual_commands.txt') 54 | if os.path.isfile(manual_commands): 55 | with open(os.path.join(report, target.address, 'Manual Commands' + '.md'), 'w') as output: 56 | with open(manual_commands, 'r') as file: 57 | output.writelines('```bash\n' + file.read() + '\n```') 58 | 59 | patterns = os.path.join(target.scandir, '_patterns.log') 60 | if os.path.isfile(patterns): 61 | with open(os.path.join(report, target.address, 'Patterns' + '.md'), 'w') as output: 62 | with open(patterns, 'r') as file: 63 | output.writelines(file.read()) 64 | 65 | commands = os.path.join(target.scandir, '_commands.log') 66 | if os.path.isfile(commands): 67 | with open(os.path.join(report, target.address, 'Commands' + '.md'), 'w') as output: 68 | with open(commands, 'r') as file: 69 | output.writelines('```bash\n' + file.read() + '\n```') 70 | 71 | errors = os.path.join(target.scandir, '_errors.log') 72 | if os.path.isfile(errors): 73 | with open(os.path.join(report, target.address, 'Errors' + '.md'), 'w') as output: 74 | with open(errors, 'r') as file: 75 | output.writelines('```\n' + file.read() + '\n```') 76 | -------------------------------------------------------------------------------- /autorecon/default-plugins/rpcclient.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class RPCClient(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "rpcclient" 8 | self.tags = ['default', 'safe', 'rpc'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^msrpc', '^rpcbind', '^erpc']) 12 | 13 | def manual(self, service, plugin_was_run): 14 | service.add_manual_command('RPC Client:', 'rpcclient -p {port} -U "" {address}') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/rpcdump.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class RPCDump(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'rpcdump' 8 | self.tags = ['default', 'safe', 'rpc'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^msrpc', '^rpcbind', '^erpc', '^ncacn_http$']) 12 | self.match_port('tcp', [135, 139, 443, 445, 593]) 13 | 14 | async def run(self, service): 15 | if service.protocol == 'tcp': 16 | await service.execute('impacket-rpcdump -port {port} {address}', outfile='{protocol}_{port}_rpc_rpcdump.txt') 17 | -------------------------------------------------------------------------------- /autorecon/default-plugins/rsync-list-files.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class RsyncList(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'Rsync List Files' 8 | self.tags = ['default', 'safe', 'rsync'] 9 | 10 | def configure(self): 11 | self.match_service_name('^rsync') 12 | 13 | async def run(self, service): 14 | await service.execute('rsync -av --list-only rsync://{addressv6}:{port}', outfile='{protocol}_{port}_rsync_file_list.txt') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/showmount.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class Showmount(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "showmount" 8 | self.tags = ['default', 'safe', 'nfs'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^nfs', '^rpcbind']) 12 | 13 | async def run(self, service): 14 | await service.execute('showmount -e {address} 2>&1', outfile='{protocol}_{port}_showmount.txt') 15 | -------------------------------------------------------------------------------- /autorecon/default-plugins/sipvicious.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class SIPVicious(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "SIPVicious" 8 | self.tags = ['default', 'safe', 'sip'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^asterisk', '^sip']) 12 | 13 | def manual(self, service, plugin_was_run): 14 | if service.target.ipversion == 'IPv4': 15 | service.add_manual_command('svwar:', 'svwar -D -m INVITE -p {port} {address}') 16 | -------------------------------------------------------------------------------- /autorecon/default-plugins/smb-vuln.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class SMBVuln(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "SMB Vulnerabilities" 8 | self.tags = ['unsafe', 'smb', 'active-directory'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^smb', '^microsoft\-ds', '^netbios']) 12 | 13 | async def run(self, service): 14 | await service.execute('nmap {nmap_extra} -sV -p {port} --script="smb-vuln-*" --script-args="unsafe=1" -oN "{scandir}/{protocol}_{port}_smb_vulnerabilities.txt" -oX "{scandir}/xml/{protocol}_{port}_smb_vulnerabilities.xml" {address}') 15 | 16 | def manual(self, service, plugin_was_run): 17 | if not plugin_was_run: # Only suggest these if they weren't run. 18 | service.add_manual_commands('Nmap scans for SMB vulnerabilities that could potentially cause a DoS if scanned (according to Nmap). Be careful:', 'nmap {nmap_extra} -sV -p {port} --script="smb-vuln-* and dos" --script-args="unsafe=1" -oN "{scandir}/{protocol}_{port}_smb_vulnerabilities.txt" -oX "{scandir}/xml/{protocol}_{port}_smb_vulnerabilities.xml" {address}') 19 | -------------------------------------------------------------------------------- /autorecon/default-plugins/smbclient.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class SMBClient(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "SMBClient" 8 | self.tags = ['default', 'safe', 'smb', 'active-directory'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^smb', '^microsoft\-ds', '^netbios']) 12 | self.match_port('tcp', [139, 445]) 13 | self.run_once(True) 14 | 15 | async def run(self, service): 16 | await service.execute('smbclient -L //{address} -N -I {address} 2>&1', outfile='smbclient.txt') 17 | -------------------------------------------------------------------------------- /autorecon/default-plugins/smbmap.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class SMBMap(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "SMBMap" 8 | self.tags = ['default', 'safe', 'smb', 'active-directory'] 9 | 10 | def configure(self): 11 | self.match_service_name(['^smb', '^microsoft\-ds', '^netbios']) 12 | 13 | async def run(self, service): 14 | if service.target.ipversion == 'IPv4': 15 | await service.execute('smbmap -H {address} -P {port} 2>&1', outfile='smbmap-share-permissions.txt') 16 | await service.execute('smbmap -u null -p "" -H {address} -P {port} 2>&1', outfile='smbmap-share-permissions.txt') 17 | await service.execute('smbmap -H {address} -P {port} -r 2>&1', outfile='smbmap-list-contents.txt') 18 | await service.execute('smbmap -u null -p "" -H {address} -P {port} -r 2>&1', outfile='smbmap-list-contents.txt') 19 | await service.execute('smbmap -H {address} -P {port} -x "ipconfig /all" 2>&1', outfile='smbmap-execute-command.txt') 20 | await service.execute('smbmap -u null -p "" -H {address} -P {port} -x "ipconfig /all" 2>&1', outfile='smbmap-execute-command.txt') 21 | -------------------------------------------------------------------------------- /autorecon/default-plugins/smtp-user-enum.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class SMTPUserEnum(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'SMTP-User-Enum' 8 | self.tags = ['default', 'safe', 'smtp', 'email'] 9 | 10 | def configure(self): 11 | self.match_service_name('^smtp') 12 | 13 | async def run(self, service): 14 | await service.execute('hydra smtp-enum://{addressv6}:{port}/vrfy -L "' + self.get_global('username_wordlist', default='/usr/share/seclists/Usernames/top-usernames-shortlist.txt') + '" 2>&1', outfile='{protocol}_{port}_smtp_user-enum_hydra_vrfy.txt') 15 | await service.execute('hydra smtp-enum://{addressv6}:{port}/expn -L "' + self.get_global('username_wordlist', default='/usr/share/seclists/Usernames/top-usernames-shortlist.txt') + '" 2>&1', outfile='{protocol}_{port}_smtp_user-enum_hydra_expn.txt') 16 | 17 | def manual(self, service, plugin_was_run): 18 | service.add_manual_command('Try User Enumeration using "RCPT TO". Replace with the target\'s domain name:', [ 19 | 'hydra smtp-enum://{addressv6}:{port}/rcpt -L "' + self.get_global('username_wordlist', default='/usr/share/seclists/Usernames/top-usernames-shortlist.txt') + '" -o "{scandir}/{protocol}_{port}_smtp_user-enum_hydra_rcpt.txt" -p ' 20 | ]) 21 | -------------------------------------------------------------------------------- /autorecon/default-plugins/snmpwalk.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class SNMPWalk(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "SNMPWalk" 8 | self.tags = ['default', 'safe', 'snmp'] 9 | 10 | def configure(self): 11 | self.match_service_name('^snmp') 12 | self.match_port('udp', 161) 13 | self.run_once(True) 14 | 15 | async def run(self, service): 16 | await service.execute('snmpwalk -c public -v 1 {address} 2>&1', outfile='{protocol}_{port}_snmp_snmpwalk.txt') 17 | await service.execute('snmpwalk -c public -v 1 {address} 1.3.6.1.2.1.25.1.6.0 2>&1', outfile='{protocol}_{port}_snmp_snmpwalk_system_processes.txt') 18 | await service.execute('snmpwalk -c public -v 1 {address} 1.3.6.1.2.1.25.4.2.1.2 2>&1', outfile='{scandir}/{protocol}_{port}_snmp_snmpwalk_running_processes.txt') 19 | await service.execute('snmpwalk -c public -v 1 {address} 1.3.6.1.2.1.25.4.2.1.4 2>&1', outfile='{protocol}_{port}_snmp_snmpwalk_process_paths.txt') 20 | await service.execute('snmpwalk -c public -v 1 {address} 1.3.6.1.2.1.25.2.3.1.4 2>&1', outfile='{protocol}_{port}_snmp_snmpwalk_storage_units.txt') 21 | await service.execute('snmpwalk -c public -v 1 {address} 1.3.6.1.2.1.25.2.3.1.4 2>&1', outfile='{protocol}_{port}_snmp_snmpwalk_software_names.txt') 22 | await service.execute('snmpwalk -c public -v 1 {address} 1.3.6.1.4.1.77.1.2.25 2>&1', outfile='{protocol}_{port}_snmp_snmpwalk_user_accounts.txt') 23 | await service.execute('snmpwalk -c public -v 1 {address} 1.3.6.1.2.1.6.13.1.3 2>&1', outfile='{protocol}_{port}_snmp_snmpwalk_tcp_ports.txt') 24 | -------------------------------------------------------------------------------- /autorecon/default-plugins/sslscan.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class SSLScan(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "SSL Scan" 8 | self.tags = ['default', 'safe', 'ssl', 'tls'] 9 | 10 | def configure(self): 11 | self.match_all_service_names(True) 12 | self.require_ssl(True) 13 | 14 | async def run(self, service): 15 | if service.protocol == 'tcp' and service.secure: 16 | await service.execute('sslscan --show-certificate --no-colour {addressv6}:{port} 2>&1', outfile='{protocol}_{port}_sslscan.html') 17 | -------------------------------------------------------------------------------- /autorecon/default-plugins/subdomain-enumeration.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | import os 3 | 4 | class SubdomainEnumeration(ServiceScan): 5 | 6 | def __init__(self): 7 | super().__init__() 8 | self.name = "Subdomain Enumeration" 9 | self.slug = "subdomain-enum" 10 | self.tags = ['default', 'safe', 'long', 'dns'] 11 | 12 | def configure(self): 13 | self.add_option('domain', help='The domain to use as the base domain (e.g. example.com) for subdomain enumeration. Default: %(default)s') 14 | self.add_list_option('wordlist', default=['/usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt'], help='The wordlist(s) to use when enumerating subdomains. Separate multiple wordlists with spaces. Default: %(default)s') 15 | self.add_option('threads', default=10, help='The number of threads to use when enumerating subdomains. Default: %(default)s') 16 | self.match_service_name('^domain') 17 | 18 | async def run(self, service): 19 | domains = [] 20 | 21 | if self.get_option('domain'): 22 | domains.append(self.get_option('domain')) 23 | if service.target.type == 'hostname' and service.target.address not in domains: 24 | domains.append(service.target.address) 25 | if self.get_global('domain') and self.get_global('domain') not in domains: 26 | domains.append(self.get_global('domain')) 27 | 28 | if len(domains) > 0: 29 | for wordlist in self.get_option('wordlist'): 30 | name = os.path.splitext(os.path.basename(wordlist))[0] 31 | for domain in domains: 32 | await service.execute('gobuster dns -d ' + domain + ' -r {addressv6} -w ' + wordlist + ' -o "{scandir}/{protocol}_{port}_' + domain + '_subdomains_' + name + '.txt"') 33 | else: 34 | service.info('The target was not a domain, nor was a domain provided as an option. Skipping subdomain enumeration.') 35 | -------------------------------------------------------------------------------- /autorecon/default-plugins/virtual-host-enumeration.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | from shutil import which 3 | import os, requests, random, string, urllib3 4 | 5 | urllib3.disable_warnings() 6 | 7 | class VirtualHost(ServiceScan): 8 | 9 | def __init__(self): 10 | super().__init__() 11 | self.name = 'Virtual Host Enumeration' 12 | self.slug = 'vhost-enum' 13 | self.tags = ['default', 'safe', 'http', 'long'] 14 | 15 | def configure(self): 16 | self.add_option('hostname', help='The hostname to use as the base host (e.g. example.com) for virtual host enumeration. Default: %(default)s') 17 | self.add_list_option('wordlist', default=['/usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt'], help='The wordlist(s) to use when enumerating virtual hosts. Separate multiple wordlists with spaces. Default: %(default)s') 18 | self.add_option('threads', default=10, help='The number of threads to use when enumerating virtual hosts. Default: %(default)s') 19 | self.match_service_name('^http') 20 | self.match_service_name('^nacn_http$', negative_match=True) 21 | 22 | async def run(self, service): 23 | hostnames = [] 24 | if self.get_option('hostname'): 25 | hostnames.append(self.get_option('hostname')) 26 | if service.target.type == 'hostname' and service.target.address not in hostnames: 27 | hostnames.append(service.target.address) 28 | if self.get_global('domain') and self.get_global('domain') not in hostnames: 29 | hostnames.append(self.get_global('domain')) 30 | 31 | if len(hostnames) > 0: 32 | for wordlist in self.get_option('wordlist'): 33 | name = os.path.splitext(os.path.basename(wordlist))[0] 34 | for hostname in hostnames: 35 | try: 36 | wildcard = requests.get( 37 | ('https' if service.secure else 'http') + '://' + service.target.address + ':' + str(service.port) + '/', 38 | headers={'Host': ''.join(random.choice(string.ascii_letters) for _ in range(20)) + '.' + hostname}, 39 | verify=False, 40 | allow_redirects=False 41 | ) 42 | size = str(len(wildcard.content)) 43 | except requests.exceptions.RequestException as e: 44 | service.error(f"[!] Wildcard request failed for {hostname}: {e}") 45 | continue 46 | 47 | await service.execute( 48 | 'ffuf -u {http_scheme}://' + hostname + ':{port}/ -t ' + str(self.get_option('threads')) + 49 | ' -w ' + wordlist + ' -H "Host: FUZZ.' + hostname + '" -mc all -fs ' + size + 50 | ' -r -noninteractive -s | tee "{scandir}/{protocol}_{port}_{http_scheme}_' + hostname + '_vhosts_' + name + '.txt"' 51 | ) 52 | else: 53 | service.info('The target was not a hostname, nor was a hostname provided as an option. Skipping virtual host enumeration.') 54 | -------------------------------------------------------------------------------- /autorecon/default-plugins/whatweb.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class WhatWeb(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = "whatweb" 8 | self.tags = ['default', 'safe', 'http'] 9 | 10 | def configure(self): 11 | self.match_service_name('^http') 12 | self.match_service_name('^nacn_http$', negative_match=True) 13 | 14 | async def run(self, service): 15 | if service.protocol == 'tcp' and service.target.ipversion == 'IPv4': 16 | await service.execute('whatweb --color=never --no-errors -a 3 -v {http_scheme}://{address}:{port} 2>&1', outfile='{protocol}_{port}_{http_scheme}_whatweb.txt') 17 | -------------------------------------------------------------------------------- /autorecon/default-plugins/winrm-detection.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | from autorecon.io import fformat 3 | 4 | class WinRMDetection(ServiceScan): 5 | 6 | def __init__(self): 7 | super().__init__() 8 | self.name = 'WinRM Detection' 9 | self.tags = ['default', 'safe', 'winrm'] 10 | 11 | def configure(self): 12 | self.match_service_name('^wsman') 13 | self.match_service('tcp', [5985, 5986], '^http') 14 | 15 | async def run(self, service): 16 | filename = fformat('{scandir}/{protocol}_{port}_winrm-detection.txt') 17 | with open(filename, mode='wt', encoding='utf8') as winrm: 18 | winrm.write('WinRM was possibly detected running on ' + service.protocol + ' port ' + str(service.port) + '.\nCheck _manual_commands.txt for manual commands you can run against this service.') 19 | 20 | def manual(self, service, plugin_was_run): 21 | service.add_manual_commands('Bruteforce logins:', [ 22 | 'crackmapexec winrm {address} -d \'' + self.get_global('domain', default='') + '\' -u \'' + self.get_global('username_wordlist', default='/usr/share/seclists/Usernames/top-usernames-shortlist.txt') + '\' -p \'' + self.get_global('password_wordlist', default='/usr/share/seclists/Passwords/darkweb2017-top100.txt') + '\'' 23 | ]) 24 | 25 | service.add_manual_commands('Check login (requires credentials):', [ 26 | 'crackmapexec winrm {address} -d \'' + self.get_global('domain', default='') + '\' -u \'\' -p \'\'' 27 | ]) 28 | 29 | service.add_manual_commands('Evil WinRM (gem install evil-winrm):', [ 30 | 'evil-winrm -u \'\' -p \'\' -i {address}', 31 | 'evil-winrm -u \'\' -H \'\' -i {address}' 32 | ]) 33 | -------------------------------------------------------------------------------- /autorecon/default-plugins/wpscan.py: -------------------------------------------------------------------------------- 1 | from autorecon.plugins import ServiceScan 2 | 3 | class WPScan(ServiceScan): 4 | 5 | def __init__(self): 6 | super().__init__() 7 | self.name = 'WPScan' 8 | self.tags = ['default', 'safe', 'http'] 9 | 10 | def configure(self): 11 | self.add_option('api-token', help='An API Token from wpvulndb.com to help search for more vulnerabilities.') 12 | self.match_service_name('^http') 13 | self.match_service_name('^nacn_http$', negative_match=True) 14 | 15 | def manual(self, service, plugin_was_run): 16 | api_token = '' 17 | if self.get_option('api-token'): 18 | api_token = ' --api-token ' + self.get_option('api-token') 19 | 20 | service.add_manual_command('(wpscan) WordPress Security Scanner (useful if WordPress is found):', 'wpscan --url {http_scheme}://{addressv6}:{port}/ --no-update -e vp,vt,tt,cb,dbe,u,m --plugins-detection aggressive --plugins-version-detection aggressive -f cli-no-color' + api_token + ' 2>&1 | tee "{scandir}/{protocol}_{port}_{http_scheme}_wpscan.txt"') 21 | -------------------------------------------------------------------------------- /autorecon/global.toml: -------------------------------------------------------------------------------- 1 | [global.username-wordlist] 2 | default = '/usr/share/seclists/Usernames/top-usernames-shortlist.txt' 3 | help = 'A wordlist of usernames, useful for bruteforcing. Default: %(default)s' 4 | 5 | [global.password-wordlist] 6 | default = '/usr/share/seclists/Passwords/darkweb2017-top100.txt' 7 | help = 'A wordlist of passwords, useful for bruteforcing. Default: %(default)s' 8 | 9 | [global.domain] 10 | help = 'The domain to use (if known). Used for DNS and/or Active Directory. Default: %(default)s' 11 | 12 | # Configure global pattern matching here. 13 | [[pattern]] 14 | description = 'Nmap script found a potential vulnerability. ({match})' 15 | pattern = 'State: (?:(?:LIKELY\_?)?VULNERABLE)' 16 | 17 | [[pattern]] 18 | pattern = '(?i)unauthorized' 19 | 20 | [[pattern]] 21 | description = 'CVE Identified: {match}' 22 | pattern = '(CVE-\d{4}-\d{4,7})' 23 | -------------------------------------------------------------------------------- /autorecon/io.py: -------------------------------------------------------------------------------- 1 | import asyncio, colorama, os, re, string, sys, unidecode 2 | from colorama import Fore, Style 3 | from autorecon.config import config 4 | 5 | def slugify(name): 6 | return re.sub(r'[\W_]+', '-', unidecode.unidecode(name).lower()).strip('-') 7 | 8 | def e(*args, frame_index=1, **kvargs): 9 | frame = sys._getframe(frame_index) 10 | 11 | vals = {} 12 | 13 | vals.update(frame.f_globals) 14 | vals.update(frame.f_locals) 15 | vals.update(kvargs) 16 | 17 | return string.Formatter().vformat(' '.join(args), args, vals) 18 | 19 | def fformat(s): 20 | return e(s, frame_index=3) 21 | 22 | def cprint(*args, color=Fore.RESET, char='*', sep=' ', end='\n', frame_index=1, file=sys.stdout, printmsg=True, verbosity=0, **kvargs): 23 | if printmsg and verbosity > config['verbose']: 24 | return '' 25 | frame = sys._getframe(frame_index) 26 | 27 | vals = { 28 | 'bgreen': Fore.GREEN + Style.BRIGHT, 29 | 'bred': Fore.RED + Style.BRIGHT, 30 | 'bblue': Fore.BLUE + Style.BRIGHT, 31 | 'byellow': Fore.YELLOW + Style.BRIGHT, 32 | 'bmagenta': Fore.MAGENTA + Style.BRIGHT, 33 | 34 | 'green': Fore.GREEN, 35 | 'red': Fore.RED, 36 | 'blue': Fore.BLUE, 37 | 'yellow': Fore.YELLOW, 38 | 'magenta': Fore.MAGENTA, 39 | 40 | 'bright': Style.BRIGHT, 41 | 'srst': Style.NORMAL, 42 | 'crst': Fore.RESET, 43 | 'rst': Style.NORMAL + Fore.RESET 44 | } 45 | 46 | if config['accessible']: 47 | vals = {'bgreen':'', 'bred':'', 'bblue':'', 'byellow':'', 'bmagenta':'', 'green':'', 'red':'', 'blue':'', 'yellow':'', 'magenta':'', 'bright':'', 'srst':'', 'crst':'', 'rst':''} 48 | 49 | vals.update(frame.f_globals) 50 | vals.update(frame.f_locals) 51 | vals.update(kvargs) 52 | 53 | unfmt = '' 54 | if char is not None and not config['accessible']: 55 | unfmt += color + '[' + Style.BRIGHT + char + Style.NORMAL + ']' + Fore.RESET + sep 56 | unfmt += sep.join(args) 57 | 58 | fmted = unfmt 59 | 60 | for attempt in range(10): 61 | try: 62 | fmted = string.Formatter().vformat(unfmt, args, vals) 63 | break 64 | except KeyError as err: 65 | key = err.args[0] 66 | unfmt = unfmt.replace('{' + key + '}', '{{' + key + '}}') 67 | 68 | if printmsg: 69 | print(fmted, sep=sep, end=end, file=file) 70 | else: 71 | return fmted 72 | 73 | def debug(*args, color=Fore.GREEN, sep=' ', end='\n', file=sys.stdout, **kvargs): 74 | if config['verbose'] >= 2: 75 | if config['accessible']: 76 | args = ('Debug:',) + args 77 | cprint(*args, color=color, char='-', sep=sep, end=end, file=file, frame_index=2, **kvargs) 78 | 79 | def info(*args, sep=' ', end='\n', file=sys.stdout, **kvargs): 80 | cprint(*args, color=Fore.BLUE, char='*', sep=sep, end=end, file=file, frame_index=2, **kvargs) 81 | 82 | def warn(*args, sep=' ', end='\n', file=sys.stderr,**kvargs): 83 | if config['accessible']: 84 | args = ('Warning:',) + args 85 | cprint(*args, color=Fore.YELLOW, char='!', sep=sep, end=end, file=file, frame_index=2, **kvargs) 86 | 87 | def error(*args, sep=' ', end='\n', file=sys.stderr, **kvargs): 88 | if config['accessible']: 89 | args = ('Error:',) + args 90 | cprint(*args, color=Fore.RED, char='!', sep=sep, end=end, file=file, frame_index=2, **kvargs) 91 | 92 | def fail(*args, sep=' ', end='\n', file=sys.stderr, **kvargs): 93 | if config['accessible']: 94 | args = ('Failure:',) + args 95 | cprint(*args, color=Fore.RED, char='!', sep=sep, end=end, file=file, frame_index=2, **kvargs) 96 | exit(-1) 97 | 98 | class CommandStreamReader(object): 99 | 100 | def __init__(self, stream, target, tag, patterns=None, outfile=None): 101 | self.stream = stream 102 | self.target = target 103 | self.tag = tag 104 | self.lines = [] 105 | self.patterns = patterns or [] 106 | self.outfile = outfile 107 | self.ended = False 108 | 109 | # Empty files that already exist. 110 | if self.outfile != None: 111 | with open(self.outfile, 'w'): pass 112 | 113 | # Read lines from the stream until it ends. 114 | async def _read(self): 115 | while True: 116 | if self.stream.at_eof(): 117 | break 118 | try: 119 | line = (await self.stream.readline()).decode('utf8').rstrip() 120 | except ValueError: 121 | error('{bright}[{yellow}' + self.target.address + '{crst}/{bgreen}' + self.tag + '{crst}]{rst} A line was longer than 64 KiB and cannot be processed. Ignoring.') 122 | continue 123 | 124 | if line != '': 125 | info('{bright}[{yellow}' + self.target.address + '{crst}/{bgreen}' + self.tag + '{crst}]{rst} ' + line.strip().replace('{', '{{').replace('}', '}}'), verbosity=3) 126 | 127 | # Check lines for pattern matches. 128 | for p in self.patterns: 129 | description = '' 130 | 131 | # Match and replace entire pattern. 132 | match = p.pattern.search(line) 133 | if match: 134 | if p.description: 135 | description = p.description.replace('{match}', line[match.start():match.end()]) 136 | 137 | # Match and replace substrings. 138 | matches = p.pattern.findall(line) 139 | if len(matches) > 0 and isinstance(matches[0], tuple): 140 | matches = list(matches[0]) 141 | 142 | match_count = 1 143 | for match in matches: 144 | if p.description: 145 | description = description.replace('{match' + str(match_count) + '}', match) 146 | match_count += 1 147 | 148 | async with self.target.lock: 149 | with open(os.path.join(self.target.scandir, '_patterns.log'), 'a') as file: 150 | info('{bright}[{yellow}' + self.target.address + '{crst}/{bgreen}' + self.tag + '{crst}]{rst} {bmagenta}' + description + '{rst}', verbosity=2) 151 | file.writelines(description + '\n\n') 152 | else: 153 | info('{bright}[{yellow}' + self.target.address + '{crst}/{bgreen}' + self.tag + '{crst}]{rst} {bmagenta}Matched Pattern: ' + line[match.start():match.end()] + '{rst}', verbosity=2) 154 | async with self.target.lock: 155 | with open(os.path.join(self.target.scandir, '_patterns.log'), 'a') as file: 156 | file.writelines('Matched Pattern: ' + line[match.start():match.end()] + '\n\n') 157 | 158 | if self.outfile is not None: 159 | with open(self.outfile, 'a') as writer: 160 | writer.write(line + '\n') 161 | self.lines.append(line) 162 | self.ended = True 163 | 164 | # Read a line from the stream cache. 165 | async def readline(self): 166 | while True: 167 | try: 168 | return self.lines.pop(0) 169 | except IndexError: 170 | if self.ended: 171 | return None 172 | else: 173 | await asyncio.sleep(0.1) 174 | 175 | # Read all lines from the stream cache. 176 | async def readlines(self): 177 | lines = [] 178 | while True: 179 | line = await self.readline() 180 | if line is not None: 181 | lines.append(line) 182 | else: 183 | break 184 | return lines 185 | -------------------------------------------------------------------------------- /autorecon/plugins.py: -------------------------------------------------------------------------------- 1 | import asyncio, inspect, os, re, sys 2 | from typing import final 3 | from autorecon.config import config 4 | from autorecon.io import slugify, info, warn, error, fail, CommandStreamReader 5 | from autorecon.targets import Service 6 | 7 | class Pattern: 8 | 9 | def __init__(self, pattern, description=None): 10 | self.pattern = pattern 11 | self.description = description 12 | 13 | class Plugin(object): 14 | 15 | def __init__(self): 16 | self.name = None 17 | self.slug = None 18 | self.description = None 19 | self.tags = ['default'] 20 | self.priority = 1 21 | self.patterns = [] 22 | self.autorecon = None 23 | self.disabled = False 24 | 25 | @final 26 | def add_option(self, name, default=None, help=None): 27 | self.autorecon.add_argument(self, name, metavar='VALUE', default=default, help=help) 28 | 29 | @final 30 | def add_constant_option(self, name, const, default=None, help=None): 31 | self.autorecon.add_argument(self, name, action='store_const', const=const, default=default, help=help) 32 | 33 | @final 34 | def add_true_option(self, name, help=None): 35 | self.autorecon.add_argument(self, name, action='store_true', help=help) 36 | 37 | @final 38 | def add_false_option(self, name, help=None): 39 | self.autorecon.add_argument(self, name, action='store_false', help=help) 40 | 41 | @final 42 | def add_list_option(self, name, default=None, help=None): 43 | self.autorecon.add_argument(self, name, nargs='+', metavar='VALUE', default=default, help=help) 44 | 45 | @final 46 | def add_choice_option(self, name, choices, default=None, help=None): 47 | if not isinstance(choices, list): 48 | fail('The choices argument for ' + self.name + '\'s ' + name + ' choice option should be a list.') 49 | self.autorecon.add_argument(self, name, choices=choices, default=default, help=help) 50 | 51 | @final 52 | def get_option(self, name, default=None): 53 | # TODO: make sure name is simple. 54 | name = self.slug.replace('-', '_') + '.' + slugify(name).replace('-', '_') 55 | 56 | if name in vars(self.autorecon.args): 57 | if vars(self.autorecon.args)[name] is None: 58 | if default: 59 | return default 60 | else: 61 | return None 62 | else: 63 | return vars(self.autorecon.args)[name] 64 | else: 65 | if default: 66 | return default 67 | return None 68 | 69 | @final 70 | def get_global_option(self, name, default=None): 71 | name = 'global.' + slugify(name).replace('-', '_') 72 | 73 | if name in vars(self.autorecon.args): 74 | if vars(self.autorecon.args)[name] is None: 75 | if default: 76 | return default 77 | else: 78 | return None 79 | else: 80 | return vars(self.autorecon.args)[name] 81 | else: 82 | if default: 83 | return default 84 | return None 85 | 86 | @final 87 | def get_global(self, name, default=None): 88 | return self.get_global_option(name, default) 89 | 90 | @final 91 | def add_pattern(self, pattern, description=None): 92 | try: 93 | compiled = re.compile(pattern) 94 | if description: 95 | self.patterns.append(Pattern(compiled, description=description)) 96 | else: 97 | self.patterns.append(Pattern(compiled)) 98 | except re.error: 99 | fail('Error: The pattern "' + pattern + '" in the plugin "' + self.name + '" is invalid regex.') 100 | 101 | @final 102 | def info(self, msg, verbosity=0): 103 | info('{bright}[{bgreen}' + self.slug + '{crst}]{rst} ' + msg) 104 | 105 | @final 106 | def warn(self, msg, verbosity=0): 107 | warn('{bright}[{bgreen}' + self.slug + '{crst}]{rst} ' + msg) 108 | 109 | @final 110 | def error(self, msg, verbosity=0): 111 | error('{bright}[{bgreen}' + self.slug + '{crst}]{rst} ' + msg) 112 | 113 | class PortScan(Plugin): 114 | 115 | def __init__(self): 116 | super().__init__() 117 | self.type = None 118 | self.specific_ports = False 119 | 120 | async def run(self, target): 121 | raise NotImplementedError 122 | 123 | class ServiceScan(Plugin): 124 | 125 | def __init__(self): 126 | super().__init__() 127 | self.ports = {'tcp':[], 'udp':[]} 128 | self.ignore_ports = {'tcp':[], 'udp':[]} 129 | self.services = [] 130 | self.service_names = [] 131 | self.ignore_service_names = [] 132 | self.run_once_boolean = False 133 | self.require_ssl_boolean = False 134 | self.max_target_instances = 0 135 | self.max_global_instances = 0 136 | 137 | @final 138 | def match_service(self, protocol, port, name, negative_match=False): 139 | protocol = protocol.lower() 140 | if protocol not in ['tcp', 'udp']: 141 | print('Invalid protocol.') 142 | sys.exit(1) 143 | 144 | if not isinstance(port, list): 145 | port = [port] 146 | 147 | port = list(map(int, port)) 148 | 149 | if not isinstance(name, list): 150 | name = [name] 151 | 152 | valid_regex = True 153 | for r in name: 154 | try: 155 | re.compile(r) 156 | except re.error: 157 | print('Invalid regex: ' + r) 158 | valid_regex = False 159 | 160 | if not valid_regex: 161 | sys.exit(1) 162 | 163 | service = {'protocol': protocol, 'port': port, 'name': name, 'negative_match': negative_match} 164 | self.services.append(service) 165 | 166 | @final 167 | def match_port(self, protocol, port, negative_match=False): 168 | protocol = protocol.lower() 169 | if protocol not in ['tcp', 'udp']: 170 | print('Invalid protocol.') 171 | sys.exit(1) 172 | else: 173 | if not isinstance(port, list): 174 | port = [port] 175 | 176 | port = list(map(int, port)) 177 | 178 | if negative_match: 179 | self.ignore_ports[protocol] = list(set(self.ignore_ports[protocol] + port)) 180 | else: 181 | self.ports[protocol] = list(set(self.ports[protocol] + port)) 182 | 183 | @final 184 | def match_service_name(self, name, negative_match=False): 185 | if not isinstance(name, list): 186 | name = [name] 187 | 188 | valid_regex = True 189 | for r in name: 190 | try: 191 | re.compile(r) 192 | except re.error: 193 | print('Invalid regex: ' + r) 194 | valid_regex = False 195 | 196 | if valid_regex: 197 | if negative_match: 198 | self.ignore_service_names = list(set(self.ignore_service_names + name)) 199 | else: 200 | self.service_names = list(set(self.service_names + name)) 201 | else: 202 | sys.exit(1) 203 | 204 | @final 205 | def require_ssl(self, boolean): 206 | self.require_ssl_boolean = boolean 207 | 208 | @final 209 | def run_once(self, boolean): 210 | self.run_once_boolean = boolean 211 | 212 | @final 213 | def match_all_service_names(self, boolean): 214 | if boolean: 215 | # Add a "match all" service name. 216 | self.match_service_name('.*') 217 | 218 | class Report(Plugin): 219 | 220 | def __init__(self): 221 | super().__init__() 222 | 223 | class AutoRecon(object): 224 | 225 | def __init__(self): 226 | self.pending_targets = [] 227 | self.scanning_targets = [] 228 | self.completed_targets = [] 229 | self.plugins = {} 230 | self.__slug_regex = re.compile('^[a-z0-9\-]+$') 231 | self.plugin_types = {'port':[], 'service':[], 'report':[]} 232 | self.port_scan_semaphore = None 233 | self.service_scan_semaphore = None 234 | self.argparse = None 235 | self.argparse_group = None 236 | self.args = None 237 | self.missing_services = [] 238 | self.taglist = [] 239 | self.tags = [] 240 | self.excluded_tags = [] 241 | self.patterns = [] 242 | self.errors = False 243 | self.lock = asyncio.Lock() 244 | self.load_slug = None 245 | self.load_module = None 246 | 247 | def add_argument(self, plugin, name, **kwargs): 248 | # TODO: make sure name is simple. 249 | name = '--' + plugin.slug + '.' + slugify(name) 250 | 251 | if self.argparse_group is None: 252 | self.argparse_group = self.argparse.add_argument_group('plugin arguments', description='These are optional arguments for certain plugins.') 253 | self.argparse_group.add_argument(name, **kwargs) 254 | 255 | def extract_service(self, line, regex): 256 | if regex is None: 257 | regex = '^(?P\d+)\/(?P(tcp|udp))(.*)open(\s*)(?P[\w\-\/]+)(\s*)(.*)$' 258 | match = re.search(regex, line) 259 | if match: 260 | protocol = match.group('protocol').lower() 261 | port = int(match.group('port')) 262 | service = match.group('service') 263 | secure = True if 'ssl' in service or 'tls' in service else False 264 | 265 | if service.startswith('ssl/') or service.startswith('tls/'): 266 | service = service[4:] 267 | 268 | return Service(protocol, port, service, secure) 269 | else: 270 | return None 271 | 272 | async def extract_services(self, stream, regex): 273 | if not isinstance(stream, CommandStreamReader): 274 | print('Error: extract_services must be passed an instance of a CommandStreamReader.') 275 | sys.exit(1) 276 | 277 | services = [] 278 | while True: 279 | line = await stream.readline() 280 | if line is not None: 281 | service = self.extract_service(line, regex) 282 | if service: 283 | services.append(service) 284 | else: 285 | break 286 | return services 287 | 288 | def register(self, plugin, filename): 289 | if plugin.disabled: 290 | return 291 | 292 | if plugin.name is None: 293 | fail('Error: Plugin with class name "' + plugin.__class__.__name__ + '" in ' + filename + ' does not have a name.') 294 | 295 | for _, loaded_plugin in self.plugins.items(): 296 | if plugin.name == loaded_plugin.name: 297 | fail('Error: Duplicate plugin name "' + plugin.name + '" detected in ' + filename + '.', file=sys.stderr) 298 | 299 | if plugin.slug is None: 300 | plugin.slug = slugify(plugin.name) 301 | elif not self.__slug_regex.match(plugin.slug): 302 | fail('Error: provided slug "' + plugin.slug + '" in ' + filename + ' is not valid (must only contain lowercase letters, numbers, and hyphens).', file=sys.stderr) 303 | 304 | if plugin.slug in config['protected_classes']: 305 | fail('Error: plugin slug "' + plugin.slug + '" in ' + filename + ' is a protected string. Please change.') 306 | 307 | if plugin.slug not in self.plugins: 308 | 309 | for _, loaded_plugin in self.plugins.items(): 310 | if plugin is loaded_plugin: 311 | fail('Error: plugin "' + plugin.name + '" in ' + filename + ' already loaded as "' + loaded_plugin.name + '" (' + str(loaded_plugin) + ')', file=sys.stderr) 312 | 313 | configure_function_found = False 314 | run_coroutine_found = False 315 | manual_function_found = False 316 | 317 | for member_name, member_value in inspect.getmembers(plugin, predicate=inspect.ismethod): 318 | if member_name == 'configure': 319 | configure_function_found = True 320 | elif member_name == 'run' and inspect.iscoroutinefunction(member_value): 321 | if len(inspect.getfullargspec(member_value).args) != 2: 322 | fail('Error: the "run" coroutine in the plugin "' + plugin.name + '" in ' + filename + ' should have two arguments.', file=sys.stderr) 323 | run_coroutine_found = True 324 | elif member_name == 'manual': 325 | if len(inspect.getfullargspec(member_value).args) != 3: 326 | fail('Error: the "manual" function in the plugin "' + plugin.name + '" in ' + filename + ' should have three arguments.', file=sys.stderr) 327 | manual_function_found = True 328 | 329 | if not run_coroutine_found and not manual_function_found: 330 | fail('Error: the plugin "' + plugin.name + '" in ' + filename + ' needs either a "manual" function, a "run" coroutine, or both.', file=sys.stderr) 331 | 332 | if issubclass(plugin.__class__, PortScan): 333 | if plugin.type is None: 334 | fail('Error: the PortScan plugin "' + plugin.name + '" in ' + filename + ' requires a type (either tcp or udp).') 335 | else: 336 | plugin.type = plugin.type.lower() 337 | if plugin.type not in ['tcp', 'udp']: 338 | fail('Error: the PortScan plugin "' + plugin.name + '" in ' + filename + ' has an invalid type (should be tcp or udp).') 339 | self.plugin_types["port"].append(plugin) 340 | elif issubclass(plugin.__class__, ServiceScan): 341 | self.plugin_types["service"].append(plugin) 342 | elif issubclass(plugin.__class__, Report): 343 | self.plugin_types["report"].append(plugin) 344 | else: 345 | fail('Plugin "' + plugin.name + '" in ' + filename + ' is neither a PortScan, ServiceScan, nor a Report.', file=sys.stderr) 346 | 347 | plugin.tags = [tag.lower() for tag in plugin.tags] 348 | 349 | # Add plugin tags to tag list. 350 | [self.taglist.append(t) for t in plugin.tags if t not in self.tags] 351 | 352 | plugin.autorecon = self 353 | if configure_function_found: 354 | plugin.configure() 355 | self.plugins[plugin.slug] = plugin 356 | else: 357 | fail('Error: plugin slug "' + plugin.slug + '" in ' + filename + ' is already assigned.', file=sys.stderr) 358 | 359 | async def execute(self, cmd, target, tag, patterns=None, outfile=None, errfile=None): 360 | if patterns: 361 | combined_patterns = self.patterns + patterns 362 | else: 363 | combined_patterns = self.patterns 364 | 365 | process = await asyncio.create_subprocess_shell( 366 | cmd, 367 | stdin=open('/dev/null'), 368 | stdout=asyncio.subprocess.PIPE, 369 | stderr=asyncio.subprocess.PIPE) 370 | 371 | cout = CommandStreamReader(process.stdout, target, tag, patterns=combined_patterns, outfile=outfile) 372 | cerr = CommandStreamReader(process.stderr, target, tag, patterns=combined_patterns, outfile=errfile) 373 | 374 | asyncio.create_task(cout._read()) 375 | asyncio.create_task(cerr._read()) 376 | 377 | return process, cout, cerr 378 | -------------------------------------------------------------------------------- /autorecon/targets.py: -------------------------------------------------------------------------------- 1 | import asyncio, inspect, os 2 | from typing import final 3 | from autorecon.config import config 4 | from autorecon.io import e, info, warn, error 5 | 6 | class Target: 7 | 8 | def __init__(self, address, ip, ipversion, type, autorecon): 9 | self.address = address 10 | self.ip = ip 11 | self.ipversion = ipversion 12 | self.type = type 13 | self.autorecon = autorecon 14 | self.basedir = '' 15 | self.reportdir = '' 16 | self.scandir = '' 17 | self.lock = asyncio.Lock() 18 | self.ports = None 19 | self.pending_services = [] 20 | self.services = [] 21 | self.scans = {'ports':{}, 'services':{}} 22 | self.running_tasks = {} 23 | 24 | async def add_service(self, service): 25 | async with self.lock: 26 | self.pending_services.append(service) 27 | 28 | def extract_service(self, line, regex=None): 29 | return self.autorecon.extract_service(line, regex) 30 | 31 | async def extract_services(self, stream, regex=None): 32 | return await self.autorecon.extract_services(stream, regex) 33 | 34 | @final 35 | def info(self, msg, verbosity=0): 36 | plugin = inspect.currentframe().f_back.f_locals['self'] 37 | info('{bright}[{yellow}' + self.address + '{crst}/{bgreen}' + plugin.slug + '{crst}]{rst} ' + msg) 38 | 39 | @final 40 | def warn(self, msg, verbosity=0): 41 | plugin = inspect.currentframe().f_back.f_locals['self'] 42 | warn('{bright}[{yellow}' + self.address + '{crst}/{bgreen}' + plugin.slug + '{crst}]{rst} ' + msg) 43 | 44 | @final 45 | def error(self, msg, verbosity=0): 46 | plugin = inspect.currentframe().f_back.f_locals['self'] 47 | error('{bright}[{yellow}' + self.address + '{crst}/{bgreen}' + plugin.slug + '{crst}]{rst} ' + msg) 48 | 49 | async def execute(self, cmd, blocking=True, outfile=None, errfile=None, future_outfile=None): 50 | target = self 51 | 52 | # Create variables for command references. 53 | address = target.address 54 | addressv6 = target.address 55 | ipaddress = target.ip 56 | ipaddressv6 = target.ip 57 | scandir = target.scandir 58 | 59 | nmap_extra = target.autorecon.args.nmap 60 | if target.autorecon.args.nmap_append: 61 | nmap_extra += ' ' + target.autorecon.args.nmap_append 62 | 63 | if target.ipversion == 'IPv6': 64 | nmap_extra += ' -6' 65 | if addressv6 == target.ip: 66 | addressv6 = '[' + addressv6 + ']' 67 | ipaddressv6 = '[' + ipaddressv6 + ']' 68 | 69 | plugin = inspect.currentframe().f_back.f_locals['self'] 70 | 71 | if config['proxychains']: 72 | nmap_extra += ' -sT' 73 | 74 | cmd = e(cmd) 75 | tag = plugin.slug 76 | 77 | info('Port scan {bblue}' + plugin.name + ' {green}(' + tag + '){rst} is running the following command against {byellow}' + address + '{rst}: ' + cmd, verbosity=2) 78 | 79 | if outfile is not None: 80 | outfile = os.path.join(target.scandir, e(outfile)) 81 | 82 | if errfile is not None: 83 | errfile = os.path.join(target.scandir, e(errfile)) 84 | 85 | if future_outfile is not None: 86 | future_outfile = os.path.join(target.scandir, e(future_outfile)) 87 | 88 | target.scans['ports'][tag]['commands'].append([cmd, outfile if outfile is not None else future_outfile, errfile]) 89 | 90 | async with target.lock: 91 | with open(os.path.join(target.scandir, '_commands.log'), 'a') as file: 92 | file.writelines(cmd + '\n\n') 93 | 94 | process, stdout, stderr = await target.autorecon.execute(cmd, target, tag, patterns=plugin.patterns, outfile=outfile, errfile=errfile) 95 | 96 | target.running_tasks[tag]['processes'].append({'process': process, 'stderr': stderr, 'cmd': cmd}) 97 | 98 | # If process should block, sleep until stdout and stderr have finished. 99 | if blocking: 100 | while (not (stdout.ended and stderr.ended)): 101 | await asyncio.sleep(0.1) 102 | await process.wait() 103 | 104 | return process, stdout, stderr 105 | 106 | class Service: 107 | 108 | def __init__(self, protocol, port, name, secure=False): 109 | self.target = None 110 | self.protocol = protocol.lower() 111 | self.port = int(port) 112 | self.name = name 113 | self.secure = secure 114 | self.manual_commands = {} 115 | 116 | @final 117 | def tag(self): 118 | return self.protocol + '/' + str(self.port) + '/' + self.name 119 | 120 | @final 121 | def full_tag(self): 122 | return self.protocol + '/' + str(self.port) + '/' + self.name + '/' + ('secure' if self.secure else 'insecure') 123 | 124 | @final 125 | def add_manual_commands(self, description, commands): 126 | if not isinstance(commands, list): 127 | commands = [commands] 128 | if description not in self.manual_commands: 129 | self.manual_commands[description] = [] 130 | 131 | # Merge in new unique commands, while preserving order. 132 | [self.manual_commands[description].append(m) for m in commands if m not in self.manual_commands[description]] 133 | 134 | @final 135 | def add_manual_command(self, description, command): 136 | self.add_manual_commands(description, command) 137 | 138 | @final 139 | def info(self, msg): 140 | plugin = inspect.currentframe().f_back.f_locals['self'] 141 | info('{bright}[{yellow}' + self.target.address + '{crst}/{bgreen}' + self.tag() + '/' + plugin.slug + '{crst}]{rst} ' + msg) 142 | 143 | @final 144 | def warn(self, msg): 145 | plugin = inspect.currentframe().f_back.f_locals['self'] 146 | warn('{bright}[{yellow}' + self.target.address + '{crst}/{bgreen}' + self.tag() + '/' + plugin.slug + '{crst}]{rst} ' + msg) 147 | 148 | @final 149 | def error(self, msg): 150 | plugin = inspect.currentframe().f_back.f_locals['self'] 151 | error('{bright}[{yellow}' + self.target.address + '{crst}/{bgreen}' + self.tag() + '/' + plugin.slug + '{crst}]{rst} ' + msg) 152 | 153 | @final 154 | async def execute(self, cmd, blocking=True, outfile=None, errfile=None, future_outfile=None): 155 | target = self.target 156 | 157 | # Create variables for command references. 158 | address = target.address 159 | addressv6 = target.address 160 | ipaddress = target.ip 161 | ipaddressv6 = target.ip 162 | scandir = target.scandir 163 | protocol = self.protocol 164 | port = self.port 165 | name = self.name 166 | 167 | if not config['no_port_dirs']: 168 | scandir = os.path.join(scandir, protocol + str(port)) 169 | os.makedirs(scandir, exist_ok=True) 170 | os.makedirs(os.path.join(scandir, 'xml'), exist_ok=True) 171 | 172 | # Special cases for HTTP. 173 | http_scheme = 'https' if 'https' in self.name or self.secure is True else 'http' 174 | 175 | nmap_extra = target.autorecon.args.nmap 176 | if target.autorecon.args.nmap_append: 177 | nmap_extra += ' ' + target.autorecon.args.nmap_append 178 | 179 | if protocol == 'udp': 180 | nmap_extra += ' -sU' 181 | 182 | if target.ipversion == 'IPv6': 183 | nmap_extra += ' -6' 184 | if addressv6 == target.ip: 185 | addressv6 = '[' + addressv6 + ']' 186 | ipaddressv6 = '[' + ipaddressv6 + ']' 187 | 188 | if config['proxychains'] and protocol == 'tcp': 189 | nmap_extra += ' -sT' 190 | 191 | plugin = inspect.currentframe().f_back.f_locals['self'] 192 | cmd = e(cmd) 193 | tag = self.tag() + '/' + plugin.slug 194 | plugin_tag = tag 195 | if plugin.run_once_boolean: 196 | plugin_tag = plugin.slug 197 | 198 | info('Service scan {bblue}' + plugin.name + ' {green}(' + tag + '){rst} is running the following command against {byellow}' + address + '{rst}: ' + cmd, verbosity=2) 199 | 200 | if outfile is not None: 201 | outfile = os.path.join(scandir, e(outfile)) 202 | 203 | if errfile is not None: 204 | errfile = os.path.join(scandir, e(errfile)) 205 | 206 | if future_outfile is not None: 207 | future_outfile = os.path.join(scandir, e(future_outfile)) 208 | 209 | target.scans['services'][self][plugin_tag]['commands'].append([cmd, outfile if outfile is not None else future_outfile, errfile]) 210 | 211 | async with target.lock: 212 | with open(os.path.join(target.scandir, '_commands.log'), 'a') as file: 213 | file.writelines(cmd + '\n\n') 214 | 215 | process, stdout, stderr = await target.autorecon.execute(cmd, target, tag, patterns=plugin.patterns, outfile=outfile, errfile=errfile) 216 | 217 | target.running_tasks[tag]['processes'].append({'process': process, 'stderr': stderr, 'cmd': cmd}) 218 | 219 | # If process should block, sleep until stdout and stderr have finished. 220 | if blocking: 221 | while (not (stdout.ended and stderr.ended)): 222 | await asyncio.sleep(0.1) 223 | await process.wait() 224 | 225 | return process, stdout, stderr 226 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "autorecon" 3 | version = "2.0.36" 4 | description = "A multi-threaded network reconnaissance tool which performs automated enumeration of services." 5 | authors = ["Tib3rius"] 6 | license = "GNU GPL v3" 7 | exclude = ["autorecon.py"] 8 | packages = [ 9 | { include = "autorecon" }, 10 | ] 11 | 12 | [tool.poetry.dependencies] 13 | python = "^3.8" 14 | platformdirs = "^4.3.6" 15 | colorama = "^0.4.5" 16 | impacket = "^0.10.0" 17 | psutil = "^5.9.4" 18 | requests = "^2.28.1" 19 | toml = "^0.10.2" 20 | Unidecode = "^1.3.1" 21 | 22 | [tool.poetry.dev-dependencies] 23 | 24 | [tool.poetry.scripts] 25 | autorecon = "autorecon.main:main" 26 | 27 | [build-system] 28 | requires = ["poetry-core>=1.0.0"] 29 | build-backend = "poetry.core.masonry.api" 30 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | colorama>=0.4.5 2 | impacket>=0.10.0 3 | platformdirs>=4.3.6 4 | psutil>=5.9.4 5 | requests>=2.28.1 6 | toml>=0.10.2 7 | Unidecode>=1.3.1 8 | --------------------------------------------------------------------------------