mt_srand
— 播下一个更好的随机数发生器种子
hexdec — 十六进制转换为十进制
hexdec() 会忽略它遇到的任意非十六进制的字符。自 PHP 7.4.0 起,弃用使用任何无效字符
<?php
var_dump(hexdec("See"));
var_dump(hexdec("ee"));
// both print "int(238)"
var_dump(hexdec("that")); // print "int(10)"
var_dump(hexdec("a0")); // print "int(160)"
?>
/*
dechex() - 十进制转换为十六进制
•bindec() - 二进制转换为十进制
•octdec() - 八进制转换为十进制
•base_convert() - 在任意进制之间转换数字
*/
mt_rand
— 通过梅森旋转(Mersenne Twister)随机数生成器生成随机值
mt_srand(seed)函数通过分发seed种子,依靠mt_rand()使用 Mersenne Twister算法返回随机整数
preg_match
preg_match — 执行匹配正则表达式 如果 pattern 匹配到指定 subject,则 preg_match() 返回 1,如果没有匹配到则返回 0, 或者在失败时返回 false。 preg_match( string $pattern, string $subject, array &$matches = null, int $flags = 0, int $offset = 0 ): int|false 搜索subject与pattern给定的正则表达式的一个匹配.
<?php
preg_match('/(a)(b)*(c)/', 'ac', $matches);
var_dump($matches);
preg_match('/(a)(b)*(c)/', 'ac', $matches, PREG_UNMATCHED_AS_NULL);
var_dump($matches);
?>
/*结果
array(4) {
[0]=>
string(2) "ac"
[1]=>
string(1) "a"
[2]=>
string(0) ""
[3]=>
string(1) "c"
}
array(4) {
[0]=>
string(2) "ac"
[1]=>
string(1) "a"
[2]=>
NULL
[3]=>
string(1) "c"
}
*/
命令执行函数
system(string $command, int &$result_code = null): string|false
同 C 版本的 system() 函数一样,本函数执行 command 参数所指定的命令,并且输出执行结果。
用法
<?php
system('命令');
exec()
exec(string $command, array &$output = null, int &$result_code = null): string|false
exec() 执行 command 参数所指定的命令,没有回显
用法
<?php
exec('命令');
passthru()
passthru(string $command, int &$result_code = null): ?false
同 exec() 函数类似, passthru() 函数也是用来执行外部命令(command)的。当所执行的 Unix 命令输出二进制数据,并且需要直接传送到浏览器的时候,需要用此函数来替代 exec() 或 system() 函数。
用法
<?php
passthru('命令');
shell_exec()
shell_exec(string $command): string|false|null
shell_exec — 通过 shell 执行命令并将完整的输出以字符串的方式返回
用法
<?php
shell_exec('命令');
代码执行函数
eval()
eval — 把字符串作为PHP代码执行
用法
<?php
eval('echo 1;');
assert()
assert — 断言检测
功能:在 PHP 5 中,assert() 可以将字符串作为 PHP 代码执行。但在 PHP 7 及更高版本中,assert() 的行为被改变,主要用于断言
代码执行用法
<?php
assert('php代码');
工具
php_mt_seed:一个专门用于从已知随机数逆推出 Mersenne Twister 种子的工具
安装步骤
┌──(root㉿kali)-[/tools]
└─# wget https://www.openwall.com/php_mt_seed/php_mt_seed-4.0.tar.gz
┌──(root㉿kali)-[/tools]
└─# tar -xf php_mt_seed-4.0.tar.gz
┌──(root㉿kali)-[/tools]
└─# cd php_mt_seed-4.0
┌──(root㉿kali)-[/tools/php_mt_seed-4.0]
└─# make
报错执行,执行完后提示如下,在make一下就可以了
┌──(root㉿kali)-[/tools/php_mt_seed-4.0]
└─# gcc -mavx512f
gcc: fatal error: no input files
compilation terminated.
用法
┌──(root㉿kali)-[/tools/php_mt_seed-4.0]
└─# ./php_mt_seed 1982404128
- THE END -
最后修改:2025年1月28日
非特殊说明,本博所有文章均为博主原创。
如若转载,请注明出处:https://guofun.top/ctf/45/
共有 0 条评论