Skip to content

Commit

Permalink
Land #687, Add version detection for newer Windows
Browse files Browse the repository at this point in the history
Merge branch 'land-687' into upstream-master
  • Loading branch information
bwatters-r7 committed Dec 5, 2023
2 parents f539248 + 4e789ee commit 4810c5c
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions c/meterpreter/source/extensions/stdapi/server/sys/config/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,41 +556,49 @@ DWORD add_windows_os_version(Packet** packet)
{
if (v.dwMinorVersion == 0)
{
osName = "Windows 2000";
osName = v.wProductType == VER_NT_WORKSTATION ? "Windows 2000" : "Windows Server 2000";
}
else if (v.dwMinorVersion == 1)
{
osName = "Windows XP";
}
else if (v.dwMinorVersion == 2)
{
osName = "Windows .NET Server";
osName = "Windows Server 2003";
}
}
else if (v.dwMajorVersion == 6)
{
if (v.dwMinorVersion == 0)
{
osName = v.wProductType == VER_NT_WORKSTATION ? "Windows Vista" : "Windows 2008";
osName = v.wProductType == VER_NT_WORKSTATION ? "Windows Vista" : "Windows Server 2008";
}
else if (v.dwMinorVersion == 1)
{
osName = v.wProductType == VER_NT_WORKSTATION ? "Windows 7" : "Windows 2008 R2";
osName = v.wProductType == VER_NT_WORKSTATION ? "Windows 7" : "Windows Server 2008 R2";
}
else if (v.dwMinorVersion == 2)
{
osName = v.wProductType == VER_NT_WORKSTATION ? "Windows 8" : "Windows 2012";
osName = v.wProductType == VER_NT_WORKSTATION ? "Windows 8" : "Windows Server 2012";
}
else if (v.dwMinorVersion == 3)
{
osName = v.wProductType == VER_NT_WORKSTATION ? "Windows 8.1" : "Windows 2012 R2";
osName = v.wProductType == VER_NT_WORKSTATION ? "Windows 8.1" : "Windows Server 2012 R2";
}
}
else if (v.dwMajorVersion == 10)
{
if (v.dwMinorVersion == 0)
{
osName = v.wProductType == VER_NT_WORKSTATION ? "Windows 10" : "Windows 2016+";
if (v.dwBuildNumber < 17763) {
osName = v.wProductType == VER_NT_WORKSTATION ? "Windows 10" : "Windows Server 2016";
} else if (v.dwBuildNumber < 20348) {
osName = v.wProductType == VER_NT_WORKSTATION ? "Windows 10" : "Windows Server 2019";
} else if (v.dwBuildNumber < 22000) {
osName = v.wProductType == VER_NT_WORKSTATION ? "Windows 10" : "Windows Server 2022";
} else {
osName = v.wProductType == VER_NT_WORKSTATION ? "Windows 11" : "Windows Server 2022";
}
}
}

Expand Down

0 comments on commit 4810c5c

Please sign in to comment.