-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathProgram.cs
More file actions
52 lines (43 loc) · 1.31 KB
/
Program.cs
File metadata and controls
52 lines (43 loc) · 1.31 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
using System;
using System.Collections.ObjectModel;
using System.Management.Automation.Runspaces;
using System.Management.Automation;
using System.Text;
using BetterSharpPick.Parsing;
using BetterSharpPick.Payload;
using BetterSharpPick.Util;
using BetterSharpPick.Scripting;
using BetterSharpPick.Patch;
namespace BetterSharpPick
{
internal static class Program
{
private static int Main(string[] args)
{
try
{
var parser = new ArgParser();
var opts = parser.Parse(args);
if (string.IsNullOrWhiteSpace(opts.PathOrUrl) &&
string.IsNullOrWhiteSpace(opts.Command))
{
HelpText.Print();
return 0;
}
IPreparer preparer = new Preparer();
string payload = preparer.Prepare(opts);
Patcher.Patch();
string output = Executor.Execute(payload);
Console.WriteLine(output);
return 0;
}
catch (ArgumentException ex)
{
Console.Error.WriteLine("[!] Error: " + ex.Message);
Console.Error.WriteLine();
HelpText.Print();
return 1;
}
}
}
}