So, I am writing some code and am pulling in 3rd party projects to achieve a specific set of functionality. Namely, talking to AD, getting kerberos tickets, doing user impersonation if a username/password is supplied to the program etc.
The issue I've run into is that many of these things depend on Windows kernel libraries (netapi.dll, win32.dll to name a few). I need to be able to run this one Linux as well. So I tried .NET core. Well, being core I was never able to find an alternative to these libraries, and of course WINE doesn't work for them either. So I am left with one option. Socks proxies.
So how in the world, can I proxy an entire application (console app) through a socks4 or socks5 proxy. PS, I am NOT talking HTTP. An example would be the following (just a simple AD lookup):
public void PrintAllUsers()
{
Console.WriteLine("[+] Domain Users");
Console.WriteLine("-----------------");
GroupPrincipal gp = GetGroup("Domain Users");
Console.WriteLine("[+] Count (" + gp.Members.Count + ")");
foreach (Principal pc in gp.Members)
{
if (pc.StructuralObjectClass.ToLower() == "user")
{
PrintUserData(pc as UserPrincipal);
}
if (pc.StructuralObjectClass.ToLower() == "computer")
{
PrintComputerData(pc as ComputerPrincipal);
}
}
Console.WriteLine("-----------------");
}