mirror of
https://github.com/gnh1201/welsonjs.git
synced 2024-11-26 15:31:42 +00:00
Update
This commit is contained in:
parent
4ea98b1540
commit
f393a99dc5
|
@ -240,6 +240,11 @@
|
|||
"description": "Confirm() API 호출 시 메시지 출력 및 Yes/No 선택",
|
||||
"tags": ["휴먼 인터페이스", "가상 휴면 인터페이스"]
|
||||
},
|
||||
{
|
||||
"id": "vhid_prompt",
|
||||
"description": "Prompt() API 호출 시 서술형 응답 받을 수 있음",
|
||||
"tags": ["휴먼 인터페이스", "가상 휴면 인터페이스"]
|
||||
},
|
||||
{
|
||||
"id": "network_http_get",
|
||||
"description": "HTTP GET 전송",
|
||||
|
|
|
@ -8,7 +8,7 @@ function recordDead(name) {
|
|||
}
|
||||
|
||||
function checkIsDead(name) {
|
||||
var text = FILE.readFile(filename, "utf-8");
|
||||
var text = FILE.readFile(filename, FILE.CdoCharset.CdoUTF_8);
|
||||
var deadNames = splitLn(text);
|
||||
return deadNames.indexOf(name) > -1;
|
||||
}
|
||||
|
|
|
@ -5,16 +5,25 @@
|
|||
//var XML = require("lib/xml");
|
||||
var PS = require("lib/powershell");
|
||||
|
||||
exports.encode = function(sText) {
|
||||
function encode(sText) {
|
||||
return PS.execScript("app\\assets\\ps1\\base64encode", [sText]).trim();
|
||||
//return XML.create().createElement("base64").encode(sText, "bin.base64");
|
||||
};
|
||||
|
||||
exports.decode = function(vCode) {
|
||||
return PS.execScript("app\\assets\\ps1\\base64decode", [vCode]).trim();
|
||||
function decode(vCode) {
|
||||
return (function(s) {
|
||||
var h = "Encoded String: ";
|
||||
if (s.indexOf(h) == 0) {
|
||||
s = s.substring(h.length);
|
||||
}
|
||||
return s;
|
||||
})(PS.execScript("app\\assets\\ps1\\base64decode", [vCode]).trim());
|
||||
//return XML.create().createElement("base64").decode(vCode, "bin.base64");
|
||||
};
|
||||
|
||||
exports.VERSIONINFO = "Base64 Module (base64.js) version 0.3";
|
||||
exports.encode = encode;
|
||||
exports.decode = decode;
|
||||
|
||||
exports.VERSIONINFO = "Base64 Module (base64.js) version 0.3.1";
|
||||
exports.global = global;
|
||||
exports.require = require;
|
||||
|
|
|
@ -23,6 +23,7 @@ var ChromeObject = function(interfaces) {
|
|||
this.vendor = "Chrome";
|
||||
this.workingDirectory = SYS.getEnvString("PROGRAMFILES") + "\\Google\\Chrome\\Application";
|
||||
this.binPath = SYS.getEnvString("PROGRAMFILES") + "\\Google\\:installedDir\\Application\\chrome.exe";
|
||||
|
||||
//this.processID = 0;
|
||||
this.installedDir = "Chrome";
|
||||
this.profileName = "Default";
|
||||
|
|
|
@ -6,6 +6,7 @@ var FILE = require("lib/file");
|
|||
var SHELL = require("lib/shell");
|
||||
var RAND = require("lib/rand");
|
||||
var BASE64 = require("lib/base64");
|
||||
var PipeIPC = require("lib/pipe-ipc");
|
||||
|
||||
var OS_NAME = SYS.getOS();
|
||||
var OS_ARCH = SYS.getArch();
|
||||
|
@ -965,7 +966,7 @@ exports.patch = patch;
|
|||
exports.put = put;
|
||||
exports._delete = _delete;
|
||||
|
||||
exports.VERSIONINFO = "HTTP Library (http.js) version 0.7.9";
|
||||
exports.VERSIONINFO = "HTTP Library (http.js) version 0.7.10";
|
||||
exports.AUTHOR = "abuse@catswords.net";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
|
|
@ -89,7 +89,7 @@ var PowershellObject = function() {
|
|||
|
||||
case 2: // dataType: file(2)
|
||||
cmd.push("-file");
|
||||
cmd.push(scriptName + ".ps1");
|
||||
cmd.push(this.target + ".ps1");
|
||||
break;
|
||||
|
||||
case 1: // dataType: command(1)
|
||||
|
|
16
lib/shell.js
16
lib/shell.js
|
@ -21,6 +21,7 @@ var ShellObject = function() {
|
|||
try {
|
||||
this.interface = CreateObject("WScript.Shell");
|
||||
this.currentDirectory = this.interface.CurrentDirectory;
|
||||
this.workingDirectory = this.currentDirectory;
|
||||
} catch (e) {
|
||||
console.error("ShellObject.create() ->", e.message);
|
||||
}
|
||||
|
@ -131,7 +132,7 @@ var ShellObject = function() {
|
|||
return oShell;
|
||||
};
|
||||
|
||||
this.createShoutcut = function(shoutcutName, cmd, workingDirectory) {
|
||||
this.createShoutcut = function(shoutcutName, cmd) {
|
||||
var desktopPath = this.interface.SpecialFolders("Desktop");
|
||||
var path = desktopPath + "\\" + shoutcutName + ".lnk";
|
||||
|
||||
|
@ -143,7 +144,7 @@ var ShellObject = function() {
|
|||
link.Arguments = "bgloader.js " + this.build(cmd);
|
||||
//link.Arguments = this.build(cmd);
|
||||
link.WindowStyle = 1;
|
||||
link.WorkingDirectory = workingDirectory;
|
||||
link.WorkingDirectory = this.workingDirectory;
|
||||
//link.Hotkey = "";
|
||||
link.IconLocation = require("lib/system").getCurrentScriptDirectory() + "\\app\\favicon.ico";
|
||||
link.Save();
|
||||
|
@ -193,20 +194,25 @@ exports.showAs = function(FN, args) {
|
|||
|
||||
exports.createProcess = function(cmd, workingDirectory) {
|
||||
if (typeof(workingDirectory) !== "undefined") {
|
||||
console.log("Working directory: " + workingDirectory);
|
||||
console.info("Working directory: " + workingDirectory);
|
||||
}
|
||||
return (new ShellObject()).setWorkingDirectory(workingDirectory).createProcess(cmd);
|
||||
};
|
||||
|
||||
exports.createDesktopIcon = function(name, cmd, workingDirectory) {
|
||||
return (new ShellObject()).createDesktopIcon(name, cmd, workingDirectory);
|
||||
if (typeof(workingDirectory) !== "undefined") {
|
||||
console.info("Working directory: " + workingDirectory);
|
||||
}
|
||||
return (new ShellObject()).setWorkingDirectory(workingDirectory).createDesktopIcon(name, cmd);
|
||||
};
|
||||
|
||||
exports.getPathOfMyDocuments = function() {
|
||||
return (new ShellObject()).getPathOfMyDocuments();
|
||||
};
|
||||
|
||||
exports.VERSIONINFO = "Shell interface (shell.js) version 0.3.5";
|
||||
exports.CdoCharset = PipeIPC.CdoCharset;
|
||||
|
||||
exports.VERSIONINFO = "Shell interface (shell.js) version 0.3.7";
|
||||
exports.AUTHOR = "abuse@catswords.net";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
|
|
@ -5,10 +5,6 @@ var SHELL = require("lib/shell");
|
|||
var WSH = CreateObject("WScript.Shell");
|
||||
var WMI = require("lib/wmi");
|
||||
|
||||
exports.VERSIONINFO = "System Module (system.js) version 0.1";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
||||
exports.createProcess = function(cmd) {
|
||||
var SW_HIDE = 0;
|
||||
//wmi.Get("Win32_Process").Create(cmd, null, si, pid);
|
||||
|
@ -27,24 +23,16 @@ exports.createProcess = function(cmd) {
|
|||
};
|
||||
|
||||
exports.getEnvString = function(envName) {
|
||||
var envName = envName.toUpperCase();
|
||||
var resolvedEnvString = WSH.ExpandEnvironmentStrings('%' + envName + '%');
|
||||
|
||||
// Fixed: [lib/system] A few environment variables cannot be referenced in ScriptControl mode. #79
|
||||
if (resolvedEnvString == "") {
|
||||
resolvedEnvString = (function(s) {
|
||||
return (function(s) {
|
||||
switch(s) {
|
||||
case "PROGRAMFILES":
|
||||
return WSH.ExpandEnvironmentStrings("%HOMEDRIVE%\\Program Files");
|
||||
case "PROGRAMFILES(X86)":
|
||||
return WSH.ExpandEnvironmentStrings("%HOMEDRIVE%\\Program Files (x86)");
|
||||
default:
|
||||
return "";
|
||||
return WSH.ExpandEnvironmentStrings('%' + s + '%');
|
||||
}
|
||||
})(envName);
|
||||
}
|
||||
|
||||
return resolvedEnvString;
|
||||
})(envName.toUpperCase());
|
||||
};
|
||||
|
||||
exports.get32BitFolder = function() {
|
||||
|
@ -67,7 +55,7 @@ exports.isElevated = function() {
|
|||
};
|
||||
|
||||
exports.getOS = function() {
|
||||
return WMI.execQuery("SELECT * FROM Win32_OperatingSystem").fetch().get("Caption").trim();
|
||||
return WMI.execQuery("SELECT Caption FROM Win32_OperatingSystem").fetch().get("Caption").trim();
|
||||
};
|
||||
|
||||
exports.getDCName = function() {
|
||||
|
@ -79,11 +67,11 @@ exports.getDCName = function() {
|
|||
};
|
||||
|
||||
exports.getArch = function() {
|
||||
return WMI.execQuery("SELECT * FROM Win32_OperatingSystem").fetch().get("OSArchitecture");
|
||||
return WMI.execQuery("SELECT OSArchitecture FROM Win32_OperatingSystem").fetch().get("OSArchitecture");
|
||||
};
|
||||
|
||||
exports.getUUID = function() {
|
||||
return WMI.execQuery("SELECT * FROM Win32_ComputerSystemProduct").fetch().get("UUID").toLowerCase();
|
||||
return WMI.execQuery("SELECT UUID FROM Win32_ComputerSystemProduct").fetch().get("UUID").toLowerCase();
|
||||
};
|
||||
|
||||
exports.getCurrentWorkingDirectory = function() {
|
||||
|
@ -185,5 +173,9 @@ exports.createShortcut = function(shoutcutName, fileName) {
|
|||
};
|
||||
|
||||
exports.ping = function(address) {
|
||||
return WMI.execQuery("Select * From Win32_PingStatus where address='" + address + "'").fetch().get("ResponseTime");
|
||||
return WMI.execQuery("Select ResponseTime From Win32_PingStatus where address='" + address + "'").fetch().get("ResponseTime");
|
||||
};
|
||||
|
||||
exports.VERSIONINFO = "System Module (system.js) version 0.1.1";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
|
18
lib/wmi.js
18
lib/wmi.js
|
@ -146,14 +146,22 @@ var WMIClassObject = function() {
|
|||
};
|
||||
};
|
||||
|
||||
exports.execQuery = function(query) {
|
||||
return (new WMIQueryObject()).execQuery(query);
|
||||
function create() {
|
||||
return new WMIQueryObject();
|
||||
}
|
||||
|
||||
function execQuery(query) {
|
||||
return create().execQuery(query);
|
||||
};
|
||||
|
||||
exports.setClass = function(className) {
|
||||
return (new WMIClassObject()).setClass(className);
|
||||
function setClass(className) {
|
||||
return create().setClass(className);
|
||||
};
|
||||
|
||||
exports.VERSIONINFO = "WMI interface (wmi.js) version 0.1";
|
||||
exports.create = create;
|
||||
exports.execQuery = execQuery;
|
||||
exports.setClass = setClass;
|
||||
|
||||
exports.VERSIONINFO = "WMI interface (wmi.js) version 0.1.1";
|
||||
exports.global = global;
|
||||
exports.require = global.require;
|
||||
|
|
209
testloader.js
209
testloader.js
|
@ -275,33 +275,84 @@ var test_implements = {
|
|||
console.log("welsonjs:///?application=mscalc");
|
||||
},
|
||||
|
||||
"system_pipe_ipc": function() {},
|
||||
"system_pipe_ipc": function() {
|
||||
|
||||
"vhid_find_window": function() {},
|
||||
},
|
||||
|
||||
"vhid_send_click": function() {},
|
||||
"vhid_find_window": function() {
|
||||
var SHELL = require("lib/shell");
|
||||
var Toolkit = require("lib/toolkit");
|
||||
|
||||
"vhid_send_keys": function() {},
|
||||
// 메모장 열기
|
||||
SHELL.run(["notepad"]);
|
||||
|
||||
"vhid_send_key_enter": function() {},
|
||||
// 3초 대기
|
||||
sleep(5000);
|
||||
|
||||
"vhid_send_key_functions": function() {},
|
||||
// 키 보내기
|
||||
Toolkit.sendKeys("제목 없음 - Windows 메모장", "dasdasdasdasasdasdasd");
|
||||
console.log("키를 보냈습니다.");
|
||||
},
|
||||
|
||||
"vhid_alert": function() {},
|
||||
"vhid_send_click": function() {
|
||||
|
||||
"vhid_confirm": function() {},
|
||||
},
|
||||
|
||||
"network_http_get": function() {},
|
||||
"vhid_send_keys": function() {
|
||||
|
||||
"network_http_post": function() {},
|
||||
},
|
||||
|
||||
"network_http_extended": function() {},
|
||||
"vhid_send_key_enter": function() {
|
||||
|
||||
"network_attach_debugger": function() {},
|
||||
},
|
||||
|
||||
"network_detect_charset": function() {},
|
||||
"vhid_send_key_functions": function() {
|
||||
|
||||
"network_detect_http_ssl": function() {},
|
||||
},
|
||||
|
||||
"vhid_alert": function() {
|
||||
var Toolkit = require("lib/toolkit");
|
||||
|
||||
Toolkit.alert("잘 보이면 테스트에 성공한 것입니다.");
|
||||
},
|
||||
|
||||
"vhid_confirm": function() {
|
||||
var Toolkit = require("lib/toolkit");
|
||||
|
||||
var answer = Toolkit.confirm("예 또는 아니오를 눌러주세요");
|
||||
console.log(String(answer));
|
||||
},
|
||||
|
||||
"vhid_prompt": function() {
|
||||
var Toolkit = require("lib/toolkit");
|
||||
|
||||
var answer = Toolkit.prompt("Enter your input:");
|
||||
console.log(String(answer));
|
||||
},
|
||||
|
||||
"network_http_get": function() {
|
||||
|
||||
},
|
||||
|
||||
"network_http_post": function() {
|
||||
|
||||
},
|
||||
|
||||
"network_http_extended": function() {
|
||||
|
||||
},
|
||||
|
||||
"network_attach_debugger": function() {
|
||||
|
||||
},
|
||||
|
||||
"network_detect_charset": function() {
|
||||
|
||||
},
|
||||
|
||||
"network_detect_http_ssl": function() {
|
||||
|
||||
},
|
||||
|
||||
"network_send_icmp": function() {
|
||||
var SYS = require("lib/system");
|
||||
|
@ -383,36 +434,129 @@ var test_implements = {
|
|||
},
|
||||
|
||||
"chromium_run": function() {
|
||||
var Chrome = require("lib/chrome");
|
||||
Chrome.startDebugInPrivate("https://example.org", null, "welsonjs_test", 9222, true);
|
||||
},
|
||||
|
||||
"chromium_create_profile": function() {
|
||||
|
||||
},
|
||||
|
||||
"chromium_create_profile": function() {},
|
||||
"chromium_run_incognito": function() {
|
||||
var Chrome = require("lib/chrome");
|
||||
Chrome.startDebugInPrivate("https://example.org", null, "welsonjs_test", 9222, true);
|
||||
},
|
||||
|
||||
"chromium_run_incognito": function() {},
|
||||
"chromium_navigate": function() {
|
||||
var Chrome = require("lib/chrome");
|
||||
var wbInstance = Chrome.startDebugInPrivate("https://example.org", null, "welsonjs_test", 9222, true);
|
||||
|
||||
"chromium_navigate": function() {},
|
||||
console.log("5초 후 구글로 이동합니다.");
|
||||
sleep(5000);
|
||||
|
||||
"chromium_get_active_pages": function() {},
|
||||
wbInstance.setPageId(null);
|
||||
wbInstance.navigate("https://google.com");
|
||||
},
|
||||
|
||||
"chromium_find_page_by_id": function() {},
|
||||
"chromium_get_active_pages": function() {
|
||||
var Chrome = require("lib/chrome");
|
||||
var wbInstance = Chrome.startDebugInPrivate("https://example.org", null, "welsonjs_test", 9222, true);
|
||||
|
||||
"chromium_find_pages_by_title": function() {},
|
||||
console.log("5초 후 페이지 목록을 불러옵니다.");
|
||||
sleep(5000);
|
||||
|
||||
"chromium_move_focused": function() {},
|
||||
var pageList = wbInstance.getPageList();
|
||||
pageList.forEach(function(x) {
|
||||
console.log(x.title);
|
||||
});
|
||||
},
|
||||
|
||||
"chromium_find_page_by_id": function() {
|
||||
var Chrome = require("lib/chrome");
|
||||
var wbInstance = Chrome.startDebugInPrivate("https://example.org", null, "welsonjs_test", 9222, true);
|
||||
|
||||
console.log("5초 후 페이지 ID를 불러옵니다.");
|
||||
sleep(5000);
|
||||
|
||||
var pageId = wbInstance.getPageList()[0].id;
|
||||
console.log("페이지 ID: " + pageId);
|
||||
|
||||
console.log("페이지 ID로 페이지 찾기");
|
||||
var page = wbInstance.getPageById(pageId);
|
||||
|
||||
console.log("페이지 제목: " + page.title);
|
||||
},
|
||||
|
||||
"chromium_find_pages_by_title": function() {
|
||||
var Chrome = require("lib/chrome");
|
||||
var wbInstance = Chrome.startDebugInPrivate("https://example.org", null, "welsonjs_test", 9222, true);
|
||||
|
||||
console.log("5초 후 페이지 타이틀을 불러옵니다.");
|
||||
sleep(5000);
|
||||
|
||||
var pageTitle = wbInstance.getPageList()[0].title;
|
||||
console.log("페이지 타이틀: " + pageTitle);
|
||||
|
||||
console.log("페이지 타이틀로 페이지 찾기");
|
||||
var pages = wbInstance.getPagesByTitle(pageTitle); // 타이틀로 찾는 경우 복수형으로 반환됨
|
||||
|
||||
console.log("페이지 ID: " + pages[0].id);
|
||||
},
|
||||
|
||||
"chromium_move_focused": function() {
|
||||
var Chrome = require("lib/chrome");
|
||||
|
||||
var wbInstances = [];
|
||||
wbInstances.push(Chrome.startDebugInPrivate("https://example.org", null, "welsonjs_test", 9222, true));
|
||||
sleep(2000);
|
||||
wbInstances.push(Chrome.startDebugInPrivate("https://naver.com", null, "welsonjs_test_2", 9223, true));
|
||||
sleep(2000);
|
||||
wbInstances.push(Chrome.startDebugInPrivate("https://daum.net", null, "welsonjs_test_3", 9224, true));
|
||||
sleep(2000);
|
||||
|
||||
var wbInstance = wbInstances[1];
|
||||
wbInstance.setPageId(null);
|
||||
wbInstance.focus();
|
||||
},
|
||||
|
||||
"chromium_adjust_window_size": function() {},
|
||||
|
||||
"chromium_get_element_position": function() {},
|
||||
"chromium_get_element_position": function() {
|
||||
var Chrome = require("lib/chrome");
|
||||
var wbInstance = Chrome.startDebugInPrivate("https://example.org", null, "welsonjs_test", 9222, true);
|
||||
|
||||
"chromium_get_mapreduced_element_position": function() {},
|
||||
console.log("5초 후 명령을 수행합니다.");
|
||||
sleep(5000);
|
||||
|
||||
"chromium_set_value_to_textbox": function() {},
|
||||
console.log(JSON.stringify(wbInstance.getElementPosition("p")));
|
||||
},
|
||||
|
||||
"chromium_send_click": function() {},
|
||||
"chromium_get_mapreduced_element_position": function() {
|
||||
var Chrome = require("lib/chrome");
|
||||
var wbInstance = Chrome.startDebugInPrivate("https://example.org", null, "welsonjs_test", 9222, true);
|
||||
|
||||
"chromium_send_keys": function() {},
|
||||
console.log("5초 후 명령을 수행합니다.");
|
||||
sleep(5000);
|
||||
|
||||
"chromium_auto_scroll_until_end": function() {},
|
||||
console.log("More information... 버튼의 위치를 탐색");
|
||||
console.log(JSON.stringify(wbInstance.getNestedElementPosition("p", ":self", "More information...")));
|
||||
},
|
||||
|
||||
"chromium_set_value_to_textbox": function() {
|
||||
|
||||
},
|
||||
|
||||
"chromium_send_click": function() {
|
||||
|
||||
},
|
||||
|
||||
"chromium_send_keys": function() {
|
||||
|
||||
},
|
||||
|
||||
"chromium_auto_scroll_until_end": function() {
|
||||
|
||||
},
|
||||
|
||||
"grpc_run_server": function() {
|
||||
var SHELL = require("lib/shell");
|
||||
|
@ -427,16 +571,7 @@ var test_implements = {
|
|||
},
|
||||
|
||||
"gui_check": function() {
|
||||
var SHELL = require("lib/shell");
|
||||
var SYS = require("lib/system");
|
||||
|
||||
var text1 = SHELL.exec("echo hello world!");
|
||||
alert(text1);
|
||||
|
||||
var text2 = SYS.getOS();
|
||||
alert(text2);
|
||||
|
||||
alert("모든 메시지가 정상적으로 보였다면 테스트에 성공한 것입니다.");
|
||||
console.log("GUI 환경에서 실행하여 주십시오");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user