coercive / xss
Coercive 安全路由器
0.0.8
2024-01-30 10:08 UTC
Requires
- php: >=7
README
对URL中的XSS攻击进行简单检测。例如 '<' '>' 和引号...
获取
composer require coercive/xss
加载
use Coercive\Security\Xss; # Test URL $url = "https://mywebsite.com/?var='%22><script>alert();</script>"; # Load with construct param $xss = new XssUrl($url); # Or use setUrl on an alredy loaded instance $xss = new XssUrl; $xss->setUrl($url); # Detect if($xss->isXss()) { die; }
新的检测优化
# Test encoded url with script => alert('XSS') $url = "javascript:alert('XSS')"; # Load with construct param $xss = new XssUrl($url); # Show example echo '<a href="'.$url.'">BEFORE<a>'; echo '<br />'; echo '<a href="'.$xss->getFiltered().'">AFTER<a>';