Coder Social home page Coder Social logo

nullarray / dorknet Goto Github PK

View Code? Open in Web Editor NEW
335.0 22.0 103.0 46 KB

Selenium powered Python script to automate searching for vulnerable web apps.

License: GNU General Public License v3.0

Python 71.06% Shell 28.94%
selenium geckodriver dork infosec web-app web-app-sec pentesting pentest proxy osint

dorknet's Introduction

DorkNet

Selenium powered Python script to automate searching the web for vulnerable applications.

DorkNet can take a single dork or a list of dorks as arguments. After the proper command line arguments have been passed, the script will use Selenium and Geckodriver to find the results we want and save them to a textfile for further processing with SQLmap or similar utilities.

Usage

git clone https://github.com/NullArray/DorkNet.git
cd DorkNet
python dorknet.py

The options for the program are as follows.

-h, --help              show this help message and exit
-d DORK, --dork DORK    specify the dork you wish to use
-l LIST, --list LIST    specify path to list with dorks
-v, --verbose           toggle verbosity

Some examples for clarity.

DorkNet.py -h
DorkNet.py -d inurl:show.php?id= -v
DorkNet.py -l /path/to/list.txt --verbose

Proxifying

I have included the ability to proxy the connection of the web driver if desired. Simply provide the proxy IP and PORT when the dialog comes up and the search engine will be accessed via the proxy settings you have provided.

Dependencies

You will need the Mozilla Geckodriver for this to work. You can install it manually. However i've added a shell script to automate the process if you'd prefer.

To use it, navigate to the DorkNet directory and make the shell script executable like so.

cd DorkNet
chmod +x gecko-setup.sh

# Execute the shell script with the below command.
sudo ./gecko-setup.sh

The shell script has an option to automatically install the rest of the dependencies as well, via the requirements file, by invoking the following commands.

sudo -H pip install -r requirements.txt

Beta Update

I've added some logic that lets the user run Geckodriver in Headless Mode, that is to say, without the traditional UI. This is useful if you have a particularly long list of dorks you'd like to work with. In it's current implementation, the function that is responsible for proxyfying our connection to Google interferes with the operations required to set the Geckodriver options to enable headless mode. Therefore, running DorkNet with the --nogui flag and a proxy enabled will not work as it is supposed to.

However, users that would like to run the program in headless mode anyway, can. I've committed all the relevant code to the repo. For the tme being it's just been commented out. Remove the comments and it should work without issue. Check out the commit historry here to see the affected lines.

Now if you really want to proxy your connection while --nogui is set, you can start DorkNet with ProxyChains like so;

proxychains python dorknet.py -l /path/to/dorks.list --nogui --verbose

If you don't have ProxyChains simply follow the link above or use your package manager to install it. Thank you.

Note

DorkNet is featured in the BlackArch Linux PenTesting Distro under WebApp Tools & Automation. As such it comes pre-installed with the distro. Refer to the relevant PKGBUILD file in it's respective repo for details.

Known Issue

By using Selenium and Geckodriver, DorkNet is effective at emulating a regular browser. In this manner the program is able to avoid captchas most of the time. However on limited occasions, Google throws one regardless. The same sometimes happens when manually searching for strings that look like a dork. Should you encounter one, you can just fill out the captcha in the Geckodriver and DorkNet will continue it's normal operation.

dorknet's People

Contributors

cameleopardus avatar nullarray avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dorknet's Issues

Used Disk Imager with sha256 encryption now USB is not accessible

I am trying to make a Kali Linux USB, when burning the iso, I chose encryption of sha256. I have a file kali-linux-2018.2-amd64.txt.sha256sum that downloaded with the iso file. Once I burned the iso, it made the USB so it is unaccesible. What do I need to do in order to get this to work properly? Thank you in advance.

Multi page support.

Since DorkNet was designed primarily to be used with a list of dorks to be loaded in and iterated over in search for vulnerable web apps. I made the design decision to only include the first page which would likely contain the most relevant results. After all, loading in 10 dorks while Google displays 20 results per page works out to 200 related URLs, which all things considered is a lot of data to work with.

However as an enhancement i am looking into creating a feature that will have DorkNet navigate until the last page in order to get even more results.

Adding 'Headless' support.

I think i will add some code that allows DorkNet to be run headless so without Geckodriver being in the way. In general when working, you do so from the terminal, at least with scripts such as these. Why not make it a little easier to multitask by having the option of not having Geckodriver's window in the way while running DorkNet.

#result_not_save

python dorknet.py -d inurl:php?id= --verbose

[+]Would you like DorkNet to proxy it's connection to the search engine?
[Y]es/[N]o: n
[+]Establishing unproxied connection...
[+]Done. Results have been saved to a textfile, in the current directory as <closed file 'results.log', mode 'ab' at 0x7f69cfb57270> for further processing.

But result not save

Captcha Issues

Hi @NullArray, having issues with the Google captcha when using DorkNet. When it gets to the captcha screen, after about 5-10 seconds the tool crashes and I am unable to even complete the captcha. This is the output I get:

