Coder Social home page Coder Social logo

Comments (11)

NullArray avatar NullArray commented on June 14, 2024

No need to apologize, i'm happy to help. I don't think your permissions are the issue in this case.

It might be the case that there are simply no results for the dork you specified, could be a typo, or a dork that doesn't yield any results when looked for in general. To cover all our bases though would you mind posting the dork you used? And maybe answer some more questions with regards to the exact situation that led to the result you got.

Are you trying to use the program with the --dork or --list option? With or without proxy? And if you didn't specify a proxy in the dialog, did you perhaps start DorkNet with proxychains like so: proxychains python dorknet.py?

from dorknet.

b5019628 avatar b5019628 commented on June 14, 2024

Of course, tested two different dorks of the following:
inurl:book.php?id=
inurl:product.php?id=

If I watch it run, it searches for the dork and results come up on Google, then it closes after a second or so.

I've tried without proxy for the moment just until I get it working properly. Command is as follows:
./dorknet -d inurl:book.php?id= --verbose

Lastly I haven't used proxy chains as shown from the above.

Thanks for the help. Still learning Linux and such so spending a few hours trying to fix it earlier has helped further my knowledge haha.

from dorknet.

NullArray avatar NullArray commented on June 14, 2024

Yeah lol, trouble shooting is generally a great way to learn about something , even though it can be frustrating at times.

Thanks for posting the info. Geckodriver is only supposed to close like that if it can't establish a connection to whatever host it's trying to reach . Let me try and see if i can replicate the problem from my end. In the mean time, copy and paste the following into your terminal:

python -c "from selenium import webdriver; driver = webdriver.Firefox(); driver.get('http://google.com/')"

And tell me what happens.

from dorknet.

NullArray avatar NullArray commented on June 14, 2024

I think i know what's up, Google changed the name of the element i use to find the search bar. I'm looking into the situation now, but a fix shouldn't be too hard to find.

from dorknet.

b5019628 avatar b5019628 commented on June 14, 2024

Sounds good. It does actually search for the dork and get results but then exits. This way, I can see the results and for example, the Website Titles and URL's but it doesn't actually proceed after that.

from dorknet.

NullArray avatar NullArray commented on June 14, 2024

Yeah, since google changed some stuff and to put it simply how URL's are stored in their result page source code, i am trying to figure out, how i am going to select the proper elements that will allow me to grab just the data that i want. Which would be of course the URL.

from dorknet.

NullArray avatar NullArray commented on June 14, 2024
#!/usr/bin/env python2.7

import argparse
import sys
import time

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

from blessings import Terminal

t = Terminal()


# Check for args, print logo and usage
if not len(sys.argv[1:]):
    print t.cyan("""
 ____          _   _____     _   
|    \ ___ ___| |_|   | |___| |_ 
|  |  | . |  _| '_| | | | -_|  _|
|____/|___|_| |_,_|_|___|___|_|  
                               
Welcome to DorkNet.

To start using this script please provide one or more command
line arguments and their corresponding value, where applicable.
To display all options available use -h or --help.

Example:
DorkNet.py -h
DorkNet.py -d inurl:show.php?id= --verbose\n""")
    
    sys.exit(0)


# Handle command line arguments
parser = argparse.ArgumentParser(description="Use this script and dorks to find vulnerable web applications.")
group = parser.add_mutually_exclusive_group()
group.add_argument("-d", "--dork", help="		specify the dork you wish to use\n")
group.add_argument("-l", "--list", help="		specify path to list with dorks\n")
parser.add_argument("-v", "--verbose", action="store_true", help="		toggle verbosity\n")
args = parser.parse_args()

dork_list = []

# Dork list processing
if args.list:
	print "\n[" + t.green("+") + "]Reading in list from: " + args.list + "\n\n"	
	try:
		with open(args.list, "r") as ins:
			for line in ins:
				dork_list.append(line)
				
				if args.verbose == True:
					print "[" + t.magenta("~") + "]" + line 
				
	except IOError as e:
		print "\n[" + t.red("!") + "]Could not read dork list"
		if args.verbose == True:
			print "\nAn IO Error was raised with the following error message: "
			print "\n %s" % (e)
            
