# Testing the Honeypot

Once the honeypot is set up and running at a particular IP address, you can
use the program `test.py` to test that it is working.

The general usage of the program is:

```bash
usage: test.py [-h] [-v] [-P PORT] [-H HOST] [-s SENDER] [-t TO] [-c CALLID] [-r REQUEST]

Test the SIPHoney honeypot

options:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -P PORT, --port PORT  Port to send data to (default: 5060)
  -H HOST, --host HOST  Host to communicate with (default: 127.0.0.1)
  -s SENDER, --sender SENDER
                        From address (default: "sipvicious"<sip:100@1.1.1.1>)
  -t TO, --to TO        To address (default: <sip:user_2@test.test>)
  -c CALLID, --callid CALLID
                        Call ID (default: 1@0.0.0.0)
  -r REQUEST, --request REQUEST
                        Call ID (default: OPTIONS)
```

To test the honeypot with all the requests it supports, use the script `test.sh`
(or `test.bat`, or `test.ps1` on Windows) like this:

```bash
cd ~/siphoney-workdir
./test.sh >output
diff -y --suppress-common-lines output docs/baseline | grep -Fv "Via:"
```

On Windows:

```powershell
PS C:\siphoney-workdir> .\test.ps1 >output
PS C:\siphoney-workdir> Compare-Object -ReferenceObject (Get-Content .\docs\baseline) -DifferenceObject (Get-Content .\output) | Select-String -Pattern 'Via:' -SimpleMatch -NotMatch
```

The contents of the created file `output` should be identical to the existing
file `baseline` (except maybe the `Via` lines, which is why they're excluded
from the comparison).

If you are running the honeypot on `127.0.0.1`, make sure to change the
`blacklist=` option in `etc/honeypot.cfg` because by default the honeypot
ignores the requests coming from that IP address (or from the internal
network, `192.168.*.*`)
