First commit
This commit is contained in:
commit
2e580baa91
201
LICENSE
Normal file
201
LICENSE
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
36
README.md
Normal file
36
README.md
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Blink
|
||||||
|
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
|
||||||
|
|
||||||
|
Blink is a DNS bruteforcer made in Go
|
||||||
|
|
||||||
|
## This project is a work in progress
|
||||||
|
|
||||||
|
## Todo
|
||||||
|
- [ ] Add ENT (empty non-terminal) support
|
||||||
|
- [ ] Add verifying host support
|
||||||
|
- [ ] Move half of main.go to /internal
|
||||||
|
|
||||||
|
## Help
|
||||||
|
```
|
||||||
|
Blink is a DNS bruteforcer made in Go (Author: perp)
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
blink [flags]
|
||||||
|
|
||||||
|
Flags:
|
||||||
|
-w, --wordlist string Path to wordlist
|
||||||
|
-r, --resolvers string Path to resolvers
|
||||||
|
-u, --udp Query using UDP
|
||||||
|
-i, --ipv6 Query for IPv6
|
||||||
|
-c, --wildcard Query for wildcard
|
||||||
|
-d, --timeout int Query timeout (default 5)
|
||||||
|
-t, --threads int Concurrent threads (default 1)
|
||||||
|
-v, --debug Debug mode
|
||||||
|
-h, --help help for blink
|
||||||
|
```
|
||||||
|
|
||||||
|
## Credits
|
||||||
|
Thanks to [aiodnsbrute](https://github.com/blark/aiodnsbrute) for the inspiration
|
||||||
|
|
||||||
|
## Disclaimer
|
||||||
|
###### Developers are not responsible for any misuse
|
27
go.mod
Normal file
27
go.mod
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
module git.supernets.org/perp/blink
|
||||||
|
|
||||||
|
go 1.22.4
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/fatih/color v1.17.0
|
||||||
|
github.com/miekg/dns v1.1.61
|
||||||
|
github.com/panjf2000/ants/v2 v2.10.0
|
||||||
|
github.com/rs/zerolog v1.33.0
|
||||||
|
github.com/schollz/progressbar/v3 v3.14.4
|
||||||
|
github.com/spf13/cobra v1.8.1
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||||
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
|
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
|
||||||
|
github.com/rivo/uniseg v0.4.7 // indirect
|
||||||
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
|
golang.org/x/mod v0.18.0 // indirect
|
||||||
|
golang.org/x/net v0.26.0 // indirect
|
||||||
|
golang.org/x/sync v0.7.0 // indirect
|
||||||
|
golang.org/x/sys v0.21.0 // indirect
|
||||||
|
golang.org/x/term v0.21.0 // indirect
|
||||||
|
golang.org/x/tools v0.22.0 // indirect
|
||||||
|
)
|
68
go.sum
Normal file
68
go.sum
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
|
||||||
|
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
|
||||||
|
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||||
|
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||||
|
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||||
|
github.com/k0kubun/go-ansi v0.0.0-20180517002512-3bf9e2903213/go.mod h1:vNUNkEQ1e29fT/6vq2aBdFsgNPmy8qMdSay1npru+Sw=
|
||||||
|
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||||
|
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||||
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
|
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
|
github.com/miekg/dns v1.1.61 h1:nLxbwF3XxhwVSm8g9Dghm9MHPaUZuqhPiGL+675ZmEs=
|
||||||
|
github.com/miekg/dns v1.1.61/go.mod h1:mnAarhS3nWaW+NVP2wTkYVIZyHNJ098SJZUki3eykwQ=
|
||||||
|
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
|
||||||
|
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
|
||||||
|
github.com/panjf2000/ants/v2 v2.10.0 h1:zhRg1pQUtkyRiOFo2Sbqwjp0GfBNo9cUY2/Grpx1p+8=
|
||||||
|
github.com/panjf2000/ants/v2 v2.10.0/go.mod h1:7ZxyxsqE4vvW0M7LSD8aI3cKwgFhBHbxnlN8mDqHa1I=
|
||||||
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||||
|
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||||
|
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||||
|
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
|
||||||
|
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
|
||||||
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
|
github.com/schollz/progressbar/v3 v3.14.4 h1:W9ZrDSJk7eqmQhd3uxFNNcTr0QL+xuGNI9dEMrw0r74=
|
||||||
|
github.com/schollz/progressbar/v3 v3.14.4/go.mod h1:aT3UQ7yGm+2ZjeXPqsjTenwL3ddUiuZ0kfQ/2tHlyNI=
|
||||||
|
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
|
||||||
|
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
|
||||||
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
|
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
|
||||||
|
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
|
golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0=
|
||||||
|
golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||||
|
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
|
||||||
|
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
|
||||||
|
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||||
|
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
||||||
|
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
|
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
|
||||||
|
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
|
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||||
|
golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA=
|
||||||
|
golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0=
|
||||||
|
golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA=
|
||||||
|
golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
33
resolvers.txt
Normal file
33
resolvers.txt
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
1.0.0.1
|
||||||
|
1.1.1.1
|
||||||
|
134.195.4.2
|
||||||
|
149.112.112.112
|
||||||
|
159.89.120.99
|
||||||
|
185.228.168.9
|
||||||
|
185.228.169.9
|
||||||
|
195.46.39.39
|
||||||
|
195.46.39.40
|
||||||
|
205.171.2.65
|
||||||
|
205.171.3.65
|
||||||
|
208.67.220.220
|
||||||
|
208.67.222.222
|
||||||
|
216.146.35.35
|
||||||
|
216.146.36.36
|
||||||
|
64.6.64.6
|
||||||
|
64.6.65.6
|
||||||
|
74.82.42.42
|
||||||
|
76.76.10.0
|
||||||
|
76.76.2.0
|
||||||
|
77.88.8.1
|
||||||
|
77.88.8.8
|
||||||
|
8.20.247.20
|
||||||
|
8.26.56.26
|
||||||
|
8.8.4.4
|
||||||
|
8.8.8.8
|
||||||
|
84.200.69.80
|
||||||
|
84.200.70.40
|
||||||
|
89.233.43.71
|
||||||
|
9.9.9.9
|
||||||
|
91.239.100.100
|
||||||
|
94.140.14.14
|
||||||
|
94.140.15.15
|
114442
subdomains.txt
Normal file
114442
subdomains.txt
Normal file
File diff suppressed because it is too large
Load Diff
205
v1/cmd/blink/main.go
Normal file
205
v1/cmd/blink/main.go
Normal file
@ -0,0 +1,205 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"git.supernets.org/perp/blink/v1/internal/file"
|
||||||
|
"git.supernets.org/perp/blink/v1/pkg/dns"
|
||||||
|
"git.supernets.org/perp/blink/v1/pkg/runner"
|
||||||
|
"github.com/fatih/color"
|
||||||
|
"github.com/rs/zerolog"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
"github.com/schollz/progressbar/v3"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Custom banner
|
||||||
|
const banner = `___ _ _ _ _ _ _
|
||||||
|
|__] | | |\ | |_/
|
||||||
|
|__] |___ | | \| | \_
|
||||||
|
|
||||||
|
`
|
||||||
|
|
||||||
|
// Runner options
|
||||||
|
var opts runner.Options
|
||||||
|
|
||||||
|
// CLI flags
|
||||||
|
var (
|
||||||
|
wordlist string
|
||||||
|
resolvers string
|
||||||
|
debug bool
|
||||||
|
)
|
||||||
|
|
||||||
|
// var debug bool
|
||||||
|
var rootCmd = &cobra.Command{
|
||||||
|
Use: "blink",
|
||||||
|
Short: "Blink is a DNS bruteforcer made in Go (Author: perp)",
|
||||||
|
Run: func(_ *cobra.Command, args []string) {
|
||||||
|
// Debug mode enabled
|
||||||
|
if debug {
|
||||||
|
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
||||||
|
} else {
|
||||||
|
zerolog.SetGlobalLevel(zerolog.InfoLevel)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set domains
|
||||||
|
opts.Domains = args
|
||||||
|
|
||||||
|
// Read pipe
|
||||||
|
pipe := file.Pipe()
|
||||||
|
|
||||||
|
// Pipe is found
|
||||||
|
if len(pipe) != 0 {
|
||||||
|
// Set domains
|
||||||
|
opts.Domains = pipe
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print banner
|
||||||
|
color.Red(banner)
|
||||||
|
|
||||||
|
// Read wordlist path
|
||||||
|
wordlistLines, err := file.Read(wordlist)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
opts.Wordlist = wordlistLines
|
||||||
|
|
||||||
|
// Read resolvers file
|
||||||
|
resolversLines, err := file.Read(resolvers)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
opts.Resolvers = resolversLines
|
||||||
|
|
||||||
|
// Warnings
|
||||||
|
if opts.UDP {
|
||||||
|
log.Warn().Msg("UDP is enabled")
|
||||||
|
}
|
||||||
|
|
||||||
|
if opts.IPv6 {
|
||||||
|
log.Warn().Msg("IPv6 is enabled")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store domains
|
||||||
|
domains := make(map[string]int)
|
||||||
|
|
||||||
|
// Store task count
|
||||||
|
tasks := len(opts.Wordlist) * len(opts.Domains)
|
||||||
|
|
||||||
|
// Create progress bar
|
||||||
|
bar := progressbar.NewOptions(tasks,
|
||||||
|
progressbar.OptionSetWriter(os.Stderr),
|
||||||
|
progressbar.OptionShowCount(),
|
||||||
|
progressbar.OptionShowIts(),
|
||||||
|
progressbar.OptionSetPredictTime(false),
|
||||||
|
progressbar.OptionEnableColorCodes(true),
|
||||||
|
progressbar.OptionSetWidth(40),
|
||||||
|
progressbar.OptionSetTheme(progressbar.Theme{
|
||||||
|
Saucer: "[blue]=[reset]",
|
||||||
|
SaucerHead: "[blue]>[reset]",
|
||||||
|
SaucerPadding: " ",
|
||||||
|
BarStart: "[",
|
||||||
|
BarEnd: "]",
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
|
// Store shown
|
||||||
|
var shown bool
|
||||||
|
|
||||||
|
// Handle results
|
||||||
|
opts.OnResult = func(result *dns.Result) {
|
||||||
|
bar.Add(1)
|
||||||
|
|
||||||
|
if !shown {
|
||||||
|
if result.Wildcard {
|
||||||
|
log.Warn().Str("domain", result.Domain).Msg("Wildcard detected")
|
||||||
|
shown = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error found
|
||||||
|
if result.Error != nil {
|
||||||
|
// Debug mode enabled
|
||||||
|
if debug {
|
||||||
|
bar.Clear()
|
||||||
|
log.Debug().Msg(result.Error.Error())
|
||||||
|
bar.RenderBlank()
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append domain
|
||||||
|
domains[result.Domain] += 1
|
||||||
|
|
||||||
|
// Store IPs
|
||||||
|
var ipv4s, ipv6s []string
|
||||||
|
|
||||||
|
// Go through IPv4
|
||||||
|
for _, ip := range result.IPv4 {
|
||||||
|
ipv4s = append(ipv4s, ip.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Go through IPv6
|
||||||
|
for _, ip := range result.IPv6 {
|
||||||
|
ipv6s = append(ipv6s, ip.String())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Join IPs
|
||||||
|
ipv4 := "[" + strings.Join(ipv4s, ", ") + "]"
|
||||||
|
ipv6 := "[" + strings.Join(ipv6s, ", ") + "]"
|
||||||
|
|
||||||
|
bar.Clear()
|
||||||
|
|
||||||
|
// Check IPv6
|
||||||
|
if !opts.IPv6 {
|
||||||
|
log.Info().Str("addresses", ipv4).Msgf("%s", result.Subdomain)
|
||||||
|
} else {
|
||||||
|
log.Info().Str("addresses", ipv6).Msgf("%s", result.Subdomain)
|
||||||
|
}
|
||||||
|
|
||||||
|
bar.RenderBlank()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create runner
|
||||||
|
run := runner.New(&opts)
|
||||||
|
run.Bruteforce()
|
||||||
|
|
||||||
|
// Go through domains
|
||||||
|
for domain, count := range domains {
|
||||||
|
log.Info().Str("subdomains", fmt.Sprintf("%d", count)).Msg(domain)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// Add flags
|
||||||
|
rootCmd.Flags().StringVarP(&wordlist, "wordlist", "w", "", "Path to wordlist")
|
||||||
|
rootCmd.Flags().StringVarP(&resolvers, "resolvers", "r", "", "Path to resolvers")
|
||||||
|
rootCmd.Flags().BoolVarP(&opts.UDP, "udp", "u", false, "Query using UDP")
|
||||||
|
rootCmd.Flags().BoolVarP(&opts.IPv6, "ipv6", "i", false, "Query for IPv6")
|
||||||
|
rootCmd.Flags().BoolVarP(&opts.Wildcard, "wildcard", "c", false, "Query for wildcard")
|
||||||
|
rootCmd.Flags().IntVarP(&opts.Timeout, "timeout", "d", 5, "Query timeout")
|
||||||
|
rootCmd.Flags().IntVarP(&opts.Threads, "threads", "t", 1, "Concurrent threads")
|
||||||
|
rootCmd.Flags().BoolVarP(&debug, "debug", "v", false, "Debug mode")
|
||||||
|
|
||||||
|
// Set flag options
|
||||||
|
rootCmd.Flags().SortFlags = false
|
||||||
|
rootCmd.MarkFlagRequired("wordlist")
|
||||||
|
|
||||||
|
// Setup logger
|
||||||
|
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
if err := rootCmd.Execute(); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Todo:
|
||||||
|
// Clean up main.go
|
||||||
|
// Fix warning logs
|
||||||
|
// Fix wildcard log
|
||||||
|
// Complete all options
|
35
v1/internal/file/pipe.go
Normal file
35
v1/internal/file/pipe.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package file
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get the pipe
|
||||||
|
func Pipe() []string {
|
||||||
|
// Store lines
|
||||||
|
var lines []string
|
||||||
|
|
||||||
|
// Get pipe
|
||||||
|
pipe, _ := os.Stdin.Stat()
|
||||||
|
|
||||||
|
// Piped found
|
||||||
|
if (pipe.Mode() & os.ModeCharDevice) == 0 {
|
||||||
|
// Create scanner
|
||||||
|
scanner := bufio.NewScanner(os.Stdin)
|
||||||
|
|
||||||
|
// Go through scanner
|
||||||
|
for scanner.Scan() {
|
||||||
|
// Store line
|
||||||
|
line := scanner.Text()
|
||||||
|
|
||||||
|
// Ignore empty & commented lines
|
||||||
|
if line != "" && !strings.HasPrefix(line, "#") {
|
||||||
|
lines = append(lines, line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines
|
||||||
|
}
|
36
v1/internal/file/read.go
Normal file
36
v1/internal/file/read.go
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package file
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Read a file
|
||||||
|
func Read(path string) ([]string, error) {
|
||||||
|
// Store lines
|
||||||
|
var lines []string
|
||||||
|
|
||||||
|
// Open file
|
||||||
|
file, err := os.Open(path)
|
||||||
|
if err != nil {
|
||||||
|
return lines, err
|
||||||
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
|
// Create scanner
|
||||||
|
scanner := bufio.NewScanner(file)
|
||||||
|
|
||||||
|
// Go through scanner
|
||||||
|
for scanner.Scan() {
|
||||||
|
// Store line
|
||||||
|
line := scanner.Text()
|
||||||
|
|
||||||
|
// Ignore empty & commented lines
|
||||||
|
if line != "" && !strings.HasPrefix(line, "#") {
|
||||||
|
lines = append(lines, line)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return lines, nil
|
||||||
|
}
|
71
v1/pkg/dns/a.go
Normal file
71
v1/pkg/dns/a.go
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
package dns
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
|
"net"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/miekg/dns"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Query A record (ipv4)
|
||||||
|
func (q *Query) A() {
|
||||||
|
for {
|
||||||
|
// Create result
|
||||||
|
result := &Result{
|
||||||
|
Domain: q.Domain,
|
||||||
|
Subdomain: q.Subdomain,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create message
|
||||||
|
message := new(dns.Msg)
|
||||||
|
|
||||||
|
// Set question
|
||||||
|
message.SetQuestion(dns.Fqdn(q.Subdomain), dns.TypeA)
|
||||||
|
|
||||||
|
// Choose random resolver
|
||||||
|
resolver := q.Resolvers[rand.Intn(len(q.Resolvers))]
|
||||||
|
|
||||||
|
// Query response
|
||||||
|
resp, _, err := q.Client.Exchange(message, resolver)
|
||||||
|
if err != nil {
|
||||||
|
// Ratelimited
|
||||||
|
if strings.ContainsAny(err.Error(), "i/o timeout") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
result.Error = err
|
||||||
|
q.Results <- result
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store IPs
|
||||||
|
var ips []net.IP
|
||||||
|
|
||||||
|
// Go through answers
|
||||||
|
for _, answer := range resp.Answer {
|
||||||
|
// Map record
|
||||||
|
record, ok := answer.(*dns.A)
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append IPv4
|
||||||
|
ips = append(ips, record.A)
|
||||||
|
}
|
||||||
|
|
||||||
|
// No IPs found
|
||||||
|
if len(ips) < 1 {
|
||||||
|
result.Error = errors.New(fmt.Sprintf("No IPv4s found for %s", q.Domain))
|
||||||
|
q.Results <- result
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send result
|
||||||
|
result.IPv4 = ips
|
||||||
|
q.Results <- result
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
71
v1/pkg/dns/aaaa.go
Normal file
71
v1/pkg/dns/aaaa.go
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
package dns
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"math/rand"
|
||||||
|
"net"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/miekg/dns"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Query AAAA record (ipv6)
|
||||||
|
func (q *Query) AAAA() {
|
||||||
|
for {
|
||||||
|
// Create result
|
||||||
|
result := &Result{
|
||||||
|
Domain: q.Domain,
|
||||||
|
Subdomain: q.Subdomain,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create message
|
||||||
|
message := new(dns.Msg)
|
||||||
|
|
||||||
|
// Set question
|
||||||
|
message.SetQuestion(dns.Fqdn(q.Subdomain), dns.TypeAAAA)
|
||||||
|
|
||||||
|
// Choose random resolver
|
||||||
|
resolver := q.Resolvers[rand.Intn(len(q.Resolvers))]
|
||||||
|
|
||||||
|
// Query response
|
||||||
|
resp, _, err := q.Client.Exchange(message, resolver)
|
||||||
|
if err != nil {
|
||||||
|
// Ratelimited
|
||||||
|
if strings.ContainsAny(err.Error(), "i/o timeout") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
result.Error = err
|
||||||
|
q.Results <- result
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store IPs
|
||||||
|
var ips []net.IP
|
||||||
|
|
||||||
|
// Go through answers
|
||||||
|
for _, answer := range resp.Answer {
|
||||||
|
// Map record
|
||||||
|
record, ok := answer.(*dns.AAAA)
|
||||||
|
if !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Append IPv6
|
||||||
|
ips = append(ips, record.AAAA)
|
||||||
|
}
|
||||||
|
|
||||||
|
// No IPs found
|
||||||
|
if len(ips) < 1 {
|
||||||
|
result.Error = errors.New(fmt.Sprintf("No IPv6s found for %s", q.Domain))
|
||||||
|
q.Results <- result
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send result
|
||||||
|
result.IPv6 = ips
|
||||||
|
q.Results <- result
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
33
v1/pkg/dns/dns.go
Normal file
33
v1/pkg/dns/dns.go
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package dns
|
||||||
|
|
||||||
|
import (
|
||||||
|
"math/rand"
|
||||||
|
"net"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/miekg/dns"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DNS query
|
||||||
|
type Query struct {
|
||||||
|
Client *dns.Client // DNS client
|
||||||
|
Resolvers []string // Target resolvers
|
||||||
|
Domain string // Target domain
|
||||||
|
Subdomain string // Target subdomain
|
||||||
|
Results chan<- *Result // Results channel
|
||||||
|
}
|
||||||
|
|
||||||
|
// DNS result
|
||||||
|
type Result struct {
|
||||||
|
Domain string // Target domain
|
||||||
|
Subdomain string // Target subdomain
|
||||||
|
Wildcard bool // Wildcard detect
|
||||||
|
IPv4 []net.IP // IPv4 hosts
|
||||||
|
IPv6 []net.IP // IPv6 hosts
|
||||||
|
Error error // Error response
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// Random seed
|
||||||
|
rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||||
|
}
|
64
v1/pkg/dns/wildcard.go
Normal file
64
v1/pkg/dns/wildcard.go
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
package dns
|
||||||
|
|
||||||
|
import (
|
||||||
|
"math/rand"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/miekg/dns"
|
||||||
|
)
|
||||||
|
|
||||||
|
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
|
|
||||||
|
// Generate a random string
|
||||||
|
// https://stackoverflow.com/a/31832326
|
||||||
|
func generate(length int) string {
|
||||||
|
// Create byte array with length
|
||||||
|
word := make([]byte, length)
|
||||||
|
|
||||||
|
// Go through word
|
||||||
|
for index := range word {
|
||||||
|
// Set index to random letter
|
||||||
|
word[index] = letterBytes[rand.Intn(len(letterBytes))]
|
||||||
|
}
|
||||||
|
|
||||||
|
return string(word)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Query wildcard
|
||||||
|
func Wildcard(client *dns.Client, resolvers []string, domain string) bool {
|
||||||
|
for {
|
||||||
|
// Generate subdomain
|
||||||
|
subdomain := generate(10) + "." + domain
|
||||||
|
|
||||||
|
// Create message
|
||||||
|
message := new(dns.Msg)
|
||||||
|
|
||||||
|
// Set question
|
||||||
|
message.SetQuestion(dns.Fqdn(subdomain), dns.TypeA)
|
||||||
|
|
||||||
|
// Choose random resolver
|
||||||
|
resolver := resolvers[rand.Intn(len(resolvers))]
|
||||||
|
|
||||||
|
// Query response
|
||||||
|
response, _, err := client.Exchange(message, resolver)
|
||||||
|
if err != nil {
|
||||||
|
// Ratelimited
|
||||||
|
if strings.ContainsAny(err.Error(), "i/o timeout") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store status
|
||||||
|
var status bool
|
||||||
|
|
||||||
|
// Go through answers
|
||||||
|
for _, answer := range response.Answer {
|
||||||
|
// Map record
|
||||||
|
_, status = answer.(*dns.A)
|
||||||
|
}
|
||||||
|
|
||||||
|
return status
|
||||||
|
}
|
||||||
|
}
|
63
v1/pkg/runner/options.go
Normal file
63
v1/pkg/runner/options.go
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
package runner
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"git.supernets.org/perp/blink/v1/pkg/dns"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Configuration options
|
||||||
|
type Options struct {
|
||||||
|
Domains []string // Target domains
|
||||||
|
Wordlist []string // Target wordlist
|
||||||
|
Resolvers []string // Target resolvers
|
||||||
|
// ENT bool // Query for ENT
|
||||||
|
UDP bool // Query using UDP
|
||||||
|
IPv6 bool // Query for IPv6
|
||||||
|
Wildcard bool // Detect wildcard
|
||||||
|
// Verify bool // Verify query
|
||||||
|
Timeout int // Query timeout
|
||||||
|
Threads int // Concurrent threads
|
||||||
|
OnResult OnResultFunc // Result handler
|
||||||
|
}
|
||||||
|
|
||||||
|
// Result handler function
|
||||||
|
type OnResultFunc func(*dns.Result)
|
||||||
|
|
||||||
|
// Check resolvers
|
||||||
|
func (o *Options) resolvers() {
|
||||||
|
// No resolvers found
|
||||||
|
if len(o.Resolvers) == 0 {
|
||||||
|
o.Resolvers = append(o.Resolvers, "1.1.1.1:53")
|
||||||
|
o.Resolvers = append(o.Resolvers, "9.9.9.9:53")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Go through resolvers
|
||||||
|
for index, resolver := range o.Resolvers {
|
||||||
|
// Split
|
||||||
|
split := strings.Split(resolver, ":")
|
||||||
|
|
||||||
|
// No port found
|
||||||
|
if len(split) == 1 {
|
||||||
|
// Ignore empty & commented lines
|
||||||
|
if resolver != "" && !strings.HasPrefix(resolver, "#") {
|
||||||
|
o.Resolvers[index] = resolver + ":53"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check threads
|
||||||
|
func (o *Options) threads() {
|
||||||
|
// No threads found
|
||||||
|
if o.Threads == 0 {
|
||||||
|
o.Threads = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check options
|
||||||
|
func (o *Options) Check() {
|
||||||
|
o.resolvers()
|
||||||
|
o.threads()
|
||||||
|
}
|
129
v1/pkg/runner/runner.go
Normal file
129
v1/pkg/runner/runner.go
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
package runner
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"git.supernets.org/perp/blink/v1/pkg/dns"
|
||||||
|
mdns "github.com/miekg/dns"
|
||||||
|
"github.com/panjf2000/ants/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Bruteforce runner
|
||||||
|
type Runner struct {
|
||||||
|
options *Options // CLI options
|
||||||
|
client *mdns.Client // DNS client
|
||||||
|
pool *ants.Pool // Goroutine pool
|
||||||
|
results chan *dns.Result // Results channel
|
||||||
|
wildcards map[string]bool // Domain wildcards
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return a new Runner
|
||||||
|
func New(options *Options) *Runner {
|
||||||
|
// Check options
|
||||||
|
options.Check()
|
||||||
|
|
||||||
|
// Create client
|
||||||
|
client := &mdns.Client{
|
||||||
|
Net: "tcp",
|
||||||
|
Timeout: time.Second * time.Duration(options.Timeout),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detect UDP
|
||||||
|
if options.UDP {
|
||||||
|
client.Net = "udp"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create pool
|
||||||
|
pool, err := ants.NewPool(options.Threads)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store task count
|
||||||
|
tasks := len(options.Wordlist) * len(options.Domains)
|
||||||
|
|
||||||
|
// Create channel
|
||||||
|
results := make(chan *dns.Result, tasks)
|
||||||
|
|
||||||
|
// Create wildcards
|
||||||
|
wildcards := make(map[string]bool)
|
||||||
|
|
||||||
|
return &Runner{
|
||||||
|
options: options,
|
||||||
|
client: client,
|
||||||
|
pool: pool,
|
||||||
|
results: results,
|
||||||
|
wildcards: wildcards,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Detect wildcard
|
||||||
|
func (r *Runner) Detect() {
|
||||||
|
// Go through domains
|
||||||
|
for _, domain := range r.options.Domains {
|
||||||
|
// Get wildcard status
|
||||||
|
r.wildcards[domain] = dns.Wildcard(r.client, r.options.Resolvers, domain)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Submit tasks into pool
|
||||||
|
func (r *Runner) Submit() {
|
||||||
|
// Go through wordlist
|
||||||
|
for _, word := range r.options.Wordlist {
|
||||||
|
// Go through domains
|
||||||
|
for _, domain := range r.options.Domains {
|
||||||
|
// Create query
|
||||||
|
query := &dns.Query{
|
||||||
|
Client: r.client,
|
||||||
|
Resolvers: r.options.Resolvers,
|
||||||
|
Domain: domain,
|
||||||
|
Subdomain: word + "." + domain,
|
||||||
|
Results: r.results,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Submit query
|
||||||
|
r.pool.Submit(func() {
|
||||||
|
// Check IPv6
|
||||||
|
if !r.options.IPv6 {
|
||||||
|
query.A()
|
||||||
|
} else {
|
||||||
|
query.AAAA()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Receive tasks from pool
|
||||||
|
func (r *Runner) Receive() {
|
||||||
|
// Store task count
|
||||||
|
tasks := len(r.options.Wordlist) * len(r.options.Domains)
|
||||||
|
|
||||||
|
// Go through tasks
|
||||||
|
for range tasks {
|
||||||
|
select {
|
||||||
|
case result := <-r.results:
|
||||||
|
// Go through domains
|
||||||
|
for domain, wildcard := range r.wildcards {
|
||||||
|
// Domain found
|
||||||
|
if result.Domain == domain {
|
||||||
|
// Set wildcard
|
||||||
|
result.Wildcard = wildcard
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send result
|
||||||
|
r.options.OnResult(result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start bruteforcing
|
||||||
|
func (r *Runner) Bruteforce() {
|
||||||
|
if r.options.Wildcard {
|
||||||
|
r.Detect()
|
||||||
|
}
|
||||||
|
|
||||||
|
go r.Submit()
|
||||||
|
r.Receive()
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user