Quantcast
Channel: Scanner – Security List Network™
Viewing all articles
Browse latest Browse all 271

dorkedIn.py – Python Google-LinkedIn Link Scraper.

$
0
0

Python script which utilizes the xgoogle python module to perform automated LinkedIn dorking. This script prints user information to the screen including:
– Name
– Relationship with the company
– A link to check out the page
This script also writes just the names to a file for use with creating userlists.

Usage

Usage

Requirements:
– git+git://github.com/pkrumins/xgoogle.git@master

script:

#! /usr/bin/python
# Python Google-LinkedIn Link Scraper
# Utilizes google dorks to search LinkedIn for users relating to
# a specified company.


import argparse
from urlparse import urlparse
from xgoogle.search import GoogleSearch, SearchError

def dorked_search(lookup, num_results, out_file):
	search = "site:linkedin.com inurl:pub ("+lookup+")"
	try:
		gs = GoogleSearch(search)
		gs.results_per_page = num_results
		results = gs.get_results()
		for res in results:
			print res.title.encode("utf8")
			fname = res.title.encode("utf8")
			name = fname.split("|")[0]
			out_file.write(name)
			out_file.write("\n")
			print res.desc.encode("utf8")
			print res.url.encode("utf8")
			print
	except SearchError as error:
		print "Search failed: {0!r}".format(error)

def intro():
	print "     _____                                         _____              "
	print "  __|__   |__ _____ _____  __  __ ______ _____  __|_    |__ ____   _  "
	print " |     \     /     |     ||  |/ /|   ___|     \|    |      |    \ | | "
	print " |      \    |     |     \|     \|   ___|      |    |      |     \| | "
	print " |______/  __\_____|__|\__|__|\__|______|______|____|    __|__/\____| "
	print "    |_____|                                       |_____|             "
	print "                                                                      "
	print ""
	print ""
	print "Results from this search will print to screen. A File with just names "
	print "will be located in the file you specified. Happy Hunting... "
	print ""
	print ""

def main():
	parser = argparse.ArgumentParser(description='LinkedIn Link Scraper')
	parser.add_argument( '-c', '--company', help='Company Name', required=True)
	parser.add_argument( '-r', '--results', help='Number of Results', type=int, required=True)
	parser.add_argument( '-o', '--output', help='File to Export To', required=True)
	args = parser.parse_args()

	lookup = args.company
	num_results = args.results
	intro()
	with open(args.output, 'w') as out_file:
		dorked_search(lookup, num_results, out_file)

if __name__ == '__main__':
	main()

source : https://github.com/guitarmanj


Viewing all articles
Browse latest Browse all 271

Trending Articles