May212020
手把手教你解决PHP中的Fatal error: Call to undefined function错误
在PHP开发过程中,我们经常会遇到各种错误。其中,”Fatal error: Call to undefined function”错误是一个非常常见的错误。这个错误的原因是在我们的代码中调用了一个未定义的函数。下面,我们将详细介绍如何解决这个错误。
错误示例
让我们先看一个简单的错误示例,来理解这个错误的表现。
<?php
$number = 5;
$result = double($number);
echo $result;
?>
在这个示...阅读全文
抢沙发
May182020
MySQL开启慢查询功能
mysql慢查询日志对于跟踪有问题的查询非常有用,可以分析出当前程序里有很耗费资源的sql语句,这是一个有用的日志。它对于性能的影响不大(假设所有查询都很快),并且强调了那些最需要注意的查询(丢失了索引或索引没有得到最佳应用),那如何打开mysql的慢查询日志记录呢?
首先在开启之前得确定下当前mysql是否已经开启了慢日志查询,我们可以在登录了mysql命令行下输入命令:
show va...阅读全文
May182020
php将字符串中连续的某个字符替换为一个
php将字符串中连续的某个字符替换为一个。
/**
 * php将字符串中连续的某个字符替换为一个
 * @param string $search
 * @param string $replace
 * @param string $subject
 * @return string
 */
function str_replace_multiple_consecutive($search, $replace, $subject) {
    return (string)preg_replace("/[" . $search . "]+/i", $replace, $subject);
}
示例:
$str = ",,,,w...阅读全文
May122020
读书笔记——徐焱等《Web安全攻防渗透测试实战指南》
全书思维导图:https://www.ms08067.com/map.html
第一章 渗透测试之信息收集
1.1 收集域名信息
1.1.1 whois查询
<1>whois工具:在kali系统中,whois默认安装,输入命令 whois 域名 即可。
<2>在线whois查询网站:
爱站工具网:https://whois.aizhan.com/
站长之家:https://whois.chinaz.com/
Virus Total:https://www.virustotal.com/gui/home/search
1.1.2 备案信息...阅读全文
May062020
DVWA-13.4 CSP Bypass(绕过浏览器的安全策略)-Impossible
Impossible Level
查看源码
impossible.php
<?php
$headerCSP = "Content-Security-Policy: script-src 'self';";
header($headerCSP);
?>
<?php
if (isset ($_POST['include'])) {
$page[ 'body' ] .= "
    " . $_POST['include'] . "
";
}
$page[ 'body' ] .= '
<form name="csp" method="POST">
    <p>Unlike the high level, this does a JSONP call but d...阅读全文
May062020
DVWA-13.3 CSP Bypass(绕过浏览器的安全策略)-High?
High Level
查看源码
high.php
<?php
$headerCSP = "Content-Security-Policy: script-src 'self';";
header($headerCSP);
?>
<?php
if (isset ($_POST['include'])) {
$page[ 'body' ] .= "
    " . $_POST['include'] . "
";
}
$page[ 'body' ] .= '
<form name="csp" method="POST">
    <p>The page makes a call to ' . DVWA_WEB_PAGE_TO_ROOT . '/vulnerabili...阅读全文
May062020
DVWA-13.2 CSP Bypass(绕过浏览器的安全策略)-Medium
Medium Level
查看代码
<?php
$headerCSP = "Content-Security-Policy: script-src 'self' 'unsafe-inline' 'nonce-TmV2ZXIgZ29pbmcgdG8gZ2l2ZSB5b3UgdXA=';";
header($headerCSP);
// Disable XSS protections so that inline alert boxes will work
header ("X-XSS-Protection: 0");
# <script nonce="TmV2ZXIgZ29pbmcgdG8gZ2l2ZSB5b3UgdXA=">alert(1)</script>
?&...阅读全文
May062020
DVWA-13.1 CSP Bypass(绕过浏览器的安全策略)-Low
CSP
Content-Security-Policy是指HTTP返回报文头中的标签,浏览器会根据标签中的内容,判断哪些资源可以加载或执行。翻译为中文就是内容安全策略。是为了缓解潜在的跨站脚本问题(XSS),浏览器的扩展程序系统引入了内容安全策略这个概念。原来应对XSS攻击时,主要采用函数过滤、转义输入中的特殊字符、标签、文本来规避攻击。CSP的实质就是白名单制度,开发人员明确告诉客户端,哪些外部...阅读全文
May062020
DVWA-12.4 XSS (Stored)(存储型跨站脚本)-Impossible
Impossible Level
查看源码
<?php
if( isset( $_POST[ 'btnSign' ] ) ) {
    // Check Anti-CSRF token
    checkToken( $_REQUEST[ 'user_token' ], $_SESSION[ 'session_token' ], 'index.php' );
    // Get input
    $message = trim( $_POST[ 'mtxMessage' ] );
    $name    = trim( $_POST[ 'txtName' ] );
    // Sanitize message input
    $message = stripslashes( $...阅读全文
May062020
DVWA-12.3 XSS (Stored)(存储型跨站脚本)-High
High Level
查看源码
<?php
if( isset( $_POST[ 'btnSign' ] ) ) {
    // Get input
    $message = trim( $_POST[ 'mtxMessage' ] );
    $name    = trim( $_POST[ 'txtName' ] );
    // Sanitize message input
    $message = strip_tags( addslashes( $message ) );
    $message = ((isset($GLOBALS["___mysqli_ston"]) && is_object($GLOBALS["___mysqli_ston"])) ...阅读全文
 
        
         
 
 
 
 
 
 
 
