Update lib/http.js, lib/system.js

This commit is contained in:
Namhyeon Go 2022-05-30 20:09:09 +09:00
parent 6ac790ec1d
commit dbec582041
2 changed files with 39 additions and 6 deletions

View File

@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////
// HTTP API
////////////////////////////////////////////////////////////////////////
var SYS = require("lib/sys");
var SYS = require("lib/system");
var FILE = require("lib/file");
var SHELL = require("lib/shell");
var RAND = require("lib/rand");
@ -60,6 +60,8 @@ var HTTPObject = function(engine) {
this.isLoggingCookie = false;
this.debuggingText = '';
this.curlOptions = [];
this.create = function() {
if (this.engine == "MSXML") {
this.interface = CreateObject([
@ -475,6 +477,11 @@ var HTTPObject = function(engine) {
cmd.push("-o");
cmd.push(this.saveTo);
}
// if the count of this.curlOptions greater than 0
if (this.curlOptions.length > 0) {
cmd = cmd.concat(this.curlOptions);
}
// set the URL
cmd.push(state.url);
@ -745,6 +752,18 @@ var HTTPObject = function(engine) {
switch(_debugger) {
case "FIDDLER":
this.proxy = {
"enabled": true,
"protocol": "http",
"host": "127.0.0.1",
"port": 8888,
"credential": null
};
this.curlOptions.push("-k");
this.curlOptions.push("--ssl-no-revoke");
break;
case "FIDDLER2":
this.proxy = {
"enabled": true,
"protocol": "http",
@ -752,8 +771,10 @@ var HTTPObject = function(engine) {
"port": 8866,
"credential": null
};
this.curlOptions.push("-k");
this.curlOptions.push("--ssl-no-revoke");
break;
case "MITMPROXY":
this.proxy = {
"enabled": true,
@ -763,6 +784,18 @@ var HTTPObject = function(engine) {
"credential": null
};
break;
case "BURPSUITE":
this.proxy = {
"enabled": true,
"protocol": "http",
"host": "127.0.0.1",
"port": 8080,
"credential": null
};
this.curlOptions.push("-k");
this.curlOptions.push("--ssl-no-revoke");
break;
default:
this.proxy = {
@ -793,6 +826,6 @@ exports.get = function(url, data, headers) {
return (new HTTPObject()).setHeaders(headers).setParameters(data).setUseCache(false).get(url).responseBody;
};
exports.VERSIONINFO = "HTTP Lib (http.js) version 0.7.1";
exports.VERSIONINFO = "HTTP Lib (http.js) version 0.7.2";
exports.global = global;
exports.require = global.require;
exports.require = global.require;

View File

@ -50,7 +50,7 @@ exports.isElevated = function() {
};
exports.getOS = function() {
return WMI.execQuery("SELECT * FROM Win32_OperatingSystem").fetch().get("Caption").rtrim();
return WMI.execQuery("SELECT * FROM Win32_OperatingSystem").fetch().get("Caption").trim();
};
exports.getDCName = function() {
@ -71,7 +71,7 @@ exports.getUUID = function() {
exports.getCurrentWorkingDirectory = function() {
try {
cwd = SHELL.exec("cd", "cwd.txt").rtrim();
cwd = SHELL.exec("cd", "cwd.txt").trim();
return cwd;
} catch (e) {}
};