# XSpear
XSpear is XSS Scanner on ruby gems
## Key features
- Pattern matching based XSS scanning
- Dynamic test based XSS scanning (with Selenium)
- Testing request/response for XSS protection bypass and reflected params
- Enable XSpear in code with Gem library load
- Support output format `cli` `json`
- Support custom callback code to any test various attack vectors
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'XSpear'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install XSpear
Or install it yourself as (local file):
$ gem install XSpear-0.1.0.gem
### Dependency gems
`colorize` `selenium-webdriver`
If you configured it to install automatically in the Gem library, but it behaves abnormally, install it with the following command.
```
$ gem install colorize
$ gem install selenium-webdriver
```
## Usage on cli
```
Usage: xspear -u [target] -[options] [value]
[ e.g ]
$ xspear -u 'https://www.hahwul.com/?q=123' --cookie='role=admin'
[ Options ]
-u, --url=target_URL [required] Target Url
-d, --data=POST Body [optional] POST Method Body data
--headers=HEADERS [optional] Add HTTP Headers
--cookie=COOKIE [optional] Add Cookie
-l, --level=1~3 [optional] Custom scan level
+ Default value: 3
+ Level3
+ Level2
+ Level1:
-t, --threads=NUMBER [optional] thread , default: 10
-o, --output=FILENAME [optional] Save JSON Result
-v, --verbose=1~3 [optional] Show log depth
+ Default value: 2
+ v=1 : quite mode
+ v=2 : show scanning log
+ v=3 : show detail log(req/res)
-h, --help Prints this help
--update Update with online
```
### Case by Case
**Scanning XSS**
```
$ xspear -u "http://testphp.vulnweb.com/search.php?test=query" -d "searchFor=yy"
```
**json output**
```
$ xspear -u "http://testphp.vulnweb.com/search.php?test=query" -d "searchFor=yy" -o json -v 1
```
**detail log**
```
$ xspear -u "http://testphp.vulnweb.com/search.php?test=query" -d "searchFor=yy" -v 3
```
etc...
### Sample log
**Scanning XSS**
```
$ xspear -u "http://testphp.vulnweb.com/listproducts.php?cat=1"
[*] creating a test query.
[*] test query generation is complete. [50 query]
[*] starting test and analysis. [10 threads]
[I] [00:57:24] reflected XsPeaR>[param: searchFor][not filtered >]
[-] [00:57:24] not reflected XsPeaR>
[-] [00:57:24] not reflected alert(45)
[H] [00:57:27] reflected