Skip to content

Commit

Permalink
added placeholder code for a workaround for the isssue: dotnet/runtim…
Browse files Browse the repository at this point in the history
  • Loading branch information
checkymander committed Jun 3, 2022
1 parent 64f59dc commit b6d759e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
15 changes: 13 additions & 2 deletions Payload_Type/athena/agent_code/AthenaPlugins/dsquery/dsquery.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.DirectoryServices.Protocols;
using System.Net;
using System.Runtime.InteropServices;
using System.Text;
using dsquery;
using PluginBase;
Expand All @@ -8,8 +9,12 @@ namespace Plugin
{
public static class dsquery
{
//We can pass dictionaries to functions. I just need to figure out how I want to do it on the agent side.
//Err on Linux: https://github.com/dotnet/runtime/issues/60972
//[DllImport("libc")]
//public static extern void setenv(string name, string value);

//[DllImport("libc")]
//public static extern void unsetenv(string name);

static LdapConnection ldapConnection;
static string domain;

Expand Down Expand Up @@ -47,6 +52,12 @@ static string GetBaseDN(string domain)

static ResponseResult Connect(Dictionary<string, object> args)
{

//if (!OperatingSystem.IsWindows()) //Workaround for https://github.com/dotnet/runtime/issues/60972
//{
// setenv("LDAPTLS_REQCERT", "never");
//}

if (String.IsNullOrEmpty((string)args["username"]) || String.IsNullOrEmpty((string)args["password"]) || String.IsNullOrEmpty((string)args["domain"]))
{
return new ResponseResult
Expand Down
9 changes: 7 additions & 2 deletions Payload_Type/athena/agent_code/AthenaPlugins/sftp/sftp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,16 @@ public static ResponseResult Execute(Dictionary<string, object> args)
{
case "upload":
//return RunCommand(args);
return new ResponseResult
{
task_id = (string)args["task-id"],
user_output = "Sorry, this function is not yet supported",
completed = "true",
status = "error"
};
break;
case "download":
return DownloadFile(args);
//return RunCommand(args);
break;
case "connect":
return Connect(args);
Expand Down Expand Up @@ -106,7 +112,6 @@ public static ResponseResult Execute(Dictionary<string, object> args)

static ResponseResult DownloadFile(Dictionary<string, object> args)
{
Console.WriteLine("Downloading File.");
if (string.IsNullOrEmpty(currentSession))
{
return new FileBrowserResponseResult
Expand Down
12 changes: 8 additions & 4 deletions Payload_Type/athena/mythic/agent_functions/sftp.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ async def parse_arguments(self):
else:
self.load_args_from_json_string(self.command_line)
else:
raise Exception("sftp requires at least one command-line parameter.\n\tUsage: {}".format(SshCommand.help_cmd))
raise Exception("sftp requires at least one command-line parameter.\n\tUsage: {}".format(SftpCommand.help_cmd))

pass

Expand All @@ -139,24 +139,28 @@ class SftpCommand(CommandBase):
help_cmd = """
Module Requirements: ssh
Connect to SFTP host:
sftp connect -hostname <host/ip> -username <user> [-password <password>] [-keypath </path/to/key>]
Execute a command in the current session:
sftp ls "<path>"
sftp ls <path>
Get current working path
sftp pwd
Set current working path
sftp cd "<path>"
sftp cd <path>
Switch active session:
sftp switch-session -session <session ID>
List active sessions:
sftp list-sessions
Download a file:
sftp download /full/path/to/file.txt
Note: Downloaded files are not handled through the normal mythif file upload/download so they will need to be small enough to be read in the callback window.
"""
description = "Interact with a given host using SFTP"
version = 1
Expand Down

0 comments on commit b6d759e

Please sign in to comment.