watobo 0.9.19 → 0.9.20
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +104 -0
- data/bin/nfq_server.rb +8 -20
- data/bin/watobo_gui.rb +8 -20
- data/config/forwarding_proxy.yml +2 -2
- data/lib/watobo.rb +12 -22
- data/lib/watobo/adapters.rb +12 -24
- data/lib/watobo/adapters/data_store.rb +76 -66
- data/lib/watobo/adapters/file/file_store.rb +295 -307
- data/lib/watobo/adapters/session_store.rb +13 -25
- data/lib/watobo/ca.rb +9 -21
- data/lib/watobo/config.rb +205 -217
- data/lib/watobo/constants.rb +8 -20
- data/lib/watobo/core.rb +11 -23
- data/lib/watobo/core/active_check.rb +11 -21
- data/lib/watobo/core/active_checks.rb +57 -69
- data/lib/watobo/core/ca.rb +388 -398
- data/lib/watobo/core/cert_store.rb +42 -54
- data/lib/watobo/core/chat.rb +100 -112
- data/lib/watobo/core/chats.rb +271 -275
- data/lib/watobo/core/client_cert_store.rb +33 -45
- data/lib/watobo/core/conversation.rb +56 -68
- data/lib/watobo/core/cookie.rb +31 -43
- data/lib/watobo/core/finding.rb +74 -86
- data/lib/watobo/core/findings.rb +113 -125
- data/lib/watobo/core/forwarding_proxy.rb +44 -35
- data/lib/watobo/core/fuzz_gen.rb +8 -20
- data/lib/watobo/core/intercept_carver.rb +176 -188
- data/lib/watobo/core/intercept_filter.rb +243 -255
- data/lib/watobo/core/interceptor.rb +106 -118
- data/lib/watobo/core/min_class.rb +12 -24
- data/lib/watobo/core/netfilter_queue.rb +178 -190
- data/lib/watobo/core/ott_cache.rb +152 -148
- data/lib/watobo/core/parameter.rb +53 -58
- data/lib/watobo/core/passive_check.rb +8 -20
- data/lib/watobo/core/passive_checks.rb +56 -68
- data/lib/watobo/core/passive_scanner.rb +54 -66
- data/lib/watobo/core/plugin.rb +19 -31
- data/lib/watobo/core/project.rb +8 -20
- data/lib/watobo/core/proxy.rb +51 -63
- data/lib/watobo/core/request.rb +128 -120
- data/lib/watobo/core/response.rb +59 -61
- data/lib/watobo/core/scanner.rb +8 -20
- data/lib/watobo/core/scanner3.rb +413 -425
- data/lib/watobo/core/scope.rb +91 -103
- data/lib/watobo/core/session.rb +109 -87
- data/lib/watobo/core/sid_cache.rb +106 -118
- data/lib/watobo/core/subscriber.rb +33 -45
- data/lib/watobo/defaults.rb +29 -41
- data/lib/watobo/external/diff/lcs.rb +8 -20
- data/lib/watobo/external/diff/lcs/array.rb +8 -20
- data/lib/watobo/external/diff/lcs/block.rb +8 -20
- data/lib/watobo/external/diff/lcs/callbacks.rb +8 -20
- data/lib/watobo/external/diff/lcs/change.rb +8 -20
- data/lib/watobo/external/diff/lcs/hunk.rb +8 -20
- data/lib/watobo/external/diff/lcs/ldiff.rb +8 -20
- data/lib/watobo/external/diff/lcs/string.rb +8 -20
- data/lib/watobo/externals.rb +14 -26
- data/lib/watobo/framework.rb +12 -24
- data/lib/watobo/framework/create_project.rb +68 -80
- data/lib/watobo/framework/init.rb +8 -20
- data/lib/watobo/framework/init_modules.rb +8 -20
- data/lib/watobo/framework/license_text.rb +36 -48
- data/lib/watobo/framework/load_chat.rb +21 -33
- data/lib/watobo/gui.rb +121 -133
- data/lib/watobo/gui/about_watobo.rb +8 -20
- data/lib/watobo/gui/browser_preview.rb +8 -20
- data/lib/watobo/gui/certificate_dialog.rb +8 -20
- data/lib/watobo/gui/chat_diff.rb +11 -21
- data/lib/watobo/gui/chatviewer_frame.rb +10 -22
- data/lib/watobo/gui/checkboxtree.rb +8 -20
- data/lib/watobo/gui/checks_policy_frame.rb +8 -20
- data/lib/watobo/gui/client_cert_dialog.rb +10 -21
- data/lib/watobo/gui/confirm_scan_dialog.rb +8 -20
- data/lib/watobo/gui/conversation_table.rb +54 -44
- data/lib/watobo/gui/conversation_table_ctrl.rb +215 -227
- data/lib/watobo/gui/conversation_table_ctrl2.rb +385 -393
- data/lib/watobo/gui/csrf_token_dialog.rb +11 -25
- data/lib/watobo/gui/custom_viewer.rb +357 -369
- data/lib/watobo/gui/dashboard.rb +8 -20
- data/lib/watobo/gui/define_scope_frame.rb +8 -20
- data/lib/watobo/gui/differ_frame.rb +223 -235
- data/lib/watobo/gui/edit_comment.rb +8 -20
- data/lib/watobo/gui/edit_scope_dialog.rb +8 -20
- data/lib/watobo/gui/export_dialog.rb +114 -0
- data/lib/watobo/gui/finding_info.rb +9 -21
- data/lib/watobo/gui/findings_tree.rb +8 -20
- data/lib/watobo/gui/full_scan_dialog.rb +8 -20
- data/lib/watobo/gui/fuzzer_gui.rb +8 -20
- data/lib/watobo/gui/goto_url_dialog.rb +78 -90
- data/lib/watobo/gui/hex_viewer.rb +25 -27
- data/lib/watobo/gui/html_viewer.rb +295 -307
- data/lib/watobo/gui/intercept_filter_dialog.rb +196 -208
- data/lib/watobo/gui/interceptor_gui.rb +1046 -1041
- data/lib/watobo/gui/interceptor_settings_dialog.rb +8 -20
- data/lib/watobo/gui/list_box.rb +109 -121
- data/lib/watobo/gui/log_file_viewer.rb +40 -52
- data/lib/watobo/gui/log_viewer.rb +87 -99
- data/lib/watobo/gui/login_wizzard.rb +8 -20
- data/lib/watobo/gui/main_window.rb +34 -33
- data/lib/watobo/gui/manual_request_editor.rb +25 -35
- data/lib/watobo/gui/master_pw_dialog.rb +8 -20
- data/lib/watobo/gui/mixins/gui_settings.rb +37 -49
- data/lib/watobo/gui/page_tree.rb +225 -237
- data/lib/watobo/gui/password_policy_dialog.rb +8 -20
- data/lib/watobo/gui/plugin_board.rb +8 -20
- data/lib/watobo/gui/preferences_dialog.rb +8 -20
- data/lib/watobo/gui/progress_window.rb +8 -20
- data/lib/watobo/gui/project_wizzard.rb +8 -20
- data/lib/watobo/gui/proxy_dialog.rb +117 -85
- data/lib/watobo/gui/quick_scan_dialog.rb +8 -20
- data/lib/watobo/gui/request_builder_frame.rb +125 -122
- data/lib/watobo/gui/request_editor.rb +53 -28
- data/lib/watobo/gui/rewrite_filters_dialog.rb +402 -414
- data/lib/watobo/gui/rewrite_rules_dialog.rb +380 -392
- data/lib/watobo/gui/save_chat_dialog.rb +148 -160
- data/lib/watobo/gui/scanner_settings_dialog.rb +8 -20
- data/lib/watobo/gui/select_chat_dialog.rb +8 -20
- data/lib/watobo/gui/session_management_dialog.rb +8 -20
- data/lib/watobo/gui/sites_tree.rb +118 -22
- data/lib/watobo/gui/status_bar.rb +8 -20
- data/lib/watobo/gui/table_editor.rb +76 -53
- data/lib/watobo/gui/tagless_viewer.rb +10 -21
- data/lib/watobo/gui/templates/plugin.rb +8 -20
- data/lib/watobo/gui/templates/plugin2.rb +99 -111
- data/lib/watobo/gui/templates/plugin_base.rb +152 -164
- data/lib/watobo/gui/text_viewer.rb +8 -20
- data/lib/watobo/gui/transcoder_window.rb +15 -22
- data/lib/watobo/gui/utils/gui_utils.rb +8 -20
- data/lib/watobo/gui/utils/init_icons.rb +94 -106
- data/lib/watobo/gui/utils/load_icons.rb +41 -53
- data/lib/watobo/gui/utils/load_plugins.rb +118 -130
- data/lib/watobo/gui/utils/master_password.rb +76 -88
- data/lib/watobo/gui/utils/save_default_settings.rb +121 -133
- data/lib/watobo/gui/utils/save_project_settings.rb +8 -20
- data/lib/watobo/gui/utils/save_proxy_settings.rb +53 -21
- data/lib/watobo/gui/utils/save_scanner_settings.rb +26 -38
- data/lib/watobo/gui/utils/session_history.rb +120 -132
- data/lib/watobo/gui/workspace_dialog.rb +8 -20
- data/lib/watobo/gui/www_auth_dialog.rb +8 -20
- data/lib/watobo/gui/xml_viewer_frame.rb +8 -20
- data/lib/watobo/http.rb +12 -23
- data/lib/watobo/http/cookies/cookies.rb +63 -70
- data/lib/watobo/http/data/data.rb +56 -64
- data/lib/watobo/http/data/json.rb +51 -0
- data/lib/watobo/http/url/url.rb +46 -58
- data/lib/watobo/http/xml/xml.rb +129 -141
- data/lib/watobo/interceptor.rb +11 -23
- data/lib/watobo/interceptor/proxy.rb +624 -625
- data/lib/watobo/interceptor/transparent.rb +22 -34
- data/lib/watobo/mixins.rb +18 -30
- data/lib/watobo/mixins/check_info.rb +35 -47
- data/lib/watobo/mixins/httpparser.rb +42 -35
- data/lib/watobo/mixins/request_parser.rb +8 -20
- data/lib/watobo/mixins/shapers.rb +484 -477
- data/lib/watobo/mixins/transcoders.rb +8 -20
- data/lib/watobo/parser.rb +9 -21
- data/lib/watobo/parser/html.rb +91 -103
- data/lib/watobo/sockets.rb +11 -23
- data/lib/watobo/sockets/agent.rb +836 -848
- data/lib/watobo/sockets/client_socket.rb +283 -277
- data/lib/watobo/sockets/connection.rb +409 -421
- data/lib/watobo/sockets/http_socket.rb +16 -23
- data/lib/watobo/sockets/ntlm_auth.rb +137 -149
- data/lib/watobo/utils.rb +18 -30
- data/lib/watobo/utils/check_regex.rb +8 -20
- data/lib/watobo/utils/copy_object.rb +8 -20
- data/lib/watobo/utils/crypto.rb +8 -20
- data/lib/watobo/utils/expand_range.rb +31 -43
- data/lib/watobo/utils/export_xml.rb +108 -0
- data/lib/watobo/utils/file_management.rb +8 -20
- data/lib/watobo/utils/hexprint.rb +17 -29
- data/lib/watobo/utils/load_chat.rb +8 -20
- data/lib/watobo/utils/load_icon.rb +8 -20
- data/lib/watobo/{external/ntlm → utils}/ntlm.rb +874 -796
- data/lib/watobo/utils/print_debug.rb +20 -32
- data/lib/watobo/utils/response_builder.rb +98 -110
- data/lib/watobo/utils/response_hash.rb +9 -20
- data/lib/watobo/utils/secure_eval.rb +10 -22
- data/lib/watobo/utils/strings.rb +18 -30
- data/lib/watobo/utils/text2request.rb +12 -20
- data/lib/watobo/utils/url.rb +31 -43
- data/lib/watobo/utils/utf16.rb +22 -0
- data/modules/active/Apache/mod_status.rb +9 -0
- data/modules/active/Apache/multiview.rb +161 -0
- data/modules/active/Flash/crossdomain.rb +9 -0
- data/modules/active/directories/dirwalker.rb +8 -20
- data/modules/active/discovery/fileextensions.rb +10 -22
- data/modules/active/discovery/http_methods.rb +8 -20
- data/modules/active/domino/domino_db.rb +8 -20
- data/modules/active/dotNET/custom_errors.rb +110 -122
- data/modules/active/dotNET/dotnet_files.rb +98 -110
- data/modules/active/fileinclusion/lfi_simple.rb +8 -20
- data/modules/active/jboss/jboss_basic.rb +8 -20
- data/modules/active/sap/business_objects.rb +63 -0
- data/modules/active/sap/its_commands.rb +8 -20
- data/modules/active/sap/its_service_parameter.rb +8 -20
- data/modules/active/sap/its_services.rb +8 -20
- data/modules/active/sap/its_xss.rb +8 -20
- data/modules/active/shell_shock/shell_shock.rb +149 -0
- data/modules/active/siebel/siebel_apps.rb +168 -180
- data/modules/active/sqlinjection/sql_boolean.rb +9 -21
- data/modules/active/sqlinjection/sqli_error.rb +10 -22
- data/modules/active/sqlinjection/sqli_timing.rb +228 -240
- data/modules/active/struts2/default_handler_ognl.rb +114 -126
- data/modules/active/struts2/include_params_ognl.rb +113 -125
- data/modules/active/xml/xml_xxe.rb +122 -127
- data/modules/active/xss/xss_ng.rb +223 -234
- data/modules/active/xss/xss_simple.rb +8 -20
- data/modules/passive/ajax.rb +76 -84
- data/modules/passive/autocomplete.rb +64 -76
- data/modules/passive/cookie_options.rb +8 -20
- data/modules/passive/cookie_xss.rb +9 -21
- data/modules/passive/detect_code.rb +9 -21
- data/modules/passive/detect_fileupload.rb +11 -22
- data/modules/passive/detect_infrastructure.rb +23 -35
- data/modules/passive/detect_one_time_tokens.rb +8 -20
- data/modules/passive/dirindexing.rb +9 -21
- data/modules/passive/disclosure_domino.rb +66 -79
- data/modules/passive/disclosure_emails.rb +9 -21
- data/modules/passive/disclosure_ipaddr.rb +15 -23
- data/modules/passive/filename_as_parameter.rb +8 -20
- data/modules/passive/form_spotter.rb +15 -21
- data/modules/passive/hidden_fields.rb +64 -70
- data/modules/passive/hotspots.rb +13 -22
- data/modules/passive/in_script_parameter.rb +15 -24
- data/modules/passive/multiple_server_headers.rb +8 -20
- data/modules/passive/possible_login.rb +12 -23
- data/modules/passive/redirect_url.rb +10 -22
- data/modules/passive/redirectionz.rb +9 -21
- data/modules/passive/sap-headers.rb +64 -76
- data/modules/passive/xss_dom.rb +10 -21
- data/plugins/catalog/catalog.rb +17 -23
- data/plugins/crawler/crawler.rb +12 -24
- data/plugins/crawler/gui.rb +13 -25
- data/plugins/crawler/gui/auth_frame.rb +278 -290
- data/plugins/crawler/gui/crawler_gui.rb +302 -320
- data/plugins/crawler/gui/general_settings_frame.rb +104 -116
- data/plugins/crawler/gui/hooks_frame.rb +88 -100
- data/plugins/crawler/gui/scope_frame.rb +58 -70
- data/plugins/crawler/gui/settings_tabbook.rb +46 -58
- data/plugins/crawler/gui/status_frame.rb +67 -78
- data/plugins/crawler/lib/bags.rb +26 -38
- data/plugins/crawler/lib/constants.rb +19 -31
- data/plugins/crawler/lib/engine.rb +505 -508
- data/plugins/crawler/lib/grabber.rb +77 -87
- data/plugins/crawler/lib/status.rb +82 -0
- data/plugins/crawler/lib/uri_mp.rb +20 -32
- data/plugins/filefinder/dbs/siebel_paths.txt +1118 -0
- data/plugins/filefinder/dbs/subs-big.lst +31986 -0
- data/plugins/filefinder/filefinder.rb +13 -23
- data/plugins/sqlmap/bin/test.rb +86 -98
- data/plugins/sqlmap/gui.rb +12 -24
- data/plugins/sqlmap/gui/main.rb +226 -238
- data/plugins/sqlmap/gui/options_frame.rb +105 -117
- data/plugins/sqlmap/lib/sqlmap_ctrl.rb +103 -115
- data/plugins/sqlmap/sqlmap.rb +10 -22
- data/plugins/sslchecker/cli/sslchecker_cli.rb +8 -20
- data/plugins/sslchecker/gui/cipher_table.rb +252 -264
- data/plugins/sslchecker/gui/gui.rb +267 -276
- data/plugins/sslchecker/gui/sslchecker.rb +12 -24
- data/plugins/sslchecker/lib/check.rb +172 -80
- data/plugins/wshell/gui/main.rb +115 -127
- data/plugins/wshell/lib/core.rb +85 -97
- data/plugins/wshell/wshell.rb +19 -31
- metadata +14 -6
- data/.yardopts +0 -24
@@ -1,24 +1,12 @@
|
|
1
|
-
|
1
|
+
#.
|
2
2
|
# http_socket.rb
|
3
|
-
|
4
|
-
# Copyright
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
|
10
|
-
# it under the terms of the GNU General Public License as published by
|
11
|
-
# the Free Software Foundation version 2 of the License.
|
12
|
-
#
|
13
|
-
# WATOBO is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU General Public License
|
19
|
-
# along with WATOBO; if not, write to the Free Software
|
20
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
# .
|
3
|
+
#.
|
4
|
+
# Copyright 2014 by siberas, http://www.siberas.de
|
5
|
+
# This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
|
6
|
+
# WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
|
7
|
+
# WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
8
|
+
# You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
9
|
+
|
22
10
|
# @private
|
23
11
|
module Watobo#:nodoc: all
|
24
12
|
module HTTPSocket
|
@@ -218,11 +206,16 @@ module Watobo#:nodoc: all
|
|
218
206
|
return
|
219
207
|
end
|
220
208
|
|
221
|
-
def self.readChunkedBody(socket)
|
209
|
+
def self.readChunkedBody(socket, &block)
|
222
210
|
buf = nil
|
223
211
|
while (chunk_size = socket.gets)
|
224
|
-
|
225
|
-
|
212
|
+
|
213
|
+
if chunk_size.strip.empty?
|
214
|
+
yield chunk_size
|
215
|
+
next
|
216
|
+
end
|
217
|
+
next unless chunk_size.strip =~/^[a-fA-F0-9]+$/
|
218
|
+
yield "#{chunk_size.strip}\n" if block_given?
|
226
219
|
bytes_to_read = num_bytes = chunk_size.strip.hex
|
227
220
|
# puts "> chunk-length: 0x#{chunk_size.strip}(#{num_bytes})"
|
228
221
|
return if num_bytes == 0
|
@@ -1,152 +1,140 @@
|
|
1
|
-
|
1
|
+
#.
|
2
2
|
# ntlm_auth.rb
|
3
|
-
|
4
|
-
# Copyright
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
# WATOBO is free software; you can redistribute it and/or modify
|
10
|
-
# it under the terms of the GNU General Public License as published by
|
11
|
-
# the Free Software Foundation version 2 of the License.
|
12
|
-
#
|
13
|
-
# WATOBO is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU General Public License
|
19
|
-
# along with WATOBO; if not, write to the Free Software
|
20
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
# .
|
22
|
-
# @private
|
23
|
-
module Watobo#:nodoc: all
|
24
|
-
module HTTPSocket
|
25
|
-
module NTLMAuth
|
26
|
-
|
27
|
-
def do_ntlm_auth()
|
28
|
-
response_header = nil
|
29
|
-
|
30
|
-
auth_request = @request.copy
|
31
|
-
|
32
|
-
ntlm_challenge = nil
|
33
|
-
t1 = Net::NTLM::Message::Type1.new()
|
34
|
-
msg = "NTLM " + t1.encode64
|
35
|
-
|
36
|
-
auth_request.removeHeader("Connection")
|
37
|
-
auth_request.removeHeader("Authorization")
|
38
|
-
|
39
|
-
auth_request.addHeader("Authorization", msg)
|
40
|
-
auth_request.addHeader("Connection", "Keep-Alive")
|
41
|
-
|
42
|
-
if $DEBUG
|
43
|
-
puts "============= T1 ======================="
|
44
|
-
puts auth_request
|
45
|
-
end
|
46
|
-
|
47
|
-
data = auth_request.join + "\r\n"
|
48
|
-
@connection.send data
|
49
|
-
|
50
|
-
puts "-----------------" if $DEBUG
|
51
|
-
|
52
|
-
response_header = []
|
53
|
-
rcode = nil
|
54
|
-
clen = nil
|
55
|
-
ntlm_challenge = nil
|
56
|
-
response_header = connection.read_header
|
57
|
-
response_header.each do |line|
|
58
|
-
if line =~ /^HTTP\/\d\.\d (\d+) (.*)/ then
|
59
|
-
rcode = $1.to_i
|
60
|
-
rmsg = $2
|
61
|
-
end
|
62
|
-
if line =~ /^WWW-Authenticate: (NTLM) (.+)\r\n/
|
63
|
-
ntlm_challenge = $2
|
64
|
-
end
|
65
|
-
if line =~ /^Content-Length: (\d{1,})\r\n/
|
66
|
-
clen = $1.to_i
|
67
|
-
end
|
68
|
-
break if line.strip.empty?
|
69
|
-
end
|
70
|
-
# puts "==================="
|
71
|
-
|
72
|
-
if $DEBUG
|
73
|
-
puts "--- T1 RESPONSE HEADERS ---"
|
74
|
-
puts response_header
|
75
|
-
puts "---"
|
76
|
-
end
|
77
|
-
|
78
|
-
if rcode == 401 #Authentication Required
|
79
|
-
puts "[NTLM] got ntlm challenge: #{ntlm_challenge}" if $DEBUG
|
80
|
-
return socket, response_header if ntlm_challenge.nil?
|
81
|
-
elsif rcode == 200 # Ok
|
82
|
-
puts "[NTLM] seems request doesn't need authentication" if $DEBUG
|
83
|
-
return socket, Watobo::Response.new(response_header)
|
84
|
-
else
|
85
|
-
if $DEBUG
|
86
|
-
puts "[NTLM] ... !#*+.!*peep* ...."
|
87
|
-
puts response_header
|
88
|
-
end
|
89
|
-
return socket, Watobo::Response.new(response_header)
|
90
|
-
end
|
91
|
-
|
92
|
-
# reading rest of response
|
93
|
-
rest = ''
|
94
|
-
Watobo::HTTPSocket.read_body(socket, :max_bytes => clen){ |d|
|
95
|
-
rest += d
|
96
|
-
}
|
97
|
-
|
98
|
-
if $DEBUG
|
99
|
-
puts "--- T1 RESPONSE BODY ---"
|
100
|
-
puts rest
|
101
|
-
puts "---"
|
102
|
-
end
|
103
|
-
t2 = Net::NTLM::Message.decode64(ntlm_challenge)
|
104
|
-
t3 = t2.response({:user => ntlm_credentials[:username],
|
105
|
-
:password => ntlm_credentials[:password],
|
106
|
-
:domain => ntlm_credentials[:domain]},
|
107
|
-
{:workstation => ntlm_credentials[:workstation], :ntlmv2 => true})
|
3
|
+
#.
|
4
|
+
# Copyright 2014 by siberas, http://www.siberas.de
|
5
|
+
# This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
|
6
|
+
# WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
|
7
|
+
# WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
8
|
+
# You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
108
9
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
10
|
+
# @private
|
11
|
+
module Watobo#:nodoc: all
|
12
|
+
module HTTPSocket
|
13
|
+
module NTLMAuth
|
14
|
+
|
15
|
+
def do_ntlm_auth()
|
16
|
+
response_header = nil
|
17
|
+
|
18
|
+
auth_request = @request.copy
|
19
|
+
|
20
|
+
ntlm_challenge = nil
|
21
|
+
t1 = Watobo::NTLM::Message::Type1.new()
|
22
|
+
msg = "NTLM " + t1.encode64
|
23
|
+
|
24
|
+
auth_request.removeHeader("Connection")
|
25
|
+
auth_request.removeHeader("Authorization")
|
26
|
+
|
27
|
+
auth_request.addHeader("Authorization", msg)
|
28
|
+
auth_request.addHeader("Connection", "Keep-Alive")
|
29
|
+
|
30
|
+
if $DEBUG
|
31
|
+
puts "============= T1 ======================="
|
32
|
+
puts auth_request
|
33
|
+
end
|
34
|
+
|
35
|
+
data = auth_request.join + "\r\n"
|
36
|
+
@connection.send data
|
37
|
+
|
38
|
+
puts "-----------------" if $DEBUG
|
39
|
+
|
40
|
+
response_header = []
|
41
|
+
rcode = nil
|
42
|
+
clen = nil
|
43
|
+
ntlm_challenge = nil
|
44
|
+
response_header = connection.read_header
|
45
|
+
response_header.each do |line|
|
46
|
+
if line =~ /^HTTP\/\d\.\d (\d+) (.*)/ then
|
47
|
+
rcode = $1.to_i
|
48
|
+
rmsg = $2
|
49
|
+
end
|
50
|
+
if line =~ /^WWW-Authenticate: (NTLM) (.+)\r\n/
|
51
|
+
ntlm_challenge = $2
|
52
|
+
end
|
53
|
+
if line =~ /^Content-Length: (\d{1,})\r\n/
|
54
|
+
clen = $1.to_i
|
55
|
+
end
|
56
|
+
break if line.strip.empty?
|
57
|
+
end
|
58
|
+
# puts "==================="
|
59
|
+
|
60
|
+
if $DEBUG
|
61
|
+
puts "--- T1 RESPONSE HEADERS ---"
|
62
|
+
puts response_header
|
63
|
+
puts "---"
|
64
|
+
end
|
65
|
+
|
66
|
+
if rcode == 401 #Authentication Required
|
67
|
+
puts "[NTLM] got ntlm challenge: #{ntlm_challenge}" if $DEBUG
|
68
|
+
return socket, response_header if ntlm_challenge.nil?
|
69
|
+
elsif rcode == 200 # Ok
|
70
|
+
puts "[NTLM] seems request doesn't need authentication" if $DEBUG
|
71
|
+
return socket, Watobo::Response.new(response_header)
|
72
|
+
else
|
73
|
+
if $DEBUG
|
74
|
+
puts "[NTLM] ... !#*+.!*peep* ...."
|
75
|
+
puts response_header
|
76
|
+
end
|
77
|
+
return socket, Watobo::Response.new(response_header)
|
78
|
+
end
|
79
|
+
|
80
|
+
# reading rest of response
|
81
|
+
rest = ''
|
82
|
+
Watobo::HTTPSocket.read_body(socket, :max_bytes => clen){ |d|
|
83
|
+
rest += d
|
84
|
+
}
|
85
|
+
|
86
|
+
if $DEBUG
|
87
|
+
puts "--- T1 RESPONSE BODY ---"
|
88
|
+
puts rest
|
89
|
+
puts "---"
|
90
|
+
end
|
91
|
+
t2 = Watobo::NTLM::Message.decode64(ntlm_challenge)
|
92
|
+
t3 = t2.response({:user => ntlm_credentials[:username],
|
93
|
+
:password => ntlm_credentials[:password],
|
94
|
+
:domain => ntlm_credentials[:domain]},
|
95
|
+
{:workstation => ntlm_credentials[:workstation], :ntlmv2 => true})
|
96
|
+
|
97
|
+
# puts "* NTLM-Credentials: #{ntlm_credentials[:username]},#{ntlm_credentials[:password]}, #{ntlm_credentials[:domain]}, #{ntlm_credentials[:workstation]}"
|
98
|
+
auth_request.removeHeader("Authorization")
|
99
|
+
auth_request.removeHeader("Connection")
|
100
|
+
|
101
|
+
# auth_request.addHeader("Connection", "Close")
|
102
|
+
|
103
|
+
msg = "NTLM " + t3.encode64
|
104
|
+
auth_request.addHeader("Authorization", msg)
|
105
|
+
# puts "============= T3 ======================="
|
106
|
+
|
107
|
+
data = auth_request.join + "\r\n"
|
108
|
+
|
109
|
+
if $DEBUG
|
110
|
+
puts "= NTLM Type 3 ="
|
111
|
+
puts data
|
112
|
+
end
|
113
|
+
@connection.send data
|
114
|
+
|
115
|
+
response_header = []
|
116
|
+
response_header = connection.header
|
117
|
+
response_header.each do |line|
|
118
|
+
|
119
|
+
if line =~ /^HTTP\/\d\.\d (\d+) (.*)/ then
|
120
|
+
rcode = $1.to_i
|
121
|
+
rmsg = $2
|
122
|
+
end
|
123
|
+
break if line.strip.empty?
|
124
|
+
end
|
125
|
+
|
126
|
+
if rcode == 200 # Ok
|
127
|
+
puts "[NTLM] Authentication Successfull" if $DEBUG
|
128
|
+
elsif rcode == 401 # Authentication Required
|
129
|
+
# TODO: authorization didn't work -> do some notification
|
130
|
+
# ...
|
131
|
+
puts "[NTLM] could not authenticate. Bad credentials?"
|
132
|
+
puts ntlm_credentials.to_yaml
|
133
|
+
end
|
134
|
+
|
135
|
+
return socket, Watobo::Response.new(response_header)
|
136
|
+
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
152
140
|
end
|
data/lib/watobo/utils.rb
CHANGED
@@ -1,33 +1,21 @@
|
|
1
|
-
|
1
|
+
#.
|
2
2
|
# utils.rb
|
3
|
-
|
4
|
-
# Copyright
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
# WATOBO is free software; you can redistribute it and/or modify
|
10
|
-
# it under the terms of the GNU General Public License as published by
|
11
|
-
# the Free Software Foundation version 2 of the License.
|
12
|
-
#
|
13
|
-
# WATOBO is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU General Public License
|
19
|
-
# along with WATOBO; if not, write to the Free Software
|
20
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
# .
|
22
|
-
# @private
|
23
|
-
module Watobo#:nodoc: all
|
24
|
-
module Utils
|
25
|
-
utils_path = File.expand_path(File.join(File.dirname(__FILE__), "utils"))
|
26
|
-
#puts "* loading utils #{utils_path}"
|
27
|
-
Dir.glob("#{utils_path}/*.rb").each do |cf|
|
28
|
-
puts "+ #{File.basename(cf)}" if $DEBUG
|
29
|
-
require File.join("watobo","utils", File.basename(cf))
|
3
|
+
#.
|
4
|
+
# Copyright 2014 by siberas, http://www.siberas.de
|
5
|
+
# This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
|
6
|
+
# WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
|
7
|
+
# WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
8
|
+
# You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
30
9
|
|
31
|
-
|
32
|
-
|
10
|
+
# @private
|
11
|
+
module Watobo#:nodoc: all
|
12
|
+
module Utils
|
13
|
+
utils_path = File.expand_path(File.join(File.dirname(__FILE__), "utils"))
|
14
|
+
#puts "* loading utils #{utils_path}"
|
15
|
+
Dir.glob("#{utils_path}/*.rb").each do |cf|
|
16
|
+
puts "+ #{File.basename(cf)}" if $DEBUG
|
17
|
+
require File.join("watobo","utils", File.basename(cf))
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
33
21
|
end
|
@@ -1,24 +1,12 @@
|
|
1
|
-
|
1
|
+
#.
|
2
2
|
# check_regex.rb
|
3
|
-
|
4
|
-
# Copyright
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
|
10
|
-
# it under the terms of the GNU General Public License as published by
|
11
|
-
# the Free Software Foundation version 2 of the License.
|
12
|
-
#
|
13
|
-
# WATOBO is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU General Public License
|
19
|
-
# along with WATOBO; if not, write to the Free Software
|
20
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
# .
|
3
|
+
#.
|
4
|
+
# Copyright 2014 by siberas, http://www.siberas.de
|
5
|
+
# This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
|
6
|
+
# WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
|
7
|
+
# WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
8
|
+
# You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
9
|
+
|
22
10
|
# @private
|
23
11
|
module Watobo#:nodoc: all
|
24
12
|
module Utils
|
@@ -1,24 +1,12 @@
|
|
1
|
-
|
1
|
+
#.
|
2
2
|
# copy_object.rb
|
3
|
-
|
4
|
-
# Copyright
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
|
10
|
-
# it under the terms of the GNU General Public License as published by
|
11
|
-
# the Free Software Foundation version 2 of the License.
|
12
|
-
#
|
13
|
-
# WATOBO is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU General Public License
|
19
|
-
# along with WATOBO; if not, write to the Free Software
|
20
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
21
|
-
# .
|
3
|
+
#.
|
4
|
+
# Copyright 2014 by siberas, http://www.siberas.de
|
5
|
+
# This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
|
6
|
+
# WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
|
7
|
+
# WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
8
|
+
# You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
9
|
+
|
22
10
|
# @private
|
23
11
|
module Watobo#:nodoc: all
|
24
12
|
module Utils
|