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
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,107 @@
|
|
1
|
+
Version 0.9.20
|
2
|
+
===
|
3
|
+
|
4
|
+
News
|
5
|
+
---
|
6
|
+
|
7
|
+
**Export**
|
8
|
+
|
9
|
+
* added an XML export function available via File->Export
|
10
|
+
|
11
|
+
**SitesTree**
|
12
|
+
|
13
|
+
* added findings to sites tree view
|
14
|
+
|
15
|
+
**Platform**
|
16
|
+
|
17
|
+
* watobo is running under Ruby 2.0 (2.1 not tested yet)
|
18
|
+
|
19
|
+
**ForwardingProxy**
|
20
|
+
|
21
|
+
* introduced per-site proxying
|
22
|
+
|
23
|
+
**ActiveChecks**
|
24
|
+
|
25
|
+
* added ShellShock module (Generic->ShellShock)
|
26
|
+
* added Apache MultiViews module
|
27
|
+
|
28
|
+
**Interceptor**
|
29
|
+
|
30
|
+
* added TableEditor to request
|
31
|
+
|
32
|
+
**TableEditor**
|
33
|
+
|
34
|
+
* added new menu item "to clipboard" which exports the table fields as a CSV (comma seperated values) to the clipboard
|
35
|
+
* column width does not change after refresh
|
36
|
+
|
37
|
+
**SSL-Checker**
|
38
|
+
|
39
|
+
* optimized ssl checks - but keep in mihd number of checked ciphers depends on installed ruby version :/
|
40
|
+
|
41
|
+
Fixes
|
42
|
+
---
|
43
|
+
|
44
|
+
** General **
|
45
|
+
|
46
|
+
* post parameter values containing equal signs ('=') will no longer be truncated
|
47
|
+
|
48
|
+
**Transcoder**
|
49
|
+
|
50
|
+
* now LineFeeds will not be replaced in text-view
|
51
|
+
|
52
|
+
**HexViewer**
|
53
|
+
|
54
|
+
* changed font type to courier
|
55
|
+
* fixed crash on invalid UTF-8 sequences
|
56
|
+
* now works in request viewer
|
57
|
+
* shows header & body
|
58
|
+
|
59
|
+
**ChunkEncoding**
|
60
|
+
|
61
|
+
* fixed handling of chunk encoded data
|
62
|
+
|
63
|
+
**NTLM**
|
64
|
+
|
65
|
+
* fixed ntlm authentication
|
66
|
+
|
67
|
+
**Crawler**
|
68
|
+
|
69
|
+
* Fixed status bar infos
|
70
|
+
|
71
|
+
**CatalogScanner**
|
72
|
+
|
73
|
+
* if match value contains 3 digits it will be treated as response code (reduces false positives)
|
74
|
+
|
75
|
+
**CA**
|
76
|
+
|
77
|
+
* CA serial now starts with current time to avoid serial number conflicts after reinitializing CA
|
78
|
+
|
79
|
+
**Modules**
|
80
|
+
|
81
|
+
* fixed cookie access in passive module 'possible_login'
|
82
|
+
* little fix in xxe module
|
83
|
+
* fixed proof pattern for hidden field detection in hidden_fields.rb
|
84
|
+
|
85
|
+
**Conversation Table**
|
86
|
+
|
87
|
+
* fixed chat filter, now request and response can be filterd together
|
88
|
+
* new chats run through filter before they are added
|
89
|
+
|
90
|
+
**GUI**
|
91
|
+
|
92
|
+
* fixed crash when selecting 'scope only' in sites-tree
|
93
|
+
* fixed transcoder, so all CRLF will be removed before Base64 decoding
|
94
|
+
|
95
|
+
**Interceptor**
|
96
|
+
|
97
|
+
* now removes Expect-100-continue headers from client
|
98
|
+
|
99
|
+
**General**
|
100
|
+
|
101
|
+
* added json support for table editor (only first level paramaters)
|
102
|
+
* fixed redirect mechanism, now also 301 and 308 codes are supported as well as absolut path locations
|
103
|
+
* now post-parameters with empty names will be handled correctly
|
104
|
+
|
1
105
|
Version 0.9.19
|
2
106
|
===
|
3
107
|
|
data/bin/nfq_server.rb
CHANGED
@@ -1,25 +1,13 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
-
|
2
|
+
#.
|
3
3
|
# nfq_server.rb
|
4
|
-
|
5
|
-
# Copyright
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
|
11
|
-
# it under the terms of the GNU General Public License as published by
|
12
|
-
# the Free Software Foundation version 2 of the License.
|
13
|
-
#
|
14
|
-
# WATOBO is distributed in the hope that it will be useful,
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
-
# GNU General Public License for more details.
|
18
|
-
#
|
19
|
-
# You should have received a copy of the GNU General Public License
|
20
|
-
# along with WATOBO; if not, write to the Free Software
|
21
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
22
|
-
# .
|
4
|
+
#.
|
5
|
+
# Copyright 2014 by siberas, http://www.siberas.de
|
6
|
+
# This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
|
7
|
+
# 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.
|
8
|
+
# 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.
|
9
|
+
# 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
|
10
|
+
|
23
11
|
require 'drb'
|
24
12
|
require 'yaml'
|
25
13
|
require 'openssl'
|
data/bin/watobo_gui.rb
CHANGED
@@ -1,25 +1,13 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
-
|
2
|
+
#.
|
3
3
|
# watobo_gui.rb
|
4
|
-
|
5
|
-
# Copyright
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
|
11
|
-
# it under the terms of the GNU General Public License as published by
|
12
|
-
# the Free Software Foundation version 2 of the License.
|
13
|
-
#
|
14
|
-
# WATOBO is distributed in the hope that it will be useful,
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
-
# GNU General Public License for more details.
|
18
|
-
#
|
19
|
-
# You should have received a copy of the GNU General Public License
|
20
|
-
# along with WATOBO; if not, write to the Free Software
|
21
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
22
|
-
# .
|
4
|
+
#.
|
5
|
+
# Copyright 2014 by siberas, http://www.siberas.de
|
6
|
+
# This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
|
7
|
+
# 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.
|
8
|
+
# 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.
|
9
|
+
# 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
|
10
|
+
|
23
11
|
if $0 == __FILE__
|
24
12
|
inc_path = File.expand_path(File.join(File.dirname(__FILE__), "..", "lib")) # this is the same as rubygems would do
|
25
13
|
$: << inc_path
|
data/config/forwarding_proxy.yml
CHANGED
data/lib/watobo.rb
CHANGED
@@ -1,25 +1,13 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
-
|
2
|
+
#.
|
3
3
|
# watobo.rb
|
4
|
-
|
5
|
-
# Copyright
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
|
11
|
-
# it under the terms of the GNU General Public License as published by
|
12
|
-
# the Free Software Foundation version 2 of the License.
|
13
|
-
#
|
14
|
-
# WATOBO is distributed in the hope that it will be useful,
|
15
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17
|
-
# GNU General Public License for more details.
|
18
|
-
#
|
19
|
-
# You should have received a copy of the GNU General Public License
|
20
|
-
# along with WATOBO; if not, write to the Free Software
|
21
|
-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
22
|
-
# .
|
4
|
+
#.
|
5
|
+
# Copyright 2014 by siberas, http://www.siberas.de
|
6
|
+
# This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
|
7
|
+
# 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.
|
8
|
+
# 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.
|
9
|
+
# 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
|
10
|
+
|
23
11
|
#Encoding: UTF-8
|
24
12
|
require 'rubygems'
|
25
13
|
require 'yaml'
|
@@ -36,7 +24,9 @@ require 'base64'
|
|
36
24
|
require 'cgi'
|
37
25
|
require 'uri'
|
38
26
|
require 'pathname'
|
39
|
-
require '
|
27
|
+
#require 'rubyntlm'
|
28
|
+
#require 'net/ntlm'
|
29
|
+
#require 'httpi'
|
40
30
|
require 'drb'
|
41
31
|
require 'nokogiri'
|
42
32
|
require 'stringio'
|
@@ -62,7 +52,7 @@ dont_know_why_REQUIRE_hangs = Mechanize.new
|
|
62
52
|
# @private
|
63
53
|
module Watobo#:nodoc: all #:nodoc: all
|
64
54
|
|
65
|
-
VERSION = "0.9.
|
55
|
+
VERSION = "0.9.20"
|
66
56
|
|
67
57
|
def self.base_directory
|
68
58
|
@base_directory ||= ""
|
data/lib/watobo/adapters.rb
CHANGED
@@ -1,26 +1,14 @@
|
|
1
|
-
|
1
|
+
#.
|
2
2
|
# adapters.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
|
-
%w( data_store session_store ).each do |lib|
|
23
|
-
require "watobo/adapters/#{lib}"
|
24
|
-
end
|
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
|
25
9
|
|
26
|
-
|
10
|
+
%w( data_store session_store ).each do |lib|
|
11
|
+
require "watobo/adapters/#{lib}"
|
12
|
+
end
|
13
|
+
|
14
|
+
require "watobo/adapters/file/file_store"
|
@@ -1,73 +1,83 @@
|
|
1
|
-
|
1
|
+
#.
|
2
2
|
# data_store.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
|
-
class DataStore
|
25
|
-
|
26
|
-
@engine = nil
|
27
|
-
|
28
|
-
def self.engine
|
29
|
-
@engine
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.connect(project_name, session_name)
|
33
|
-
a = Watobo::Conf::Datastore.adapter
|
34
|
-
store = case
|
35
|
-
when 'file'
|
36
|
-
FileSessionStore.new(project_name, session_name)
|
37
|
-
else
|
38
|
-
nil
|
39
|
-
end
|
40
|
-
@engine = store
|
41
|
-
store
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.method_missing(name, *args, &block)
|
45
|
-
super unless @engine.respond_to? name
|
46
|
-
@engine.send name, *args, &block
|
11
|
+
module Watobo#:nodoc: all
|
12
|
+
class DataStore
|
13
|
+
|
14
|
+
@engine = nil
|
15
|
+
|
16
|
+
def self.engine
|
17
|
+
@engine
|
47
18
|
end
|
48
19
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
def self.log(message, prefs={})
|
58
|
-
|
59
|
-
text = message
|
60
|
-
if message.is_a? Array
|
61
|
-
text = message.join("\n| ")
|
62
|
-
end
|
63
|
-
|
64
|
-
#clean up sender's name
|
65
|
-
if prefs.has_key? :sender
|
66
|
-
prefs[:sender].gsub!(/.*::/,'')
|
20
|
+
def self.projects(&block)
|
21
|
+
ps = []
|
22
|
+
Dir.glob("#{Watobo.workspace_path}/*").each do |p|
|
23
|
+
pname = File.basename(p)
|
24
|
+
yield pname if block_given?
|
25
|
+
ps << pname
|
26
|
+
end
|
27
|
+
ps
|
67
28
|
end
|
68
29
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
30
|
+
def self.sessions(project_name, &block)
|
31
|
+
ss = []
|
32
|
+
project_name = project_name.to_s if project_name.is_a? Symbol
|
33
|
+
return ps unless File.exist? "#{Watobo.workspace_path}/#{project_name}"
|
34
|
+
Dir.glob("#{Watobo.workspace_path}/#{project_name}/*").each do |s|
|
35
|
+
sname = File.basename(s)
|
36
|
+
yield sname if block_given?
|
37
|
+
ss << sname
|
38
|
+
end
|
39
|
+
ss
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.connect(project_name, session_name)
|
43
|
+
a = Watobo::Conf::Datastore.adapter
|
44
|
+
store = case
|
45
|
+
when 'file'
|
46
|
+
FileSessionStore.new(project_name, session_name)
|
47
|
+
else
|
48
|
+
nil
|
49
|
+
end
|
50
|
+
@engine = store
|
51
|
+
store
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.method_missing(name, *args, &block)
|
55
|
+
super unless @engine.respond_to? name
|
56
|
+
@engine.send name, *args, &block
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.logs
|
63
|
+
return "" if DataStore.engine.nil?
|
64
|
+
DataStore.engine.logs
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.log(message, prefs={})
|
68
|
+
|
69
|
+
text = message
|
70
|
+
if message.is_a? Array
|
71
|
+
text = message.join("\n| ")
|
72
|
+
end
|
73
|
+
|
74
|
+
#clean up sender's name
|
75
|
+
if prefs.has_key? :sender
|
76
|
+
prefs[:sender].gsub!(/.*::/,'')
|
77
|
+
end
|
78
|
+
|
79
|
+
if DataStore.engine.respond_to? :logger
|
80
|
+
DataStore.engine.logger message, prefs
|
81
|
+
end
|
82
|
+
end
|
73
83
|
end
|
@@ -1,314 +1,302 @@
|
|
1
|
-
|
1
|
+
#.
|
2
2
|
# file_store.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
|
-
class FileSessionStore < SessionStore
|
25
|
-
def num_chats
|
26
|
-
get_file_list(@conversation_path, "*-chat*").length
|
27
|
-
end
|
28
|
-
|
29
|
-
def num_findings
|
30
|
-
get_file_list(@findings_path, "*-finding*").length
|
31
|
-
end
|
32
|
-
|
33
|
-
def add_finding(finding)
|
34
|
-
return false unless finding.respond_to? :request
|
35
|
-
return false unless finding.respond_to? :response
|
36
|
-
|
37
|
-
finding_file = File.join("#{@findings_path}", "#{finding.id}-finding.yml")
|
38
|
-
if not File.exists?(finding_file) then
|
39
|
-
|
40
|
-
finding_data = {
|
41
|
-
:request => finding.request.map{|x| x.inspect},
|
42
|
-
:response => finding.response.map{|x| x.inspect},
|
43
|
-
:details => Hash.new
|
44
|
-
}
|
45
|
-
finding_data[:details].update(finding.details)
|
46
|
-
|
47
|
-
fh = File.new(finding_file, "w+b")
|
48
|
-
fh.print YAML.dump(finding_data)
|
49
|
-
fh.close
|
50
|
-
return true
|
51
|
-
end
|
52
|
-
return false
|
53
|
-
end
|
54
|
-
|
55
|
-
def delete_finding(finding)
|
56
|
-
finding_file = File.join("#{@findings_path}", "#{finding.id}-finding")
|
57
|
-
File.delete finding_file if File.exist? finding_file
|
58
|
-
finding_file << ".yml"
|
59
|
-
File.delete finding_file if File.exist? finding_file
|
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
|
60
9
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
10
|
+
# @private
|
11
|
+
module Watobo#:nodoc: all
|
12
|
+
class FileSessionStore < SessionStore
|
13
|
+
def num_chats
|
14
|
+
get_file_list(@conversation_path, "*-chat*").length
|
15
|
+
end
|
16
|
+
|
17
|
+
def num_findings
|
18
|
+
get_file_list(@findings_path, "*-finding*").length
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_finding(finding)
|
22
|
+
return false unless finding.respond_to? :request
|
23
|
+
return false unless finding.respond_to? :response
|
24
|
+
|
25
|
+
finding_file = File.join("#{@findings_path}", "#{finding.id}-finding.yml")
|
26
|
+
if not File.exists?(finding_file) then
|
27
|
+
|
28
|
+
finding_data = {
|
29
|
+
:request => finding.request.map{|x| x.inspect},
|
30
|
+
:response => finding.response.map{|x| x.inspect},
|
31
|
+
:details => Hash.new
|
32
|
+
}
|
33
|
+
finding_data[:details].update(finding.details)
|
34
|
+
|
35
|
+
fh = File.new(finding_file, "w+b")
|
36
|
+
fh.print YAML.dump(finding_data)
|
37
|
+
fh.close
|
38
|
+
return true
|
39
|
+
end
|
40
|
+
return false
|
41
|
+
end
|
42
|
+
|
43
|
+
def delete_finding(finding)
|
44
|
+
finding_file = File.join("#{@findings_path}", "#{finding.id}-finding")
|
45
|
+
File.delete finding_file if File.exist? finding_file
|
46
|
+
finding_file << ".yml"
|
47
|
+
File.delete finding_file if File.exist? finding_file
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
def update_finding(finding)
|
52
|
+
finding_file = File.join("#{@findings_path}", "#{finding.id}-finding.yml")
|
53
|
+
finding_data = {
|
54
|
+
:request => finding.request.map{|x| x.inspect},
|
55
|
+
:response => finding.response.map{|x| x.inspect},
|
56
|
+
:details => Hash.new
|
57
|
+
}
|
58
|
+
finding_data[:details].update(finding.details)
|
59
|
+
|
60
|
+
if File.exists?(finding_file) then
|
61
|
+
fh = File.new(finding_file, "w+b")
|
62
|
+
fh.print YAML.dump(finding_data)
|
63
|
+
fh.close
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
# add_scan_log
|
69
|
+
# adds a chat to a specific log store, e.g. if you want to log scan results.
|
70
|
+
# needs a scan_name (STRING) as its destination which will be created
|
71
|
+
# if the scan name does not exist.
|
72
|
+
def add_scan_log(chat, scan_name = nil)
|
73
|
+
return false unless chat.respond_to? :request
|
74
|
+
return false unless chat.respond_to? :response
|
87
75
|
begin
|
88
|
-
|
76
|
+
|
89
77
|
return false if scan_name.nil?
|
90
78
|
return false if scan_name.empty?
|
91
79
|
|
92
|
-
scan_name_clean = scan_name.gsub(/[:\\\/\.]*/,"_")
|
93
|
-
# puts ">> scan_name"
|
94
|
-
path = File.join(@scanlog_path, scan_name_clean)
|
95
|
-
|
96
|
-
Dir.mkdir path unless File.exist? path
|
97
|
-
|
98
|
-
log_file = File.join( path, "log_" + Time.now.to_f.to_s + ".yml")
|
99
|
-
|
100
|
-
chat_data = {
|
101
|
-
:request => chat.request.map{|x| x.inspect},
|
102
|
-
:response => chat.response.map{|x| x.inspect},
|
103
|
-
}
|
104
|
-
# puts log_file
|
105
|
-
chat_data.update(chat.settings)
|
106
|
-
File.open(log_file, "w") { |fh|
|
107
|
-
YAML.dump(chat_data, fh)
|
108
|
-
}
|
109
|
-
return true
|
110
|
-
rescue => bang
|
111
|
-
puts bang
|
112
|
-
puts bang.backtrace if $DEBUG
|
113
|
-
end
|
114
|
-
return false
|
115
|
-
end
|
116
|
-
|
117
|
-
def add_chat(chat)
|
118
|
-
return false unless chat_valid? chat
|
119
|
-
chat_file = File.join("#{@conversation_path}", "#{chat.id}-chat.yml")
|
120
|
-
chat_data = {
|
121
|
-
:request => chat.request.map{|x| x.inspect},
|
122
|
-
:response => chat.response.map{|x| x.inspect},
|
123
|
-
}
|
124
|
-
|
125
|
-
chat_data.update(chat.settings)
|
126
|
-
if not File.exists?(chat_file) then
|
127
|
-
File.open(chat_file, "w") { |fh|
|
128
|
-
YAML.dump(chat_data, fh)
|
129
|
-
}
|
130
|
-
chat.file = chat_file
|
131
|
-
return true
|
132
|
-
end
|
133
|
-
return false
|
134
|
-
end
|
135
|
-
|
136
|
-
def each_chat(&block)
|
137
|
-
get_file_list(@conversation_path, "*-chat*").each do |fname|
|
138
|
-
chat = Watobo::Utils.loadChatYAML(fname)
|
139
|
-
next unless chat
|
140
|
-
yield chat if block_given?
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
def each_finding(&block)
|
145
|
-
get_file_list(@findings_path, "*-finding*").each do |fname|
|
146
|
-
f = Watobo::Utils.loadFindingYAML(fname)
|
147
|
-
next unless f
|
148
|
-
yield f if block_given?
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
def initialize(project_name, session_name)
|
153
|
-
|
154
|
-
wsp = Watobo.workspace_path
|
155
|
-
return false unless File.exist? wsp
|
156
|
-
puts "* using workspace path: #{wsp}" if $DEBUG
|
157
|
-
|
158
|
-
@log_file = nil
|
159
|
-
@log_lock = Mutex.new
|
160
|
-
|
161
|
-
@project_path = File.join(wsp, project_name)
|
162
|
-
unless File.exist? @project_path
|
163
|
-
puts "* create project path: #{@project_path}" if $DEBUG
|
164
|
-
Dir.mkdir(@project_path)
|
165
|
-
end
|
166
|
-
|
167
|
-
@project_config_path = File.join(@project_path, ".config")
|
168
|
-
Dir.mkdir @project_config_path unless File.exist? @project_config_path
|
169
|
-
|
170
|
-
@session_path = File.join(@project_path, session_name)
|
171
|
-
|
172
|
-
unless File.exist? @session_path
|
173
|
-
puts "* create session path: #{@session_path}" if $DEBUG
|
174
|
-
Dir.mkdir(@session_path)
|
175
|
-
end
|
176
|
-
|
177
|
-
@session_config_path = File.join(@session_path, ".config")
|
178
|
-
Dir.mkdir @session_config_path unless File.exist? @session_config_path
|
179
|
-
|
180
|
-
sext = Watobo::Conf::General.session_settings_file_ext
|
181
|
-
|
182
|
-
@session_file = File.join(@session_path, session_name + sext)
|
183
|
-
@project_file = File.join(@project_path, project_name + Watobo::Conf::General.project_settings_file_ext)
|
184
|
-
|
185
|
-
@conversation_path = File.expand_path(File.join(@session_path, Watobo::Conf::Datastore.conversations))
|
186
|
-
|
187
|
-
@findings_path = File.expand_path(File.join(@session_path, Watobo::Conf::Datastore.findings))
|
188
|
-
@log_path = File.expand_path(File.join(@session_path, Watobo::Conf::Datastore.event_logs_dir))
|
189
|
-
@scanlog_path = File.expand_path(File.join(@session_path, Watobo::Conf::Datastore.scan_logs_dir))
|
190
|
-
|
191
|
-
[ @conversation_path, @findings_path, @log_path, @scanlog_path ].each do |folder|
|
192
|
-
if not File.exists?(folder) then
|
193
|
-
puts "create path #{folder}"
|
194
|
-
begin
|
195
|
-
Dir.mkdir(folder)
|
196
|
-
rescue SystemCallError => bang
|
197
|
-
puts "!!!ERROR:"
|
198
|
-
puts bang
|
199
|
-
rescue => bang
|
200
|
-
puts "!!!ERROR:"
|
201
|
-
puts bang
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
@log_file = File.join(@log_path, session_name + ".log")
|
207
|
-
|
208
|
-
# @chat_files = get_file_list(@conversation_path, "*-chat")
|
209
|
-
# @finding_files = get_file_list(@findings_path, "*-finding")
|
210
|
-
end
|
211
|
-
|
212
|
-
def save_session_settings(group, session_settings)
|
213
|
-
# puts ">> save_session_settings <<"
|
214
|
-
file = Watobo::Utils.snakecase group.gsub(/\.yml/,'')
|
215
|
-
file << ".yml"
|
216
|
-
|
217
|
-
session_file = File.join(@session_config_path, file)
|
218
|
-
# puts "Dest.File: #{session_file}"
|
219
|
-
# puts session_settings.to_yaml
|
220
|
-
# puts "---"
|
221
|
-
Watobo::Utils.save_settings(session_file, session_settings)
|
222
|
-
end
|
223
|
-
|
224
|
-
def load_session_settings(group)
|
225
|
-
# puts ">> load_session_settings : #{group}"
|
226
|
-
file = Watobo::Utils.snakecase group.gsub(/\.yml/,'')
|
227
|
-
file << ".yml"
|
228
|
-
|
229
|
-
session_file = File.join(@session_config_path, file)
|
230
|
-
# puts "File: #{session_file}"
|
231
|
-
# puts "---"
|
232
|
-
|
233
|
-
s = Watobo::Utils.load_settings(session_file)
|
234
|
-
s
|
235
|
-
end
|
236
|
-
|
237
|
-
def save_project_settings(group, project_settings)
|
238
|
-
# puts ">> save_project_settings : #{group}"
|
239
|
-
file = Watobo::Utils.snakecase group.gsub(/\.yml/,'')
|
240
|
-
file << ".yml"
|
241
|
-
|
242
|
-
project_file = File.join(@project_config_path, file)
|
243
|
-
# puts "Dest.File: #{project_file}"
|
244
|
-
# puts project_settings.to_yaml
|
245
|
-
# puts "---"
|
246
|
-
Watobo::Utils.save_settings(project_file, project_settings)
|
247
|
-
|
248
|
-
end
|
249
|
-
|
250
|
-
def load_project_settings(group)
|
251
|
-
# puts ">> load_project_settings : #{group}"
|
252
|
-
file = Watobo::Utils.snakecase group.gsub(/\.yml/,'')
|
253
|
-
file << ".yml"
|
254
|
-
|
255
|
-
project_file = File.join(@project_config_path, file)
|
256
|
-
# puts "File: #{project_file}"
|
257
|
-
# puts "---"
|
258
|
-
|
259
|
-
s = Watobo::Utils.load_settings(project_file)
|
260
|
-
s
|
261
|
-
|
262
|
-
end
|
263
|
-
|
264
|
-
def logs
|
265
|
-
l = ''
|
266
|
-
@log_lock.synchronize do
|
267
|
-
l = File.open(@log_file).read
|
268
|
-
end
|
269
|
-
l
|
270
|
-
end
|
271
|
-
|
272
|
-
def logger( message, prefs = {} )
|
273
|
-
opts = { :sender => "unknown", :level => Watobo::Constants::LOG_INFO }
|
274
|
-
opts.update prefs
|
275
|
-
return false if @log_file.nil?
|
276
|
-
begin
|
277
|
-
t = Time.now
|
278
|
-
now = t.strftime("%m/%d/%Y @ %H:%M:%S")
|
279
|
-
log_message = [ now ]
|
280
|
-
log_message << "#{opts[:sender]}"
|
281
|
-
if message.is_a? Array
|
282
|
-
log_message << message.join("\n| ")
|
283
|
-
log_message << "\n-"
|
284
|
-
else
|
285
|
-
log_message << message
|
286
|
-
end
|
287
|
-
@log_lock.synchronize do
|
288
|
-
File.open(@log_file,"a") do |lfh|
|
289
|
-
lfh.puts log_message.join("|")
|
290
|
-
end
|
291
|
-
end
|
292
|
-
rescue => bang
|
293
|
-
puts bang
|
294
|
-
end
|
295
|
-
|
296
|
-
end
|
297
|
-
|
298
|
-
private
|
299
|
-
|
300
|
-
def chat_valid?(chat)
|
301
|
-
return false unless chat.respond_to? :request
|
302
|
-
return false unless chat.respond_to? :response
|
303
|
-
true
|
304
|
-
end
|
305
|
-
|
306
|
-
def get_file_list(path, pattern)
|
307
|
-
fl = Dir["#{path}/#{pattern}"].sort_by{ |x| File.basename(x).sub(/[^0-9]*/,'').to_i }
|
308
|
-
#puts fl.length
|
309
|
-
fl
|
310
|
-
end
|
311
|
-
|
312
|
-
end
|
313
|
-
|
80
|
+
scan_name_clean = scan_name.gsub(/[:\\\/\.]*/,"_")
|
81
|
+
# puts ">> scan_name"
|
82
|
+
path = File.join(@scanlog_path, scan_name_clean)
|
83
|
+
|
84
|
+
Dir.mkdir path unless File.exist? path
|
85
|
+
|
86
|
+
log_file = File.join( path, "log_" + Time.now.to_f.to_s + ".yml")
|
87
|
+
|
88
|
+
chat_data = {
|
89
|
+
:request => chat.request.map{|x| x.inspect},
|
90
|
+
:response => chat.response.map{|x| x.inspect},
|
91
|
+
}
|
92
|
+
# puts log_file
|
93
|
+
chat_data.update(chat.settings)
|
94
|
+
File.open(log_file, "w") { |fh|
|
95
|
+
YAML.dump(chat_data, fh)
|
96
|
+
}
|
97
|
+
return true
|
98
|
+
rescue => bang
|
99
|
+
puts bang
|
100
|
+
puts bang.backtrace if $DEBUG
|
101
|
+
end
|
102
|
+
return false
|
103
|
+
end
|
104
|
+
|
105
|
+
def add_chat(chat)
|
106
|
+
return false unless chat_valid? chat
|
107
|
+
chat_file = File.join("#{@conversation_path}", "#{chat.id}-chat.yml")
|
108
|
+
chat_data = {
|
109
|
+
:request => chat.request.map{|x| x.inspect},
|
110
|
+
:response => chat.response.map{|x| x.inspect},
|
111
|
+
}
|
112
|
+
|
113
|
+
chat_data.update(chat.settings)
|
114
|
+
if not File.exists?(chat_file) then
|
115
|
+
File.open(chat_file, "w") { |fh|
|
116
|
+
YAML.dump(chat_data, fh)
|
117
|
+
}
|
118
|
+
chat.file = chat_file
|
119
|
+
return true
|
120
|
+
end
|
121
|
+
return false
|
122
|
+
end
|
123
|
+
|
124
|
+
def each_chat(&block)
|
125
|
+
get_file_list(@conversation_path, "*-chat*").each do |fname|
|
126
|
+
chat = Watobo::Utils.loadChatYAML(fname)
|
127
|
+
next unless chat
|
128
|
+
yield chat if block_given?
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def each_finding(&block)
|
133
|
+
get_file_list(@findings_path, "*-finding*").each do |fname|
|
134
|
+
f = Watobo::Utils.loadFindingYAML(fname)
|
135
|
+
next unless f
|
136
|
+
yield f if block_given?
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
def initialize(project_name, session_name)
|
141
|
+
|
142
|
+
wsp = Watobo.workspace_path
|
143
|
+
return false unless File.exist? wsp
|
144
|
+
puts "* using workspace path: #{wsp}" if $DEBUG
|
145
|
+
|
146
|
+
@log_file = nil
|
147
|
+
@log_lock = Mutex.new
|
148
|
+
|
149
|
+
@project_path = File.join(wsp, project_name)
|
150
|
+
unless File.exist? @project_path
|
151
|
+
puts "* create project path: #{@project_path}" if $DEBUG
|
152
|
+
Dir.mkdir(@project_path)
|
153
|
+
end
|
154
|
+
|
155
|
+
@project_config_path = File.join(@project_path, ".config")
|
156
|
+
Dir.mkdir @project_config_path unless File.exist? @project_config_path
|
157
|
+
|
158
|
+
@session_path = File.join(@project_path, session_name)
|
159
|
+
|
160
|
+
unless File.exist? @session_path
|
161
|
+
puts "* create session path: #{@session_path}" if $DEBUG
|
162
|
+
Dir.mkdir(@session_path)
|
163
|
+
end
|
164
|
+
|
165
|
+
@session_config_path = File.join(@session_path, ".config")
|
166
|
+
Dir.mkdir @session_config_path unless File.exist? @session_config_path
|
167
|
+
|
168
|
+
sext = Watobo::Conf::General.session_settings_file_ext
|
169
|
+
|
170
|
+
@session_file = File.join(@session_path, session_name + sext)
|
171
|
+
@project_file = File.join(@project_path, project_name + Watobo::Conf::General.project_settings_file_ext)
|
172
|
+
|
173
|
+
@conversation_path = File.expand_path(File.join(@session_path, Watobo::Conf::Datastore.conversations))
|
174
|
+
|
175
|
+
@findings_path = File.expand_path(File.join(@session_path, Watobo::Conf::Datastore.findings))
|
176
|
+
@log_path = File.expand_path(File.join(@session_path, Watobo::Conf::Datastore.event_logs_dir))
|
177
|
+
@scanlog_path = File.expand_path(File.join(@session_path, Watobo::Conf::Datastore.scan_logs_dir))
|
178
|
+
|
179
|
+
[ @conversation_path, @findings_path, @log_path, @scanlog_path ].each do |folder|
|
180
|
+
if not File.exists?(folder) then
|
181
|
+
puts "create path #{folder}"
|
182
|
+
begin
|
183
|
+
Dir.mkdir(folder)
|
184
|
+
rescue SystemCallError => bang
|
185
|
+
puts "!!!ERROR:"
|
186
|
+
puts bang
|
187
|
+
rescue => bang
|
188
|
+
puts "!!!ERROR:"
|
189
|
+
puts bang
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
@log_file = File.join(@log_path, session_name + ".log")
|
195
|
+
|
196
|
+
# @chat_files = get_file_list(@conversation_path, "*-chat")
|
197
|
+
# @finding_files = get_file_list(@findings_path, "*-finding")
|
198
|
+
end
|
199
|
+
|
200
|
+
def save_session_settings(group, session_settings)
|
201
|
+
# puts ">> save_session_settings <<"
|
202
|
+
file = Watobo::Utils.snakecase group.gsub(/\.yml/,'')
|
203
|
+
file << ".yml"
|
204
|
+
|
205
|
+
session_file = File.join(@session_config_path, file)
|
206
|
+
# puts "Dest.File: #{session_file}"
|
207
|
+
# puts session_settings.to_yaml
|
208
|
+
# puts "---"
|
209
|
+
Watobo::Utils.save_settings(session_file, session_settings)
|
210
|
+
end
|
211
|
+
|
212
|
+
def load_session_settings(group)
|
213
|
+
# puts ">> load_session_settings : #{group}"
|
214
|
+
file = Watobo::Utils.snakecase group.gsub(/\.yml/,'')
|
215
|
+
file << ".yml"
|
216
|
+
|
217
|
+
session_file = File.join(@session_config_path, file)
|
218
|
+
# puts "File: #{session_file}"
|
219
|
+
# puts "---"
|
220
|
+
|
221
|
+
s = Watobo::Utils.load_settings(session_file)
|
222
|
+
s
|
223
|
+
end
|
224
|
+
|
225
|
+
def save_project_settings(group, project_settings)
|
226
|
+
# puts ">> save_project_settings : #{group}"
|
227
|
+
file = Watobo::Utils.snakecase group.gsub(/\.yml/,'')
|
228
|
+
file << ".yml"
|
229
|
+
|
230
|
+
project_file = File.join(@project_config_path, file)
|
231
|
+
# puts "Dest.File: #{project_file}"
|
232
|
+
# puts project_settings.to_yaml
|
233
|
+
# puts "---"
|
234
|
+
Watobo::Utils.save_settings(project_file, project_settings)
|
235
|
+
|
236
|
+
end
|
237
|
+
|
238
|
+
def load_project_settings(group)
|
239
|
+
# puts ">> load_project_settings : #{group}"
|
240
|
+
file = Watobo::Utils.snakecase group.gsub(/\.yml/,'')
|
241
|
+
file << ".yml"
|
242
|
+
|
243
|
+
project_file = File.join(@project_config_path, file)
|
244
|
+
# puts "File: #{project_file}"
|
245
|
+
# puts "---"
|
246
|
+
|
247
|
+
s = Watobo::Utils.load_settings(project_file)
|
248
|
+
s
|
249
|
+
|
250
|
+
end
|
251
|
+
|
252
|
+
def logs
|
253
|
+
l = ''
|
254
|
+
@log_lock.synchronize do
|
255
|
+
l = File.open(@log_file).read
|
256
|
+
end
|
257
|
+
l
|
258
|
+
end
|
259
|
+
|
260
|
+
def logger( message, prefs = {} )
|
261
|
+
opts = { :sender => "unknown", :level => Watobo::Constants::LOG_INFO }
|
262
|
+
opts.update prefs
|
263
|
+
return false if @log_file.nil?
|
264
|
+
begin
|
265
|
+
t = Time.now
|
266
|
+
now = t.strftime("%m/%d/%Y @ %H:%M:%S")
|
267
|
+
log_message = [ now ]
|
268
|
+
log_message << "#{opts[:sender]}"
|
269
|
+
if message.is_a? Array
|
270
|
+
log_message << message.join("\n| ")
|
271
|
+
log_message << "\n-"
|
272
|
+
else
|
273
|
+
log_message << message
|
274
|
+
end
|
275
|
+
@log_lock.synchronize do
|
276
|
+
File.open(@log_file,"a") do |lfh|
|
277
|
+
lfh.puts log_message.join("|")
|
278
|
+
end
|
279
|
+
end
|
280
|
+
rescue => bang
|
281
|
+
puts bang
|
282
|
+
end
|
283
|
+
|
284
|
+
end
|
285
|
+
|
286
|
+
private
|
287
|
+
|
288
|
+
def chat_valid?(chat)
|
289
|
+
return false unless chat.respond_to? :request
|
290
|
+
return false unless chat.respond_to? :response
|
291
|
+
true
|
292
|
+
end
|
293
|
+
|
294
|
+
def get_file_list(path, pattern)
|
295
|
+
fl = Dir["#{path}/#{pattern}"].sort_by{ |x| File.basename(x).sub(/[^0-9]*/,'').to_i }
|
296
|
+
#puts fl.length
|
297
|
+
fl
|
298
|
+
end
|
299
|
+
|
300
|
+
end
|
301
|
+
|
314
302
|
end
|