@@ -18,7 +18,7 @@ def mock_note_destroy
18
18
# This empties it
19
19
notes = [ ]
20
20
21
- db = double ( 'db ' )
21
+ db = double ( 'db1 ' )
22
22
allow ( db ) . to receive ( :notes ) . and_return ( notes )
23
23
allow ( framework ) . to receive ( :db ) . and_return ( db )
24
24
@@ -28,14 +28,14 @@ def mock_note_destroy
28
28
def mock_report_note ( arg )
29
29
framework = double ( 'Msf::Framework' , datastore : { } )
30
30
notes = [ create_fake_note ( 'bap.clicks' ) ]
31
- db = double ( 'db ' )
31
+ db = double ( 'db2 ' )
32
32
allow ( db ) . to receive ( :notes ) . and_return ( notes )
33
33
allow ( framework ) . to receive ( :db ) . and_return ( db )
34
34
allow ( subject ) . to receive ( :framework ) . and_return ( framework )
35
35
end
36
36
37
37
def create_fake_note ( tag , data = '' )
38
- note = double ( 'note ' )
38
+ note = double ( 'note3 ' )
39
39
40
40
allow ( note ) . to receive ( :ntype ) . and_return ( tag )
41
41
allow ( note ) . to receive ( :data ) . and_return ( data )
@@ -65,6 +65,7 @@ def create_fake_exploit(opts={})
65
65
datastore_options = opts [ :datastore_options ] || { }
66
66
job_id = opts [ :job_id ] || 0
67
67
requirements = opts [ :requirements ] || { }
68
+ workspace = opts [ :workspace ] || 'default'
68
69
69
70
mod = Msf ::Exploit . new
70
71
mod . extend ( Msf ::Exploit ::Remote ::BrowserExploitServer )
@@ -75,6 +76,7 @@ def create_fake_exploit(opts={})
75
76
allow ( mod ) . to receive ( :compatible_payloads ) . and_return ( compat_payloads )
76
77
allow ( mod ) . to receive ( :datastore ) . and_return ( datastore_options )
77
78
allow ( mod ) . to receive ( :job_id ) . and_return ( job_id )
79
+ allow ( mod ) . to receive ( :workspace ) . and_return ( workspace )
78
80
allow ( mod ) . to receive ( :exploit_simple )
79
81
allow ( mod ) . to receive ( :vprint_status )
80
82
allow ( mod ) . to receive ( :shortname ) . and_return ( short_name )
@@ -139,6 +141,7 @@ def create_fake_payload(opts={})
139
141
datastores = opts [ :datastore_options ]
140
142
fullname = opts [ :fullname ]
141
143
shortname = opts [ :shortname ]
144
+ workspace = opts [ :workspace ] || 'default'
142
145
143
146
p = Msf ::Payload . new
144
147
@@ -154,8 +157,11 @@ def create_fake_payload(opts={})
154
157
p . datastore [ key ] = value
155
158
end
156
159
160
+ datastores [ 'WORKSPACE' ] = workspace
161
+
157
162
allow ( p ) . to receive ( :fullname ) . and_return ( fullname )
158
163
allow ( p ) . to receive ( :shoftname ) . and_return ( shortname )
164
+ allow ( p ) . to receive ( :workspace ) . and_return ( workspace )
159
165
160
166
p
161
167
end
@@ -329,10 +335,14 @@ def mock_exploit_create(full_name)
329
335
notes = [ create_fake_note ( "#{ note_type_prefix } .#{ profile_tag } " , profile_packed_data ) ]
330
336
331
337
# Prepare framework.db
338
+ w = double ( 'workspace' )
339
+ allow ( w ) . to receive ( :name ) . and_return ( 'WORKSPACE' )
340
+
332
341
db = double ( 'db' )
333
342
allow ( db ) . to receive ( :report_note ) . with ( kind_of ( Hash ) ) { |arg | mock_report_note ( arg ) }
334
343
allow ( db ) . to receive ( :notes ) . and_return ( notes )
335
344
allow ( db ) . to receive ( :active ) . and_return ( true )
345
+ allow ( db ) . to receive ( :workspace ) . and_return ( w )
336
346
allow ( framework ) . to receive ( :db ) . and_return ( db )
337
347
338
348
# Prepare framework.exploits
@@ -710,20 +720,6 @@ def get_stdout(&block)
710
720
# You got me, I don't know how to implement this one because the super"
711
721
end
712
722
713
- describe '#show_payloads' do
714
- it 'shows payloads' do
715
- output = get_stdout { subject . show_payloads }
716
- expect ( output ) . to include ( windows_meterpreter_reverse_tcp )
717
- expect ( output ) . to include ( linux_meterpreter_reverse_tcp )
718
- end
719
- end
720
-
721
- describe '#set_payload' do
722
- it 'shows set_payload' do
723
- output = get_stdout { subject . set_payload }
724
- expect ( output ) . to include ( '\'set payload\' has been disabled for BrowserAutoPwn' )
725
- end
726
- end
727
723
end
728
724
729
725
describe '#log_click' do
0 commit comments