fidius-evasiondb 0.0.1 → 0.0.2
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/evasion-db.gemspec +12 -7
- data/lib/db/db-install.rb +5 -1
- data/lib/db/migrations/006_create_ids_rules.rb +15 -0
- data/lib/db/migrations/007_create_enabled_rules.rb +13 -0
- data/lib/evasion-db/base.rb +23 -1
- data/lib/evasion-db/idmef-fetchers/prelude-db/lib/models/alert.rb +5 -4
- data/lib/evasion-db/idmef-fetchers/prelude-db/lib/models/detect_time.rb +2 -3
- data/lib/evasion-db/idmef-fetchers/prelude-db/lib/prelude_event_fetcher.rb +11 -6
- data/lib/evasion-db/knowledge/attack_module.rb +1 -0
- data/lib/evasion-db/knowledge/enabled_rules.rb +36 -0
- data/lib/evasion-db/knowledge/ids_rule.rb +33 -0
- data/lib/evasion-db/knowledge.rb +17 -6
- data/lib/evasion-db/postgres_patch.rb +21 -0
- data/lib/evasion-db/recorders/msf-recorder/lib/msf-recorder.rb +8 -9
- data/lib/evasion-db/rule_fetchers/rule_fetchers.rb +61 -0
- data/lib/evasion-db/rule_fetchers/snort/lib/snort.rb +100 -0
- data/lib/evasion-db/rule_fetchers/snort/rule_fetcher.rb +6 -0
- data/lib/evasion-db/vendor/bitfield.rb +66 -0
- data/lib/evasion-db/version.rb +1 -1
- data/lib/fidius-evasiondb.rb +8 -3
- data/lib/msf-plugins/database.yml.example +10 -0
- data/lib/msf-plugins/evasiondb.rb +40 -8
- data/test/config/database.yml +7 -0
- data/test/fixtures/ruleset1.rules +3 -0
- data/test/test_knowledge.rb +23 -0
- data/test/test_rule_fetchers.rb +17 -0
- metadata +97 -147
data/evasion-db.gemspec
CHANGED
@@ -21,17 +21,22 @@ Gem::Specification.new do |s|
|
|
21
21
|
|
22
22
|
s.rubyforge_project = ""
|
23
23
|
|
24
|
-
s.add_dependency "activerecord"
|
25
|
-
s.add_dependency "activesupport"
|
26
|
-
s.add_dependency "fidius-common", "
|
24
|
+
s.add_dependency "activerecord" #, ">= 3.0.0"
|
25
|
+
s.add_dependency "activesupport" #, ">= 3.0.0"
|
26
|
+
s.add_dependency "fidius-common", "~> 0.0.4"
|
27
|
+
s.add_dependency "snortor", "~> 0.0.1"
|
27
28
|
|
28
29
|
s.files = `git ls-files`.split("\n")
|
29
30
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
30
31
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
31
32
|
s.require_paths = ["lib"]
|
32
33
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
# TODO: this raises error ERROR: While executing gem ... (Gem::InvalidSpecificationException)
|
35
|
+
# rdoc_options must be an Array of String
|
36
|
+
# with bundler 1.0.14
|
37
|
+
# ##################################################
|
38
|
+
#s.rdoc_options = '--title' << s.name <<
|
39
|
+
# '--main' << 'README.md' << '--show-hash' <<
|
40
|
+
# `git ls-files -- lib/*`.split("\n") <<
|
41
|
+
# 'README.md' << 'LICENSE' << 'CREDITS.md'
|
37
42
|
end
|
data/lib/db/db-install.rb
CHANGED
@@ -63,7 +63,11 @@ module FIDIUS
|
|
63
63
|
@charset = ENV['CHARSET'] || 'utf8'
|
64
64
|
@collation = ENV['COLLATION'] || 'utf8_unicode_ci'
|
65
65
|
creation_options = {:charset => (config['charset'] || @charset), :collation => (config['collation'] || @collation)}
|
66
|
-
|
66
|
+
begin
|
67
|
+
error_class = config['adapter'] =~ /mysql2/ ? Mysql2::Error : Mysql::Error
|
68
|
+
rescue
|
69
|
+
error_class = Mysql::Error
|
70
|
+
end
|
67
71
|
access_denied_error = 1045
|
68
72
|
begin
|
69
73
|
ActiveRecord::Base.establish_connection(config.merge('database' => nil))
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateIdsRules < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :ids_rules do |t|
|
4
|
+
t.integer :sort
|
5
|
+
t.text :rule_text
|
6
|
+
t.string :rule_hash
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
add_index :ids_rules, :rule_hash,:unique => true
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.down
|
13
|
+
drop_table :ids_rules
|
14
|
+
end
|
15
|
+
end
|
data/lib/evasion-db/base.rb
CHANGED
@@ -11,6 +11,7 @@ module FIDIUS
|
|
11
11
|
@@yml_config = nil
|
12
12
|
@@current_fetcher = nil
|
13
13
|
@@current_recorder = nil
|
14
|
+
@@current_rule_fetcher = nil
|
14
15
|
|
15
16
|
# Configures EvasionDB.
|
16
17
|
#
|
@@ -32,6 +33,7 @@ module FIDIUS
|
|
32
33
|
else
|
33
34
|
#self.load_db_adapter(evasion_db['adapter'])
|
34
35
|
FIDIUS::EvasionDB::Knowledge::Connection.establish_connection evasion_db
|
36
|
+
#require File.join(GEM_BASE, 'evasion-db', 'postgres_patch.rb')
|
35
37
|
FIDIUS::EvasionDB::Knowledge::Connection.connection
|
36
38
|
end
|
37
39
|
end
|
@@ -55,8 +57,20 @@ module FIDIUS
|
|
55
57
|
def self.use_fetcher(fetcher_name)
|
56
58
|
raise "not configured. use FIDIUS::EvasionDB.config first" unless @@yml_config
|
57
59
|
@@current_fetcher = Fetcher.by_name(fetcher_name)
|
60
|
+
raise "fetcher #{fetcher_name} not found" unless @@current_fetcher
|
58
61
|
@@current_fetcher.config(@@yml_config)
|
59
|
-
|
62
|
+
end
|
63
|
+
|
64
|
+
# Use a given rule-fetcher. RuleFetchers are used to fetch rules from an rule based ids.
|
65
|
+
# Currently there is only the Fetcher for a Snort IDS.
|
66
|
+
#
|
67
|
+
# @param [String] rule_fetcher_name
|
68
|
+
# @raise RuntimeError if fetcher not found
|
69
|
+
def self.use_rule_fetcher(rule_fetcher_name)
|
70
|
+
raise "not configured. use FIDIUS::EvasionDB.config first" unless @@yml_config
|
71
|
+
@@current_rule_fetcher = RuleFetcher.by_name(rule_fetcher_name)
|
72
|
+
raise "rule-fetcher #{rule_fetcher_name} not found" unless @@current_rule_fetcher
|
73
|
+
@@current_rule_fetcher.config(@@yml_config)
|
60
74
|
end
|
61
75
|
|
62
76
|
# Returns the current recorder
|
@@ -76,5 +90,13 @@ module FIDIUS
|
|
76
90
|
raise "no fetcher set. Use FIDIUS::EvasionDB.use_fetcher" unless @@current_fetcher
|
77
91
|
@@current_fetcher
|
78
92
|
end
|
93
|
+
|
94
|
+
|
95
|
+
# Returns the current rule fetcher
|
96
|
+
#
|
97
|
+
# @see #use_rule_fetcher
|
98
|
+
def self.current_rule_fetcher
|
99
|
+
@@current_rule_fetcher
|
100
|
+
end
|
79
101
|
end# module EvasionDB
|
80
102
|
end# module FIDIUS
|
@@ -12,11 +12,12 @@ module FIDIUS
|
|
12
12
|
has_one :analyzer, :class_name => 'Analyzer', :foreign_key => :_message_ident, :primary_key => :_ident
|
13
13
|
has_one :impact, :class_name => 'Impact', :foreign_key => :_message_ident, :primary_key => :_ident
|
14
14
|
has_one :payload, :class_name => 'AdditionalData', :foreign_key => :_message_ident, :primary_key => :_ident, :conditions=>["Prelude_AdditionalData.meaning='payload'"]
|
15
|
-
set_primary_key :_ident
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
set_primary_key :_ident
|
17
|
+
set_table_name "Prelude_Alert"
|
18
|
+
#def self.table_name
|
19
|
+
# "Prelude_Alert"
|
20
|
+
#end
|
20
21
|
|
21
22
|
def self.total_entries
|
22
23
|
sql = connection();
|
@@ -2,9 +2,8 @@ module FIDIUS
|
|
2
2
|
module PreludeDB
|
3
3
|
# Wrapper for Prelude_DetectTime table
|
4
4
|
class DetectTime < FIDIUS::PreludeDB::Connection
|
5
|
-
|
6
|
-
|
7
|
-
end
|
5
|
+
set_primary_key :_message_ident
|
6
|
+
set_table_name "Prelude_DetectTime"
|
8
7
|
end
|
9
8
|
end
|
10
9
|
end
|
@@ -12,9 +12,8 @@ module FIDIUS
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def begin_record
|
15
|
-
|
16
|
-
|
17
|
-
@start_time = last_event.detect_time
|
15
|
+
t = FIDIUS::PreludeDB::DetectTime.find(:first,:order=>"time DESC")
|
16
|
+
@start_time = t.time
|
18
17
|
end
|
19
18
|
|
20
19
|
def get_events
|
@@ -22,7 +21,14 @@ module FIDIUS
|
|
22
21
|
res = Array.new
|
23
22
|
sleep 3
|
24
23
|
$logger.debug "alert.find(:all,:joins=>[:detect_time],time > #{@start_time})"
|
25
|
-
|
24
|
+
|
25
|
+
detect_times = FIDIUS::PreludeDB::DetectTime.find(:all,:order=>"time DESC",:conditions=>["time > :d",{:d => @start_time}])
|
26
|
+
events = []
|
27
|
+
detect_times.each do |dt|
|
28
|
+
events << FIDIUS::PreludeDB::Alert.find(:first,:conditions=>{:_ident=>dt._message_ident})
|
29
|
+
end
|
30
|
+
################################################
|
31
|
+
|
26
32
|
$logger.debug "found #{events.size} events"
|
27
33
|
events.each do |event|
|
28
34
|
ev = FIDIUS::PreludeDB::PreludeEvent.new(event)
|
@@ -30,7 +36,7 @@ module FIDIUS
|
|
30
36
|
if @local_ip
|
31
37
|
if (ev.source_ip == @local_ip || ev.dest_ip == @local_ip)
|
32
38
|
$logger.debug "adding #{ev.inspect} to events "
|
33
|
-
res << ev
|
39
|
+
res << ev
|
34
40
|
end
|
35
41
|
else
|
36
42
|
$logger.debug "adding #{ev.inspect} to events "
|
@@ -64,4 +70,3 @@ Dir.glob(File.join File.dirname(__FILE__), 'models', '*.rb') do |rb|
|
|
64
70
|
$logger.debug "loading #{rb}"
|
65
71
|
require rb
|
66
72
|
end
|
67
|
-
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module FIDIUS::EvasionDB::Knowledge
|
2
|
+
class EnabledRules < FIDIUS::EvasionDB::Knowledge::Connection
|
3
|
+
belongs_to :attack_module
|
4
|
+
|
5
|
+
@bitvector = nil
|
6
|
+
|
7
|
+
def self.table_name
|
8
|
+
"enabled_rules"
|
9
|
+
end
|
10
|
+
|
11
|
+
def bitvector
|
12
|
+
return @bitvector if @bitvector
|
13
|
+
res = BitField.new(self.bitstring.size)
|
14
|
+
i = 0
|
15
|
+
self.bitstring.each_char do |bit|
|
16
|
+
res[i] = bit.to_i
|
17
|
+
i += 1
|
18
|
+
end
|
19
|
+
@bitvector = res
|
20
|
+
return @bitvector
|
21
|
+
end
|
22
|
+
|
23
|
+
# count rules
|
24
|
+
# :active or :inactive or :all
|
25
|
+
def count(h)
|
26
|
+
if h == :all
|
27
|
+
return bitvector.size
|
28
|
+
elsif h == :active
|
29
|
+
return bitvector.total_set
|
30
|
+
elsif h == :inactive
|
31
|
+
return (bitvector.size - bitvector.total_set)
|
32
|
+
end
|
33
|
+
raise "use count(:active) or count(:inactive)"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module FIDIUS::EvasionDB::Knowledge
|
2
|
+
class IdsRule < FIDIUS::EvasionDB::Knowledge::Connection
|
3
|
+
def self.table_name
|
4
|
+
"ids_rules"
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.exists?(text)
|
8
|
+
self.find_by_rule_hash(Digest::MD5.hexdigest(text)) != nil
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.sub_query_for_insert(text,sort)
|
12
|
+
h = Digest::MD5.hexdigest(text)
|
13
|
+
# escape single quotes
|
14
|
+
text = self.sanitize(text)
|
15
|
+
return "(#{text},'#{h}',#{sort})"
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.create_if_not_exists(text,sort=0)
|
19
|
+
q = self.sub_query_for_insert(text,sort)
|
20
|
+
begin
|
21
|
+
self.connection.execute("INSERT IGNORE INTO ids_rules (rule_text,rule_hash,sort) VALUES #{q};")
|
22
|
+
rescue
|
23
|
+
puts $!.message
|
24
|
+
puts "trying without IGNORE command"
|
25
|
+
begin
|
26
|
+
self.connection.execute("INSERT INTO ids_rules (rule_text,rule_hash,sort) VALUES #{q};")
|
27
|
+
rescue
|
28
|
+
puts $!.message
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/evasion-db/knowledge.rb
CHANGED
@@ -10,12 +10,14 @@ module FIDIUS
|
|
10
10
|
# to indicate that the exploit with maximal events should be searched
|
11
11
|
MAX_EVENTS = 2
|
12
12
|
|
13
|
-
autoload :AttackModule,
|
14
|
-
autoload :AttackOption,
|
15
|
-
autoload :AttackPayload,
|
16
|
-
autoload :Connection,
|
17
|
-
autoload :IdmefEvent,
|
18
|
-
autoload :Packet,
|
13
|
+
autoload :AttackModule, "#{GEM_BASE}/evasion-db/knowledge/attack_module"
|
14
|
+
autoload :AttackOption, "#{GEM_BASE}/evasion-db/knowledge/attack_option"
|
15
|
+
autoload :AttackPayload, "#{GEM_BASE}/evasion-db/knowledge/attack_payload"
|
16
|
+
autoload :Connection, "#{GEM_BASE}/evasion-db/knowledge/connection"
|
17
|
+
autoload :IdmefEvent, "#{GEM_BASE}/evasion-db/knowledge/idmef_event"
|
18
|
+
autoload :Packet, "#{GEM_BASE}/evasion-db/knowledge/packet"
|
19
|
+
autoload :IdsRule, "#{GEM_BASE}/evasion-db/knowledge/ids_rule"
|
20
|
+
autoload :EnabledRules, "#{GEM_BASE}/evasion-db/knowledge/enabled_rules"
|
19
21
|
|
20
22
|
# returns all modules(exploits) in knowledge database
|
21
23
|
def self.get_exploits
|
@@ -52,6 +54,15 @@ module FIDIUS
|
|
52
54
|
Packet.find(pid)
|
53
55
|
end
|
54
56
|
|
57
|
+
# returns all exploits for the given services
|
58
|
+
#
|
59
|
+
#@param [array] ports_list
|
60
|
+
def self.find_exploits_for_services(ports_list)
|
61
|
+
exploits = []
|
62
|
+
ports_list.each { |port| exploits.concat(find_exploits_for_service(port)) }
|
63
|
+
exploits.map { |e| e.id }
|
64
|
+
end
|
65
|
+
|
55
66
|
# returns all exploits for the given service
|
56
67
|
#
|
57
68
|
#@param [integer] port
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# This Patch will fix the Error:
|
2
|
+
#ActiveRecord::StatementInvalid: PGError: ERROR: relation "Prelude_Alert" does not exist
|
3
|
+
#LINE 4: WHERE a.attrelid = '"Prelude_Alert"'::regclass
|
4
|
+
# ^
|
5
|
+
#: SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
|
6
|
+
# FROM pg_attribute a LEFT JOIN pg_attrdef d
|
7
|
+
# ON a.attrelid = d.adrelid AND a.attnum = d.adnum
|
8
|
+
# WHERE a.attrelid = '"Prelude_Alert"'::regclass
|
9
|
+
# AND a.attnum > 0 AND NOT a.attisdropped
|
10
|
+
# ORDER BY a.attnum
|
11
|
+
# provided @http://s3.amazonaws.com/activereload-lighthouse/assets/a3d9b3646f58246ef6ffe027001dd643cca7aade/postgresql-support-capitalized-table-names.diff?AWSAccessKeyId=1AJ9W2TX1B2Z7C2KYB82&Expires=1290010522&Signature=ignfCi9%2Bm37oHijccGBsbJj298w%3D
|
12
|
+
|
13
|
+
module ActiveRecord
|
14
|
+
module ConnectionAdapters
|
15
|
+
class PostgreSQLAdapter < AbstractAdapter
|
16
|
+
def quote_table_name(name)
|
17
|
+
return name
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module FIDIUS
|
2
2
|
module EvasionDB
|
3
3
|
# This recorder provides an interface for the metasploit console
|
4
|
-
# it is used to have callbacks when modules are executed.
|
5
|
-
#
|
4
|
+
# it is used to have callbacks when modules are executed.
|
5
|
+
#
|
6
6
|
# @see {file:msf-plugins/evasiondb.rb}
|
7
7
|
module MsfRecorder
|
8
8
|
def module_started(module_instance)
|
9
|
+
# use rule_fetcher if the module starts
|
9
10
|
@@current_exploit = FIDIUS::EvasionDB::Knowledge::AttackModule.find_or_create_by_name_and_options(module_instance.fullname,module_instance.datastore)
|
10
11
|
FIDIUS::EvasionDB.current_fetcher.begin_record
|
11
12
|
end
|
@@ -27,7 +28,7 @@ module FIDIUS
|
|
27
28
|
if module_instance && module_instance.respond_to?("fullname")
|
28
29
|
$logger.debug "idmef_events << #{idmef_event}"
|
29
30
|
@@current_exploit.idmef_events << idmef_event
|
30
|
-
# meterpreter is not a module and does not respond to fullname
|
31
|
+
# meterpreter is not a module and does not respond to fullname
|
31
32
|
# we handle this seperatly
|
32
33
|
elsif module_instance == "Meterpreter"
|
33
34
|
$logger.debug "attack_payload.idmef_events << #{idmef_event}"
|
@@ -48,17 +49,15 @@ module FIDIUS
|
|
48
49
|
|
49
50
|
def log_packet(module_instance,data,socket)
|
50
51
|
begin
|
51
|
-
# set local ip, if there is no
|
52
|
-
#FIDIUS::EvasionDB.current_fetcher.local_ip = FIDIUS::Common.get_my_ip(socket.peerhost)
|
53
52
|
$logger.debug "logged module_instance: #{module_instance} with #{data.size} bytes payload"
|
54
|
-
# TODO: what shall we do with meterpreter?
|
53
|
+
# TODO: what shall we do with meterpreter?
|
55
54
|
# it has not options and no fullname, logger assigns only the string "meterpreter"
|
56
55
|
if module_instance.respond_to?("fullname")
|
57
56
|
unless @@current_exploit.finished
|
58
57
|
@@current_exploit.packets << FIDIUS::EvasionDB::Knowledge::Packet.create(:payload=>data,:src_addr=>socket.localhost,:src_port=>socket.localport,:dest_addr=>socket.peerhost,:dest_port=>socket.peerport)
|
59
58
|
@@current_exploit.save
|
60
59
|
end
|
61
|
-
# meterpreter is not a module and does not respond to fullname
|
60
|
+
# meterpreter is not a module and does not respond to fullname
|
62
61
|
# we handle this seperatly
|
63
62
|
elsif module_instance == "Meterpreter"
|
64
63
|
$logger.debug "module_instance is meterpreter"
|
@@ -69,8 +68,8 @@ module FIDIUS
|
|
69
68
|
$logger.debug "LOG: #{module_instance} #{data.size} Bytes on #{socket}"
|
70
69
|
rescue ActiveRecord::StatementInvalid
|
71
70
|
$logger.error "StatementInvalid"
|
72
|
-
rescue
|
73
|
-
$logger.error "error:"
|
71
|
+
rescue
|
72
|
+
$logger.error "error:"
|
74
73
|
end
|
75
74
|
end
|
76
75
|
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module FIDIUS
|
2
|
+
module EvasionDB
|
3
|
+
def self.rule_fetcher(name,&block)
|
4
|
+
FIDIUS::EvasionDB::RuleFetcher.new(name,&block)
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.install_rule_fetchers
|
8
|
+
$logger.debug "installing rule fetchers"
|
9
|
+
FIDIUS::EvasionDB::RuleFetcher.all.each do |fetcher|
|
10
|
+
fetcher.run_install
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# A Fetcher is used to fetch rules from an ids
|
15
|
+
class RuleFetcher
|
16
|
+
@@fetchers = []
|
17
|
+
attr_accessor :name
|
18
|
+
|
19
|
+
def initialize(name,&block)
|
20
|
+
self.instance_eval(&block)
|
21
|
+
@name = name
|
22
|
+
@@fetchers << self
|
23
|
+
end
|
24
|
+
|
25
|
+
def install(&block)
|
26
|
+
$logger.debug "setting installblock"
|
27
|
+
@install = block
|
28
|
+
end
|
29
|
+
|
30
|
+
def run_install
|
31
|
+
raise "no install block given" unless @install
|
32
|
+
$logger.debug "run install of #{@name}"
|
33
|
+
@install.call
|
34
|
+
end
|
35
|
+
|
36
|
+
def config(conf)
|
37
|
+
raise "overwrite this"
|
38
|
+
end
|
39
|
+
|
40
|
+
def fetch_rules(attack_module)
|
41
|
+
raise "overwrite this"
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.all
|
45
|
+
@@fetchers
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.by_name(name)
|
49
|
+
self.all.each do |fetcher|
|
50
|
+
return fetcher if fetcher.name == name
|
51
|
+
end
|
52
|
+
nil
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
Dir[File.join(File.dirname(__FILE__), "*/rule_fetcher.rb")].each{|fetch_require|
|
59
|
+
$logger.debug "load #{fetch_require}"
|
60
|
+
require fetch_require
|
61
|
+
}
|
@@ -0,0 +1,100 @@
|
|
1
|
+
begin
|
2
|
+
require 'snortor'
|
3
|
+
rescue
|
4
|
+
raise "can not find snortor gem. Please gem install snortor"
|
5
|
+
end
|
6
|
+
|
7
|
+
require File.join(FIDIUS::EvasionDB::GEM_BASE, 'evasion-db', 'vendor', 'bitfield')
|
8
|
+
|
9
|
+
module FIDIUS
|
10
|
+
module EvasionDB
|
11
|
+
module SnortRuleFetcher
|
12
|
+
@@rule_path = nil
|
13
|
+
|
14
|
+
|
15
|
+
@@ssh_host = nil
|
16
|
+
@@ssh_pw = nil
|
17
|
+
@@ssh_remote_path = nil
|
18
|
+
@@ssh_user = nil
|
19
|
+
@@fetch_remote = false
|
20
|
+
@@ssh_options = {}
|
21
|
+
|
22
|
+
def import_rules_to_snortor
|
23
|
+
raise "no rulepath given" unless @@rule_path
|
24
|
+
if @@fetch_remote
|
25
|
+
a = {:host=>@@ssh_host,:user=>@@ssh_user,:password=>@@ssh_pw,:remote_path=>@@ssh_remote_path,:options=>@@ssh_options}
|
26
|
+
puts "Snortor.import_rules(#{a.inspect})"
|
27
|
+
Snortor.import_rules(a)
|
28
|
+
else
|
29
|
+
Snortor.import_rules(@@rule_path)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
# generate a bitvector based on activated rules
|
33
|
+
# and assign this bisvector to the given attack_module
|
34
|
+
def fetch_rules(attack_module)
|
35
|
+
import_rules_to_snortor
|
36
|
+
|
37
|
+
raise "this attack_module has an ruleset bitvector" if attack_module.enabled_rules
|
38
|
+
|
39
|
+
start_time = Time.now
|
40
|
+
rules_enabled = BitField.new(Snortor.rules.size)
|
41
|
+
i = 0
|
42
|
+
Snortor.rules.each do |rule|
|
43
|
+
if rule.message
|
44
|
+
rules_enabled[i] = (rule.active == true)? 1 : 0
|
45
|
+
i += 1
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end_time = Time.now
|
49
|
+
|
50
|
+
ruleset = FIDIUS::EvasionDB::Knowledge::EnabledRules.create(:bitstring=>rules_enabled.to_s)
|
51
|
+
ruleset.attack_module = attack_module
|
52
|
+
ruleset.save
|
53
|
+
end
|
54
|
+
|
55
|
+
# fetches rules with snortor
|
56
|
+
# and stores them all into db
|
57
|
+
def import_rules
|
58
|
+
raise "rules imported already" if FIDIUS::EvasionDB::Knowledge::IdsRule.all.size > 0
|
59
|
+
import_rules_to_snortor
|
60
|
+
|
61
|
+
i = 0
|
62
|
+
insert_query = []
|
63
|
+
Snortor.rules.each do |rule|
|
64
|
+
if rule.message
|
65
|
+
insert_query << FIDIUS::EvasionDB::Knowledge::IdsRule.sub_query_for_insert(rule.message,i)
|
66
|
+
i += 1
|
67
|
+
end
|
68
|
+
end
|
69
|
+
begin
|
70
|
+
FIDIUS::EvasionDB::Knowledge::IdsRule.connection.execute("INSERT IGNORE INTO ids_rules (rule_text,rule_hash,sort) VALUES #{insert_query.join(',')};")
|
71
|
+
rescue
|
72
|
+
begin
|
73
|
+
# try without IGNORE statement
|
74
|
+
FIDIUS::EvasionDB::Knowledge::IdsRule.connection.execute("INSERT INTO ids_rules (rule_text,rule_hash,sort) VALUES #{insert_query.join(',')};")
|
75
|
+
rescue
|
76
|
+
puts $!.message+":"+$!.backtrace.to_s
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def config(conf)
|
82
|
+
return unless conf
|
83
|
+
conf = conf["snort-fetcher"]
|
84
|
+
return unless conf.class == Hash
|
85
|
+
|
86
|
+
@@rule_path = conf["rule_path"]#"/home/bernd/fidius/snort/rules/fetched"
|
87
|
+
|
88
|
+
@@ssh_host = conf["ssh_host"] #"10.10.10.254"
|
89
|
+
@@ssh_pw = conf["ssh_pw"]#"fidius09"
|
90
|
+
@@ssh_remote_path = conf["ssh_remote_path"] #"/etc/snort/rules/"
|
91
|
+
@@ssh_user = conf["ssh_user"] #"fidius"
|
92
|
+
@@fetch_remote = @@ssh_host != nil
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.ssh_options=(a)
|
96
|
+
@@ssh_options = a
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# NAME: BitField
|
2
|
+
# AUTHOR: Peter Cooper
|
3
|
+
# LICENSE: MIT ( http://www.opensource.org/licenses/mit-license.php )
|
4
|
+
# COPYRIGHT: (c) 2007 Peter Cooper (http://www.petercooper.co.uk/)
|
5
|
+
# VERSION: v4
|
6
|
+
# HISTORY: v4 (fixed bug where setting 0 bits to 0 caused a set to 1)
|
7
|
+
# v3 (supports dynamic bitwidths for array elements.. now doing 32 bit widths default)
|
8
|
+
# v2 (now uses 1 << y, rather than 2 ** y .. it's 21.8 times faster!)
|
9
|
+
# v1 (first release)
|
10
|
+
#
|
11
|
+
# DESCRIPTION: Basic, pure Ruby bit field. Pretty fast (for what it is) and memory efficient.
|
12
|
+
# I've written a pretty intensive test suite for it and it passes great.
|
13
|
+
# Works well for Bloom filters (the reason I wrote it).
|
14
|
+
#
|
15
|
+
# Create a bit field 1000 bits wide
|
16
|
+
# bf = BitField.new(1000)
|
17
|
+
#
|
18
|
+
# Setting and reading bits
|
19
|
+
# bf[100] = 1
|
20
|
+
# bf[100] .. => 1
|
21
|
+
# bf[100] = 0
|
22
|
+
#
|
23
|
+
# More
|
24
|
+
# bf.to_s = "10101000101010101" (example)
|
25
|
+
# bf.total_set .. => 10 (example - 10 bits are set to "1")
|
26
|
+
class BitField
|
27
|
+
attr_reader :size
|
28
|
+
include Enumerable
|
29
|
+
|
30
|
+
ELEMENT_WIDTH = 32
|
31
|
+
|
32
|
+
def initialize(size)
|
33
|
+
@size = size
|
34
|
+
@field = Array.new(((size - 1) / ELEMENT_WIDTH) + 1, 0)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Set a bit (1/0)
|
38
|
+
def []=(position, value)
|
39
|
+
if value == 1
|
40
|
+
@field[position / ELEMENT_WIDTH] |= 1 << (position % ELEMENT_WIDTH)
|
41
|
+
elsif (@field[position / ELEMENT_WIDTH]) & (1 << (position % ELEMENT_WIDTH)) != 0
|
42
|
+
@field[position / ELEMENT_WIDTH] ^= 1 << (position % ELEMENT_WIDTH)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Read a bit (1/0)
|
47
|
+
def [](position)
|
48
|
+
@field[position / ELEMENT_WIDTH] & 1 << (position % ELEMENT_WIDTH) > 0 ? 1 : 0
|
49
|
+
end
|
50
|
+
|
51
|
+
# Iterate over each bit
|
52
|
+
def each(&block)
|
53
|
+
@size.times { |position| yield self[position] }
|
54
|
+
end
|
55
|
+
|
56
|
+
# Returns the field as a string like "0101010100111100," etc.
|
57
|
+
def to_s
|
58
|
+
inject("") { |a, b| a + b.to_s }
|
59
|
+
end
|
60
|
+
|
61
|
+
# Returns the total number of bits that are set
|
62
|
+
# (The technique used here is about 6 times faster than using each or inject direct on the bitfield)
|
63
|
+
def total_set
|
64
|
+
@field.inject(0) { |a, byte| a += byte & 1 and byte >>= 1 until byte == 0; a }
|
65
|
+
end
|
66
|
+
end
|
data/lib/evasion-db/version.rb
CHANGED
data/lib/fidius-evasiondb.rb
CHANGED
@@ -12,9 +12,10 @@ module FIDIUS
|
|
12
12
|
GEM_BASE = File.expand_path('..', __FILE__)
|
13
13
|
$logger.debug "GEM_BASE ist: #{GEM_BASE}"
|
14
14
|
|
15
|
-
autoload :VERSION,
|
16
|
-
autoload :LogMatchesHelper,
|
17
|
-
autoload :Knowledge,
|
15
|
+
autoload :VERSION, "#{GEM_BASE}/evasion-db/version"
|
16
|
+
autoload :LogMatchesHelper, "#{GEM_BASE}/evasion-db/log_matches_helper"
|
17
|
+
autoload :Knowledge, "#{GEM_BASE}/evasion-db/knowledge"
|
18
|
+
autoload :BitField, "#{GEM_BASE}/evasion-db/vendor/bitfield"
|
18
19
|
|
19
20
|
# install fetchers
|
20
21
|
require File.join(GEM_BASE, 'evasion-db', 'idmef-fetchers', 'fetchers.rb')
|
@@ -23,5 +24,9 @@ module FIDIUS
|
|
23
24
|
# install recorders
|
24
25
|
require File.join(GEM_BASE, 'evasion-db', 'recorders', 'recorders.rb')
|
25
26
|
FIDIUS::EvasionDB.install_recorders
|
27
|
+
|
28
|
+
# install rule_recorder
|
29
|
+
require File.join(GEM_BASE, 'evasion-db', 'rule_fetchers', 'rule_fetchers.rb')
|
30
|
+
FIDIUS::EvasionDB.install_rule_fetchers
|
26
31
|
end
|
27
32
|
end
|
@@ -22,3 +22,13 @@ evasion_db:
|
|
22
22
|
username: root
|
23
23
|
password:
|
24
24
|
socket: /opt/lampp/var/mysql/mysql.sock
|
25
|
+
|
26
|
+
snort-fetcher:
|
27
|
+
# path with *.rules files
|
28
|
+
rule_path: /home/bernd/fidius/snort/rules/fetched
|
29
|
+
# optional ssh credentials
|
30
|
+
# content of folder remote_path will be copied via ssh tu rule_path
|
31
|
+
ssh_host: 10.10.10.254
|
32
|
+
ssh_pw: fidius09
|
33
|
+
ssh_remote_path: /etc/snort/rules/
|
34
|
+
ssh_user: root
|
@@ -34,7 +34,9 @@ class Plugin::EvasionDB < Msf::Plugin
|
|
34
34
|
"send_event_payload" => "send a given payload of an idmef-event to generate false positive",
|
35
35
|
"config_exploit" => "configures an exploit with the options of a previous runtime",
|
36
36
|
"delete_events" => "deletes events from knowledge",
|
37
|
-
"set_autologging" => "true|false automatically log all executed modules"
|
37
|
+
"set_autologging" => "true|false automatically log all executed modules",
|
38
|
+
"import_rules" => "import rules based on your config (this could take some time)",
|
39
|
+
"assign_rules_to_attack" => "assigns bitvector of activated rules to the given attack"
|
38
40
|
}
|
39
41
|
end
|
40
42
|
|
@@ -50,7 +52,7 @@ class Plugin::EvasionDB < Msf::Plugin
|
|
50
52
|
snl = false
|
51
53
|
lst = 0
|
52
54
|
rclosed = true
|
53
|
-
while (idx < str.length)
|
55
|
+
while (idx < str.length)
|
54
56
|
chunk = str[idx, width]
|
55
57
|
line = chunk.unpack("H*")[0].scan(/../).join(" ")
|
56
58
|
if from >= idx && from < idx+width
|
@@ -113,6 +115,17 @@ class Plugin::EvasionDB < Msf::Plugin
|
|
113
115
|
end
|
114
116
|
end
|
115
117
|
|
118
|
+
def cmd_import_rules(*args)
|
119
|
+
FIDIUS::EvasionDB.current_rule_fetcher.import_rules
|
120
|
+
end
|
121
|
+
|
122
|
+
def cmd_assign_rules_to_attack(*args)
|
123
|
+
raise "please provide an attack module id" if args.size != 1
|
124
|
+
a = FIDIUS::EvasionDB::Knowledge::AttackModule.find(args[0].to_i)
|
125
|
+
FIDIUS::EvasionDB.current_rule_fetcher.fetch_rules(a)
|
126
|
+
end
|
127
|
+
|
128
|
+
|
116
129
|
def cmd_send_packet(*args)
|
117
130
|
raise "please provide packet id" if args.size != 1
|
118
131
|
packet = FIDIUS::EvasionDB::Knowledge.get_packet(args[0].to_i)
|
@@ -134,6 +147,14 @@ class Plugin::EvasionDB < Msf::Plugin
|
|
134
147
|
print_line "-"*60
|
135
148
|
print_line "#{events.size} idmef-events fetched"
|
136
149
|
print_line "-"*60
|
150
|
+
|
151
|
+
if exploit.enabled_rules
|
152
|
+
print_line "-"*60
|
153
|
+
all = exploit.enabled_rules.count(:all)
|
154
|
+
active = exploit.enabled_rules.count(:active)
|
155
|
+
print_line "Rules: #{active}/#{all}"
|
156
|
+
print_line "-"*60
|
157
|
+
end
|
137
158
|
events.each do |event|
|
138
159
|
print_line "(#{event.id})#{event.text} with #{event.payload_size} bytes payload"
|
139
160
|
end
|
@@ -163,7 +184,7 @@ class Plugin::EvasionDB < Msf::Plugin
|
|
163
184
|
def cmd_show_packet(*args)
|
164
185
|
raise "please provide packet_id" if args.size != 1
|
165
186
|
packet = FIDIUS::EvasionDB::Knowledge::Packet.find(args[0].to_i)
|
166
|
-
|
187
|
+
|
167
188
|
hex = to_hex_dump(packet.payload)
|
168
189
|
print_line hex
|
169
190
|
end
|
@@ -182,7 +203,7 @@ class Plugin::EvasionDB < Msf::Plugin
|
|
182
203
|
print_line "#{packet[:packet].payload.size} bytes"
|
183
204
|
print_line "match #{packet[:index]} - #{packet[:index]+packet[:length]-1}"
|
184
205
|
hex = to_hex_dump(packet[:packet].payload,packet[:index],packet[:index]+packet[:length]-1)
|
185
|
-
print_line hex
|
206
|
+
print_line hex
|
186
207
|
else
|
187
208
|
print_line "no packets available"
|
188
209
|
end
|
@@ -192,7 +213,6 @@ class Plugin::EvasionDB < Msf::Plugin
|
|
192
213
|
end
|
193
214
|
|
194
215
|
def cmd_fetch_events(*args)
|
195
|
-
#events = FIDIUS::EvasionDB::Knowledge.fetch_events
|
196
216
|
FIDIUS::EvasionDB.current_fetcher.local_ip = nil
|
197
217
|
events = FIDIUS::EvasionDB.current_fetcher.fetch_events
|
198
218
|
if events
|
@@ -221,6 +241,8 @@ class Plugin::EvasionDB < Msf::Plugin
|
|
221
241
|
FIDIUS::EvasionDB.config(dbconfig_path)
|
222
242
|
FIDIUS::EvasionDB.use_recoder "Msf-Recorder"
|
223
243
|
FIDIUS::EvasionDB.use_fetcher "PreludeDB"
|
244
|
+
FIDIUS::EvasionDB.use_rule_fetcher "Snortrule-Fetcher"
|
245
|
+
FIDIUS::EvasionDB::SnortRuleFetcher.ssh_options = {:auth_methods=>["password"],:msfmodule=>FIDIUS::MsfModuleStub}
|
224
246
|
|
225
247
|
add_console_dispatcher(ConsoleCommandDispatcher)
|
226
248
|
framework.events.add_general_subscriber(FIDIUS::ModuleRunCallback.new)
|
@@ -263,7 +285,7 @@ class PacketLogger
|
|
263
285
|
end
|
264
286
|
|
265
287
|
def self.inspect_socket(socket)
|
266
|
-
"#{socket.localhost}:#{socket.localport} -> #{socket.peerhost}:#{socket.peerport}"
|
288
|
+
"#{socket.localhost}:#{socket.localport} -> #{socket.peerhost}:#{socket.peerport}"
|
267
289
|
end
|
268
290
|
|
269
291
|
class MySocketEventHandler
|
@@ -316,7 +338,7 @@ end #class ModuleRunCallback
|
|
316
338
|
end #FIDIUS
|
317
339
|
|
318
340
|
# This extends the PacketDispatcher from Rex
|
319
|
-
# with Logging
|
341
|
+
# with Logging
|
320
342
|
# Original Source is: lib/rex/post/meterpreter/packet_dispatcher.rb
|
321
343
|
module Rex::Post::Meterpreter::PacketDispatcher
|
322
344
|
def send_packet(packet, completion_routine = nil, completion_param = nil)
|
@@ -339,7 +361,7 @@ module Rex::Post::Meterpreter::PacketDispatcher
|
|
339
361
|
@finish = true
|
340
362
|
|
341
363
|
# Reraise the error to the top-level caller
|
342
|
-
raise e
|
364
|
+
raise e
|
343
365
|
end
|
344
366
|
end
|
345
367
|
|
@@ -376,3 +398,13 @@ module SocketTracer
|
|
376
398
|
end
|
377
399
|
end #SocketTracer
|
378
400
|
end #FIDIUS
|
401
|
+
|
402
|
+
module FIDIUS
|
403
|
+
class MsfModuleStub
|
404
|
+
# do nothing to prevent metasploits lib/net/ssh.rb from dieing
|
405
|
+
def self.add_socket(a)
|
406
|
+
end
|
407
|
+
def self.remove_socket(a)
|
408
|
+
end
|
409
|
+
end
|
410
|
+
end
|
data/test/config/database.yml
CHANGED
@@ -0,0 +1,3 @@
|
|
1
|
+
alert tcp $EXTERNAL_NET any <> $HOME_NET 0 (msg:"BAD-TRAFFIC tcp port 0 traffic"; flow:stateless; classtype:misc-activity; sid:524; rev:8;)
|
2
|
+
alert udp $EXTERNAL_NET any <> $HOME_NET 0 (msg:"BAD-TRAFFIC udp port 0 traffic"; reference:bugtraq,576; reference:cve,1999-0675; reference:nessus,10074; classtype:misc-activity; sid:525; rev:9;)
|
3
|
+
|
data/test/test_knowledge.rb
CHANGED
@@ -99,4 +99,27 @@ class TestKnowledge < Test::Unit::TestCase
|
|
99
99
|
assert_equal 1,events.size
|
100
100
|
|
101
101
|
end
|
102
|
+
|
103
|
+
def test_rule_models
|
104
|
+
IdsRule.create(:rule_text=>"Wurst1")
|
105
|
+
IdsRule.create(:rule_text=>"Wurst2")
|
106
|
+
|
107
|
+
e = EnabledRules.create(:bitstring=>"00101")
|
108
|
+
e.attack_module = FIDIUS::EvasionDB::Knowledge::AttackModule.first
|
109
|
+
e.save
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_ids_rule_helpers
|
113
|
+
IdsRule.create_if_not_exists("wurst",0)
|
114
|
+
IdsRule.create_if_not_exists("brot",1)
|
115
|
+
IdsRule.create_if_not_exists("hans",2)
|
116
|
+
IdsRule.create_if_not_exists("hans",2)
|
117
|
+
|
118
|
+
assert_equal 3, IdsRule.all.size
|
119
|
+
|
120
|
+
assert_equal 0, IdsRule.find_by_rule_text("wurst").sort
|
121
|
+
assert_equal 1, IdsRule.find_by_rule_text("brot").sort
|
122
|
+
assert_equal 2, IdsRule.find_by_rule_text("hans").sort
|
123
|
+
end
|
124
|
+
|
102
125
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestRuleFetchers < Test::Unit::TestCase
|
4
|
+
def test_rule_fetcher
|
5
|
+
FIDIUS::EvasionDB::Knowledge::EnabledRules.destroy_all
|
6
|
+
FIDIUS::EvasionDB::Knowledge::IdsRule.destroy_all
|
7
|
+
|
8
|
+
FIDIUS::EvasionDB.use_rule_fetcher "Snortrule-Fetcher"
|
9
|
+
FIDIUS::EvasionDB::current_rule_fetcher.fetch_rules(FIDIUS::EvasionDB::Knowledge::AttackModule.new)
|
10
|
+
|
11
|
+
# cant provide this for sqlite
|
12
|
+
#assert_equal 2, FIDIUS::EvasionDB::Knowledge::IdsRule.all.size
|
13
|
+
assert_equal 1, FIDIUS::EvasionDB::Knowledge::EnabledRules.all.size
|
14
|
+
enabled_rules = FIDIUS::EvasionDB::Knowledge::EnabledRules.first
|
15
|
+
assert_equal "11", enabled_rules.bitstring
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,108 +1,98 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: fidius-evasiondb
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
version: 0.0.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
12
|
-
-
|
7
|
+
authors:
|
8
|
+
- Jens Färber
|
13
9
|
- Bernhard Katzmarski
|
14
10
|
autorequire:
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2011-12-04 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: fidius-common
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &10084200 !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
- 0
|
31
|
-
version: "0"
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
32
23
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: activerecord
|
36
24
|
prerelease: false
|
37
|
-
|
25
|
+
version_requirements: *10084200
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: activerecord
|
28
|
+
requirement: &10083660 !ruby/object:Gem::Requirement
|
38
29
|
none: false
|
39
|
-
requirements:
|
40
|
-
- -
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
- 0
|
44
|
-
version: "0"
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
45
34
|
type: :runtime
|
46
|
-
version_requirements: *id002
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: activerecord
|
49
35
|
prerelease: false
|
50
|
-
|
36
|
+
version_requirements: *10083660
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: activerecord
|
39
|
+
requirement: &10082480 !ruby/object:Gem::Requirement
|
51
40
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
|
56
|
-
- 3
|
57
|
-
- 0
|
58
|
-
- 0
|
59
|
-
version: 3.0.0
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
60
45
|
type: :runtime
|
61
|
-
version_requirements: *id003
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: activesupport
|
64
46
|
prerelease: false
|
65
|
-
|
47
|
+
version_requirements: *10082480
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: activesupport
|
50
|
+
requirement: &10033180 !ruby/object:Gem::Requirement
|
66
51
|
none: false
|
67
|
-
requirements:
|
68
|
-
- -
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
|
71
|
-
- 3
|
72
|
-
- 0
|
73
|
-
- 0
|
74
|
-
version: 3.0.0
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
75
56
|
type: :runtime
|
76
|
-
version_requirements: *id004
|
77
|
-
- !ruby/object:Gem::Dependency
|
78
|
-
name: fidius-common
|
79
57
|
prerelease: false
|
80
|
-
|
58
|
+
version_requirements: *10033180
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: fidius-common
|
61
|
+
requirement: &10032340 !ruby/object:Gem::Requirement
|
81
62
|
none: false
|
82
|
-
requirements:
|
83
|
-
- -
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
segments:
|
86
|
-
- 0
|
87
|
-
- 0
|
88
|
-
- 4
|
63
|
+
requirements:
|
64
|
+
- - ~>
|
65
|
+
- !ruby/object:Gem::Version
|
89
66
|
version: 0.0.4
|
90
67
|
type: :runtime
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *10032340
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: snortor
|
72
|
+
requirement: &10031600 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.0.1
|
78
|
+
type: :runtime
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *10031600
|
81
|
+
description: ! 'The FIDIUS EvasionDB Gem provides a database which contains knowledge
|
82
|
+
about metasploit exploits and their corresponding alerts/events produced by intrusion
|
83
|
+
detection systems (IDS).
|
84
|
+
|
85
|
+
|
86
|
+
It includes a Metasploit plugin which supports the recording of thrown alerts during
|
87
|
+
the execution of an exploit.'
|
88
|
+
email:
|
97
89
|
- jfaerber+evasiondb@tzi.de
|
98
90
|
- bkatzm+evasiondb@tzi.de
|
99
|
-
executables:
|
91
|
+
executables:
|
100
92
|
- fidius-evasiondb
|
101
93
|
extensions: []
|
102
|
-
|
103
94
|
extra_rdoc_files: []
|
104
|
-
|
105
|
-
files:
|
95
|
+
files:
|
106
96
|
- .gitignore
|
107
97
|
- .yardopts
|
108
98
|
- Gemfile
|
@@ -117,6 +107,8 @@ files:
|
|
117
107
|
- lib/db/migrations/003_create_attack_modules.rb
|
118
108
|
- lib/db/migrations/004_create_attack_options.rb
|
119
109
|
- lib/db/migrations/005_create_attack_payloads.rb
|
110
|
+
- lib/db/migrations/006_create_ids_rules.rb
|
111
|
+
- lib/db/migrations/007_create_enabled_rules.rb
|
120
112
|
- lib/evasion-db/base.rb
|
121
113
|
- lib/evasion-db/idmef-fetchers/fetchers.rb
|
122
114
|
- lib/evasion-db/idmef-fetchers/prelude-db/fetcher.rb
|
@@ -139,100 +131,58 @@ files:
|
|
139
131
|
- lib/evasion-db/knowledge/attack_option.rb
|
140
132
|
- lib/evasion-db/knowledge/attack_payload.rb
|
141
133
|
- lib/evasion-db/knowledge/connection.rb
|
134
|
+
- lib/evasion-db/knowledge/enabled_rules.rb
|
142
135
|
- lib/evasion-db/knowledge/idmef_event.rb
|
136
|
+
- lib/evasion-db/knowledge/ids_rule.rb
|
143
137
|
- lib/evasion-db/knowledge/packet.rb
|
144
138
|
- lib/evasion-db/log_matches_helper.rb
|
139
|
+
- lib/evasion-db/postgres_patch.rb
|
145
140
|
- lib/evasion-db/recorders/msf-recorder/lib/msf-recorder.rb
|
146
141
|
- lib/evasion-db/recorders/msf-recorder/recorder.rb
|
147
142
|
- lib/evasion-db/recorders/recorders.rb
|
143
|
+
- lib/evasion-db/rule_fetchers/rule_fetchers.rb
|
144
|
+
- lib/evasion-db/rule_fetchers/snort/lib/snort.rb
|
145
|
+
- lib/evasion-db/rule_fetchers/snort/rule_fetcher.rb
|
146
|
+
- lib/evasion-db/vendor/bitfield.rb
|
148
147
|
- lib/evasion-db/version.rb
|
149
148
|
- lib/fidius-evasiondb.rb
|
150
149
|
- lib/msf-plugins/database.yml.example
|
151
150
|
- lib/msf-plugins/evasiondb.rb
|
152
151
|
- test/config/database.yml
|
153
152
|
- test/config/prelude.sql
|
153
|
+
- test/fixtures/ruleset1.rules
|
154
154
|
- test/helper.rb
|
155
155
|
- test/preludedb_helper.rb
|
156
156
|
- test/test_fetchers.rb
|
157
157
|
- test/test_knowledge.rb
|
158
158
|
- test/test_preludedb.rb
|
159
159
|
- test/test_recorders.rb
|
160
|
-
|
160
|
+
- test/test_rule_fetchers.rb
|
161
161
|
homepage: http://fidius.me
|
162
162
|
licenses: []
|
163
|
-
|
164
163
|
post_install_message:
|
165
|
-
rdoc_options:
|
166
|
-
|
167
|
-
- fidius-evasiondb
|
168
|
-
- --main
|
169
|
-
- README.md
|
170
|
-
- --show-hash
|
171
|
-
- - lib/db/db-install.rb
|
172
|
-
- lib/db/migrations/001_create_packets.rb
|
173
|
-
- lib/db/migrations/002_create_idmef_events.rb
|
174
|
-
- lib/db/migrations/003_create_attack_modules.rb
|
175
|
-
- lib/db/migrations/004_create_attack_options.rb
|
176
|
-
- lib/db/migrations/005_create_attack_payloads.rb
|
177
|
-
- lib/evasion-db/base.rb
|
178
|
-
- lib/evasion-db/idmef-fetchers/fetchers.rb
|
179
|
-
- lib/evasion-db/idmef-fetchers/prelude-db/fetcher.rb
|
180
|
-
- lib/evasion-db/idmef-fetchers/prelude-db/lib/models/additional_data.rb
|
181
|
-
- lib/evasion-db/idmef-fetchers/prelude-db/lib/models/address.rb
|
182
|
-
- lib/evasion-db/idmef-fetchers/prelude-db/lib/models/alert.rb
|
183
|
-
- lib/evasion-db/idmef-fetchers/prelude-db/lib/models/analyzer.rb
|
184
|
-
- lib/evasion-db/idmef-fetchers/prelude-db/lib/models/classification.rb
|
185
|
-
- lib/evasion-db/idmef-fetchers/prelude-db/lib/models/connection.rb
|
186
|
-
- lib/evasion-db/idmef-fetchers/prelude-db/lib/models/detect_time.rb
|
187
|
-
- lib/evasion-db/idmef-fetchers/prelude-db/lib/models/impact.rb
|
188
|
-
- lib/evasion-db/idmef-fetchers/prelude-db/lib/models/prelude_event.rb
|
189
|
-
- lib/evasion-db/idmef-fetchers/prelude-db/lib/models/service.rb
|
190
|
-
- lib/evasion-db/idmef-fetchers/prelude-db/lib/patches/postgres_patch.rb
|
191
|
-
- lib/evasion-db/idmef-fetchers/prelude-db/lib/prelude_event_fetcher.rb
|
192
|
-
- lib/evasion-db/idmef-fetchers/test-fetcher/fetcher.rb
|
193
|
-
- lib/evasion-db/idmef-fetchers/test-fetcher/lib/test_fetcher.rb
|
194
|
-
- lib/evasion-db/knowledge.rb
|
195
|
-
- lib/evasion-db/knowledge/attack_module.rb
|
196
|
-
- lib/evasion-db/knowledge/attack_option.rb
|
197
|
-
- lib/evasion-db/knowledge/attack_payload.rb
|
198
|
-
- lib/evasion-db/knowledge/connection.rb
|
199
|
-
- lib/evasion-db/knowledge/idmef_event.rb
|
200
|
-
- lib/evasion-db/knowledge/packet.rb
|
201
|
-
- lib/evasion-db/log_matches_helper.rb
|
202
|
-
- lib/evasion-db/recorders/msf-recorder/lib/msf-recorder.rb
|
203
|
-
- lib/evasion-db/recorders/msf-recorder/recorder.rb
|
204
|
-
- lib/evasion-db/recorders/recorders.rb
|
205
|
-
- lib/evasion-db/version.rb
|
206
|
-
- lib/fidius-evasiondb.rb
|
207
|
-
- lib/msf-plugins/database.yml.example
|
208
|
-
- lib/msf-plugins/evasiondb.rb
|
209
|
-
- README.md
|
210
|
-
- LICENSE
|
211
|
-
- CREDITS.md
|
212
|
-
require_paths:
|
164
|
+
rdoc_options: []
|
165
|
+
require_paths:
|
213
166
|
- lib
|
214
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
167
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
215
168
|
none: false
|
216
|
-
requirements:
|
217
|
-
- -
|
218
|
-
- !ruby/object:Gem::Version
|
219
|
-
|
220
|
-
|
221
|
-
version: "0"
|
222
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ! '>='
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
174
|
none: false
|
224
|
-
requirements:
|
225
|
-
- -
|
226
|
-
- !ruby/object:Gem::Version
|
227
|
-
|
228
|
-
- 0
|
229
|
-
version: "0"
|
175
|
+
requirements:
|
176
|
+
- - ! '>='
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '0'
|
230
179
|
requirements: []
|
231
|
-
|
232
|
-
|
233
|
-
rubygems_version: 1.3.7
|
180
|
+
rubyforge_project: ''
|
181
|
+
rubygems_version: 1.8.11
|
234
182
|
signing_key:
|
235
183
|
specification_version: 3
|
236
|
-
summary: The FIDIUS EvasionDB Gem provides a database which contains knowledge about
|
184
|
+
summary: The FIDIUS EvasionDB Gem provides a database which contains knowledge about
|
185
|
+
metasploit exploits and their corresponding alerts/events produced by intrusion
|
186
|
+
detection systems (IDS).
|
237
187
|
test_files: []
|
238
|
-
|
188
|
+
has_rdoc:
|