Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
azizkpln
GitHub Repository: azizkpln/moriarty-project
Path: blob/master/MoriartyProject.py
192 views
1
2
__author__ = 'Aziz Kaplan'
3
4
5
6
import os
7
from gevent.pywsgi import WSGIServer
8
from flask import Flask, render_template,request,redirect,url_for
9
import re
10
from Investigation.FindOwner import main
11
from Investigation.FindOwner2 import main1
12
import Investigation.FindOwner
13
import Investigation.general
14
from Investigation.spamControl import spamMain
15
import Investigation.spamControl2
16
from Investigation.socialMedia1 import faceMain
17
from Investigation.socialMedia2 import instaMain
18
from Investigation.socialMedia3 import twMain
19
from Investigation.socialMedia4 import goMain
20
from Investigation.socialMedia5 import micMain
21
from Investigation.getLinks import getLinks_
22
from Investigation.getComments import getComments_
23
from Investigation.getComments2 import _getComments2_
24
25
import asyncio
26
import time
27
import threading
28
import sys
29
app = Flask(__name__)
30
get_comments="Not Provided"
31
get_links="Not Provided"
32
spam_risk="Not Provided"
33
social_media="Not Provided"
34
find_owner="Not Provided"
35
runall="Not Provided"
36
redirectionMicrosoft=False
37
redirectionMicrosoftFailed=False
38
email=""
39
password="" #chill man. It's needed for trucaller and sync.me. Your password is safe. :D
40
phoneNumberOwner=""
41
phoneNumberOwner1=""
42
tupleOutput=False
43
def threadFunction(functionName,*args):
44
loop=asyncio.new_event_loop()
45
asyncio.set_event_loop(loop)
46
try:
47
loop.run_until_complete(functionName(args,))
48
except TypeError:
49
loop.run_until_complete(functionName(args[0],args[1],args[2]))
50
def getValueFunction(func):
51
global valueName
52
global tupleOutput
53
while True:
54
try:
55
valueName=func()
56
if type(valueName).__name__=="tuple":
57
tupleOutput=True
58
elif type(valueName).__name__=="str":
59
tupleOutput=False
60
break
61
except:
62
tupleOutput=None
63
continue
64
def bye():
65
os.system("killall -9 python3")
66
@app.route("/MicrosoftMail",methods=["POST","GET"])
67
def microsoftMail():
68
global find_owner,redirectionMicrosoftFailed,email,password
69
if request.method=="POST":
70
find_owner="Added"
71
email=request.form["email"]
72
password=request.form["password"]
73
if "@gmail.com" in email:
74
return redirect(url_for("success"))
75
else:
76
return render_template("unkownMail.html")
77
try:
78
if phone_number!="":
79
return render_template("findOwnerEmailPassword.html")
80
81
else:
82
return render_template("failed.html")
83
except:
84
redirectionMicrosoftFailed=True
85
return redirect(url_for("index"))
86
@app.route("/success",methods=["POST","GET"])
87
def success():
88
if request.method=="GET":
89
global redirectionMicrosoft
90
redirectionMicrosoft=True
91
return redirect(url_for("index"))
92
@app.route("/investigationErr",methods=["GET"])
93
def investigationErr():
94
threading.Thread(target=bye).start()
95
return render_template("resultErr.html",phone_number=phone_number)
96
@app.route("/investigation",methods=["GET"])
97
def investigation():
98
99
return render_template("result.html",
100
phoneNumberOwner=phoneNumberOwner,
101
phoneNumberOwner1=phoneNumberOwner1,
102
phone_number=phone_number,
103
timeZone=timeZone,
104
country=country,
105
operator=operator,
106
errNumber=errNumber,
107
currentTime=currentTime,
108
social_media=social_media,
109
find_owner=find_owner,
110
faceResult=faceResult,
111
instaResult=instaResult,
112
twResult=twResult,
113
goResult=goResult,
114
micResult=micResult,
115
get_links=get_links,
116
spam_risk=spam_risk,
117
spamGet=spamGet,
118
links=links,
119
120
get_comments=get_comments,
121
comments=comments,
122
comments2=comments2,
123
situationSpam=situationSpam,
124
explanation=explanation,
125
numberType=numberType
126
127
)
128
@app.route("/",methods=["POST","GET"])
129
def index():
130
global get_comments,get_links,spam_risk,social_media,find_owner,phone_number,comments2,runall
131
if request.method=="GET":
132
if redirectionMicrosoft==True:
133
return render_template("findOwnerSuccess.html",phone_number=phone_number)
134
if redirectionMicrosoftFailed==True:
135
return render_template("failed.html")
136
return render_template("index.html")
137
if request.method=="POST":
138
command=request.form["in"]
139
if command=="help":
140
return render_template("help.html")
141
elif command[0:15]=="add PhoneNumber":
142
143
phone_number=str("+"+re.search("\d+",command).group(0))
144
return render_template("phoneNumberSuccess.html",phone_number=phone_number)
145
elif command[0:21]=="add feature FindOwner":
146
try:
147
if email!="" or password!="":
148
find_owner="Added"
149
return render_template("findOwnerSuccess.html",phone_number=phone_number)
150
else:
151
152
return redirect(url_for("microsoftMail"))
153
except:
154
return render_template("failed.html")
155
elif command[0:23]=="add feature SocialMedia":
156
social_media="Added"
157
try:
158
return render_template("socialMediaSuccess.html",phone_number=phone_number)
159
except:
160
return render_template("failed.html")
161
elif command[0:20]=="add feature GetLinks":
162
get_links="Added"
163
try:
164
return render_template("GetLinksSuccess.html",phone_number=phone_number)
165
except:
166
return render_template("failed.html")
167
elif command[0:20]=="add feature SpamRisk":
168
spam_risk="Added"
169
try:
170
return render_template("SpamRiskSuccess.html",phone_number=phone_number)
171
except:
172
return render_template("failed.html")
173
elif command[0:23]=="add feature GetComments":
174
get_comments="Added"
175
try:
176
return render_template("GetCommentsSuccess.html",phone_number=phone_number)
177
except:
178
return render_template("failed.html")
179
elif command[0:12]=="show options":
180
try:
181
return render_template("showoptions.html",phone_number=phone_number,social_media=social_media,get_links=get_links,spam_risk=spam_risk,find_owner=find_owner,get_comments=get_comments)
182
except:
183
phone_number="Not Provided"
184
return render_template("showoptions.html",phone_number=phone_number,social_media=social_media,get_links=get_links,spam_risk=spam_risk,find_owner=find_owner,get_comments=get_comments)
185
elif command[0:20]=="add feature *":
186
runall="Added"
187
social_media="Added"
188
spam_risk="Added"
189
get_comments="Added"
190
get_links="Added"
191
try:
192
if email!="" or password!="":
193
find_owner="Added"
194
return render_template("featureAll.html",phone_number=phone_number)
195
else:
196
return redirect(url_for("microsoftMail"))
197
except:
198
return render_template("failed.html")
199
elif command[0:3]=="run":
200
global country,operator,timeZone,errNumber,currentTime,comments,comments2
201
Investigation.general.location(phone_number)
202
country=Investigation.general.returnCountry()
203
operator=Investigation.general.returnOperator()
204
timeZone=Investigation.general.returnTimeZone()
205
errNumber=Investigation.general.return_errNumber_()
206
currentTime=Investigation.general.returnCurrentTime()
207
if errNumber!="False":
208
threading.Thread(target=runScripts).start()
209
time.sleep(2)
210
return redirect(url_for("investigation"))
211
else:
212
return redirect(url_for("investigationErr"))
213
else:
214
return render_template("unkownCommand.html")
215
def featureOnProgress():
216
global instaResult,twResult,goResult,micResult,links,comments2,comments,faceResult,spam_risk,situationSpam,explanation,numberType,spamGet
217
global phoneNumberOwner,phoneNumberOwner1
218
if spam_risk=="Added":
219
spamGet="Feature On Progress"
220
situationSpam="Feature On Progress"
221
explanation="Feature On Progress"
222
numberType="Feature On Progress"
223
else:
224
spamGet="Feature Not Selected"
225
situationSpam="Feature Not Selected"
226
explanation="Feature Not Selected"
227
numberType="Feature Not Selected"
228
if social_media=="Added":
229
faceResult="Feature On Progress"
230
instaResult="Feature On Progress"
231
twResult="Feature On Progress"
232
goResult="Feature On Progress"
233
micResult="Feature On Progress"
234
else:
235
faceResult="Feature Not Selected"
236
instaResult="Feature Not Selected"
237
twResult="Feature Not Selected"
238
goResult="Feature Not Selected"
239
micResult="Feature Not Selected"
240
if get_links=="Added":
241
links="Feature On Progress"
242
else:
243
links="Feature Not Selected"
244
if get_comments=="Added":
245
comments="Feature On Progress";comments2="Feature On Progress"
246
else:
247
comments="Feature Not Selected";comments2="Feature Not Selected"
248
if find_owner=="Added":
249
phoneNumberOwner="Feature On Progress"
250
phoneNumberOwner1="Feature On Progress"
251
else:
252
phoneNumberOwner="Feature Not Selected";phoneNumberOwner1="Feature Not Selected"
253
def runScripts():
254
global get_comments,get_links,spam_risk,social_media,find_owner,phone_number,runall,faceResult,links,phoneNumberOwner
255
global situationSpam,explanation,numberType,spamGet,comments2,instaResult,twResult,goResult,micResult,phoneNumberOwner1
256
#some features are being ran in threads while others aren't. This is designed for low system devices that are using moriarty project.
257
if errNumber!="False":
258
featureOnProgress()
259
260
if spam_risk=="Added":
261
Investigation.spamControl2.getSpam(phone_number)
262
spamGet=Investigation.spamControl2.returnValue()
263
spamMain(phone_number)
264
situationSpam,explanation,numberType=Investigation.spamControl.printAll()
265
if get_comments=="Added":
266
getComments_(phone_number)
267
threading.Thread(target=_getComments_).start()
268
_getComments2_(phone_number)
269
comments2=Investigation.getComments2.printAll()
270
if get_links=="Added":
271
getLinks_(phone_number)
272
links=Investigation.getLinks.printAll()
273
if find_owner=="Added":
274
threadFunction(main,phone_number,email,password)
275
phoneNumberOwner=Investigation.FindOwner.printName()
276
threadFunction(main1,phone_number,email,password)
277
phoneNumberOwner1=Investigation.FindOwner2.printName()
278
if social_media=="Added":
279
threadFunction(faceMain,phone_number);faceResult=Investigation.socialMedia1.printAll()
280
threadFunction(instaMain,phone_number);instaResult=Investigation.socialMedia2.printAll()
281
threadFunction(twMain,phone_number);twResult=Investigation.socialMedia3.printAll()
282
threadFunction(goMain,phone_number);goResult=Investigation.socialMedia4.printAll()
283
threadFunction(micMain,phone_number);micResult=Investigation.socialMedia5.printAll()
284
285
286
287
288
def _getComments_():
289
global comments
290
while True:
291
try:
292
comments=Investigation.getComments.printAll()
293
break
294
except:
295
comments="Feature On Progress"
296
continue
297
def socialMedia1():
298
global faceResult
299
while True:
300
try:
301
faceResult=Investigation.socialMedia1.printAll()
302
except:
303
faceResult="Feature On Progress"
304
continue
305
def socialMedia2():
306
global instaResult
307
while True:
308
try:
309
instaResult=Investigation.socialMedia2.printAll()
310
except:
311
instaResult="Feature On Progress"
312
continue
313
def socialMedia3():
314
global twResult
315
while True:
316
try:
317
twResult=Investigation.socialMedia3.printAll()
318
except:
319
twResult="Feature On Progress"
320
continue
321
def socialMedia4():
322
global goResult
323
while True:
324
try:
325
goResult=Investigation.socialMedia4.printAll()
326
except:
327
goResult="Feature On Progress"
328
continue
329
def socialMedia5():
330
global micResult
331
while True:
332
try:
333
micResult=Investigation.socialMedia5.printAll()
334
except:
335
micResult="Feature On Progress"
336
continue
337
if __name__ == "__main__":
338
import subprocess
339
app.run(str(subprocess.check_output("hostname -I | awk '{print $1}'",shell=True).decode().strip()),8080,debug=True)
340
341
342