get(target, _prop) { const prop = _prop.toLowerCase(); if (prop in target) return target[prop]; if (prop === "create") return command => { lib.logIOC("CommandExec", command, "The script executed a command."); lib.logSnippet(lib.getUUID(), {as: "command"}, command); } lib.kill(`Win32_Process.${prop} not implemented!`); }
function ScriptControl() { this.addobject = () => {}, this.addcode = (code) => lib.logSnippet(lib.getUUID(), { as: "Code snippet in ScriptControl", }, code); }
function TextStream(filename) { this.buffer = lib.readFile(filename) || ""; this.uuid = lib.getUUID(); this.filename = filename; this.bufferarray = []; this.atendofstream = () => this.bufferarray.length === 0; this.close = () => {}; this.readall = () => { return this.buffer; }; this.readline = function() { if (this.bufferarray.length === 0) this.bufferarray = this.buffer.split("\n"); return this.bufferarray.shift(); }; this.shortpath = (path) => path; this.write = (line) => { this.buffer = this.buffer + line; lib.writeFile(filename, this.buffer); lib.logResource(this.uuid, this.filename, this.buffer); }; this.writeline = (line) => { this.buffer = this.buffer + line + "\r\n"; lib.writeFile(filename, this.buffer); lib.logResource(this.uuid, this.filename, this.buffer); }; }
this.virtual_filename = filename; lib.writeFile(filename, this.buffer); lib.logResource(lib.getUUID(), this.virtual_filename, this.buffer, true); }; this.close = () => {};