shadowserver 0.0.0 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/shadowserver/malware.rb +11 -8
- data/shadowserver.gemspec +77 -0
- data/test/test_shadowserver.rb +40 -1
- metadata +5 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.1.0
|
data/lib/shadowserver/malware.rb
CHANGED
@@ -22,11 +22,10 @@ module Shadowserver
|
|
22
22
|
}
|
23
23
|
end
|
24
24
|
|
25
|
-
# untested
|
26
25
|
def Malware::download(hash,filename=nil)
|
27
26
|
doc = _get("https://innocuous.shadowserver.org/api/?download=#{hash}")
|
28
27
|
raise doc.chomp if doc =~ /\! The Shadowserver Foundation: RESTRICTED ACCESS/
|
29
|
-
return nil if doc =~
|
28
|
+
return nil if doc =~ /^\! The Shadowserver Foundation:/
|
30
29
|
if filename
|
31
30
|
File.open(filename,"w") do |f|
|
32
31
|
f.write(doc)
|
@@ -35,20 +34,24 @@ module Shadowserver
|
|
35
34
|
doc
|
36
35
|
end
|
37
36
|
|
38
|
-
# untested
|
39
37
|
def Malware::avresult(hash)
|
40
38
|
doc = _get("http://innocuous.shadowserver.org/api/?avresult=#{hash}")
|
41
39
|
raise doc.chomp if doc =~ /\! The Shadowserver Foundation: RESTRICTED ACCESS/
|
42
|
-
return nil if doc =~
|
43
|
-
|
40
|
+
return nil if doc =~ /^\! The Shadowserver Foundation:/
|
41
|
+
results = {}
|
42
|
+
doc.split(/\n/).each do |l|
|
43
|
+
next if l =~ /^"name","classification"/
|
44
|
+
name, classification = l.gsub(/"/,'').split(/,/,2)
|
45
|
+
results[name] = classification
|
46
|
+
end
|
47
|
+
results
|
44
48
|
end
|
45
49
|
|
46
|
-
# untested
|
47
50
|
def Malware::ssdeep(hash)
|
48
51
|
doc = _get("http://innocuous.shadowserver.org/api/?ssdeep=#{hash}")
|
49
52
|
raise doc.chomp if doc =~ /\! The Shadowserver Foundation: RESTRICTED ACCESS/
|
50
|
-
return nil if doc =~
|
51
|
-
|
53
|
+
return nil if doc =~ /^\! The Shadowserver Foundation:/
|
54
|
+
doc.split(/\n/)
|
52
55
|
end
|
53
56
|
end
|
54
57
|
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{shadowserver}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Chris Lee"]
|
12
|
+
s.date = %q{2011-06-03}
|
13
|
+
s.description = %q{The Shadowserver Foundation is an all volunteer watchdog group of security professionals that gather, track, and report on malware, botnet activity, and electronic fraud. It is the mission of the Shadowserver Foundation to improve the security of the Internet by raising awareness of the presence of compromised servers, malicious attackers, and the spread of malware.}
|
14
|
+
s.email = %q{rubygems@chrislee.dhs.org}
|
15
|
+
s.executables = ["shadowserver_asn", "shadowserver_whitelist", "shadowserver_malware"]
|
16
|
+
s.extra_rdoc_files = [
|
17
|
+
"LICENSE.txt",
|
18
|
+
"README.rdoc"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".document",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"bin/shadowserver_asn",
|
29
|
+
"bin/shadowserver_malware",
|
30
|
+
"bin/shadowserver_whitelist",
|
31
|
+
"lib/shadowserver.rb",
|
32
|
+
"lib/shadowserver/asn.rb",
|
33
|
+
"lib/shadowserver/malware.rb",
|
34
|
+
"lib/shadowserver/whitelist.rb",
|
35
|
+
"shadowserver.gemspec",
|
36
|
+
"test/helper.rb",
|
37
|
+
"test/notepad.exe",
|
38
|
+
"test/test_shadowserver.rb"
|
39
|
+
]
|
40
|
+
s.homepage = %q{http://github.com/chrislee35/shadowserver}
|
41
|
+
s.licenses = ["MIT"]
|
42
|
+
s.require_paths = ["lib"]
|
43
|
+
s.rubygems_version = %q{1.7.2}
|
44
|
+
s.summary = %q{Queries various Shadowserver services for ASN information, malware hash lookups, and whitelist hash lookups}
|
45
|
+
s.test_files = [
|
46
|
+
"test/helper.rb",
|
47
|
+
"test/test_shadowserver.rb"
|
48
|
+
]
|
49
|
+
|
50
|
+
if s.respond_to? :specification_version then
|
51
|
+
s.specification_version = 3
|
52
|
+
|
53
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
54
|
+
s.add_runtime_dependency(%q<json>, [">= 1.4.3"])
|
55
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
57
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
58
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
59
|
+
s.add_runtime_dependency(%q<json>, [">= 1.4.3"])
|
60
|
+
else
|
61
|
+
s.add_dependency(%q<json>, [">= 1.4.3"])
|
62
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
63
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
64
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
65
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
66
|
+
s.add_dependency(%q<json>, [">= 1.4.3"])
|
67
|
+
end
|
68
|
+
else
|
69
|
+
s.add_dependency(%q<json>, [">= 1.4.3"])
|
70
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
71
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
72
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
73
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
74
|
+
s.add_dependency(%q<json>, [">= 1.4.3"])
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
data/test/test_shadowserver.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'helper'
|
2
|
+
require 'digest/md5'
|
3
|
+
require 'pp'
|
2
4
|
|
3
5
|
class TestShadowserver < Test::Unit::TestCase
|
4
6
|
should "return whitelist results for 0E53C14A3E48D94FF596A2824307B492" do
|
@@ -6,7 +8,7 @@ class TestShadowserver < Test::Unit::TestCase
|
|
6
8
|
assert_not_nil(w)
|
7
9
|
assert_equal({"source_version"=>"$version", "language"=>"English", "os_name"=>"Windows NT", "mfg_name"=>"Corel Corporation", "filesize"=>"2226", "os_version"=>"Generic", "product_name"=>"Gallery", "filename"=>"00br2026.gif", "crc32"=>"AA6A7B16", "application_type"=>"Graphic/Drawing", "source"=>"NIST", "os_mfg"=>"Microsoft", "product_version"=>"750,000"}, w)
|
8
10
|
end
|
9
|
-
|
11
|
+
|
10
12
|
should "return nil for whitelist query for 0E53C14A3E48D94FF596A2824307B493" do
|
11
13
|
w = Shadowserver::Whitelist.by_hash("0E53C14A3E48D94FF596A2824307B493")
|
12
14
|
assert_nil(w)
|
@@ -29,6 +31,43 @@ class TestShadowserver < Test::Unit::TestCase
|
|
29
31
|
assert_equal({"first_seen"=>"2010-06-15 03:09:41", "filetype"=>"exe", "avresults"=>{"TrendMicro"=>"TROJ_DLOADR.SMM", "AntiVir"=>"WORM/VB.NVA", "VirusBuster"=>"Worm.VB.FMYJ", "QuickHeal"=>"Worm.VB.at", "Clam"=>"Trojan.Downloader-50691", "VBA32"=>"Trojan.VBO.011858", "Sophos"=>"Troj/DwnLdr-HQY", "NOD32"=>"Win32/AutoRun.VB.JP", "Kaspersky"=>"Trojan.Win32.Cosmu.nyl", "Panda"=>"W32/OverDoom.A", "Vexira"=>"Trojan.DL.VB.EEDT", "G-Data"=>"Trojan.Generic.2609117", "Ikarus"=>"Trojan-Downloader.Win32.VB", "Norman"=>"Suspicious_Gen2.SKLJ", "McAfee"=>"Generic", "AVG7"=>"Downloader.Generic9.URM", "F-Secure"=>"Worm:W32/Revois.gen!A", "F-Prot6"=>"W32/Worm.BAOX", "DrWeb"=>"Win32.HLLW.Autoruner.6014", "Avast-Commercial"=>"Win32:Zbot-LRA"}, "ssdeep"=>"12288:gOqOB0v2eZJys73dOvXDpNjNe8NuMpX4aBaa48L/93zKnP6ppgg2HFZlxVPbZX:sOA2eZJ8NI8Nah8L/4PqmTVPlX", "sha1"=>"6fe80e56ad4de610304bab1675ce84d16ab6988e", "last_seen"=>"2010-06-15 03:09:41", "md5"=>"aca4aad254280d25e74c82d440b76f79"}, mr)
|
30
32
|
end
|
31
33
|
|
34
|
+
should "download malware, aca4aad254280d25e74c82d440b76f79" do
|
35
|
+
mr = Shadowserver::Malware.download("aca4aad254280d25e74c82d440b76f79")
|
36
|
+
assert_not_nil(mr)
|
37
|
+
assert_equal("aca4aad254280d25e74c82d440b76f79", Digest::MD5.hexdigest(mr))
|
38
|
+
end
|
39
|
+
|
40
|
+
should "return av results for malware, aca4aad254280d25e74c82d440b76f79" do
|
41
|
+
mr = Shadowserver::Malware.avresult("aca4aad254280d25e74c82d440b76f79")
|
42
|
+
assert_not_nil(mr)
|
43
|
+
assert_equal({"TrendMicro"=>"TROJ_DLOADR.SMM",
|
44
|
+
"AntiVir"=>"WORM/VB.NVA",
|
45
|
+
"VirusBuster"=>"Worm.VB.FMYJ",
|
46
|
+
"QuickHeal"=>"Worm.VB.at",
|
47
|
+
"Clam"=>"Trojan.Downloader-50691",
|
48
|
+
"VBA32"=>"Trojan.VBO.011858",
|
49
|
+
"Sophos"=>"Troj/DwnLdr-HQY",
|
50
|
+
"NOD32"=>"Win32/AutoRun.VB.JP",
|
51
|
+
"Kaspersky"=>"Trojan.Win32.Cosmu.nyl",
|
52
|
+
"Panda"=>"W32/OverDoom.A",
|
53
|
+
"Vexira"=>"Trojan.DL.VB.EEDT",
|
54
|
+
"G-Data"=>"Trojan.Generic.2609117",
|
55
|
+
"Ikarus"=>"Trojan-Downloader.Win32.VB",
|
56
|
+
"Norman"=>"Suspicious_Gen2.SKLJ",
|
57
|
+
"McAfee"=>"Generic",
|
58
|
+
"AVG7"=>"Downloader.Generic9.URM",
|
59
|
+
"F-Secure"=>"Worm:W32/Revois.gen!A",
|
60
|
+
"F-Prot6"=>"W32/Worm.BAOX",
|
61
|
+
"DrWeb"=>"Win32.HLLW.Autoruner.6014",
|
62
|
+
"Avast-Commercial"=>"Win32:Zbot-LRA"}, mr)
|
63
|
+
end
|
64
|
+
|
65
|
+
should "return information for ssdeep hash" do
|
66
|
+
mr = Shadowserver::Malware.ssdeep("768:iMgK0w6C07j107GjD9h73eVv+hu8XZXc7OZrxuZDJihVJvmtjP:ZZ0w70n4GjD9hbeaLXhcMxaDJQXvojP")
|
67
|
+
assert_not_nil(mr)
|
68
|
+
assert_equal(["3ae7fc35e4dd3dd1b2afe7a9a20fe8f8"], mr)
|
69
|
+
end
|
70
|
+
|
32
71
|
should "return nil for malware query for 0E53C14A3E48D94FF596A2824307B492" do
|
33
72
|
mr = Shadowserver::Malware.query("0E53C14A3E48D94FF596A2824307B492")
|
34
73
|
assert_nil(mr)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shadowserver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.0
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Chris Lee
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-03 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
@@ -135,6 +135,7 @@ files:
|
|
135
135
|
- lib/shadowserver/asn.rb
|
136
136
|
- lib/shadowserver/malware.rb
|
137
137
|
- lib/shadowserver/whitelist.rb
|
138
|
+
- shadowserver.gemspec
|
138
139
|
- test/helper.rb
|
139
140
|
- test/notepad.exe
|
140
141
|
- test/test_shadowserver.rb
|