From 728294b7d120035f60b9a4f90ec8276dafad9d0e Mon Sep 17 00:00:00 2001 From: stackgo Date: Tue, 17 May 2022 18:29:39 +0900 Subject: [PATCH] Add support punycode (IDNA) --- app/assets/py/idnaencode.py | 15 +++++++++++++++ lib/http.js | 30 +++++++++++++++++++++++++++++- lib/punycode.js | 11 +++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 app/assets/py/idnaencode.py create mode 100644 lib/punycode.js diff --git a/app/assets/py/idnaencode.py b/app/assets/py/idnaencode.py new file mode 100644 index 0000000..8c3ccfc --- /dev/null +++ b/app/assets/py/idnaencode.py @@ -0,0 +1,15 @@ +#-*- coding: utf-8 -*- + +import sys + +def main(args): + if len(args) < 2: + print("Insufficient arguments") + sys.exit() + + encoded_domain = args[1].encode('idna').decode("utf-8") + + print(encoded_domain) + +if __name__ == "__main__": + main(sys.argv) diff --git a/lib/http.js b/lib/http.js index dbacefe..4f0d58f 100644 --- a/lib/http.js +++ b/lib/http.js @@ -705,6 +705,34 @@ var HTTPObject = function(engine) { return data; }; + this.getFrameURLs = function() { + if (typeof this.responseBody !== "string") { + return []; + } + + var urls = []; + var response = this.responseBody; + var pos = response.indexOf('', pos); + + if (response.indexOf('', pos) < 0) { + continue; + } + + var a = response.indexOf('src="', pos); + var b = response.indexOf('"', a + 5); + if (a > 0 && b > 0) { + urls.push(response.substring(a + 5, b)); + } + + pos = response.indexOf('