From fc464080529615244cd1f8b308dba8455ad23ddd Mon Sep 17 00:00:00 2001 From: leesoh Date: Wed, 14 Mar 2018 13:40:29 -0600 Subject: [PATCH 1/9] Implement config file --- LinkedInt.cfg | 7 +++++++ LinkedInt.py | 11 +++++++---- requirements.txt | 2 ++ 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 LinkedInt.cfg create mode 100644 requirements.txt diff --git a/LinkedInt.cfg b/LinkedInt.cfg new file mode 100644 index 0000000..28cdf94 --- /dev/null +++ b/LinkedInt.cfg @@ -0,0 +1,7 @@ +[API_KEYS] +hunter = + +[CREDS] +linkedin_username = +linkedin_password = + diff --git a/LinkedInt.py b/LinkedInt.py index 515f088..e08ba63 100644 --- a/LinkedInt.py +++ b/LinkedInt.py @@ -18,6 +18,7 @@ import subprocess import json import argparse import cookielib +import ConfigParser import os import urllib import math @@ -34,9 +35,11 @@ parser = argparse.ArgumentParser(description='Discovery LinkedIn') parser.add_argument('-u', '--keywords', help='Keywords to search') parser.add_argument('-o', '--output', help='Output file (do not include extentions)') args = parser.parse_args() -api_key = "" # Hunter API key -username = "" # enter username here -password = "" # enter password here +config = ConfigParser.RawConfigParser() +config.read('LinkedInt.cfg') +api_key = config.get('API_KEYS', 'hunter') +username = config.get('CREDS', 'linkedin_username') +password = config.get('CREDS', 'linkedin_password') def login(): cookie_filename = "cookies.txt" @@ -423,4 +426,4 @@ if __name__ == '__main__': # Initialize Scraping get_search() - print "[+] Complete" \ No newline at end of file + print "[+] Complete" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..29dc8d6 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +beautifulsoup4==4.6.0 +thready==0.1.5 From 4f6f32f89be59f3ee1120edeb10b2ebe265dc2f6 Mon Sep 17 00:00:00 2001 From: leesoh Date: Wed, 14 Mar 2018 13:40:43 -0600 Subject: [PATCH 2/9] Implement requirements --- requirements.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/requirements.txt b/requirements.txt index 29dc8d6..c08d8c0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +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 From de47d8520d718c049e9a4385c9228f7a26db3b5a Mon Sep 17 00:00:00 2001 From: leesoh Date: Wed, 14 Mar 2018 13:44:05 -0600 Subject: [PATCH 3/9] Spaelling fexes --- LinkedInt.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LinkedInt.py b/LinkedInt.py index e08ba63..5faa7b4 100644 --- a/LinkedInt.py +++ b/LinkedInt.py @@ -322,7 +322,7 @@ def authenticate(): if __name__ == '__main__': banner() # 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 outfile = args.output if args.output!=None else raw_input("[*] Enter filename for output (exclude file extension)\n") print @@ -384,7 +384,7 @@ if __name__ == '__main__': break elif prefix == "auto": #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 r = requests.get(url) content = json.loads(r.text) From c4881a5f6e2c7331193d49d968f6486f1b7d1742 Mon Sep 17 00:00:00 2001 From: leesoh Date: Wed, 14 Mar 2018 13:47:26 -0600 Subject: [PATCH 4/9] Ignore future changes to config --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3eb91bd --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +LinkedInt.cfg From 80e962a048bc678bf0aca2168eae460b623d2657 Mon Sep 17 00:00:00 2001 From: leesoh Date: Wed, 14 Mar 2018 14:07:30 -0600 Subject: [PATCH 5/9] Update documentation --- README.md | Bin 2574 -> 2560 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/README.md b/README.md index 05fbc64bee8e57dc4a6e036769d63abe8f1ede22..2e6c7288ba4607941a1bc4a5983f158c0011937f 100644 GIT binary patch delta 80 zcmeAZX%LyvZ{(R*T#}fRlUS0OpU2CUkdVO3RghVrkO>i1&@ECZN-ZqSEK1Ey%_}L^ dE2${icy4J!c{w From b12616e481242ab88f47d2c0813e46200979ea48 Mon Sep 17 00:00:00 2001 From: leesoh Date: Wed, 14 Mar 2018 14:20:27 -0600 Subject: [PATCH 6/9] Remove characters forcing bin format --- README.md | Bin 2560 -> 2507 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/README.md b/README.md index 2e6c7288ba4607941a1bc4a5983f158c0011937f..386bb11db978f1207ad327e67fa4eaf98d22f06b 100644 GIT binary patch delta 7 OcmZn=IW4^5G$#NH@dEb% delta 61 rcmX>t+#s^yG^eRDg93vOLncEWLpDPyLkfc@kX6FK%fQ8eTZRh&l41(( From 3f0dc4b747f3d4bd5fe4abe27d488ac635d2f35b Mon Sep 17 00:00:00 2001 From: leesoh Date: Wed, 14 Mar 2018 14:50:32 -0600 Subject: [PATCH 7/9] Add logon failure message --- LinkedInt.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/LinkedInt.py b/LinkedInt.py index 5faa7b4..1f6302d 100644 --- a/LinkedInt.py +++ b/LinkedInt.py @@ -14,6 +14,7 @@ import sys import re import time import requests +import pdb import subprocess import json import argparse @@ -59,6 +60,7 @@ def login(): try: cookie = cookiejar._cookies['.www.linkedin.com']['/']['li_at'].value except: + print "[!] Cannot log in" sys.exit(0) cookiejar.save() @@ -122,7 +124,6 @@ def get_search(): # Do we want to automatically get the company ID? - if bCompany: if bAuto: # Automatic @@ -415,6 +416,7 @@ if __name__ == '__main__': print "[!] Incorrect choice, please select a value from (auto,full,firstlast,firstmlast,flast,first.last,fmlast)" print + pdb.set_trace() From cb8719b37338348a7575159ff81529c3fea597d3 Mon Sep 17 00:00:00 2001 From: leesoh Date: Wed, 14 Mar 2018 14:53:14 -0600 Subject: [PATCH 8/9] Maybe less debugging --- LinkedInt.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/LinkedInt.py b/LinkedInt.py index 1f6302d..335d955 100644 --- a/LinkedInt.py +++ b/LinkedInt.py @@ -14,7 +14,6 @@ import sys import re import time import requests -import pdb import subprocess import json import argparse @@ -416,7 +415,6 @@ if __name__ == '__main__': print "[!] Incorrect choice, please select a value from (auto,full,firstlast,firstmlast,flast,first.last,fmlast)" print - pdb.set_trace() From 9d86de3de99a8a88f192a3a304019c56b14b6ad1 Mon Sep 17 00:00:00 2001 From: leesoh Date: Wed, 14 Mar 2018 15:02:29 -0600 Subject: [PATCH 9/9] Add firstl email format --- LinkedInt.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/LinkedInt.py b/LinkedInt.py index 335d955..0ca6ae1 100644 --- a/LinkedInt.py +++ b/LinkedInt.py @@ -262,6 +262,8 @@ def get_search(): user = '{}{}{}'.format(fname, mname[0], lname) if prefix == 'flast': user = '{}{}'.format(fname[0], lname) + if prefix == 'firstl': + user = '{}{}'.format(fname,lname[0]) if prefix == 'first.last': user = '{}.{}'.format(fname, lname) if prefix == 'fmlast': @@ -377,10 +379,10 @@ if __name__ == '__main__': print 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() 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 elif prefix == "auto": #if auto prefix then we want to use hunter IO to find it. @@ -402,7 +404,7 @@ if __name__ == '__main__': print "[!] %s" % prefix if prefix: 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 break else: @@ -412,7 +414,7 @@ if __name__ == '__main__': print "[!] Automatic prefix search failed, please insert a manual choice" continue 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