diff --git a/lib/http.js b/lib/http.js index 8383cd8..f78a750 100644 --- a/lib/http.js +++ b/lib/http.js @@ -13,8 +13,71 @@ var OS_NAME = SYS.getOS(); var OS_ARCH = SYS.getArch(); var DEVICE_UUID = SYS.getUUID(); var PROCESS_VERSION = SYS.getProcessVersion(); -var DEFAULT_USER_AGENT; -var AVAILABLE_PROXIES; +var DEFAULT_USER_AGENT = "WelsonJS/0.2.7 (" + OS_NAME + "; " + OS_ARCH + "; " + PROCESS_VERSION + "; " + DEVICE_UUID + "; abuse@catswords.net)"; + +// If you have any suggestions for collaboration (e.g., Affiliate), please contact us: abuse@catswords.net +var AVAILABLE_PROXIES = [ + { + "type": "stateless", + "provider": "scrapeops", + "url": "https://proxy.scrapeops.io/v1/?api_key={api_key}&url={url}&render_js={render_js}&residential={residential}&country={country}&keep_headers={keep_headers}", + "documentation": "https://scrapeops.io?fpr=namhyeon75" + }, + { + "type": "stateful", + "provider": "scrapeops", + "url": "http://scrapeops:{api_key}@residential-proxy.scrapeops.io:8181", + "documentation": "https://scrapeops.io?fpr=namhyeon75" + }, + { + "type": "stateless-jsonrpc2", + "provider": "gnh1201/caterpillar", + "url": "http://localhost:5555", + "documentation": "https://github.com/gnh1201/caterpillar" + }, + { + "type": "stateful", + "provider": "gnh1201/caterpillar", + "url": "http://localhost:5555", + "documentation": "https://github.com/gnh1201/caterpillar" + }, + { + "type": "stateful", + "provider": "cloudflare", + "url": "http://localhost:40000", + "documentation": "https://developers.cloudflare.com/warp-client/warp-modes/" + }, + { + "type": "stateful", + "provider": "fiddler", + "url": "http://localhost:8888", + "documentation": "https://www.telerik.com/fiddler/fiddler-classic" + }, + { + "type": "stateful", + "provider": "fiddler2", + "url": "http://localhost:8866", + "documentation": "https://www.telerik.com/fiddler/fiddler-everywhere" + }, + { + "type": "stateful", + "provider": "mitmproxy", + "url": "http://localhost:8080", + "documetation": "https://mitmproxy.org/" + }, + { + "type": "stateful", + "provider": "burpsuite", + "url": "http://localhost:8080", + "documetation": "https://portswigger.net/burp" + }, + { + "type": "stateful", + "provider": "zaproxy", + "url": "http://localhost:8080", + "documetation": "https://www.zaproxy.org/" + } +]; var HTTPObject = function(engine) { this._interface = null; @@ -963,56 +1026,12 @@ var HTTPObject = function(engine) { }; this.attachDebugger = function(_debugger) { - var _debugger = _debugger.toUpperCase(); + this.setProxy({ + "provider": _debugger.toLowerCase() + }); + this.isVerifySSL = false; - console.warn("Existing proxy settings will be reset."); - - switch (_debugger) { - case "FIDDLER": // Fiddler Classic - this.proxy = { - "enabled": true, - "protocol": "http", - "host": "127.0.0.1", - "port": 8888, - "credential": null - }; - this.isVerifySSL = false; - break; - - case "FIDDLER2": // Fiddler Everywhere - this.proxy = { - "enabled": true, - "protocol": "http", - "host": "127.0.0.1", - "port": 8866, - "credential": null - }; - this.isVerifySSL = false; - break; - - case "MITMPROXY": // mitmproxy - case "BURPSUITE": // Burp Suite - case "ZAP": // OWASP ZAP Zed Attack Proxy - this.proxy = { - "enabled": true, - "protocol": "http", - "host": "127.0.0.1", - "port": 8080, - "credential": null - }; - this.isVerifySSL = false; - break; - - default: - this.proxy = { - "enabled": false, - "protocol": "http", - "host": "127.0.0.1", - "port": 80, - "credential": null - }; - console.error("Not specified debugger"); - } + console.warn("The existing proxy settings have been reset."); return this; }; @@ -1124,40 +1143,6 @@ function parseURL(url) { }; } -DEFAULT_USER_AGENT = "WelsonJS/0.2.7 (" + OS_NAME + "; " + OS_ARCH + "; " + PROCESS_VERSION + "; " + DEVICE_UUID + "; abuse@catswords.net)"; -AVAILABLE_PROXIES = [ - { - "type": "stateless", - "provider": "scrapeops", - "url": "https://proxy.scrapeops.io/v1/?api_key={api_key}&url={url}&render_js={render_js}&residential={residential}&country={country}&keep_headers={keep_headers}", - "documentation": "https://scrapeops.io?fpr=namhyeon75" - }, - { - "type": "stateful", - "provider": "scrapeops", - "url": "http://scrapeops:{api_key}@residential-proxy.scrapeops.io:8181", - "documentation": "https://scrapeops.io?fpr=namhyeon75" - }, - { - "type": "stateless-jsonrpc2", - "provider": "gnh1201/caterpillar", - "url": "http://localhost:5555", - "documentation": "https://github.com/gnh1201/caterpillar" - }, - { - "type": "stateful", - "provider": "gnh1201/caterpillar", - "url": "http://localhost:5555", - "documentation": "https://github.com/gnh1201/caterpillar" - }, - { - "type": "stateful", - "provider": "cloudflare", - "url": "http://localhost:40000", - "documentation": "https://developers.cloudflare.com/warp-client/warp-modes/" - } -]; - exports.create = create; exports.get = get; exports.post = post; @@ -1169,7 +1154,7 @@ exports.parseURL = parseURL; exports.DEFAULT_USER_AGENT = DEFAULT_USER_AGENT; exports.defaultUserAgent = DEFAULT_USER_AGENT; // compatible with the specific case -exports.VERSIONINFO = "HTTP client module (http.js) version 0.7.28"; +exports.VERSIONINFO = "HTTP client module (http.js) version 0.7.29"; exports.AUTHOR = "abuse@catswords.net"; exports.global = global; exports.require = global.require;