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 // HTTP API
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
var SYS = require("lib/sys"); var SYS = require("lib/system");
var FILE = require("lib/file"); var FILE = require("lib/file");
var SHELL = require("lib/shell"); var SHELL = require("lib/shell");
var RAND = require("lib/rand"); var RAND = require("lib/rand");
@ -60,6 +60,8 @@ var HTTPObject = function(engine) {
this.isLoggingCookie = false; this.isLoggingCookie = false;
this.debuggingText = ''; this.debuggingText = '';
this.curlOptions = [];
this.create = function() { this.create = function() {
if (this.engine == "MSXML") { if (this.engine == "MSXML") {
this.interface = CreateObject([ this.interface = CreateObject([
@ -476,6 +478,11 @@ var HTTPObject = function(engine) {
cmd.push(this.saveTo); 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 // set the URL
cmd.push(state.url); cmd.push(state.url);
@ -745,6 +752,18 @@ var HTTPObject = function(engine) {
switch(_debugger) { switch(_debugger) {
case "FIDDLER": 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 = { this.proxy = {
"enabled": true, "enabled": true,
"protocol": "http", "protocol": "http",
@ -752,6 +771,8 @@ var HTTPObject = function(engine) {
"port": 8866, "port": 8866,
"credential": null "credential": null
}; };
this.curlOptions.push("-k");
this.curlOptions.push("--ssl-no-revoke");
break; break;
case "MITMPROXY": case "MITMPROXY":
@ -764,6 +785,18 @@ var HTTPObject = function(engine) {
}; };
break; 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: default:
this.proxy = { this.proxy = {
"enabled": false, "enabled": false,
@ -793,6 +826,6 @@ exports.get = function(url, data, headers) {
return (new HTTPObject()).setHeaders(headers).setParameters(data).setUseCache(false).get(url).responseBody; 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.global = global;
exports.require = global.require; exports.require = global.require;

View File

@ -50,7 +50,7 @@ exports.isElevated = function() {
}; };
exports.getOS = 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() { exports.getDCName = function() {
@ -71,7 +71,7 @@ exports.getUUID = function() {
exports.getCurrentWorkingDirectory = function() { exports.getCurrentWorkingDirectory = function() {
try { try {
cwd = SHELL.exec("cd", "cwd.txt").rtrim(); cwd = SHELL.exec("cd", "cwd.txt").trim();
return cwd; return cwd;
} catch (e) {} } catch (e) {}
}; };