Skip to content

Commit 26b7da5

Browse files
juliosmelothc202
authored andcommitted
feat: adds a targeted command thats generate and copy a sqlmap command based on the request
Signed-off-by: Julio Silveira Melo <juliocsmelo@gmail.com>
1 parent 7466ff6 commit 26b7da5

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ All notable changes to this add-on will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
55

66
## [Unreleased]
7+
### Added
8+
- targeted/SQLMapCommandGenerator.js - it will generate and copy sqlmap command based on the request
9+
710
### Changed
811
- Update minimum ZAP version to 2.12.0:
912
- Remove compatibility code that provided the singletons (`control` and `model`) in JavaScript scripts, they can now be accessed directly always.

targeted/SQLMapCommandGenerator.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//it will generate and copy sqlmap command based on the request
2+
//released under the Apache v2.0 licence.
3+
//You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
4+
//author: @juliosmelo
5+
6+
7+
function invokeWith(msg) {
8+
var string = "sqlmap --url '"+msg.getRequestHeader().getURI().toString()+"' \\\n";
9+
var header = msg.getRequestHeader().getHeadersAsString();
10+
header = header.split(msg.getRequestHeader().getLineDelimiter());
11+
12+
for(var i=0;i<header.length;i++){
13+
string += " -H '"+header[i].trim()+"' ";
14+
}
15+
string += " \\\n";
16+
var body = msg.getRequestBody().toString();
17+
if(body.length() != 0){
18+
string += "--data='"+addSlashes(body)+"'";
19+
}
20+
var selected = new java.awt.datatransfer.StringSelection(string);
21+
var clipboard = java.awt.Toolkit.getDefaultToolkit().getSystemClipboard();
22+
clipboard.setContents(selected, null);
23+
print (string);
24+
}
25+
26+
function addSlashes(body){
27+
var a ={}
28+
a[body] = 1;
29+
return JSON.stringify(a).slice(2,-4);
30+
}

0 commit comments

Comments
 (0)