@@ -65,7 +65,14 @@ class BESException < RuntimeError; end
65
65
:mshtml_build , # mshtml build. Example: Returns "65535"
66
66
:flash , # Example: Returns "12.0" (chrome/ff) or "12.0.0.77" (IE)
67
67
:vuln_test , # Example: "if(window.MyComponentIsInstalled)return true;",
68
- :activex # Example: [{:clsid=>'String', :method=>'String'}]
68
+ # :activex is a special case.
69
+ # When you set this requirement in your module, this is how it should be:
70
+ # [{:clsid=>'String', :method=>'String'}]
71
+ # Where each Hash is a test case
72
+ # But when BES receives this information, the JavaScript will return this format:
73
+ # "{CLSID}=>Method=>Boolean;"
74
+ # Also see: #has_bad_activex?
75
+ :activex
69
76
] )
70
77
71
78
def initialize ( info = { } )
@@ -188,8 +195,19 @@ def try_set_target(profile)
188
195
end
189
196
190
197
198
+ # Returns true if there's a bad ActiveX, otherwise false.
199
+ # @param ax [String] The raw activex the JavaScript detection will return in this format:
200
+ # "{CLSID}=>Method=>Boolean;"
201
+ # @return [Boolean] True if there's a bad ActiveX, otherwise false
191
202
def has_bad_activex? ( ax )
192
- return true unless ax . split ( ';' ) . empty?
203
+ print_debug ( ax )
204
+ ax . split ( ';' ) . each do |a |
205
+ bool = a . split ( '=>' ) [ 2 ]
206
+ if bool == 'false'
207
+ return true
208
+ end
209
+ end
210
+
193
211
false
194
212
end
195
213
@@ -205,7 +223,7 @@ def get_bad_requirements(profile)
205
223
vprint_debug ( "Comparing requirement: #{ k } =#{ expected } vs #{ k } =#{ profile [ k . to_sym ] } " )
206
224
207
225
if k == :activex
208
- bad_reqs << k unless has_bad_activex? ( profile [ k . to_sym ] )
226
+ bad_reqs << k if has_bad_activex? ( profile [ k . to_sym ] )
209
227
elsif k == :vuln_test
210
228
bad_reqs << k unless profile [ k . to_sym ] . to_s == 'true'
211
229
elsif v . is_a? Regexp
@@ -408,9 +426,11 @@ def get_detection_html(user_agent)
408
426
method = a[:method]
409
427
%>
410
428
var ax = ie_addons_detect.hasActiveX('<%=clsid%>', '<%=method%>');
411
- d['activex'] = '';
412
- if (ax == false) {
413
- d['activex'] += "<%=clsid%>=<%=method%>;";
429
+ d['activex'] = "";
430
+ if (ax == true) {
431
+ d['activex'] += "<%=clsid%>=><%=method%>=>true;";
432
+ } else {
433
+ d['activex'] += "<%=clsid%>=><%=method%>=>false;";
414
434
}
415
435
<% end %>
416
436
<% end %>
0 commit comments