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

Update enum_ms_product_keys to only run on supported versions. #901

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 15 additions & 4 deletions modules/post/windows/gather/enum_ms_product_keys.rb
Expand Up @@ -20,7 +20,7 @@ class Metasploit3 < Msf::Post
def initialize(info={})
super(update_info(info,
'Name' => 'Windows Gather Product Key',
'Description' => %q{ This module will enumerate the OS license key },
'Description' => %q{ This module will enumerate the OS license key and various other MS product keys. },
'License' => MSF_LICENSE,
'Author' => [ 'Brandon Perry <bperry.volatile[at]gmail.com>'],
'Version' => '$Revision$',
Expand Down Expand Up @@ -93,13 +93,13 @@ def app_list

def decode(chunk)
start = 52
finish = start + 15
string_length = 15
finish = start + string_length

#charmap idex
alphas = %w[B C D F G H J K M P Q R T V W X Y 2 3 4 6 7 8 9]

decode_length = 29
string_length = 15

#product ID in coded bytes
product_id = Array.new
Expand All @@ -108,7 +108,7 @@ def decode(chunk)
key = ""

#From byte 52 to byte 67, inclusive
(52).upto(67) do |i|
(start).upto(finish) do |i|
product_id[i-start] = chunk[i]
end

Expand All @@ -135,8 +135,19 @@ def decode(chunk)
end

def run
if not os_supportable? sysinfo['OS']
print_error("Sorry, #{sysinfo['OS']} is not supported");
return
end

print_status("Finding Microsoft key on #{sysinfo['Computer']}")
app_list
end

#MS removes the key from the registry after windows 7
def os_supportable?(os)
return true if os =~ / XP / || os =~ / Vista / || os =~ / 7 /
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2000?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2000?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about the server products? server 2000, 2003 and 2008?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Server 2008 falls to the same issue as windows 8, the key is being removed after activation. Server/2000 and 2003 though I totally forgot about and don't have machines available off hand to test with. Let me see if I can fix this so I can test them as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that 2008 will not work? 2008 and Windows 7 share the same kernel. The Windows 8 like Server product would be Server 2012

false
end

end