Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Massive credit to the below resources that really did 90% of this for me. This t
* https://github.com/AlsidOfficial/WSUSpendu - powershell tool for abusing WSUS
* https://github.com/ThunderGunExpress/Thunder_Woosus - Csharp tool for abusing WSUS

## Building
This project requires .NET Framework v4.0. You can download that here: https://dotnet.microsoft.com/en-us/download/dotnet-framework/net40. It may work with newer versions of .NET, however, it's not been tested.

## Help Menu

```
Expand Down
32 changes: 19 additions & 13 deletions SharpWSUS/lib/Server.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Net;
using System.Data.SqlClient;

public class Server
{
Expand All @@ -12,7 +13,7 @@ public class Server
public static int iPortNumber;
public static bool bSSL;
public static string sTargetComputerID;
public static int sTargetComputerTargetID;
public static int sTargetComputerTargetID;

public static void GetServerDetails()
{
Expand All @@ -24,22 +25,27 @@ public static void GetServerDetails()
}
public static void FvContentDirectory()
{
string sContentDirectoryTemp = string.Empty;
sContentDirectoryTemp = Reg.RegistryWOW6432.GetRegKey64(Reg.RegHive.HKEY_LOCAL_MACHINE, @"SOFTWARE\Microsoft\Update Services\Server\setup", "ContentDir");
if (sContentDirectoryTemp == "ERROR_FILE_NOT_FOUND")
SqlCommand sqlComm = new SqlCommand();
sqlComm.Connection = Connect.FsqlConnection();
SqlDataReader sqldrReader;
sqlComm.CommandText = "exec spConfiguration";
try
{
sContentDirectoryTemp = Reg.RegistryWOW6432.GetRegKey32(Reg.RegHive.HKEY_LOCAL_MACHINE, @"SOFTWARE\Microsoft\Update Services\Server\setup", "ContentDir");
if (sContentDirectoryTemp == "ERROR_FILE_NOT_FOUND")
//Gather Information via SQL
sqldrReader = sqlComm.ExecuteReader();
if (sqldrReader.Read())
{
bWSUSInstalled = false;
Console.WriteLine("Something went wrong, unable to detect SQL details from registry.");
return;
Server.sLocalContentCacheLocation = (string)sqldrReader.GetValue(sqldrReader.GetOrdinal("LocalContentCacheLocation"));
Console.WriteLine(Server.sLocalContentCacheLocation);
sqldrReader.Close();
}
}
sContentDirectoryTemp = HEX2ASCII(sContentDirectoryTemp);
sContentDirectoryTemp = ReverseString(sContentDirectoryTemp);
sLocalContentCacheLocation = Environment.ExpandEnvironmentVariables(sContentDirectoryTemp);
return;
catch (Exception e)
{
Console.WriteLine("\r\nFunction error - FvContentDirectory.");

Console.WriteLine($"Error Message: {e.Message}");
}
}
public static void FvFullComputerName()
{
Expand Down