diff --git a/modules/ConfigTree.py b/modules/ConfigTree.py index c6d7443..4bbc042 100644 --- a/modules/ConfigTree.py +++ b/modules/ConfigTree.py @@ -5,7 +5,7 @@ # TODO: Clean boolean in string. -def ConfigTree(verifyApi,socialscan,leakeddb,breachedsites,hunterApi,dbdata,tcrwd,pastebindumps,googlesearch,dns, _verbose=None): +def ConfigTree(verifyApi,socialscan,leakeddb,breachedsites,hunterApi,checkPDF,dbdata,tcrwd,pastebindumps,googlesearch,dns, _verbose=None): if _verbose != None: try: fileshow = Node(f"{bcolors.BOLD}Config File{bcolors.ENDC} [Modules]") @@ -43,6 +43,11 @@ def ConfigTree(verifyApi,socialscan,leakeddb,breachedsites,hunterApi,dbdata,tcrw hntr11 = Node('\x1b[6;30;42m'+'True'+ '\x1b[0m', parent=hntr1) else: hntr11 = Node('\x1b[1;31;40m'+'False'+ '\x1b[0m', parent=hntr1) + pdf = Node("PDF Check", parent=fileshow) + if (checkPDF == "True" or checkPDF == "true"): + pdf1 = Node('\x1b[6;30;42m'+'True'+ '\x1b[0m', parent=pdf) + else: + pdf1 = Node('\x1b[1;31;40m'+'False'+ '\x1b[0m', parent=pdf) dbdt1 = Node("Related Phone Numbers", parent=fileshow) if (dbdata == "True" or dbdata == "true"): dbdt11 = Node('\x1b[6;30;42m'+dbdata+ '\x1b[0m', parent=dbdt1) diff --git a/modules/PDFcheck.py b/modules/PDFcheck.py new file mode 100644 index 0000000..6cfe079 --- /dev/null +++ b/modules/PDFcheck.py @@ -0,0 +1,32 @@ +from googlesearch import search +import requests,re,PyPDF2,tabula,os + +def PDFcheck(mail,_verbose=None): + domain = mail.split("@")[1] + term = "site:"+domain+" filetype:PDF intext:"+'"'+"email"+'"' + try: + data = search(term, num_results=5) + for i in data: + r = requests.get(i, stream=True) + with open('data.pdf', 'wb') as f: + f.write(r.content) + pdfFileObj = open('data.pdf', 'rb') + for pageNumber in range(1,3): + tabula.convert_into("data.pdf","out.txt",pages=pageNumber,silent=True) + file = open("out.txt","r",encoding="utf-8") + read = file.read() + findPDFs= re.findall('[\w\.-]+@[a-z0-9\.-]+', read) + try: + if(findPDFs[0] is not None): + for pdfs in findPDFs: + print(pdfs) + except: + pass + pdfFileObj.close() + file.close() + if os.path.exists("data.pdf"): + os.remove("data.pdf") + if os.path.exists("out.txt"): + os.remove("out.txt") + except: + print("PDF Search error!") \ No newline at end of file diff --git a/mosint.py b/mosint.py index c13c117..7b125d6 100644 --- a/mosint.py +++ b/mosint.py @@ -3,42 +3,48 @@ from insides.bcolors import bcolors from insides.Header import Header -with open('config.json', "r") as configFile: - conf = json.loads(configFile.read()) +def parse_args(): + import argparse + parser = argparse.ArgumentParser() + parser.add_argument('-e', '--email', type=str, required=True, help="Email") + return parser.parse_args() -for i in conf: - verifyApi = (i['verify-email.org API Key']) - socialscan = (i['Social Scan']) - leakeddb = (i['Leaked DB']) - breachedsites = (i['Breached Sites[leak-lookup.com API Key]']) - hunterApi = (i['hunter.io API Key']) - dbdata = (i['Related Phone Numbers']) - tcrwd = (i['Related Domains']) - pastebindumps = (i['Pastebin Dumps']) - googlesearch = (i['Google Search']) - dns = (i['DNS Lookup']) -from insides.Banner import Banner -Banner() +# TODO: Clean boolean in string. -from modules.ConfigTree import ConfigTree -ConfigTree(verifyApi,socialscan,leakeddb,breachedsites,hunterApi,dbdata,tcrwd,pastebindumps,googlesearch,dns,_verbose=True) +def main(): + args = parse_args() + mail = args.email -print("") + EMAIL_REGEX = r'(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)' -# TODO: Clean boolean in string. + if not re.match(EMAIL_REGEX, mail): + print(f"{bcolors.FAIL}Email format is wrong!{bcolors.ENDC}") + exit() -EMAIL_REGEX = r'(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)' + with open('config.json', "r") as configFile: + conf = json.loads(configFile.read()) -while True: - mail=input(f"{bcolors.OKBLUE}MAIL > {bcolors.ENDC}") + for i in conf: + verifyApi = (i['verify-email.org API Key']) + socialscan = (i['Social Scan']) + leakeddb = (i['Leaked DB']) + breachedsites = (i['Breached Sites[leak-lookup.com API Key]']) + hunterApi = (i['hunter.io API Key']) + checkPDF = (i['PDF Check for Related Emails']) + dbdata = (i['Related Phone Numbers']) + tcrwd = (i['Related Domains']) + pastebindumps = (i['Pastebin Dumps']) + googlesearch = (i['Google Search']) + dns = (i['DNS Lookup']) - if (mail == "q" or mail == "Q" or mail == "exit"): - print("Thank you for using "+f"{bcolors.BOLD}MOSINT{bcolors.ENDC}.") - break - elif not re.match(EMAIL_REGEX, mail): - print(f"{bcolors.FAIL}Email format is wrong!{bcolors.ENDC}") - continue + from insides.Banner import Banner + Banner() + + from modules.ConfigTree import ConfigTree + ConfigTree(verifyApi,socialscan,leakeddb,breachedsites,hunterApi,checkPDF,dbdata,tcrwd,pastebindumps,googlesearch,dns,_verbose=True) + + print("") if (verifyApi != ""): from modules.VerifyMail import VerifyMail @@ -70,6 +76,12 @@ Header(title) Hunter(mail,hunterApi,_verbose=True) + if (checkPDF == "True" or checkPDF == "T" or checkPDF == "true"): + from modules.PDFcheck import PDFcheck + title = "RELATED EMAILS IN PDFs" + Header(title) + PDFcheck(mail,_verbose=True) + if (dbdata == "True" or dbdata == "T" or dbdata == "true"): from modules.RelatedNumbers import RelatedNumbers title = "RELATED PHONE NUMBERS" @@ -99,4 +111,6 @@ title = "DNS LOOKUP" Header(title) DNS(mail,_verbose=True) + +main()