mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +00:00
parent
b72ff92ceb
commit
0eb1552687
38
lib/http.js
38
lib/http.js
|
@ -1,11 +1,16 @@
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
// HTTP API
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
var SYS = require("lib/sys");
|
||||
var FILE = require("lib/file");
|
||||
var SHELL = require("lib/shell");
|
||||
var RAND = require("lib/rand");
|
||||
var BASE64 = require("lib/base64");
|
||||
|
||||
var OS_NAME = SYS.getOS();
|
||||
var OS_ARCH = SYS.getArch();
|
||||
var DEVICE_UUID = SYS.getUUID();
|
||||
|
||||
var HTTPObject = function(engine) {
|
||||
this.interface = null;
|
||||
this.contentType = "application/x-www-form-urlencoded";
|
||||
|
@ -15,7 +20,7 @@ var HTTPObject = function(engine) {
|
|||
this.headers = {};
|
||||
this.parameters = {};
|
||||
this.dataType = null;
|
||||
this.userAgent = "WelsonJS/0.2.3-dev (https://github.com/gnh1201/welsonjs)";
|
||||
this.userAgent = "WelsonJS/0.2.4-dev (" + OS_NAME + "; " + OS_ARCH + "; " + DEVICE_UUID + "; https://github.com/gnh1201/welsonjs)";
|
||||
this.isAsync = false;
|
||||
this.proxy = {
|
||||
"enabled": false,
|
||||
|
@ -708,18 +713,18 @@ var HTTPObject = function(engine) {
|
|||
this.getFrameURLs = function() {
|
||||
if (typeof this.responseBody !== "string") {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
var urls = [];
|
||||
var response = this.responseBody;
|
||||
var pos = response.indexOf('<iframe ');
|
||||
var response = this.responseBody;
|
||||
var pos = response.indexOf('<iframe ');
|
||||
|
||||
while (pos > -1) {
|
||||
var end = response.indexOf('</iframe>', pos);
|
||||
var end = response.indexOf('</iframe>', pos);
|
||||
|
||||
if (response.indexOf('</iframe>', pos) < 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
var a = response.indexOf('src="', pos);
|
||||
var b = response.indexOf('"', a + 5);
|
||||
|
@ -733,6 +738,27 @@ var HTTPObject = function(engine) {
|
|||
return urls;
|
||||
};
|
||||
|
||||
this.attachDebugger = function(_debugger) {
|
||||
var _debugger = _debugger.toUpperCase();
|
||||
|
||||
switch(_debugger) {
|
||||
case "FIDDLER":
|
||||
this.proxy.enabled = true;
|
||||
this.proxy.port = 8866;
|
||||
break;
|
||||
|
||||
case "MITMPROXY":
|
||||
this.proxy.enabled = true;
|
||||
this.proxy.port = 8080;
|
||||
break;
|
||||
|
||||
default:
|
||||
console.error("Not specified debugger");
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
this.create();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user