library xss
Coercive Security Router
coercive/xss
Coercive Security Router
- Wednesday, February 7, 2018
- by Coercive
- Repository
- 1 Watchers
- 3 Stars
- 561 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 3 Versions
- 21 % Grown
Coercive Security Xss
A simple detection of XSS attack in url. like '<' '>' and quotes..., (*1)
Get
composer require coercive/xss
Load
use Coercive\Security\Xss;
# Test URL
$url = "https://mywebsite.com/?var='%22>";
# 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; }
New detection optimisation
# 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>';