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,35 +1,23 @@
|
|
1
|
-
|
1
|
+
#.
|
2
2
|
# print_debug.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
|
-
module Watobo#:nodoc: all
|
24
|
-
def self.print_debug(*m)
|
25
|
-
fl = m.shift
|
26
|
-
puts "#"
|
27
|
-
puts "# #{fl} #"
|
28
|
-
if m.length > 0
|
29
|
-
m.each do |l|
|
30
|
-
puts l
|
31
|
-
end
|
32
|
-
puts "# " + "-"*fl.length + " #"
|
33
|
-
end
|
34
|
-
end
|
11
|
+
module Watobo#:nodoc: all
|
12
|
+
def self.print_debug(*m)
|
13
|
+
fl = m.shift
|
14
|
+
puts "#"
|
15
|
+
puts "# #{fl} #"
|
16
|
+
if m.length > 0
|
17
|
+
m.each do |l|
|
18
|
+
puts l
|
19
|
+
end
|
20
|
+
puts "# " + "-"*fl.length + " #"
|
21
|
+
end
|
22
|
+
end
|
35
23
|
end
|
@@ -1,113 +1,101 @@
|
|
1
|
-
|
1
|
+
#.
|
2
2
|
# response_builder.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
|
-
def self.string2response( text, opts = {} )
|
26
|
-
options = { :update_content_length => false }
|
27
|
-
options.update opts
|
28
|
-
begin
|
29
|
-
hb_sep = "\r\n\r\n"
|
30
|
-
eoh = text.index(hb_sep)
|
31
|
-
if eoh.nil?
|
32
|
-
hb_sep = "\n\n"
|
33
|
-
eoh = text.index(hb_sep)
|
34
|
-
end
|
35
|
-
unless eoh.nil?
|
36
|
-
raw_header = text[0..eoh-1]
|
37
|
-
raw_body = text[eoh+hb_sep.length..-1]
|
38
|
-
puts ">> RawBody: #{raw_body}"
|
39
|
-
else
|
40
|
-
raw_header = text
|
41
|
-
raw_body = nil
|
42
|
-
end
|
43
|
-
|
44
|
-
response = raw_header.split("\n")
|
45
|
-
response.map!{|r| "#{r.strip}\r\n" }
|
46
|
-
# Watobo::Response.create response
|
47
|
-
unless raw_body.nil?
|
48
|
-
response << "\r\n"
|
49
|
-
response << raw_body unless raw_body.strip.empty?
|
50
|
-
end
|
51
|
-
#return response
|
52
|
-
return Watobo::Response.new(response)
|
53
|
-
|
54
|
-
rescue => bang
|
55
|
-
puts bang
|
56
|
-
puts bang.backtrace
|
57
|
-
end
|
58
|
-
return nil
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
if $0 == __FILE__
|
64
|
-
inc_path = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
|
65
|
-
$: << inc_path
|
66
|
-
|
67
|
-
require 'watobo'
|
68
|
-
|
69
|
-
text =<<'EOF'
|
70
|
-
HTTP/1.1 200 OK
|
71
|
-
Content-Type: text/html
|
72
|
-
Vary: Accept-Encoding
|
73
|
-
Expires: Thu, 19 Jul 2012 06:57:20 GMT
|
74
|
-
Cache-Control: max-age=0, no-cache, no-store
|
75
|
-
Pragma: no-cache
|
76
|
-
Date: Thu, 19 Jul 2012 06:57:20 GMT
|
77
|
-
Content-Length: 203
|
78
|
-
Connection: close
|
79
|
-
|
80
|
-
<html></html>
|
81
|
-
EOF
|
82
|
-
|
83
|
-
text2 ="HTTP/1.1 200 OK\r\n" +
|
84
|
-
"Content-Type: text/html\r\n" +
|
85
|
-
"Vary: Accept-Encoding\r\n" +
|
86
|
-
"Expires: Thu, 19 Jul 2012 06:57:20 GMT\r\n" +
|
87
|
-
"Cache-Control: max-age=0, no-cache, no-store\r\n" +
|
88
|
-
"Pragma: no-cache\r\n" +
|
89
|
-
"Date: Thu, 19 Jul 2012 06:57:20 GMT\r\n" +
|
90
|
-
"Content-Length: 203\r\n" +
|
91
|
-
"Connection: close\r\n\r\n" +
|
92
|
-
"<html></html>\r\n"
|
93
|
-
|
94
|
-
unless ARGV[0].nil?
|
95
|
-
if File.exist? ARGV[0]
|
96
|
-
text = File.open(ARGV[0],"rb").read
|
97
|
-
end
|
98
|
-
end
|
99
|
-
r = Watobo::Utils.string2response text
|
100
|
-
puts r.class
|
101
|
-
puts r.status
|
102
|
-
puts r.content_type
|
103
|
-
puts r
|
104
|
-
puts
|
105
|
-
puts "="
|
106
|
-
puts
|
107
|
-
r = Watobo::Utils.string2response text2
|
108
|
-
puts r.class
|
109
|
-
puts r.status
|
110
|
-
puts r.content_type
|
111
|
-
puts r
|
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
|
112
9
|
|
10
|
+
# @private
|
11
|
+
module Watobo#:nodoc: all
|
12
|
+
module Utils
|
13
|
+
def self.string2response( text, opts = {} )
|
14
|
+
options = { :update_content_length => false }
|
15
|
+
options.update opts
|
16
|
+
begin
|
17
|
+
hb_sep = "\r\n\r\n"
|
18
|
+
eoh = text.index(hb_sep)
|
19
|
+
if eoh.nil?
|
20
|
+
hb_sep = "\n\n"
|
21
|
+
eoh = text.index(hb_sep)
|
22
|
+
end
|
23
|
+
unless eoh.nil?
|
24
|
+
raw_header = text[0..eoh-1]
|
25
|
+
raw_body = text[eoh+hb_sep.length..-1]
|
26
|
+
puts ">> RawBody: #{raw_body}"
|
27
|
+
else
|
28
|
+
raw_header = text
|
29
|
+
raw_body = nil
|
30
|
+
end
|
31
|
+
|
32
|
+
response = raw_header.split("\n")
|
33
|
+
response.map!{|r| "#{r.strip}\r\n" }
|
34
|
+
# Watobo::Response.create response
|
35
|
+
unless raw_body.nil?
|
36
|
+
response << "\r\n"
|
37
|
+
response << raw_body unless raw_body.strip.empty?
|
38
|
+
end
|
39
|
+
#return response
|
40
|
+
return Watobo::Response.new(response)
|
41
|
+
|
42
|
+
rescue => bang
|
43
|
+
puts bang
|
44
|
+
puts bang.backtrace
|
45
|
+
end
|
46
|
+
return nil
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
if $0 == __FILE__
|
52
|
+
inc_path = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
|
53
|
+
$: << inc_path
|
54
|
+
|
55
|
+
require 'watobo'
|
56
|
+
|
57
|
+
text =<<'EOF'
|
58
|
+
HTTP/1.1 200 OK
|
59
|
+
Content-Type: text/html
|
60
|
+
Vary: Accept-Encoding
|
61
|
+
Expires: Thu, 19 Jul 2012 06:57:20 GMT
|
62
|
+
Cache-Control: max-age=0, no-cache, no-store
|
63
|
+
Pragma: no-cache
|
64
|
+
Date: Thu, 19 Jul 2012 06:57:20 GMT
|
65
|
+
Content-Length: 203
|
66
|
+
Connection: close
|
67
|
+
|
68
|
+
<html></html>
|
69
|
+
EOF
|
70
|
+
|
71
|
+
text2 ="HTTP/1.1 200 OK\r\n" +
|
72
|
+
"Content-Type: text/html\r\n" +
|
73
|
+
"Vary: Accept-Encoding\r\n" +
|
74
|
+
"Expires: Thu, 19 Jul 2012 06:57:20 GMT\r\n" +
|
75
|
+
"Cache-Control: max-age=0, no-cache, no-store\r\n" +
|
76
|
+
"Pragma: no-cache\r\n" +
|
77
|
+
"Date: Thu, 19 Jul 2012 06:57:20 GMT\r\n" +
|
78
|
+
"Content-Length: 203\r\n" +
|
79
|
+
"Connection: close\r\n\r\n" +
|
80
|
+
"<html></html>\r\n"
|
81
|
+
|
82
|
+
unless ARGV[0].nil?
|
83
|
+
if File.exist? ARGV[0]
|
84
|
+
text = File.open(ARGV[0],"rb").read
|
85
|
+
end
|
86
|
+
end
|
87
|
+
r = Watobo::Utils.string2response text
|
88
|
+
puts r.class
|
89
|
+
puts r.status
|
90
|
+
puts r.content_type
|
91
|
+
puts r
|
92
|
+
puts
|
93
|
+
puts "="
|
94
|
+
puts
|
95
|
+
r = Watobo::Utils.string2response text2
|
96
|
+
puts r.class
|
97
|
+
puts r.status
|
98
|
+
puts r.content_type
|
99
|
+
puts r
|
100
|
+
|
113
101
|
end
|
@@ -1,24 +1,12 @@
|
|
1
|
-
|
1
|
+
#.
|
2
2
|
# response_hash.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
|
require 'digest/md5'
|
23
11
|
|
24
12
|
# @private
|
@@ -145,6 +133,7 @@ module Watobo#:nodoc: all
|
|
145
133
|
Watobo::Response.create response
|
146
134
|
end
|
147
135
|
response.removeHeader("Date")
|
136
|
+
response.removeHeader("Set-Cookie")
|
148
137
|
return response, Digest::MD5.hexdigest(response.join)
|
149
138
|
end
|
150
139
|
rescue => bang
|
@@ -1,24 +1,12 @@
|
|
1
|
-
|
1
|
+
#.
|
2
2
|
# secure_eval.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
|
@@ -27,8 +15,8 @@ module Watobo#:nodoc: all
|
|
27
15
|
result = nil
|
28
16
|
t = Thread.new(exp) { |e|
|
29
17
|
e.untaint
|
30
|
-
|
31
|
-
|
18
|
+
$SAFE = 3
|
19
|
+
# $SAFE = 4 # no longer supported since ruby 2.1.x
|
32
20
|
begin
|
33
21
|
|
34
22
|
result = eval(e)
|
data/lib/watobo/utils/strings.rb
CHANGED
@@ -1,33 +1,21 @@
|
|
1
|
-
|
1
|
+
#.
|
2
2
|
# strings.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
|
-
module Watobo#:nodoc: all
|
24
|
-
module Utils
|
25
|
-
def self.camelcase(string)
|
26
|
-
string.strip.gsub(/[^[a-zA-Z\-_]]/,"").gsub( "-" , "_").split("_").map{ |s| s.downcase.capitalize }.join
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.snakecase(string)
|
30
|
-
string.gsub(/([A-Z])([A-Z][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z])/, '\1_\2').tr("-","_").downcase
|
31
|
-
end
|
32
|
-
end
|
11
|
+
module Watobo#:nodoc: all
|
12
|
+
module Utils
|
13
|
+
def self.camelcase(string)
|
14
|
+
string.strip.gsub(/[^[a-zA-Z\-_]]/,"").gsub( "-" , "_").split("_").map{ |s| s.downcase.capitalize }.join
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.snakecase(string)
|
18
|
+
string.gsub(/([A-Z])([A-Z][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z])/, '\1_\2').tr("-","_").downcase
|
19
|
+
end
|
20
|
+
end
|
33
21
|
end
|
@@ -1,29 +1,21 @@
|
|
1
|
-
|
1
|
+
#.
|
2
2
|
# text2request.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
|
25
13
|
def Utils.text2request(text)
|
26
14
|
result = []
|
15
|
+
return result if text.strip.empty?
|
16
|
+
# UTF-8 CleanUp
|
17
|
+
text = text.unpack("C*").pack("C*")
|
18
|
+
|
27
19
|
if text =~ /\n\n/
|
28
20
|
dummy = text.split(/\n\n/)
|
29
21
|
header = dummy.shift.split(/\n/)
|