Skip to content

Commit 48c940b

Browse files
authored
Merge pull request #320 from thc202/sync-curl-script
Sync curl script with scripts add-on
2 parents 87dce81 + 10d8cf5 commit 48c940b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

targeted/curl_command_generator.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
//You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
44
//author:@haseebeqx
55

6+
// Note: The following code lives also in Script Console add-on.
7+
68
function invokeWith(msg) {
79
var string = "curl -i -s -k -X '"+msg.getRequestHeader().getMethod()+"' \\\n";
810
var header = msg.getRequestHeader().getHeadersAsString();
@@ -13,11 +15,14 @@ function invokeWith(msg) {
1315
if (headerEntry.startsWith("@")) {
1416
suspiciousHeaders = true;
1517
}
16-
//blacklisting Host (other blacklisting should also specify here
18+
// deny listing Host (other deny listing should also specify here)
1719
var keyval = headerEntry.split(":");
1820
if(keyval[0].trim() != "Host")
1921
string += " -H '"+headerEntry+"' ";
2022
}
23+
// if no User-Agent present ensures that curl request doesn't add one
24+
if(string.indexOf("User-Agent") < 0)
25+
string += " -A '' ";
2126
string += " \\\n";
2227
var body = msg.getRequestBody().toString();
2328
if(body.length() != 0){

0 commit comments

Comments
 (0)