Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version detection for newer Windows #687

Merged
merged 2 commits into from
Dec 5, 2023
Merged
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
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