Merge pull request #1 from leesoh/dev

Configfile + Requirements + New mail format + Auth error messages
This commit is contained in:
Vincent Yiu 2018-03-20 12:30:45 +00:00 committed by GitHub
commit 95038d031e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 11 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
LinkedInt.cfg

7
LinkedInt.cfg Normal file
View file

@ -0,0 +1,7 @@
[API_KEYS]
hunter =
[CREDS]
linkedin_username =
linkedin_password =

View file

@ -18,6 +18,7 @@ import subprocess
import json import json
import argparse import argparse
import cookielib import cookielib
import ConfigParser
import os import os
import urllib import urllib
import math import math
@ -34,9 +35,11 @@ parser = argparse.ArgumentParser(description='Discovery LinkedIn')
parser.add_argument('-u', '--keywords', help='Keywords to search') parser.add_argument('-u', '--keywords', help='Keywords to search')
parser.add_argument('-o', '--output', help='Output file (do not include extentions)') parser.add_argument('-o', '--output', help='Output file (do not include extentions)')
args = parser.parse_args() args = parser.parse_args()
api_key = "" # Hunter API key config = ConfigParser.RawConfigParser()
username = "" # enter username here config.read('LinkedInt.cfg')
password = "" # enter password here api_key = config.get('API_KEYS', 'hunter')
username = config.get('CREDS', 'linkedin_username')
password = config.get('CREDS', 'linkedin_password')
def login(): def login():
cookie_filename = "cookies.txt" cookie_filename = "cookies.txt"
@ -56,6 +59,7 @@ def login():
try: try:
cookie = cookiejar._cookies['.www.linkedin.com']['/']['li_at'].value cookie = cookiejar._cookies['.www.linkedin.com']['/']['li_at'].value
except: except:
print "[!] Cannot log in"
sys.exit(0) sys.exit(0)
cookiejar.save() cookiejar.save()
@ -119,7 +123,6 @@ def get_search():
# Do we want to automatically get the company ID? # Do we want to automatically get the company ID?
if bCompany: if bCompany:
if bAuto: if bAuto:
# Automatic # Automatic
@ -259,6 +262,8 @@ def get_search():
user = '{}{}{}'.format(fname, mname[0], lname) user = '{}{}{}'.format(fname, mname[0], lname)
if prefix == 'flast': if prefix == 'flast':
user = '{}{}'.format(fname[0], lname) user = '{}{}'.format(fname[0], lname)
if prefix == 'firstl':
user = '{}{}'.format(fname,lname[0])
if prefix == 'first.last': if prefix == 'first.last':
user = '{}.{}'.format(fname, lname) user = '{}.{}'.format(fname, lname)
if prefix == 'fmlast': if prefix == 'fmlast':
@ -319,7 +324,7 @@ def authenticate():
if __name__ == '__main__': if __name__ == '__main__':
banner() banner()
# Prompt user for data variables # Prompt user for data variables
search = args.keywords if args.keywords!=None else raw_input("[*] Enter search Keywords (use quotes for more percise results)\n") search = args.keywords if args.keywords!=None else raw_input("[*] Enter search Keywords (use quotes for more precise results)\n")
print print
outfile = args.output if args.output!=None else raw_input("[*] Enter filename for output (exclude file extension)\n") outfile = args.output if args.output!=None else raw_input("[*] Enter filename for output (exclude file extension)\n")
print print
@ -374,14 +379,14 @@ if __name__ == '__main__':
print print
while True: while True:
prefix = raw_input("[*] Select a prefix for e-mail generation (auto,full,firstlast,firstmlast,flast,first.last,fmlast,lastfirst): \n") prefix = raw_input("[*] Select a prefix for e-mail generation (auto,full,firstlast,firstmlast,flast,firstl,first.last,fmlast,lastfirst): \n")
prefix = prefix.lower() prefix = prefix.lower()
print print
if prefix == "full" or prefix == "firstlast" or prefix == "firstmlast" or prefix == "flast" or prefix =="first" or prefix == "first.last" or prefix == "fmlast" or prefix == "lastfirst": if prefix == "full" or prefix == "firstlast" or prefix == "firstmlast" or prefix == "flast" or prefix == "firstl" or prefix =="first" or prefix == "first.last" or prefix == "fmlast" or prefix == "lastfirst":
break break
elif prefix == "auto": elif prefix == "auto":
#if auto prefix then we want to use hunter IO to find it. #if auto prefix then we want to use hunter IO to find it.
print "[*] Automaticly using Hunter IO to determine best Prefix" print "[*] Automatically using Hunter IO to determine best Prefix"
url = "https://hunter.io/trial/v2/domain-search?offset=0&domain=%s&format=json" % suffix url = "https://hunter.io/trial/v2/domain-search?offset=0&domain=%s&format=json" % suffix
r = requests.get(url) r = requests.get(url)
content = json.loads(r.text) content = json.loads(r.text)
@ -399,7 +404,7 @@ if __name__ == '__main__':
print "[!] %s" % prefix print "[!] %s" % prefix
if prefix: if prefix:
prefix = prefix.replace("{","").replace("}", "") prefix = prefix.replace("{","").replace("}", "")
if prefix == "full" or prefix == "firstlast" or prefix == "firstmlast" or prefix == "flast" or prefix =="first" or prefix == "first.last" or prefix == "fmlast" or prefix == "lastfirst": if prefix == "full" or prefix == "firstlast" or prefix == "firstmlast" or prefix == "flast" or prefix == "firstl" or prefix =="first" or prefix == "first.last" or prefix == "fmlast" or prefix == "lastfirst":
print "[+] Found %s prefix" % prefix print "[+] Found %s prefix" % prefix
break break
else: else:
@ -409,7 +414,7 @@ if __name__ == '__main__':
print "[!] Automatic prefix search failed, please insert a manual choice" print "[!] Automatic prefix search failed, please insert a manual choice"
continue continue
else: else:
print "[!] Incorrect choice, please select a value from (auto,full,firstlast,firstmlast,flast,first.last,fmlast)" print "[!] Incorrect choice, please select a value from (auto,full,firstlast,firstmlast,flast,firstl,first.last,fmlast)"
print print

BIN
README.md

Binary file not shown.

8
requirements.txt Normal file
View file

@ -0,0 +1,8 @@
beautifulsoup4==4.6.0
certifi==2018.1.18
chardet==3.0.4
idna==2.6
pkg-resources==0.0.0
requests==2.18.4
thready==0.1.5
urllib3==1.22