forked from antojoseph/diff-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiff-gui.py
More file actions
90 lines (71 loc) · 2.38 KB
/
diff-gui.py
File metadata and controls
90 lines (71 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
from flask import Flask,render_template,request
from jinja2 import Environment
from os import listdir
from os.path import isfile, join
from flask_sse import sse
import sys
import frida
import requests
import json
HTML = """{{title}}"""
app = Flask(__name__)
app.config["REDIS_URL"] = "redis://localhost"
app.register_blueprint(sse, url_prefix='/stream')
def get_messages_from_js(message,data):
print(message)
print (message['payload'])
head = {'content-type': 'application/json'}
r = requests.post("http://127.0.0.1/ding", data=json.dumps(message['payload']), headers=head)
def start_frida(x,bleeh):
process = frida.get_usb_device().attach(bleeh)
script = process.create_script(x)
script.on('message',get_messages_from_js)
script.load()
#sys.stdin.read()
@app.route('/')
def hello_world():
#return 'Enter the packagename as package_name=com.jni.anto.kalip in the URL'
return render_template('intro.html')
@app.route('/hack')
def hack():
username = request.args.get('username')
mypath = "/Users/anto/PycharmProjects/diff-gui/modules/"
txt = open(mypath+username,'r').read()
return render_template('main.html',
content=txt)
@app.route('/lol',methods=['GET', 'POST'])
def lol():
try:
blah = request.get_json()
bleeh = request.args.get('package_name')
if blah is None:
return "Booooo!"
else:
x = Environment().from_string(HTML).render(title=request.get_json())
#write_data_to_file_and_exec(x)
start_frida(x,bleeh)
print x
print bleeh
return "started frida"
except Exception as e:
print e.message, e.args
@app.route('/list')
def list():
bleeh = request.args.get('package_name')
mypath = "/Users/anto/PycharmProjects/diff-gui/modules"
filess = [f for f in listdir(mypath) if isfile(join(mypath, f))]
return render_template("list.html",
posts=filess,
package_name = bleeh)
@app.route('/update')
def update():
return render_template("update.html")
@app.route('/ding',methods=['GET', 'POST'])
def ding():
print "received data from python!!"
username = request.get_json()
print username
sse.publish({"message": username}, type='greeting')
return "Message sent!"
if __name__ == '__main__':
app.run()