Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
import os
|
| 2 |
-
from flask import Flask, render_template_string, request, session, redirect, url_for, send_file
|
| 3 |
import subprocess
|
|
|
|
| 4 |
|
| 5 |
app = Flask(__name__)
|
| 6 |
-
app.secret_key = os.urandom(
|
| 7 |
|
| 8 |
-
# ---
|
| 9 |
OWNER_NAME = "WhyLaugh404"
|
| 10 |
PASSWORDS = {
|
| 11 |
"owner": "izie19281933",
|
|
@@ -13,228 +13,286 @@ PASSWORDS = {
|
|
| 13 |
"member": "jst404member"
|
| 14 |
}
|
| 15 |
|
| 16 |
-
# ---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
CSS = """
|
| 18 |
:root {
|
| 19 |
-
--bg
|
| 20 |
-
--
|
| 21 |
-
--
|
| 22 |
-
--
|
| 23 |
-
--
|
|
|
|
|
|
|
| 24 |
}
|
|
|
|
| 25 |
body {
|
| 26 |
-
background-color: var(--bg
|
| 27 |
-
color: var(--text
|
| 28 |
-
font-family: '
|
| 29 |
margin: 0;
|
| 30 |
-
|
| 31 |
-
flex-direction: column;
|
| 32 |
-
align-items: center;
|
| 33 |
}
|
|
|
|
| 34 |
.header {
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
text-align: center;
|
| 39 |
-
background: rgba(0,0,0,0.8);
|
| 40 |
}
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
}
|
|
|
|
| 46 |
.container {
|
| 47 |
-
max-width:
|
| 48 |
-
|
| 49 |
-
|
| 50 |
}
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
border-radius: 4px;
|
| 57 |
}
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
margin-top: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
}
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
background: #000;
|
| 66 |
-
border: 1px solid var(--border
|
| 67 |
-
color:
|
| 68 |
-
padding:
|
| 69 |
-
margin: 5px 0;
|
| 70 |
width: 100%;
|
|
|
|
|
|
|
|
|
|
| 71 |
}
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
color:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
cursor: pointer;
|
|
|
|
|
|
|
|
|
|
| 76 |
}
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
color: #666;
|
| 82 |
}
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
background: #000;
|
| 85 |
-
border:
|
| 86 |
-
padding:
|
|
|
|
|
|
|
|
|
|
| 87 |
white-space: pre-wrap;
|
| 88 |
-
|
| 89 |
-
max-height:
|
| 90 |
overflow-y: auto;
|
| 91 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
"""
|
| 93 |
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
<body>
|
| 102 |
<div class="header">
|
| 103 |
-
<img src="https://
|
| 104 |
-
<h2>
|
| 105 |
</div>
|
| 106 |
<div class="container" style="max-width: 400px;">
|
| 107 |
-
<form method="post">
|
| 108 |
-
<input type="password" name="auth_pass" placeholder="Enter Credentials" required>
|
| 109 |
-
<button type="submit">Decrypt Access</button>
|
| 110 |
-
</form>
|
| 111 |
</div>
|
| 112 |
-
<div
|
| 113 |
-
</body>
|
| 114 |
-
</html>
|
| 115 |
"""
|
| 116 |
|
| 117 |
-
|
| 118 |
-
<!DOCTYPE html>
|
| 119 |
-
<html>
|
| 120 |
-
<head>
|
| 121 |
-
<title>Dashboard | {{ owner }}</title>
|
| 122 |
-
<style>{{ css }}</style>
|
| 123 |
-
</head>
|
| 124 |
<body>
|
| 125 |
<div class="header">
|
| 126 |
-
<
|
| 127 |
-
<
|
|
|
|
| 128 |
</div>
|
| 129 |
-
|
| 130 |
<div class="container">
|
| 131 |
-
<div class="
|
| 132 |
-
|
| 133 |
-
<
|
| 134 |
-
<
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
<form action="/scan/phone" method="post" style="margin-top:10px;">
|
| 150 |
-
<input type="text" name="target" placeholder="Input Phone Number (ex: +62...)" required>
|
| 151 |
-
<button type="submit">Execute PhoneInfoga Scan</button>
|
| 152 |
-
</form>
|
| 153 |
</div>
|
| 154 |
-
|
| 155 |
-
<div class="tool-section">
|
| 156 |
-
<h3>[03] Platform Specific Recon</h3>
|
| 157 |
-
<form action="/scan/ghunt" method="post">
|
| 158 |
-
<input type="text" name="target" placeholder="Input Gmail Address" required>
|
| 159 |
-
<button type="submit">Execute GHunt Recon</button>
|
| 160 |
-
</form>
|
| 161 |
-
</div>
|
| 162 |
-
|
| 163 |
-
<a href="/logout" style="color: red; text-decoration: none; font-size: 0.8em;">[ TERMINATE SESSION ]</a>
|
| 164 |
</div>
|
| 165 |
-
|
| 166 |
-
</body>
|
| 167 |
-
</html>
|
| 168 |
-
"""
|
| 169 |
|
| 170 |
-
# ---
|
| 171 |
|
| 172 |
@app.route('/', methods=['GET', 'POST'])
|
| 173 |
-
def
|
| 174 |
if request.method == 'POST':
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
session['role'] = 'member'
|
| 182 |
-
else:
|
| 183 |
-
return "ACCESS DENIED"
|
| 184 |
-
return redirect(url_for('index'))
|
| 185 |
|
| 186 |
if 'role' in session:
|
| 187 |
-
return render_template_string(
|
| 188 |
-
|
|
|
|
|
|
|
| 189 |
|
| 190 |
-
@app.route('/
|
| 191 |
-
def
|
| 192 |
-
if 'role' not in session
|
|
|
|
|
|
|
| 193 |
target = request.form.get('target')
|
| 194 |
|
| 195 |
-
#
|
| 196 |
-
|
| 197 |
"sherlock": f"sherlock {target} --timeout 5",
|
| 198 |
-
"holehe": f"holehe {target}",
|
| 199 |
"maigret": f"maigret {target} --timeout 10",
|
| 200 |
-
"
|
| 201 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 202 |
}
|
| 203 |
-
|
| 204 |
-
cmd = commands.get(tool)
|
| 205 |
-
if not cmd: return "Tool not found."
|
| 206 |
|
| 207 |
try:
|
|
|
|
| 208 |
process = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
| 209 |
stdout, stderr = process.communicate()
|
| 210 |
-
|
| 211 |
|
| 212 |
-
#
|
| 213 |
-
|
| 214 |
-
with open(
|
| 215 |
-
f.write(f"SYSTEM REPORT
|
| 216 |
-
|
| 217 |
return f"""
|
| 218 |
<style>{CSS}</style>
|
| 219 |
<div class="container">
|
| 220 |
-
<h3>
|
| 221 |
-
<div class="result-
|
| 222 |
<br>
|
| 223 |
-
<
|
| 224 |
-
|
|
|
|
|
|
|
| 225 |
</div>
|
| 226 |
"""
|
| 227 |
except Exception as e:
|
| 228 |
-
return f"
|
| 229 |
|
| 230 |
-
@app.route('/
|
| 231 |
-
def
|
| 232 |
return send_file(filename, as_attachment=True)
|
| 233 |
|
| 234 |
-
@app.route('/
|
| 235 |
-
def
|
| 236 |
session.clear()
|
| 237 |
-
return redirect(url_for('
|
| 238 |
|
| 239 |
if __name__ == '__main__':
|
| 240 |
port = int(os.environ.get("PORT", 7860))
|
|
|
|
| 1 |
import os
|
|
|
|
| 2 |
import subprocess
|
| 3 |
+
from flask import Flask, render_template_string, request, session, redirect, url_for, send_file
|
| 4 |
|
| 5 |
app = Flask(__name__)
|
| 6 |
+
app.secret_key = os.urandom(32)
|
| 7 |
|
| 8 |
+
# --- IDENTITY & CREDENTIALS ---
|
| 9 |
OWNER_NAME = "WhyLaugh404"
|
| 10 |
PASSWORDS = {
|
| 11 |
"owner": "izie19281933",
|
|
|
|
| 13 |
"member": "jst404member"
|
| 14 |
}
|
| 15 |
|
| 16 |
+
# --- ACCESS CONTROL (Member Solidarity Version) ---
|
| 17 |
+
ACCESS_LEVELS = {
|
| 18 |
+
"member": ["sherlock", "socialscan", "holehe", "theharvester", "exiftool"],
|
| 19 |
+
"admin": ["sherlock", "socialscan", "holehe", "theharvester", "exiftool", "maigret", "phoneinfoga", "recon-ng"],
|
| 20 |
+
"owner": ["sherlock", "socialscan", "holehe", "theharvester", "exiftool", "maigret", "phoneinfoga", "recon-ng", "ghunt", "cloud_enum", "twint"]
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
# --- STYLING: THE DARK NODE (MR. X DESIGN) ---
|
| 24 |
CSS = """
|
| 25 |
:root {
|
| 26 |
+
--bg: #050505;
|
| 27 |
+
--panel: #0d0d0d;
|
| 28 |
+
--accent: #3867d6; /* Steel Blue - More Professional */
|
| 29 |
+
--text: #ececec;
|
| 30 |
+
--muted: #666;
|
| 31 |
+
--border: #1f1f1f;
|
| 32 |
+
--success: #20bf6b;
|
| 33 |
}
|
| 34 |
+
|
| 35 |
body {
|
| 36 |
+
background-color: var(--bg);
|
| 37 |
+
color: var(--text);
|
| 38 |
+
font-family: 'Inter', 'JetBrains Mono', monospace;
|
| 39 |
margin: 0;
|
| 40 |
+
padding: 0;
|
|
|
|
|
|
|
| 41 |
}
|
| 42 |
+
|
| 43 |
.header {
|
| 44 |
+
background: var(--panel);
|
| 45 |
+
border-bottom: 1px solid var(--border);
|
| 46 |
+
padding: 40px 20px;
|
| 47 |
text-align: center;
|
|
|
|
| 48 |
}
|
| 49 |
+
|
| 50 |
+
.mrx-logo {
|
| 51 |
+
width: 120px;
|
| 52 |
+
height: 120px;
|
| 53 |
+
margin-bottom: 15px;
|
| 54 |
+
border-radius: 50%;
|
| 55 |
+
border: 2px solid var(--accent);
|
| 56 |
+
box-shadow: 0 0 20px rgba(56, 103, 214, 0.3);
|
| 57 |
}
|
| 58 |
+
|
| 59 |
.container {
|
| 60 |
+
max-width: 1100px;
|
| 61 |
+
margin: 40px auto;
|
| 62 |
+
padding: 0 20px;
|
| 63 |
}
|
| 64 |
+
|
| 65 |
+
.grid {
|
| 66 |
+
display: grid;
|
| 67 |
+
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
|
| 68 |
+
gap: 25px;
|
|
|
|
| 69 |
}
|
| 70 |
+
|
| 71 |
+
.card {
|
| 72 |
+
background: var(--panel);
|
| 73 |
+
border: 1px solid var(--border);
|
| 74 |
+
padding: 25px;
|
| 75 |
+
border-radius: 2px;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
.card h3 {
|
| 79 |
margin-top: 0;
|
| 80 |
+
font-size: 0.9em;
|
| 81 |
+
text-transform: uppercase;
|
| 82 |
+
letter-spacing: 2px;
|
| 83 |
+
color: var(--accent);
|
| 84 |
+
border-bottom: 1px solid var(--border);
|
| 85 |
+
padding-bottom: 10px;
|
| 86 |
}
|
| 87 |
+
|
| 88 |
+
.input-group {
|
| 89 |
+
margin-bottom: 15px;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
input {
|
| 93 |
background: #000;
|
| 94 |
+
border: 1px solid var(--border);
|
| 95 |
+
color: #fff;
|
| 96 |
+
padding: 12px;
|
|
|
|
| 97 |
width: 100%;
|
| 98 |
+
box-sizing: border-box;
|
| 99 |
+
outline: none;
|
| 100 |
+
font-family: monospace;
|
| 101 |
}
|
| 102 |
+
|
| 103 |
+
input:focus {
|
| 104 |
+
border-color: var(--accent);
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
button {
|
| 108 |
+
background: transparent;
|
| 109 |
+
border: 1px solid var(--accent);
|
| 110 |
+
color: var(--accent);
|
| 111 |
+
padding: 10px 20px;
|
| 112 |
+
width: 100%;
|
| 113 |
cursor: pointer;
|
| 114 |
+
font-weight: bold;
|
| 115 |
+
text-transform: uppercase;
|
| 116 |
+
transition: 0.3s;
|
| 117 |
}
|
| 118 |
+
|
| 119 |
+
button:hover:not(:disabled) {
|
| 120 |
+
background: var(--accent);
|
| 121 |
+
color: #fff;
|
|
|
|
| 122 |
}
|
| 123 |
+
|
| 124 |
+
button:disabled {
|
| 125 |
+
border-color: var(--muted);
|
| 126 |
+
color: var(--muted);
|
| 127 |
+
cursor: not-allowed;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
.result-area {
|
| 131 |
background: #000;
|
| 132 |
+
border-left: 3px solid var(--accent);
|
| 133 |
+
padding: 20px;
|
| 134 |
+
margin-top: 20px;
|
| 135 |
+
font-family: 'JetBrains Mono', monospace;
|
| 136 |
+
font-size: 0.85em;
|
| 137 |
white-space: pre-wrap;
|
| 138 |
+
color: #ccc;
|
| 139 |
+
max-height: 500px;
|
| 140 |
overflow-y: auto;
|
| 141 |
}
|
| 142 |
+
|
| 143 |
+
.badge {
|
| 144 |
+
font-size: 0.7em;
|
| 145 |
+
padding: 3px 8px;
|
| 146 |
+
background: var(--accent);
|
| 147 |
+
color: #fff;
|
| 148 |
+
margin-left: 10px;
|
| 149 |
+
}
|
| 150 |
"""
|
| 151 |
|
| 152 |
+
# --- DATABASE TOOLS ---
|
| 153 |
+
TOOLS_MANIFEST = {
|
| 154 |
+
"Target Identification": [
|
| 155 |
+
{"id": "sherlock", "name": "Sherlock", "ph": "Target Username"},
|
| 156 |
+
{"id": "maigret", "name": "Maigret", "ph": "Target Username (Deep)"},
|
| 157 |
+
{"id": "socialscan", "name": "SocialScan", "ph": "Username / Email"}
|
| 158 |
+
],
|
| 159 |
+
"Signals Intelligence": [
|
| 160 |
+
{"id": "holehe", "name": "Holehe Protocol", "ph": "Target Email"},
|
| 161 |
+
{"id": "phoneinfoga", "name": "PhoneInfoga", "ph": "Phone (+62...)"},
|
| 162 |
+
{"id": "twint", "name": "Twint Intel", "ph": "Twitter Username"}
|
| 163 |
+
],
|
| 164 |
+
"Network & Metadata": [
|
| 165 |
+
{"id": "theharvester", "name": "theHarvester", "ph": "Target Domain"},
|
| 166 |
+
{"id": "exiftool", "name": "Exif Metadata", "ph": "File URL / Path"},
|
| 167 |
+
{"id": "recon-ng", "name": "Recon-ng", "ph": "Domain/Company"}
|
| 168 |
+
],
|
| 169 |
+
"Classified (Owner Only)": [
|
| 170 |
+
{"id": "ghunt", "name": "GHunt Recon", "ph": "Target Gmail Address"},
|
| 171 |
+
{"id": "cloud_enum", "name": "Cloud Enumerator", "ph": "Keyword / S3 Bucket"}
|
| 172 |
+
]
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
# --- TEMPLATES ---
|
| 176 |
+
T_LOGIN = """
|
| 177 |
+
<!DOCTYPE html><html><head><style>{{css}}</style></head>
|
| 178 |
<body>
|
| 179 |
<div class="header">
|
| 180 |
+
<img src="https://i.pinimg.com/originals/11/49/09/1149098730999053805f87b8d80f8076.jpg" class="mrx-logo">
|
| 181 |
+
<h2 style="letter-spacing:5px;">SYSTEM AUTH</h2>
|
| 182 |
</div>
|
| 183 |
<div class="container" style="max-width: 400px;">
|
| 184 |
+
<form method="post"><input type="password" name="p" placeholder="CREDENTIALS" required><button type="submit" style="margin-top:20px;">ACCESS NODE</button></form>
|
|
|
|
|
|
|
|
|
|
| 185 |
</div>
|
| 186 |
+
<div style="text-align:center; color:var(--muted); font-size:0.8em; margin-top:50px;">PROPRIETARY OF {{owner}}</div>
|
| 187 |
+
</body></html>
|
|
|
|
| 188 |
"""
|
| 189 |
|
| 190 |
+
T_DASHBOARD = """
|
| 191 |
+
<!DOCTYPE html><html><head><style>{{css}}</style></head>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
<body>
|
| 193 |
<div class="header">
|
| 194 |
+
<div style="font-size:0.7em; color:var(--accent);">CONNECTED TO PRIVATE NODE: 127.0.0.1</div>
|
| 195 |
+
<h2 style="margin:10px 0; letter-spacing:3px;">CENTRAL CONSOLE</h2>
|
| 196 |
+
<div style="font-size:0.8em; color:var(--muted);">OPERATOR: {{owner}} | STATUS: <span style="color:var(--success)">ENCRYPTED</span> | ROLE: {{role}}</div>
|
| 197 |
</div>
|
|
|
|
| 198 |
<div class="container">
|
| 199 |
+
<div class="grid">
|
| 200 |
+
{% for cat, tools in manifest.items() %}
|
| 201 |
+
<div class="card">
|
| 202 |
+
<h3>{{cat}}</h3>
|
| 203 |
+
{% for t in tools %}
|
| 204 |
+
<div class="input-group">
|
| 205 |
+
{% if t.id in allowed %}
|
| 206 |
+
<form action="/run/{{t.id}}" method="post">
|
| 207 |
+
<input type="text" name="target" placeholder="{{t.ph}}" required>
|
| 208 |
+
<button type="submit">EXE_{{t.id.upper()}}</button>
|
| 209 |
+
</form>
|
| 210 |
+
{% else %}
|
| 211 |
+
<button disabled>LOCKED_{{role.upper()}}</button>
|
| 212 |
+
{% endif %}
|
| 213 |
+
</div>
|
| 214 |
+
{% endfor %}
|
| 215 |
+
</div>
|
| 216 |
+
{% endfor %}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
</div>
|
| 218 |
+
<div style="text-align:center; margin-top:40px;"><a href="/exit" style="color:var(--muted); text-decoration:none; font-size:0.8em;">[ TERMINATE_SESSION ]</a></div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 219 |
</div>
|
| 220 |
+
</body></html>
|
|
|
|
|
|
|
|
|
|
| 221 |
|
| 222 |
+
# --- SERVER LOGIC ---
|
| 223 |
|
| 224 |
@app.route('/', methods=['GET', 'POST'])
|
| 225 |
+
def entry():
|
| 226 |
if request.method == 'POST':
|
| 227 |
+
p = request.form.get('p')
|
| 228 |
+
for role, val in PASSWORDS.items():
|
| 229 |
+
if p == val:
|
| 230 |
+
session['role'] = role
|
| 231 |
+
return redirect(url_for('entry'))
|
| 232 |
+
return "INVALID ACCESS"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
|
| 234 |
if 'role' in session:
|
| 235 |
+
return render_template_string(T_DASHBOARD, css=CSS, owner=OWNER_NAME,
|
| 236 |
+
role=session['role'], manifest=TOOLS_MANIFEST,
|
| 237 |
+
allowed=ACCESS_LEVELS[session['role']])
|
| 238 |
+
return render_template_string(T_LOGIN, css=CSS, owner=OWNER_NAME)
|
| 239 |
|
| 240 |
+
@app.route('/run/<tool_id>', methods=['POST'])
|
| 241 |
+
def execute(tool_id):
|
| 242 |
+
if 'role' not in session or tool_id not in ACCESS_LEVELS[session['role']]:
|
| 243 |
+
return "UNAUTHORIZED"
|
| 244 |
+
|
| 245 |
target = request.form.get('target')
|
| 246 |
|
| 247 |
+
# Tool Command Mapping
|
| 248 |
+
cmds = {
|
| 249 |
"sherlock": f"sherlock {target} --timeout 5",
|
|
|
|
| 250 |
"maigret": f"maigret {target} --timeout 10",
|
| 251 |
+
"socialscan": f"socialscan {target}",
|
| 252 |
+
"holehe": f"holehe {target}",
|
| 253 |
+
"phoneinfoga": f"phoneinfoga scan -n {target}",
|
| 254 |
+
"twint": f"twint -u {target}",
|
| 255 |
+
"theharvester": f"python3 /home/user/theHarvester/theHarvester.py -d {target} -l 100 -b google",
|
| 256 |
+
"exiftool": f"exiftool {target}",
|
| 257 |
+
"recon-ng": f"recon-ng -m {target}",
|
| 258 |
+
"ghunt": f"ghunt email {target}",
|
| 259 |
+
"cloud_enum": f"python3 /home/user/cloud_enum/cloud_enum.py -k {target}"
|
| 260 |
}
|
|
|
|
|
|
|
|
|
|
| 261 |
|
| 262 |
try:
|
| 263 |
+
cmd = cmds.get(tool_id)
|
| 264 |
process = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
| 265 |
stdout, stderr = process.communicate()
|
| 266 |
+
output = stdout if stdout else stderr
|
| 267 |
|
| 268 |
+
# Auto-Report Generator
|
| 269 |
+
report_file = f"JST_REPORT_{tool_id.upper()}_{target}.txt"
|
| 270 |
+
with open(report_file, "w") as f:
|
| 271 |
+
f.write(f"SYSTEM REPORT | OPERATOR: {OWNER_NAME}\n" + "="*40 + f"\nTOOL: {tool_id}\nTARGET: {target}\n\n" + output)
|
| 272 |
+
|
| 273 |
return f"""
|
| 274 |
<style>{CSS}</style>
|
| 275 |
<div class="container">
|
| 276 |
+
<h3 style="color:var(--accent)">>_ CONSOLE_OUTPUT: {tool_id.upper()}</h3>
|
| 277 |
+
<div class="result-area">{output}</div>
|
| 278 |
<br>
|
| 279 |
+
<div style="display:flex; gap:10px;">
|
| 280 |
+
<a href="/dl/{report_file}" style="flex:1"><button>DOWNLOAD_REPORT</button></a>
|
| 281 |
+
<a href="/" style="flex:1"><button style="border-color:var(--muted); color:var(--muted);">BACK_TO_CONSOLE</button></a>
|
| 282 |
+
</div>
|
| 283 |
</div>
|
| 284 |
"""
|
| 285 |
except Exception as e:
|
| 286 |
+
return f"CRITICAL_FAILURE: {str(e)}"
|
| 287 |
|
| 288 |
+
@app.route('/dl/<filename>')
|
| 289 |
+
def dl(filename):
|
| 290 |
return send_file(filename, as_attachment=True)
|
| 291 |
|
| 292 |
+
@app.route('/exit')
|
| 293 |
+
def exit_node():
|
| 294 |
session.clear()
|
| 295 |
+
return redirect(url_for('entry'))
|
| 296 |
|
| 297 |
if __name__ == '__main__':
|
| 298 |
port = int(os.environ.get("PORT", 7860))
|