deepsecurity 0.0.13hf1
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/.gitignore +25 -0
- data/.yardopts +4 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/bin/dsc +186 -0
- data/deepsecurity.gemspec +30 -0
- data/lib/deepsecurity/ds_object.rb +37 -0
- data/lib/deepsecurity/enums.rb +539 -0
- data/lib/deepsecurity/exceptions/authentication_failed_exception.rb +7 -0
- data/lib/deepsecurity/exceptions/authentication_required_exception.rb +6 -0
- data/lib/deepsecurity/manager.rb +223 -0
- data/lib/deepsecurity/screenscraping.rb +149 -0
- data/lib/deepsecurity/transport_object.rb +21 -0
- data/lib/deepsecurity/transport_objects/anti_malware_event.rb +106 -0
- data/lib/deepsecurity/transport_objects/anti_malware_spyware_item.rb +32 -0
- data/lib/deepsecurity/transport_objects/application_type.rb +58 -0
- data/lib/deepsecurity/transport_objects/dpi_rule.rb +113 -0
- data/lib/deepsecurity/transport_objects/host.rb +171 -0
- data/lib/deepsecurity/transport_objects/host_detail.rb +167 -0
- data/lib/deepsecurity/transport_objects/host_filter.rb +62 -0
- data/lib/deepsecurity/transport_objects/host_group.rb +41 -0
- data/lib/deepsecurity/transport_objects/host_interface.rb +42 -0
- data/lib/deepsecurity/transport_objects/id_filter.rb +37 -0
- data/lib/deepsecurity/transport_objects/private/vulnerability.rb +52 -0
- data/lib/deepsecurity/transport_objects/protocol_icmp.rb +13 -0
- data/lib/deepsecurity/transport_objects/protocol_port_based.rb +11 -0
- data/lib/deepsecurity/transport_objects/security_profile.rb +90 -0
- data/lib/deepsecurity/transport_objects/system_event.rb +45 -0
- data/lib/deepsecurity/transport_objects/time_filter.rb +55 -0
- data/lib/deepsecurity/version.rb +3 -0
- data/lib/deepsecurity.rb +58 -0
- data/lib/dsc/anti_malware_event.rb +101 -0
- data/lib/dsc/dsc_object.rb +41 -0
- data/lib/dsc/helper.rb +48 -0
- data/lib/dsc/host_detail.rb +62 -0
- data/lib/dsc.rb +6 -0
- data/lib/dsc_version.rb +3 -0
- data/lib/savon_helper/caching_object.rb +48 -0
- data/lib/savon_helper/mapping_object.rb +421 -0
- data/lib/savon_helper/missing_type_mapping_exception.rb +11 -0
- data/lib/savon_helper/soap_exception.rb +7 -0
- data/lib/savon_helper/type_mappings.rb +218 -0
- data/lib/savon_helper.rb +7 -0
- metadata +188 -0
data/.gitignore
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
sample.rb
|
19
|
+
*.pdf
|
20
|
+
.idea
|
21
|
+
DS4R/
|
22
|
+
dsm.der
|
23
|
+
keystore
|
24
|
+
playground.html
|
25
|
+
convert_cert.sh
|
data/.yardopts
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Udo Schneider
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Deepsecurity
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'deepsecurity'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install deepsecurity
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/dsc
ADDED
@@ -0,0 +1,186 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# 1.9 adds realpath to resolve symlinks; 1.8 doesn't
|
4
|
+
# have this method, so we add it so we get resolved symlinks
|
5
|
+
# and compatibility
|
6
|
+
unless File.respond_to? :realpath
|
7
|
+
class File #:nodoc:
|
8
|
+
def self.realpath path
|
9
|
+
return realpath(File.readlink(path)) if symlink?(path)
|
10
|
+
path
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
$: << File.expand_path(File.dirname(File.realpath(__FILE__)) + '/../lib')
|
15
|
+
|
16
|
+
require 'rubygems'
|
17
|
+
require 'gli'
|
18
|
+
|
19
|
+
require 'deepsecurity'
|
20
|
+
require 'dsc'
|
21
|
+
|
22
|
+
include GLI::App
|
23
|
+
|
24
|
+
# config_file '.dsc.rc'
|
25
|
+
|
26
|
+
program_desc 'DeepSecurity command line client'
|
27
|
+
|
28
|
+
version Dsc::VERSION
|
29
|
+
|
30
|
+
desc 'Enable client debug output. One of debug, info, warn, error or fatal'
|
31
|
+
arg_name 'debug'
|
32
|
+
flag [:d, :debug]
|
33
|
+
|
34
|
+
desc 'Deep Security Manager'
|
35
|
+
arg_name 'hostname'
|
36
|
+
flag [:m, :manager]
|
37
|
+
|
38
|
+
desc 'Webservice Port'
|
39
|
+
arg_name 'port'
|
40
|
+
default_value '4119'
|
41
|
+
flag [:port]
|
42
|
+
|
43
|
+
desc 'Tennat'
|
44
|
+
arg_name 'tenat'
|
45
|
+
default_value ''
|
46
|
+
flag [:t, :tenant]
|
47
|
+
|
48
|
+
desc 'Username'
|
49
|
+
arg_name 'username'
|
50
|
+
default_value 'MasterAdmin'
|
51
|
+
flag [:u, :username]
|
52
|
+
|
53
|
+
desc 'Password'
|
54
|
+
arg_name 'password'
|
55
|
+
flag [:p, :password]
|
56
|
+
|
57
|
+
desc 'Output file'
|
58
|
+
default_value '--'
|
59
|
+
flag [:o, :outfile]
|
60
|
+
|
61
|
+
desc 'Show progress'
|
62
|
+
default_value false
|
63
|
+
switch [:P]
|
64
|
+
|
65
|
+
desc 'host detail'
|
66
|
+
# arg_name 'Describe arguments to host_status here'
|
67
|
+
command :host_detail do |c|
|
68
|
+
|
69
|
+
c.desc "list"
|
70
|
+
c.command :list do |list|
|
71
|
+
|
72
|
+
list.desc 'fields'
|
73
|
+
list.default_value Dsc::HostDetail.default_fields_string
|
74
|
+
list.flag [:fields]
|
75
|
+
|
76
|
+
list.action do |global_options, options, args|
|
77
|
+
Dsc.output_from_option(global_options[:o]) do |output|
|
78
|
+
Dsc::HostDetail.list(global_options[:m],
|
79
|
+
global_options[:port].to_i,
|
80
|
+
global_options[:t],
|
81
|
+
global_options[:u],
|
82
|
+
global_options[:p],
|
83
|
+
:host_filter,
|
84
|
+
Dsc::HostDetail.fields_from_string(options[:fields]),
|
85
|
+
output, global_options[:P],
|
86
|
+
Dsc.debug_level_from_option(global_options[:d]))
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
c.desc "schema"
|
92
|
+
c.command :schema do |schema|
|
93
|
+
schema.action do |global_options, options, args|
|
94
|
+
Dsc.output_from_option(global_options[:o]) do |output|
|
95
|
+
Dsc::HostDetail.print_schema(output)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
desc 'anti malware events'
|
103
|
+
# arg_name 'Describe arguments to host_status here'
|
104
|
+
command :anti_malware_events do |c|
|
105
|
+
|
106
|
+
c.desc "list"
|
107
|
+
c.command :list do |list|
|
108
|
+
|
109
|
+
list.desc 'fields'
|
110
|
+
list.default_value Dsc::AntiMalwareEvent.default_fields_string
|
111
|
+
list.flag [:fields]
|
112
|
+
|
113
|
+
list.desc 'time filter'
|
114
|
+
list.long_desc "One of #{Dsc::AntiMalwareEvent.valid_time_filters.keys.join(', ')}"
|
115
|
+
list.default_value "last_day"
|
116
|
+
list.flag [:time_filter]
|
117
|
+
|
118
|
+
list.action do |global_options, options, args|
|
119
|
+
Dsc.output_from_option(global_options[:o]) do |output|
|
120
|
+
Dsc::AntiMalwareEvent.list(global_options[:m],
|
121
|
+
global_options[:port].to_i,
|
122
|
+
global_options[:t],
|
123
|
+
global_options[:u],
|
124
|
+
global_options[:p],
|
125
|
+
:host_filter,
|
126
|
+
Dsc::AntiMalwareEvent.parse_time_filter(options[:time_filter]),
|
127
|
+
Dsc::AntiMalwareEvent.fields_from_string(options[:fields]),
|
128
|
+
output, global_options[:P],
|
129
|
+
Dsc.debug_level_from_option(global_options[:d]))
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
c.desc "schema"
|
135
|
+
c.command :schema do |schema|
|
136
|
+
schema.action do |global_options, options, args|
|
137
|
+
Dsc.output_from_option(global_options[:o]) do |output|
|
138
|
+
Dsc::AntiMalwareEvent.print_schema(output)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
desc 'API Version'
|
146
|
+
command :api_version do |c|
|
147
|
+
|
148
|
+
c.action do |global_options, options, args|
|
149
|
+
Dsc.output_from_option(global_options[:o]) do |output|
|
150
|
+
Dsc.print_api_version(global_options[:m], global_options[:port].to_i, global_options[:t], global_options[:u], global_options[:p], output, Dsc.debug_level_from_option(global_options[:d]))
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
desc 'Manager time'
|
156
|
+
command :manager_time do |c|
|
157
|
+
|
158
|
+
c.action do |global_options, options, args|
|
159
|
+
Dsc.output_from_option(global_options[:o]) do |output|
|
160
|
+
Dsc.print_manager_time(global_options[:m], global_options[:port].to_i, global_options[:t], global_options[:u], global_options[:p], output, Dsc.debug_level_from_option(global_options[:d]))
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
pre do |global, command, options, args|
|
166
|
+
# Pre logic here
|
167
|
+
# Return true to proceed; false to abort and not call the
|
168
|
+
# chosen command
|
169
|
+
# Use skips_pre before a command to skip this block
|
170
|
+
# on that command only
|
171
|
+
true
|
172
|
+
end
|
173
|
+
|
174
|
+
post do |global, command, options, args|
|
175
|
+
# Post logic here
|
176
|
+
# Use skips_post before a command to skip this
|
177
|
+
# block on that command only
|
178
|
+
end
|
179
|
+
|
180
|
+
on_error do |exception|
|
181
|
+
# Error logic here
|
182
|
+
# return false to skip default error handling
|
183
|
+
true
|
184
|
+
end
|
185
|
+
|
186
|
+
exit run(ARGV)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/deepsecurity/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Udo Schneider"]
|
6
|
+
gem.email = ["Udo.Schneider@homeaddress.de"]
|
7
|
+
gem.description = %q{Trend Micro DeepSecurity Wrapper}
|
8
|
+
gem.summary = %q{Trend Micro DeepSecurity Wrapper}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "deepsecurity"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = DeepSecurity::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency "json"
|
19
|
+
gem.add_dependency "savon"
|
20
|
+
gem.add_dependency "ruby-cache"
|
21
|
+
|
22
|
+
gem.add_dependency "gli"
|
23
|
+
|
24
|
+
gem.add_dependency 'yard'
|
25
|
+
# gem.add_dependency 'redcarpet'
|
26
|
+
# gem.add_dependency 'github-markup'
|
27
|
+
gem.add_dependency 'progressbar'
|
28
|
+
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module DeepSecurity
|
2
|
+
|
3
|
+
class DSObject < SavonHelper::CachingObject
|
4
|
+
|
5
|
+
def self.logger
|
6
|
+
DeepSecurity.logger
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.dsm
|
10
|
+
DeepSecurity.dsm
|
11
|
+
end
|
12
|
+
|
13
|
+
def logger
|
14
|
+
self.class.logger
|
15
|
+
end
|
16
|
+
|
17
|
+
def dsm
|
18
|
+
self.class.dsm
|
19
|
+
end
|
20
|
+
|
21
|
+
def retryable(options = {}, &block)
|
22
|
+
opts = {:tries => 1, :on => Exception}.merge(options)
|
23
|
+
|
24
|
+
retry_exception, retries = opts[:on], opts[:tries]
|
25
|
+
|
26
|
+
begin
|
27
|
+
return yield
|
28
|
+
rescue retry_exception
|
29
|
+
retry if (retries -= 1) > 0
|
30
|
+
end
|
31
|
+
|
32
|
+
yield
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|