else:
    dork_list.append(args.dork)



print "\n[" + t.green("+") + "]Would you like DorkNet to proxy it's connection to the search engine?"
query = raw_input("[Y]es/[N]o: ").lower()

if query == 'y':
	IP = raw_input("\n[" + t.green("+") + "]Please enter the proxy host IP: ")
	PORT = raw_input("\n[" + t.green("+") + "]Please enter the proxy port: ")
	set_proxy = True
elif query == 'n':
	print "\n[" + t.green("+") + "]Establishing unproxied connection...\n"
	set_proxy = False
else:
	print "\n[" + t.red("!") + "]Unhandled option, defaulting to unproxied connection..."
	set_proxy = False


# Web Driver Proxy
def proxy(PROXY_HOST,PROXY_PORT):
	fp = webdriver.FirefoxProfile()
	print "[" + t.green("+") + "]Proxy host set to: " + PROXY_HOST
	print "[" + t.green("+") + "]Proxy port set to: " + PROXY_PORT
	print "\n[" + t.green("+") + "]Establishing connection..."
	fp.set_preference("network.proxy.type", 1)
	fp.set_preference("network.proxy.http",PROXY_HOST)
	fp.set_preference("network.proxy.http_port",int(PROXY_PORT))
	fp.set_preference("general.useragent.override","'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36'")
	fp.update_preferences()
	return webdriver.Firefox(firefox_profile=fp)


# Function to generate and process results based on input
def search():
	link_list = []
	
	if set_proxy == True:
		driver = proxy(IP, PORT)
	else:
		driver = webdriver.Firefox()
    
	for int in range(1):
		try:
			driver.get("http://google.com")
		except Exception as e:
			print "\n[" + t.red("!") + "]A connection could not be established"
			if args.verbose == True:
				print "An error was raised with the following error message: "
				print "\n %s" % (e)
				break
				driver.quit()
				sys.exit(0)
			
		assert "Google" in driver.title
		for items in dork_list:
			elem = driver.find_element_by_name("q")
			elem.clear()
			elem.send_keys(items)
			elem.send_keys(Keys.RETURN)
			time.sleep(2.2)
			
			try:
				WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.CLASS_NAME, "rc"))) #r
			except Exception as e:
				driver.quit()
				print "\n[" + t.red("!") + "]Detecting page source elements failed/timed out.\n"
				
				if args.verbose == True:
					print "An error was raised with the following error message: "
					print "\n %s" % (e)
				
				time.sleep(1)
				continue	
				
				
			assert "No results found" not in driver.page_source
			if "No results found" in driver.page_source:
				continue

			links = driver.find_elements_by_xpath("//cite[@class='r']/a[@href]") # //h3//a[@href]
			# links, might give us what we need entirely 
			
			for elem in links:
				link_list.append(elem.get_attribute("link")) # href
            
	driver.quit()
	return link_list

proc_one = search()

with open("results.log", "ab") as outfile:
	for item in proc_one:
		outfile.write("\n" + item)
	
	outfile.close()

if args.verbose == True:	
	with open("results.log", "r") as infile:
		for line in infile:
			print "[" + t.magenta("~") + "]" + line
		
		outfile.close()

print "\n\n[" + t.green("+") + "]Done. Results have been saved to a textfile, in the current directory as %s for further processing.\n" % outfile

This is how far i got before i ran out of proxies. I'll be back though.

from dorknet.

b5019628 avatar b5019628 commented on June 14, 2024

Hey dude, you manage to make any progress? The above didn't work for myself.. Thanks and appreciate it.

from dorknet.

NullArray avatar NullArray commented on June 14, 2024

Sorry, i've been quite busy lately. Besides other responsibilities i have some new projects in the works as well. I'm gonna try to have the issue resolved in a week, schedule permitting.

from dorknet.

NullArray avatar NullArray commented on June 14, 2024

I got the new xpath worked out i think. I'll be debugging today and hopefully later everything will be working as it is supposed to.

from dorknet.

NullArray avatar NullArray commented on June 14, 2024

Alright i fixed the issue. You can clone the new version of Dorknet from the updated repo.

#12

from dorknet.

Related Issues (15)

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.