[W3af-develop] web service api scans ( post method)
Status: Beta
Brought to you by:
andresriancho
From: 冠庭 羅 <bti...@ya...> - 2015-07-27 08:55:54
|
Hi, I have tried it a day, if I write like this ---@POST @SuppressWarnings("unchecked") @Path("/ScanTarget")@Consumes(MediaType.APPLICATION_JSON)@Produces(MediaType.APPLICATION_JSON) public int ScanIt() throws IOException { JSONObject jsonObject = new JSONObject(); jsonObject.put("scan_profile", "/home/tiff/w3af/profiles"); JSONArray jsonArray = new JSONArray(); jsonArray.add("http://testaspnet.vulnweb.com/"); jsonObject.put("target_url", jsonArray); System.out.println("output:" + jsonObject.toJSONString()); connect.set_response( connect.get_service(). request(). header("Content-Type", "application/json"). post(Entity.json(jsonObject.toJSONString()))); return connect.get_status();}---And system log is show like this: {"scan_profile":"\/home\/tiff\/w3af\/profiles","target_url":["http:\/\/testaspnet.vulnweb.com\/"]} I think that is quite match with data = {'scan_profile': file('/path/to/profile.pw3af').read(), 'target_urls': ['http://127.0.0.1:8000/audit/sql_injection/']}Need to put " file(' ... ').read() " into JSONObject? I think that is weird and of course I did it, but failure.I always get Http status 500... I don't really understand what happened and don't know how to do only by reading "starting a scan" information.Sorry about that I'm not good at this. Could you give me more details or suggestion about how to start it up? Thanks a lot. Tiff |