using REST with python, can not specify checks

Michiel's Avatar

Michiel

01 Dec, 2016 01:20 PM

Hi,

I am using arachni as a REST service to scan hosts.
I've created a minimalistic python script that feeds the json to the REST api:

#!/usr/bin/env python

# see the documentation how to use more options in the JSON call
# https://github.com/Arachni/arachni/wiki/REST-API


import json
import urllib2

URL='http://testhtml5.vulnweb.com'
SCAN_OPTS=['xss*,sql_injection*,csrf']
#SCAN_OPTS=['*'] # do every check

data = {
        'url': URL, 'checks' : SCAN_OPTS
}

req = urllib2.Request('http://172.17.0.2:7331/scans')
req.add_header('Content-Type', 'application/json')

response = urllib2.urlopen(req, json.dumps(data))

The variable SCAN_OPTS works when I am using ['*'] but whenever I try to make it work for the xss*,sql_injection*,csrf checks it borks..
I tried different syntaxes but I am missing something here.

Whenever I request the report I see: "checks" : [],

Can you help me out what the correct form of checks should be with JSON and Python? I am a bit stuck here and tried multiple formats of the array of checks :(

Thanks for any help and for such a great and flexible product! :)

Michiel

  1. Support Staff 1 Posted by Tasos Laskos on 01 Dec, 2016 01:27 PM

    Tasos Laskos's Avatar

    Hello,

    That option expects an array of check names or patterns, not an array containing a single CSV for checks (because then the option wouldn't need to be an array).

    Try:

    [ 'xss*', 'sql_injection*', 'csrf' ]
    

    Cheers

  2. Tasos Laskos closed this discussion on 01 Dec, 2016 01:27 PM.

  3. Michiel re-opened this discussion on 01 Dec, 2016 01:37 PM

  4. 2 Posted by Michiel on 01 Dec, 2016 01:37 PM

    Michiel's Avatar

    Ha, thanks!
    That seems to do the trick:

        "checks" : [
          "xss_event",
          "xss",
          "xss_script_context",
          "xss_tag",
          "xss_path",
          "xss_dom_script_context",
          "xss_dom",
          "sql_injection",
          "sql_injection_differential",
          "sql_injection_timing",
          "csrf"
    

    But I get no results:

      "issues" : [],
      "plugins" : {}
    

    And I know that website should spit out some results ;)
    Should I specify more arguments in the json options? default is everything right?

  5. Support Staff 3 Posted by Tasos Laskos on 01 Dec, 2016 01:39 PM

    Tasos Laskos's Avatar

    You're missing the audit option, right now you're not auditing any elements, just crawling, see: https://github.com/Arachni/arachni/wiki/REST-API#example-client

  6. Tasos Laskos closed this discussion on 14 Dec, 2016 02:14 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac