@@ -101,23 +101,24 @@ def rpc_info(mtype, mname)
101
101
m = _find_module ( mtype , mname )
102
102
res = { }
103
103
104
+ res [ 'type' ] = m . type
104
105
res [ 'name' ] = m . name
105
- res [ 'description' ] = m . description
106
+ res [ 'fullname' ] = m . fullname
107
+ res [ 'rank' ] = m . rank . to_i
108
+ res [ 'description' ] = Rex ::Text . compress ( m . description )
106
109
res [ 'license' ] = m . license
107
110
res [ 'filepath' ] = m . file_path
108
- res [ 'rank' ] = m . rank . to_i
111
+ res [ 'arch' ] = m . arch . map { |x | x . to_s }
112
+ res [ 'platform' ] = m . platform . platforms . map { |x | x . to_s }
113
+ res [ 'authors' ] = m . author . map { |a | a . to_s }
114
+ res [ 'privileged' ] = m . privileged?
109
115
110
116
res [ 'references' ] = [ ]
111
117
m . references . each do |r |
112
118
res [ 'references' ] << [ r . ctx_id , r . ctx_val ]
113
119
end
114
120
115
- res [ 'authors' ] = [ ]
116
- m . each_author do |a |
117
- res [ 'authors' ] << a . to_s
118
- end
119
-
120
- if ( m . type == "exploit" )
121
+ if m . type == 'exploit'
121
122
res [ 'targets' ] = { }
122
123
m . targets . each_index do |i |
123
124
res [ 'targets' ] [ i ] = m . targets [ i ] . name
@@ -126,18 +127,40 @@ def rpc_info(mtype, mname)
126
127
if ( m . default_target )
127
128
res [ 'default_target' ] = m . default_target
128
129
end
130
+
131
+ # Some modules are a combination, which means they are actually aggressive
132
+ res [ 'stance' ] = m . stance . to_s . index ( 'aggressive' ) ? 'aggressive' : 'passive'
129
133
end
130
134
131
- if ( m . type == " auxiliary" )
135
+ if m . type == ' auxiliary' || m . type == 'post'
132
136
res [ 'actions' ] = { }
133
137
m . actions . each_index do |i |
134
138
res [ 'actions' ] [ i ] = m . actions [ i ] . name
135
139
end
136
140
137
- if ( m . default_action )
141
+ if m . default_action
138
142
res [ 'default_action' ] = m . default_action
139
143
end
144
+
145
+ if m . type == 'auxiliary'
146
+ res [ 'stance' ] = m . passive? ? 'passive' : 'aggressive'
147
+ end
148
+ end
149
+
150
+ opts = { }
151
+ m . options . each_key do |k |
152
+ o = m . options [ k ]
153
+ opts [ k ] = {
154
+ 'type' => o . type ,
155
+ 'required' => o . required ,
156
+ 'advanced' => o . advanced ,
157
+ 'desc' => o . desc
158
+ }
159
+
160
+ opts [ k ] [ 'default' ] = o . default unless o . default . nil?
161
+ opts [ k ] [ 'enums' ] = o . enums if o . enums . length > 1
140
162
end
163
+ res [ 'options' ] = opts
141
164
142
165
res
143
166
end
@@ -386,7 +409,7 @@ def rpc_encode(data, encoder, options)
386
409
387
410
# How to warn?
388
411
#if exeopts[:fellback]
389
- # $stderr.puts(OutError + "Warning: Falling back to default template: #{exeopts[:fellback]}")
412
+ # $stderr.puts(OutError + "Warning: Falling back to default template: #{exeopts[:fellback]}")
390
413
#end
391
414
392
415
{ "encoded" => output . to_s }
0 commit comments