watobo 0.9.8.677
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/watobo_gui.rb +39 -0
- data/certificates/cert.pem +19 -0
- data/certificates/privkey.pem +15 -0
- data/certificates/watobo_dh.key +5 -0
- data/config/datastore.yml +5 -0
- data/config/forwarding_proxy.yml +12 -0
- data/config/general.yml +4 -0
- data/config/gui.yml +23 -0
- data/config/interceptor.yml +16 -0
- data/config/scan_policy.yml +13 -0
- data/config/scanner.yml +34 -0
- data/icons/Add.ico +0 -0
- data/icons/Add_24x24.ico +0 -0
- data/icons/Bandwidth.ico +0 -0
- data/icons/Bandwidth_24x24.ico +0 -0
- data/icons/Mr. Bomb.ico +0 -0
- data/icons/Mr. Bomb_16x16.ico +0 -0
- data/icons/Mr. Bomb_24x24.ico +0 -0
- data/icons/Orange Ball.ico +0 -0
- data/icons/Orange Ball_16x16.ico +0 -0
- data/icons/Orange Ball_24x24.ico +0 -0
- data/icons/Pause.ico +0 -0
- data/icons/Play.ico +0 -0
- data/icons/Play_24x24.ico +0 -0
- data/icons/Red Ball.ico +0 -0
- data/icons/Red Ball_16x16.ico +0 -0
- data/icons/Red Ball_24x24.ico +0 -0
- data/icons/Run.ico +0 -0
- data/icons/Stop.ico +0 -0
- data/icons/Stop_24x24.ico +0 -0
- data/icons/Terminal.ico +0 -0
- data/icons/Transfer.ico +0 -0
- data/icons/Transfer_16x16.ico +0 -0
- data/icons/User.ico +0 -0
- data/icons/User_16x16.ico +0 -0
- data/icons/User_24x24.ico +0 -0
- data/icons/Web Browser.ico +0 -0
- data/icons/Web Browser_16x16.ico +0 -0
- data/icons/Write Document.ico +0 -0
- data/icons/Yellow Ball.ico +0 -0
- data/icons/Yellow Ball_16x16.ico +0 -0
- data/icons/Yellow Ball_24x24.ico +0 -0
- data/icons/advanced.ico +0 -0
- data/icons/advanced_16x16.ico +0 -0
- data/icons/advanced_24x24.ico +0 -0
- data/icons/applications.ico +0 -0
- data/icons/applications_16x16.ico +0 -0
- data/icons/applications_24x24.ico +0 -0
- data/icons/browser_16x16.ico +0 -0
- data/icons/browser_24x24.ico +0 -0
- data/icons/burn.ico +0 -0
- data/icons/burn_16x16.ico +0 -0
- data/icons/burn_24x24.ico +0 -0
- data/icons/calculator.ico +0 -0
- data/icons/calculator_24x24.ico +0 -0
- data/icons/cb_checked.ico +0 -0
- data/icons/cb_checked_orange.ico +0 -0
- data/icons/cb_unchecked.ico +0 -0
- data/icons/coin_24x24.ico +0 -0
- data/icons/conversation.ico +0 -0
- data/icons/conversation_24x24.ico +0 -0
- data/icons/engine.ico +0 -0
- data/icons/filter.ico +0 -0
- data/icons/folder.ico +0 -0
- data/icons/folder_16x16.ico +0 -0
- data/icons/fuzzer_16x16.ico +0 -0
- data/icons/fuzzer_24x24.ico +0 -0
- data/icons/go-down_16x16.png +0 -0
- data/icons/go-up_16x16.png +0 -0
- data/icons/help.ico +0 -0
- data/icons/help_16x16.ico +0 -0
- data/icons/help_24x24.ico +0 -0
- data/icons/iChat.ico +0 -0
- data/icons/iChat_16x16.ico +0 -0
- data/icons/iChat_24x24.ico +0 -0
- data/icons/icons.txt +3 -0
- data/icons/info.ico +0 -0
- data/icons/info_16x16.ico +0 -0
- data/icons/info_24x24.ico +0 -0
- data/icons/interceptor_24x24.ico +0 -0
- data/icons/lock.ico +0 -0
- data/icons/lock_12x12.ico +0 -0
- data/icons/lock_16x16.ico +0 -0
- data/icons/monitor.ico +0 -0
- data/icons/plugin.ico +0 -0
- data/icons/plugin_24x24.ico +0 -0
- data/icons/scan_16x16.png +0 -0
- data/icons/send.ico +0 -0
- data/icons/server.ico +0 -0
- data/icons/server_16x16.ico +0 -0
- data/icons/siberas_logo_x24.gif +0 -0
- data/icons/tag_blue_32x32.ico +0 -0
- data/icons/watobo-48x48.png +0 -0
- data/icons/watobo-logo.png +0 -0
- data/icons/watobo.ico +0 -0
- data/lib/watobo/adapters/data_store.rb +38 -0
- data/lib/watobo/adapters/file/file_store.rb +211 -0
- data/lib/watobo/adapters/session_store.rb +27 -0
- data/lib/watobo/adapters.rb +26 -0
- data/lib/watobo/config.rb +143 -0
- data/lib/watobo/constants.rb +92 -0
- data/lib/watobo/core/active_check.rb +404 -0
- data/lib/watobo/core/cookie.rb +69 -0
- data/lib/watobo/core/fuzz_gen.rb +160 -0
- data/lib/watobo/core/http_socket.rb +142 -0
- data/lib/watobo/core/interceptor.rb +729 -0
- data/lib/watobo/core/passive_check.rb +141 -0
- data/lib/watobo/core/project.rb +1058 -0
- data/lib/watobo/core/scanner.rb +396 -0
- data/lib/watobo/core/session.rb +1320 -0
- data/lib/watobo/core/simple_ca.rb +393 -0
- data/lib/watobo/core.rb +34 -0
- data/lib/watobo/defaults.rb +40 -0
- data/lib/watobo/external/diff/lcs/array.rb +42 -0
- data/lib/watobo/external/diff/lcs/block.rb +72 -0
- data/lib/watobo/external/diff/lcs/callbacks.rb +343 -0
- data/lib/watobo/external/diff/lcs/change.rb +190 -0
- data/lib/watobo/external/diff/lcs/hunk.rb +279 -0
- data/lib/watobo/external/diff/lcs/ldiff.rb +247 -0
- data/lib/watobo/external/diff/lcs/string.rb +40 -0
- data/lib/watobo/external/diff/lcs.rb +1124 -0
- data/lib/watobo/external/ntlm/ntlm.rb +797 -0
- data/lib/watobo/externals.rb +28 -0
- data/lib/watobo/framework/create_project.rb +55 -0
- data/lib/watobo/framework/init.rb +149 -0
- data/lib/watobo/framework/init_modules.rb +116 -0
- data/lib/watobo/framework/license_text.rb +50 -0
- data/lib/watobo/framework.rb +26 -0
- data/lib/watobo/gui/about_watobo.rb +68 -0
- data/lib/watobo/gui/browser_preview.rb +460 -0
- data/lib/watobo/gui/certificate_dialog.rb +132 -0
- data/lib/watobo/gui/chat_diff.rb +415 -0
- data/lib/watobo/gui/chatviewer_frame.rb +427 -0
- data/lib/watobo/gui/checkboxtree.rb +221 -0
- data/lib/watobo/gui/checks_policy_frame.rb +123 -0
- data/lib/watobo/gui/client_cert_dialog.rb +227 -0
- data/lib/watobo/gui/confirm_scan_dialog.rb +67 -0
- data/lib/watobo/gui/conversation_table.rb +386 -0
- data/lib/watobo/gui/conversation_table_ctrl.rb +175 -0
- data/lib/watobo/gui/csrf_token_dialog.rb +446 -0
- data/lib/watobo/gui/dashboard.rb +341 -0
- data/lib/watobo/gui/define_scope_frame.rb +380 -0
- data/lib/watobo/gui/edit_comment.rb +70 -0
- data/lib/watobo/gui/edit_scope_dialog.rb +69 -0
- data/lib/watobo/gui/finding_info.rb +212 -0
- data/lib/watobo/gui/findings_tree.rb +459 -0
- data/lib/watobo/gui/full_scan_dialog.rb +269 -0
- data/lib/watobo/gui/fuzzer_gui.rb +1522 -0
- data/lib/watobo/gui/hex_viewer.rb +106 -0
- data/lib/watobo/gui/interceptor_gui.rb +994 -0
- data/lib/watobo/gui/interceptor_settings_dialog.rb +201 -0
- data/lib/watobo/gui/log_viewer.rb +97 -0
- data/lib/watobo/gui/login_wizzard.rb +301 -0
- data/lib/watobo/gui/main_window.rb +1815 -0
- data/lib/watobo/gui/manual_request_editor.rb +1105 -0
- data/lib/watobo/gui/master_pw_dialog.rb +142 -0
- data/lib/watobo/gui/password_policy_dialog.rb +98 -0
- data/lib/watobo/gui/plugin/base.rb +82 -0
- data/lib/watobo/gui/plugin_board.rb +95 -0
- data/lib/watobo/gui/preferences_dialog.rb +116 -0
- data/lib/watobo/gui/progress_window.rb +102 -0
- data/lib/watobo/gui/project_wizzard.rb +369 -0
- data/lib/watobo/gui/proxy_dialog.rb +550 -0
- data/lib/watobo/gui/quick_scan_dialog.rb +242 -0
- data/lib/watobo/gui/request_editor.rb +480 -0
- data/lib/watobo/gui/save_chat_dialog.rb +158 -0
- data/lib/watobo/gui/scanner_settings_dialog.rb +360 -0
- data/lib/watobo/gui/select_chat_dialog.rb +169 -0
- data/lib/watobo/gui/session_management_dialog.rb +688 -0
- data/lib/watobo/gui/sites_tree.rb +347 -0
- data/lib/watobo/gui/status_bar.rb +88 -0
- data/lib/watobo/gui/table_editor.rb +445 -0
- data/lib/watobo/gui/tagless_viewer.rb +62 -0
- data/lib/watobo/gui/templates/plugin.rb +80 -0
- data/lib/watobo/gui/templates/plugin2.rb +103 -0
- data/lib/watobo/gui/text_viewer.rb +247 -0
- data/lib/watobo/gui/transcoder_window.rb +215 -0
- data/lib/watobo/gui/utils/gui_utils.rb +129 -0
- data/lib/watobo/gui/utils/init_icons.rb +106 -0
- data/lib/watobo/gui/utils/load_icons.rb +54 -0
- data/lib/watobo/gui/utils/load_plugins.rb +94 -0
- data/lib/watobo/gui/utils/master_password.rb +90 -0
- data/lib/watobo/gui/utils/save_default_settings.rb +99 -0
- data/lib/watobo/gui/utils/save_project_settings.rb +21 -0
- data/lib/watobo/gui/utils/save_proxy_settings.rb +45 -0
- data/lib/watobo/gui/utils/save_session_settings.rb +21 -0
- data/lib/watobo/gui/utils/session_history.rb +134 -0
- data/lib/watobo/gui/workspace_dialog.rb +89 -0
- data/lib/watobo/gui/www_auth_dialog.rb +348 -0
- data/lib/watobo/gui/xml_viewer_frame.rb +114 -0
- data/lib/watobo/gui.rb +139 -0
- data/lib/watobo/mixins/httpparser.rb +664 -0
- data/lib/watobo/mixins/request_parser.rb +210 -0
- data/lib/watobo/mixins/shapers.rb +345 -0
- data/lib/watobo/mixins/transcoders.rb +88 -0
- data/lib/watobo/mixins.rb +32 -0
- data/lib/watobo/utils/check_regex.rb +36 -0
- data/lib/watobo/utils/copy_object.rb +29 -0
- data/lib/watobo/utils/crypto.rb +74 -0
- data/lib/watobo/utils/expand_range.rb +45 -0
- data/lib/watobo/utils/file_management.rb +73 -0
- data/lib/watobo/utils/load_chat.rb +219 -0
- data/lib/watobo/utils/load_icon.rb +47 -0
- data/lib/watobo/utils/print_debug.rb +34 -0
- data/lib/watobo/utils/response_hash.rb +143 -0
- data/lib/watobo/utils/secure_eval.rb +57 -0
- data/lib/watobo/utils/text2request.rb +96 -0
- data/lib/watobo/utils.rb +32 -0
- data/lib/watobo.rb +76 -0
- data/modules/active/Apache/mod_status.rb +123 -0
- data/modules/active/Flash/crossdomain.rb +102 -0
- data/modules/active/directories/dirwalker.rb +89 -0
- data/modules/active/discovery/fileextensions.rb +151 -0
- data/modules/active/discovery/http_methods.rb +135 -0
- data/modules/active/domino/domino_db.lst +164 -0
- data/modules/active/domino/domino_db.rb +128 -0
- data/modules/active/fileinclusion/lfi_simple.rb +134 -0
- data/modules/active/jboss/jboss_basic.rb +119 -0
- data/modules/active/sap/business_objects.rb +73 -0
- data/modules/active/sap/its_commands.rb +101 -0
- data/modules/active/sap/its_service_parameter.rb +105 -0
- data/modules/active/sap/its_services.rb +103 -0
- data/modules/active/sap/its_xss.rb +98 -0
- data/modules/active/sqlinjection/sql_boolean.rb +262 -0
- data/modules/active/sqlinjection/sqli_simple.rb +205 -0
- data/modules/active/xss/xss_simple.rb +179 -0
- data/modules/passive/cookie_options.rb +97 -0
- data/modules/passive/cookie_xss.rb +85 -0
- data/modules/passive/detect_code.rb +89 -0
- data/modules/passive/detect_fileupload.rb +80 -0
- data/modules/passive/detect_infrastructure.rb +98 -0
- data/modules/passive/detect_one_time_tokens.rb +86 -0
- data/modules/passive/dirindexing.rb +81 -0
- data/modules/passive/disclosure_emails.rb +82 -0
- data/modules/passive/disclosure_ipaddr.rb +87 -0
- data/modules/passive/filename_as_parameter.rb +85 -0
- data/modules/passive/form_spotter.rb +75 -0
- data/modules/passive/hotspots.rb +86 -0
- data/modules/passive/in_script_parameter.rb +92 -0
- data/modules/passive/multiple_server_headers.rb +98 -0
- data/modules/passive/possible_login.rb +134 -0
- data/modules/passive/redirect_url.rb +88 -0
- data/modules/passive/redirectionz.rb +96 -0
- data/modules/passive/xss_dom.rb +91 -0
- data/plugins/catalog/catalog.ico +0 -0
- data/plugins/catalog/catalog.rb +726 -0
- data/plugins/catalog/db_tests +6483 -0
- data/plugins/catalog/db_variables +29 -0
- data/plugins/filefinder/dbs/hbci.db +12 -0
- data/plugins/filefinder/filefinder.rb +602 -0
- data/plugins/sslchecker/cli/sslchecker_cli.rb +21 -0
- data/plugins/sslchecker/gui/cipher_table.rb +260 -0
- data/plugins/sslchecker/gui/gui.rb +245 -0
- data/plugins/sslchecker/gui/sslchecker.rb +26 -0
- data/plugins/sslchecker/icons/green_16x16.ico +0 -0
- data/plugins/sslchecker/icons/grey_16x16.ico +0 -0
- data/plugins/sslchecker/icons/red_16x16.ico +0 -0
- data/plugins/sslchecker/icons/sslchecker.ico +0 -0
- data/plugins/sslchecker/lib/check.rb +117 -0
- metadata +317 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
# .
|
|
2
|
+
# simple_ca.rb
|
|
3
|
+
#
|
|
4
|
+
# Copyright 2012 by siberas, http://www.siberas.de
|
|
5
|
+
#
|
|
6
|
+
# This file is part of WATOBO (Web Application Tool Box)
|
|
7
|
+
# http://watobo.sourceforge.com
|
|
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
|
+
require 'openssl'
|
|
23
|
+
require 'digest/md5'
|
|
24
|
+
|
|
25
|
+
module Watobo
|
|
26
|
+
|
|
27
|
+
# SimpleCA is based on QuickCert
|
|
28
|
+
# http://segment7.net/projects/ruby/QuickCert/index.html
|
|
29
|
+
|
|
30
|
+
class SimpleCA
|
|
31
|
+
|
|
32
|
+
def initialize(ca_config)
|
|
33
|
+
@ca_config = ca_config
|
|
34
|
+
create_ca()
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def create_cert(cert_config)
|
|
38
|
+
puts " ... keypair ..."
|
|
39
|
+
cert_keypair = create_key(cert_config)
|
|
40
|
+
puts "... csr ..."
|
|
41
|
+
cert_csr = create_csr(cert_config, cert_keypair)
|
|
42
|
+
puts "... signing ..."
|
|
43
|
+
sign_cert(cert_config, cert_keypair, cert_csr)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def create_ca
|
|
48
|
+
if not File.exists? @ca_config[:CA_dir] then
|
|
49
|
+
Dir.mkdir(@ca_config[:CA_dir])
|
|
50
|
+
Dir.mkdir File.join(@ca_config[:CA_dir], 'private') #, 0700
|
|
51
|
+
Dir.mkdir File.join(@ca_config[:CA_dir], 'newcerts')
|
|
52
|
+
Dir.mkdir File.join(@ca_config[:CA_dir], 'crl')
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
File.open @ca_config[:serial_file], 'w' do |f| f << '1' end
|
|
56
|
+
|
|
57
|
+
print "Generating CA keypair ..." if $DEBUG
|
|
58
|
+
puts " - rsa_key_length: " + @ca_config[:ca_rsa_key_length].to_s
|
|
59
|
+
keypair = OpenSSL::PKey::RSA.new(@ca_config[:ca_rsa_key_length])
|
|
60
|
+
puts "done!"
|
|
61
|
+
|
|
62
|
+
print "Create Certificate ..."
|
|
63
|
+
cert = OpenSSL::X509::Certificate.new
|
|
64
|
+
puts "done!"
|
|
65
|
+
name = @ca_config[:name].dup << ['CN', 'CA']
|
|
66
|
+
cert.subject = cert.issuer = OpenSSL::X509::Name.new(name)
|
|
67
|
+
cert.not_before = Time.now
|
|
68
|
+
cert.not_after = Time.now + @ca_config[:ca_cert_days] * 24 * 60 * 60
|
|
69
|
+
cert.public_key = keypair.public_key
|
|
70
|
+
cert.serial = 0x0
|
|
71
|
+
cert.version = 2 # X509v3
|
|
72
|
+
|
|
73
|
+
ef = OpenSSL::X509::ExtensionFactory.new
|
|
74
|
+
ef.subject_certificate = cert
|
|
75
|
+
ef.issuer_certificate = cert
|
|
76
|
+
cert.extensions = [
|
|
77
|
+
ef.create_extension("basicConstraints","CA:TRUE", true),
|
|
78
|
+
ef.create_extension("nsComment","Ruby/OpenSSL Generated Certificate"),
|
|
79
|
+
ef.create_extension("subjectKeyIdentifier", "hash"),
|
|
80
|
+
ef.create_extension("keyUsage", "cRLSign,keyCertSign", true),
|
|
81
|
+
]
|
|
82
|
+
cert.add_extension ef.create_extension("authorityKeyIdentifier",
|
|
83
|
+
"keyid:always,issuer:always")
|
|
84
|
+
cert.sign keypair, OpenSSL::Digest::SHA1.new
|
|
85
|
+
|
|
86
|
+
cb = proc do @ca_config[:password] end
|
|
87
|
+
keypair_export = keypair.export OpenSSL::Cipher::DES.new(:EDE3, :CBC),
|
|
88
|
+
&cb
|
|
89
|
+
|
|
90
|
+
puts "Writing keypair to #{@ca_config[:keypair_file]}" if $DEBUG
|
|
91
|
+
begin
|
|
92
|
+
fh = File.open(@ca_config[:keypair_file], "w+")
|
|
93
|
+
|
|
94
|
+
fh.puts keypair_export
|
|
95
|
+
fh.close
|
|
96
|
+
rescue => bang
|
|
97
|
+
puts "! Could not write keypair"
|
|
98
|
+
puts bang
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
puts "Writing cert to #{@ca_config[:cert_file]}" if $DEBUG
|
|
103
|
+
File.open @ca_config[:cert_file], "w", 0644 do |f|
|
|
104
|
+
f << cert.to_pem
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
puts "Done generating certificate for #{cert.subject}" if $DEBUG
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
##
|
|
111
|
+
# Creates a new RSA key from +cert_config+.
|
|
112
|
+
|
|
113
|
+
def create_key(cert_config)
|
|
114
|
+
passwd_cb = nil
|
|
115
|
+
target = cert_config[:hostname] || cert_config[:user]
|
|
116
|
+
dest = @ca_config[:CA_dir]
|
|
117
|
+
keypair_file = File.join(dest, (target + "_keypair.pem"))
|
|
118
|
+
|
|
119
|
+
puts "create_key: #{keypair_file}"
|
|
120
|
+
begin
|
|
121
|
+
Dir.mkdir dest #, 0700
|
|
122
|
+
rescue Errno::EEXIST
|
|
123
|
+
puts "directory exists"
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if not File.exists?(keypair_file) then
|
|
127
|
+
puts "Generating RSA keypair" if $DEBUG
|
|
128
|
+
keypair = OpenSSL::PKey::RSA.new 1024
|
|
129
|
+
puts keypair.to_pem.class
|
|
130
|
+
|
|
131
|
+
if cert_config[:password].nil? then
|
|
132
|
+
puts "no password for cert"
|
|
133
|
+
puts "Writing keypair to #{keypair_file}" if $DEBUG
|
|
134
|
+
begin
|
|
135
|
+
dummy = keypair.to_pem.split("\n")
|
|
136
|
+
dummy.each do |line|
|
|
137
|
+
line.strip!
|
|
138
|
+
end
|
|
139
|
+
fh = File.open( keypair_file, "wb" )
|
|
140
|
+
fh.write dummy.join("\n")
|
|
141
|
+
fh.close
|
|
142
|
+
rescue => bang
|
|
143
|
+
puts "! Could not write keypair"
|
|
144
|
+
end
|
|
145
|
+
else
|
|
146
|
+
passwd_cb = proc do cert_config[:password] end
|
|
147
|
+
keypair_export = keypair.export OpenSSL::Cipher::DES.new(:EDE3, :CBC),
|
|
148
|
+
cert_config[:password]
|
|
149
|
+
|
|
150
|
+
puts "Writing keypair to #{keypair_file}" if $DEBUG
|
|
151
|
+
#File.open keypair_file, "w" do |f|
|
|
152
|
+
# f << keypair_export
|
|
153
|
+
#end
|
|
154
|
+
begin
|
|
155
|
+
fh = File.open( keypair_file, "w" )
|
|
156
|
+
fh.puts keypair_export
|
|
157
|
+
fh.close
|
|
158
|
+
rescue => bang
|
|
159
|
+
puts "! Could not write keypair"
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
return keypair_file
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
##
|
|
168
|
+
# Creates a new Certificate Signing Request for the keypair in
|
|
169
|
+
# +keypair_file+, generating and saving new keypair if nil.
|
|
170
|
+
|
|
171
|
+
def create_csr(cert_config, keypair_file = nil)
|
|
172
|
+
keypair = nil
|
|
173
|
+
target = cert_config[:hostname] || cert_config[:user]
|
|
174
|
+
dest = @ca_config[:CA_dir]
|
|
175
|
+
csr_file = File.join dest, "csr_#{target}.pem"
|
|
176
|
+
|
|
177
|
+
name = @ca_config[:name].dup
|
|
178
|
+
case cert_config[:type]
|
|
179
|
+
when 'server' then
|
|
180
|
+
name << ['OU', 'CA']
|
|
181
|
+
name << ['CN', cert_config[:hostname]]
|
|
182
|
+
when 'client' then
|
|
183
|
+
name << ['CN', cert_config[:user]]
|
|
184
|
+
name << ['emailAddress', cert_config[:email]]
|
|
185
|
+
end
|
|
186
|
+
puts "Create Certificate Signing Request ..."
|
|
187
|
+
puts "Keypair File: " + keypair_file
|
|
188
|
+
# puts name
|
|
189
|
+
name = OpenSSL::X509::Name.new(name)
|
|
190
|
+
puts "- - -"
|
|
191
|
+
|
|
192
|
+
if File.exists? keypair_file then
|
|
193
|
+
puts "Get Keypair from file #{keypair_file}"
|
|
194
|
+
keypair = OpenSSL::PKey::RSA.new(File.read(keypair_file), cert_config[:password])
|
|
195
|
+
else
|
|
196
|
+
puts "Create Certificate KeyPair ..."
|
|
197
|
+
keypair = create_key(cert_config)
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
puts "Generating CSR for #{name}" if $DEBUG
|
|
201
|
+
|
|
202
|
+
req = OpenSSL::X509::Request.new
|
|
203
|
+
req.version = 0
|
|
204
|
+
req.subject = name
|
|
205
|
+
req.public_key = keypair.public_key
|
|
206
|
+
req.sign keypair, OpenSSL::Digest::MD5.new
|
|
207
|
+
|
|
208
|
+
puts "Writing CSR to #{csr_file}" if $DEBUG
|
|
209
|
+
File.open csr_file, "w" do |f|
|
|
210
|
+
f << req.to_pem
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
return csr_file
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
##
|
|
217
|
+
# Signs the certificate described in +cert_config+ and
|
|
218
|
+
# +csr_file+, saving it to +cert_file+.
|
|
219
|
+
|
|
220
|
+
def sign_cert(cert_config, cert_file, csr_file)
|
|
221
|
+
csr = OpenSSL::X509::Request.new File.read(csr_file)
|
|
222
|
+
|
|
223
|
+
raise "CSR sign verification failed." unless csr.verify csr.public_key
|
|
224
|
+
|
|
225
|
+
if csr.public_key.n.num_bits < @ca_config[:cert_key_length_min] then
|
|
226
|
+
raise "Key length too short"
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
if csr.public_key.n.num_bits > @ca_config[:cert_key_length_max] then
|
|
230
|
+
raise "Key length too long"
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
if csr.subject.to_a[0, @ca_config[:name].size] != @ca_config[:name] then
|
|
234
|
+
raise "DN does not match"
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
# Only checks signature here. You must verify CSR according to your
|
|
238
|
+
# CP/CPS.
|
|
239
|
+
|
|
240
|
+
# CA setup
|
|
241
|
+
|
|
242
|
+
puts "Reading CA cert from #{@ca_config[:cert_file]}" if $DEBUG
|
|
243
|
+
ca = OpenSSL::X509::Certificate.new File.read(@ca_config[:cert_file])
|
|
244
|
+
|
|
245
|
+
puts "Reading CA keypair from #{@ca_config[:keypair_file]}" if $DEBUG
|
|
246
|
+
ca_keypair = OpenSSL::PKey::RSA.new File.read(@ca_config[:keypair_file]),
|
|
247
|
+
@ca_config[:password]
|
|
248
|
+
|
|
249
|
+
serial = File.read(@ca_config[:serial_file]).chomp.hex
|
|
250
|
+
File.open @ca_config[:serial_file], "w" do |f|
|
|
251
|
+
f << "%04X" % (serial + 1)
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
puts "Generating cert" if $DEBUG
|
|
255
|
+
|
|
256
|
+
cert = OpenSSL::X509::Certificate.new
|
|
257
|
+
from = Time.now
|
|
258
|
+
cert.subject = csr.subject
|
|
259
|
+
cert.issuer = ca.subject
|
|
260
|
+
cert.not_before = from
|
|
261
|
+
cert.not_after = from + @ca_config[:cert_days] * 24 * 60 * 60
|
|
262
|
+
cert.public_key = csr.public_key
|
|
263
|
+
cert.serial = serial
|
|
264
|
+
cert.version = 2 # X509v3
|
|
265
|
+
|
|
266
|
+
basic_constraint = nil
|
|
267
|
+
key_usage = []
|
|
268
|
+
ext_key_usage = []
|
|
269
|
+
|
|
270
|
+
case cert_config[:type]
|
|
271
|
+
when "ca" then
|
|
272
|
+
basic_constraint = "CA:TRUE"
|
|
273
|
+
key_usage << "cRLSign" << "keyCertSign"
|
|
274
|
+
when "terminalsubca" then
|
|
275
|
+
basic_constraint = "CA:TRUE,pathlen:0"
|
|
276
|
+
key_usage << "cRLSign" << "keyCertSign"
|
|
277
|
+
when "server" then
|
|
278
|
+
basic_constraint = "CA:FALSE"
|
|
279
|
+
key_usage << "digitalSignature" << "keyEncipherment"
|
|
280
|
+
ext_key_usage << "serverAuth"
|
|
281
|
+
when "ocsp" then
|
|
282
|
+
basic_constraint = "CA:FALSE"
|
|
283
|
+
key_usage << "nonRepudiation" << "digitalSignature"
|
|
284
|
+
ext_key_usage << "serverAuth" << "OCSPSigning"
|
|
285
|
+
when "client" then
|
|
286
|
+
basic_constraint = "CA:FALSE"
|
|
287
|
+
key_usage << "nonRepudiation" << "digitalSignature" << "keyEncipherment"
|
|
288
|
+
ext_key_usage << "clientAuth" << "emailProtection"
|
|
289
|
+
else
|
|
290
|
+
raise "unknonw cert type \"#{cert_config[:type]}\""
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
ef = OpenSSL::X509::ExtensionFactory.new
|
|
294
|
+
ef.subject_certificate = cert
|
|
295
|
+
ef.issuer_certificate = ca
|
|
296
|
+
ex = []
|
|
297
|
+
ex << ef.create_extension("basicConstraints", basic_constraint, true)
|
|
298
|
+
ex << ef.create_extension("nsComment",
|
|
299
|
+
"Ruby/OpenSSL Generated Certificate")
|
|
300
|
+
ex << ef.create_extension("subjectKeyIdentifier", "hash")
|
|
301
|
+
#ex << ef.create_extension("nsCertType", "client,email")
|
|
302
|
+
unless key_usage.empty? then
|
|
303
|
+
ex << ef.create_extension("keyUsage", key_usage.join(","))
|
|
304
|
+
end
|
|
305
|
+
#ex << ef.create_extension("authorityKeyIdentifier",
|
|
306
|
+
# "keyid:always,issuer:always")
|
|
307
|
+
#ex << ef.create_extension("authorityKeyIdentifier", "keyid:always")
|
|
308
|
+
unless ext_key_usage.empty? then
|
|
309
|
+
ex << ef.create_extension("extendedKeyUsage", ext_key_usage.join(","))
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
if @ca_config[:cdp_location] then
|
|
313
|
+
ex << ef.create_extension("crlDistributionPoints",
|
|
314
|
+
@ca_config[:cdp_location])
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
if @ca_config[:ocsp_location] then
|
|
318
|
+
ex << ef.create_extension("authorityInfoAccess",
|
|
319
|
+
"OCSP;" << @ca_config[:ocsp_location])
|
|
320
|
+
end
|
|
321
|
+
cert.extensions = ex
|
|
322
|
+
cert.sign ca_keypair, OpenSSL::Digest::SHA1.new
|
|
323
|
+
|
|
324
|
+
backup_cert_file = @ca_config[:new_certs_dir] + "/cert_#{cert.serial}.pem"
|
|
325
|
+
puts "Writing backup cert to #{backup_cert_file}" if $DEBUG
|
|
326
|
+
File.open backup_cert_file, "w", 0644 do |f|
|
|
327
|
+
f << cert.to_pem
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
# Write cert
|
|
331
|
+
target = cert_config[:hostname] || cert_config[:user]
|
|
332
|
+
dest = @ca_config[:CA_dir]
|
|
333
|
+
cert_file = File.join dest, "cert_#{target}.pem"
|
|
334
|
+
puts "Writing cert to #{cert_file}"
|
|
335
|
+
File.open cert_file, "w", 0644 do |f|
|
|
336
|
+
f << cert.to_pem
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
return cert_file
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
end # class QuickCert
|
|
343
|
+
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
if __FILE__ == $0 then
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
cadir = File.join(Dir.pwd, "CA")
|
|
350
|
+
crl_dir= File.join(cadir, "crl")
|
|
351
|
+
hostname = "watobo"
|
|
352
|
+
domainname = "watobo.local"
|
|
353
|
+
ca = {
|
|
354
|
+
:CA_dir => cadir,
|
|
355
|
+
:password => '1234',
|
|
356
|
+
|
|
357
|
+
:keypair_file => File.join(cadir, "private/cakeypair.pem"),
|
|
358
|
+
:cert_file => File.join(cadir, "cacert.pem"),
|
|
359
|
+
:serial_file => File.join(cadir, "serial"),
|
|
360
|
+
:new_certs_dir => File.join(cadir, "newcerts"),
|
|
361
|
+
:new_keypair_dir => File.join(cadir, "private/keypair_backup"),
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
:ca_cert_days => 5 * 365, # five years
|
|
365
|
+
:ca_rsa_key_length => 2048,
|
|
366
|
+
|
|
367
|
+
:cert_days => 365, # one year
|
|
368
|
+
:cert_key_length_min => 1024,
|
|
369
|
+
:cert_key_length_max => 2048,
|
|
370
|
+
|
|
371
|
+
:crl_file => File.join(crl_dir, "#{hostname}.crl"),
|
|
372
|
+
:crl_pem_file => File.join(crl_dir, "#{hostname}.pem"),
|
|
373
|
+
:crl_days => 14,
|
|
374
|
+
:name => [
|
|
375
|
+
['C', 'DE', OpenSSL::ASN1::PRINTABLESTRING],
|
|
376
|
+
['O', domainname, OpenSSL::ASN1::UTF8STRING],
|
|
377
|
+
['OU',hostname, OpenSSL::ASN1::UTF8STRING],
|
|
378
|
+
]
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
cert = {
|
|
385
|
+
:type => 'server',
|
|
386
|
+
:user => 'watobo',
|
|
387
|
+
:email => 'a.schmidt@siberas.de',
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
qc = QuickCert.new(ca)
|
|
391
|
+
qc.create_cert(cert)
|
|
392
|
+
|
|
393
|
+
end
|
data/lib/watobo/core.rb
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# .
|
|
2
|
+
# core.rb
|
|
3
|
+
#
|
|
4
|
+
# Copyright 2012 by siberas, http://www.siberas.de
|
|
5
|
+
#
|
|
6
|
+
# This file is part of WATOBO (Web Application Tool Box)
|
|
7
|
+
# http://watobo.sourceforge.com
|
|
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
|
+
=begin
|
|
23
|
+
lib_folder = "core"
|
|
24
|
+
path = File.expand_path(File.join(File.dirname(__FILE__), lib_folder))
|
|
25
|
+
puts "* loading #{lib_folder}"
|
|
26
|
+
Dir.glob("#{path}/*.rb").each do |cf|
|
|
27
|
+
puts "+ #{cf}" if $DEBUG
|
|
28
|
+
require cf
|
|
29
|
+
|
|
30
|
+
end
|
|
31
|
+
=end
|
|
32
|
+
%w( project scanner session fuzz_gen http_socket interceptor passive_check active_check simple_ca cookie).each do |lib|
|
|
33
|
+
require File.join( "watobo", "core", lib)
|
|
34
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# .
|
|
2
|
+
# defaults.rb
|
|
3
|
+
#
|
|
4
|
+
# Copyright 2012 by siberas, http://www.siberas.de
|
|
5
|
+
#
|
|
6
|
+
# This file is part of WATOBO (Web Application Tool Box)
|
|
7
|
+
# http://watobo.sourceforge.com
|
|
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
|
+
module Watobo
|
|
23
|
+
def self.load_defaults
|
|
24
|
+
config_path = File.expand_path(File.join(File.dirname(__FILE__),"..","..", "config"))
|
|
25
|
+
puts "* loading defaults from #{config_path}"
|
|
26
|
+
Dir.glob("#{config_path}/*.yml").each do |cf|
|
|
27
|
+
dummy = File.basename(cf).gsub!(/.yml/,'')
|
|
28
|
+
cc = dummy.strip.gsub(/[^[a-zA-Z\-_]]/,"").gsub( "-" , "_").split("_").map{ |s| s.downcase.capitalize }.join
|
|
29
|
+
|
|
30
|
+
print " - #{cc} ... "
|
|
31
|
+
settings = YAML.load_file(cf)
|
|
32
|
+
Watobo::Conf.add(cc, settings )
|
|
33
|
+
print "OK\n"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
puts "=== loading defaults ==="
|
|
40
|
+
Watobo.load_defaults
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# .
|
|
2
|
+
# array.rb
|
|
3
|
+
#
|
|
4
|
+
# Copyright 2012 by siberas, http://www.siberas.de
|
|
5
|
+
#
|
|
6
|
+
# This file is part of WATOBO (Web Application Tool Box)
|
|
7
|
+
# http://watobo.sourceforge.com
|
|
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
|
+
#! /usr/env/bin ruby
|
|
23
|
+
#--
|
|
24
|
+
# Copyright 2004 Austin Ziegler <diff-lcs@halostatue.ca>
|
|
25
|
+
# adapted from:
|
|
26
|
+
# Algorithm::Diff (Perl) by Ned Konz <perl@bike-nomad.com>
|
|
27
|
+
# Smalltalk by Mario I. Wolczko <mario@wolczko.com>
|
|
28
|
+
# implements McIlroy-Hunt diff algorithm
|
|
29
|
+
#
|
|
30
|
+
# This program is free software. It may be redistributed and/or modified under
|
|
31
|
+
# the terms of the GPL version 2 (or later), the Perl Artistic licence, or the
|
|
32
|
+
# Ruby licence.
|
|
33
|
+
#
|
|
34
|
+
# $Id: array.rb,v 1.3 2004/08/08 20:33:09 austin Exp $
|
|
35
|
+
#++
|
|
36
|
+
# Includes Diff::LCS into the Array built-in class.
|
|
37
|
+
|
|
38
|
+
require 'diff/lcs'
|
|
39
|
+
|
|
40
|
+
class Array
|
|
41
|
+
include Diff::LCS
|
|
42
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# .
|
|
2
|
+
# block.rb
|
|
3
|
+
#
|
|
4
|
+
# Copyright 2012 by siberas, http://www.siberas.de
|
|
5
|
+
#
|
|
6
|
+
# This file is part of WATOBO (Web Application Tool Box)
|
|
7
|
+
# http://watobo.sourceforge.com
|
|
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
|
+
#! /usr/env/bin ruby
|
|
23
|
+
#--
|
|
24
|
+
# Copyright 2004 Austin Ziegler <diff-lcs@halostatue.ca>
|
|
25
|
+
# adapted from:
|
|
26
|
+
# Algorithm::Diff (Perl) by Ned Konz <perl@bike-nomad.com>
|
|
27
|
+
# Smalltalk by Mario I. Wolczko <mario@wolczko.com>
|
|
28
|
+
# implements McIlroy-Hunt diff algorithm
|
|
29
|
+
#
|
|
30
|
+
# This program is free software. It may be redistributed and/or modified under
|
|
31
|
+
# the terms of the GPL version 2 (or later), the Perl Artistic licence, or the
|
|
32
|
+
# Ruby licence.
|
|
33
|
+
#
|
|
34
|
+
# $Id: block.rb,v 1.3 2004/08/08 20:33:09 austin Exp $
|
|
35
|
+
#++
|
|
36
|
+
# Contains Diff::LCS::Block for bin/ldiff.
|
|
37
|
+
|
|
38
|
+
# A block is an operation removing, adding, or changing a group of items.
|
|
39
|
+
# Basically, this is just a list of changes, where each change adds or
|
|
40
|
+
# deletes a single item. Used by bin/ldiff.
|
|
41
|
+
class Diff::LCS::Block
|
|
42
|
+
attr_reader :changes, :insert, :remove
|
|
43
|
+
|
|
44
|
+
def initialize(chunk)
|
|
45
|
+
@changes = []
|
|
46
|
+
@insert = []
|
|
47
|
+
@remove = []
|
|
48
|
+
|
|
49
|
+
chunk.each do |item|
|
|
50
|
+
@changes << item
|
|
51
|
+
@remove << item if item.deleting?
|
|
52
|
+
@insert << item if item.adding?
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def diff_size
|
|
57
|
+
@insert.size - @remove.size
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def op
|
|
61
|
+
case [@remove.empty?, @insert.empty?]
|
|
62
|
+
when [false, false]
|
|
63
|
+
'!'
|
|
64
|
+
when [false, true]
|
|
65
|
+
'-'
|
|
66
|
+
when [true, false]
|
|
67
|
+
'+'
|
|
68
|
+
else # [true, true]
|
|
69
|
+
'^'
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|