Skip to content

Commit

Permalink
added PDFcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
alpkeskin committed Dec 27, 2020
1 parent 2178f6e commit a2ec97a
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 29 deletions.
7 changes: 6 additions & 1 deletion modules/ConfigTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]")
Expand Down Expand Up @@ -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)
Expand Down
32 changes: 32 additions & 0 deletions modules/PDFcheck.py
Original file line number Diff line number Diff line change
@@ -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!")
70 changes: 42 additions & 28 deletions mosint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -99,4 +111,6 @@
title = "DNS LOOKUP"
Header(title)
DNS(mail,_verbose=True)

main()

0 comments on commit a2ec97a

Please sign in to comment.