1
0
mirror of https://github.com/mastercodeon314/KsDumper-11.git synced 2024-11-23 22:41:06 +01:00
KsDumper-11/KsDumper11/SnifferBypass.cs
Dennis Nedry 58a0d27fd7 v1.3.4
2024-02-22 00:51:22 -06:00

41 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace KsDumper11
{
public class SnifferBypass
{
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
private static extern bool SetWindowText(IntPtr hWnd, string lpString);
[DllImport("user32.dll", SetLastError = true)]
private static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
public string FilePath { get; set; }
private string renamedPath = "";
public static void SelfTitle(IntPtr hWnd)
{
bool result = SetWindowText(hWnd, GenerateRandomString(12));
}
public SnifferBypass(string filePath)
{
FilePath = filePath;
}
public static string GenerateRandomString(int length)
{
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
Random random = new Random();
return new string(Enumerable.Repeat(chars, length).Select(s => s[random.Next(s.Length)]).ToArray());
}
}
}