/
githubmirror
/
vgstation13
Обзор
Документация
Войти
/
githubmirror
/
vgstation13
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
Bleeding-Edge
code/modules/ext_scripts/python.dm
28 строк
953 B
ike709
Rename vars that override internal vars (#37740)
14 июн 2025, 17:34
Не верифицирован
14 июн 2025, 17:34
2302c82
Код
Авторство
О чём код?
/proc/escape_shell_arg(var/arg) // RCE prevention // - Encloses arg in single quotes // - Escapes single quotes // Also escapes %, ! on windows if(world.system_type == MS_WINDOWS) arg = replacetext(arg, "^", "^^") // Escape char arg = replacetext(arg, "%", "%%") // %PATH% -> %%PATH%% arg = replacetext(arg, "!", "^!") // !PATH!, delayed variable expansion on Windows arg = replacetext(arg, "\"", "^\"") arg = "\"[arg]\"" else arg = replacetext(arg, "\\", "\\\\'") // Escape char arg = replacetext(arg, "'", "\\'") // No breaking out of the single quotes. arg = "'[arg]'" return arg /proc/ext_python(var/script, var/arguments, var/scriptsprefix = 1, var/log_command=0) if(scriptsprefix) script = "scripts/" + script if(world.system_type == MS_WINDOWS) script = replacetext(script, "/", "\\") var/command = config.python_path + " " + script + " " + arguments if(log_command) testing(command) return shell(command)