Traceback (most recent call last): File "./dorknet.py", line 180, in <module> proc_one = search() File "./dorknet.py", line 145, in search elem.clear() File "/usr/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 95, in clear self._execute(Command.CLEAR_ELEMENT) File "/usr/lib/python2.7/dist-packages/selenium/webdriver/remote/webelement.py", line 501, in _execute return self._parent.execute(command, params) File "/usr/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 311, in execute self.error_handler.check_response(response) File "/usr/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 237, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.InvalidElementStateException: Message: Unable to clear element that cannot be edited: <input name="q" type="hidden">

Looks to be an issue interacting with the q element from the captcha.

Traceback (most recent call last):

I have the latest installation of Selenium 3.8.1, Geckodriver 0.19.1 and Firefox 57.0.4 (32-bit) but I'm getting this error:

[+]Would you like DorkNet to proxy it's connection to the search engine?
[Y]es/[N]o: Y

[!]Unhandled option, defaulting to unproxied connection...
Traceback (most recent call last):
File "dorknet.py", line 154, in
proc_one = search()
File "dorknet.py", line 107, in search
driver = webdriver.Firefox()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 158, in init
keep_alive=True)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 154, in init
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 237, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: Unable to find a matching set of capabilities

root@kali:~/Desktop/DorkNet#

How can i solve this plz??

Error in Kali Linux

[+]Would you like DorkNet to proxy it's connection to the search engine?
[Y]es/[N]o: y

[+]Please enter the proxy host IP: ...
[+]Please enter the proxy port: *****
[+]Proxy host set to: ...
[+]Proxy port set to: *****

[+]Establishing connection...
Traceback (most recent call last):
File "dorknet.py", line 154, in
proc_one = search()
File "dorknet.py", line 151, in search
driver.quit()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 199, in quit
RemoteWebDriver.quit(self)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 691, in quit
self.execute(Command.QUIT)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 314, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: quit

Hy. I got these error. Im using Kali Linux. :)

Doesn't save results to results.log.

Apologies in advance, I'm back. Running Dorknet presents the following:

Done. Results have been saved to a textfile, in the current directory as <closed file 'results.log', mode 'ab' at 0x7f2734295ed0> for further processing.

Upon opening results.log I'm presented with a blank file. I see no error when running DorkNet etc. The following is my geckodriver.log:

1540477378288 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.ACveJ0RHoqdQ" 1540477379533 Marionette INFO Listening on port 42495 1540477379600 Marionette WARN TLS certificate errors will be ignored for this session 1540477379632 Marionette DEBUG [2147483649] Frame script loaded 1540477379634 Marionette DEBUG [2147483649] Frame script registered 1540477379664 Marionette DEBUG [2147483649] Received DOM event beforeunload for about:blank 1540477380161 Marionette DEBUG [2147483649] Received DOM event pagehide for about:blank 1540477380343 Marionette DEBUG [2147483649] Received DOM event DOMContentLoaded for https://www.google.com/?gws_rd=ssl 1540477383031 Marionette DEBUG [2147483649] Received DOM event pageshow for https://www.google.com/?gws_rd=ssl 1540477385466 Marionette INFO Stopped listening on port 42495

My permissions on the DorkNet folder:

drwxr-xrwx 4 root root 4096 Oct 25 07:23 DorkNet/

Changed Google source code breaks `find_elements_by_xpath` operator.

Due to some changes that Google implemented, find_elements_by_xpath doesn't select the right elements for DorkNet to function in the way that it should.

I'm working on a fix, but at the time of this post i am quite busy, so i don't have an ETA yet. Just wanted to post this to let you know I am aware of the issue and a solution is being worked on.

Capabilities Error

Using Selenium 3.7.0 and Firefox Esr or even Firefox I get the following; (also got a friend to run and same error.)

Traceback (most recent call last):
File "dorknet.py", line 154, in
proc_one = search()
File "dorknet.py", line 107, in search
driver = webdriver.Firefox()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/firefox/webdriver.py", line 154, in init
keep_alive=True)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 151, in init
self.start_session(desired_capabilities, browser_profile)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 240, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 308, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 194, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Unable to find a matching set of capabilities

Error

when i use python dorknet.py
the result is

Traceback (most recent call last):
File "dorknet.py", line 7, in
from selenium import webdriver
ImportError: No module named selenium

Multi-operator support.

Currently the --dork argument supports one search operator. This could be improved in the future.

unable to install requirements

hi,
while trying to install the requirements with cmd "pip install -r requirements.txt"
i get the following msg:
Ignoring selenium: markers 'python_version < "2.7"' don't match your environment
Ignoring blessings: markers 'python_version < "2.7"' don't match your environment

my python version is:
Python 2.7.9
my pip version is:
pip 9.0.1 from /usr/local/lib/python2.7/dist-packages (python 2.7)

what can i do?
thanks..

Problem dorking

Hello
Maybe is just a ench request..
if i use complex dorking such:

"HostingAccelerator" intitle:"login" +"Username" -"news" -demo

I receive an error "not recognized"

Maybe there's a way to bypass this?

Thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.