wepawet 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +17 -0
- data/Gemfile +3 -13
- data/LICENSE.txt +3 -1
- data/{README.rdoc → README.md} +25 -16
- data/Rakefile +7 -49
- data/bin/wepawet +1 -6
- data/lib/wepawet.rb +116 -1
- data/lib/wepawet/version.rb +3 -0
- data/test/helper.rb +1 -17
- data/test/test_wepawet.rb +11 -4
- data/wepawet.gemspec +24 -75
- metadata +106 -179
- metadata.gz.sig +0 -0
- data/.document +0 -5
- data/Gemfile.lock +0 -24
- data/VERSION +0 -1
- data/lib/wepawet/wepawet.rb +0 -115
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0270f5d735bd077fe47c04eb722ca1e1c1737dc0
|
4
|
+
data.tar.gz: f4814589bc399e38516eae93bdbeab8aa45637de
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2e4b42fffb14d295f47742cdaf33abc4e2470978f37f62de1dcf99bef7fadbd19715621f62f1e54472075d2097d980273cfb49180c9f28225bd398484841099e
|
7
|
+
data.tar.gz: ebab4e4ec1bdb3e5989eda1ee2be92c229450e469d234940ec17c18da6499c010450ba4eb9fe09d8f11025ff6f38b59551d3cc28a1adafef3fbf88a54538154a
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.gitignore
ADDED
data/Gemfile
CHANGED
@@ -1,14 +1,4 @@
|
|
1
|
-
source
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
gem "multipart-post", ">= 1.1.0"
|
5
|
-
gem "libxml-ruby", ">= 1.1.4"
|
1
|
+
source 'https://rubygems.org'
|
6
2
|
|
7
|
-
#
|
8
|
-
|
9
|
-
group :development do
|
10
|
-
gem "shoulda", ">= 0"
|
11
|
-
gem "bundler", "~> 1.0.0"
|
12
|
-
gem "jeweler", "~> 1.5.2"
|
13
|
-
gem "rcov", ">= 0"
|
14
|
-
end
|
3
|
+
# Specify your gem's dependencies in wepawet.gemspec
|
4
|
+
gemspec
|
data/LICENSE.txt
CHANGED
data/{README.rdoc → README.md}
RENAMED
@@ -1,9 +1,26 @@
|
|
1
|
-
|
1
|
+
# Wepawet
|
2
2
|
|
3
3
|
This gem provides an interface to UCSB's wepawet malicious URL analysis project
|
4
4
|
Wepawet is a service for detecting and analyzing web-based malware. It currently handles Flash, JavaScript, and PDF files. http://wepawet.cs.ucsb.edu
|
5
5
|
|
6
|
-
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
gem 'wepawet'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install wepawet
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
require 'wepawet'
|
23
|
+
|
7
24
|
config = {
|
8
25
|
'wepawetSubmitUrl' => 'http://wepawet.cs.ucsb.edu/services/upload.php',
|
9
26
|
'wepawetQueryUrl' => 'http://wepawet.cs.ucsb.edu/services/query.php',
|
@@ -20,18 +37,10 @@ Example usage:
|
|
20
37
|
resp = q.by_url("http://example.com")
|
21
38
|
# => {"url"=>"http://example.com", "benign"=>"http://wepawet.cs.ucsb.edu/view.php?hash=a9b9f04336ce0181a08e774e01113b31&t=1303679363&type=js"}
|
22
39
|
|
23
|
-
|
24
|
-
|
25
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
26
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
27
|
-
* Fork the project
|
28
|
-
* Start a feature/bugfix branch
|
29
|
-
* Commit and push until you are happy with your contribution
|
30
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
31
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
32
|
-
|
33
|
-
== Copyright
|
34
|
-
|
35
|
-
Copyright (c) 2011 Chris Lee. See LICENSE.txt for
|
36
|
-
further details.
|
40
|
+
## Contributing
|
37
41
|
|
42
|
+
1. Fork it
|
43
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
44
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
45
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
46
|
+
5. Create new Pull Request
|
data/Rakefile
CHANGED
@@ -1,54 +1,12 @@
|
|
1
|
-
|
2
|
-
require
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'rake'
|
11
|
-
|
12
|
-
require 'jeweler'
|
13
|
-
Jeweler::Tasks.new do |gem|
|
14
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
-
gem.name = "wepawet"
|
16
|
-
gem.homepage = "http://github.com/chrislee35/wepawet"
|
17
|
-
gem.license = "MIT"
|
18
|
-
gem.summary = %Q{provides an interface to UCSB's wepawet malicious URL analysis project}
|
19
|
-
gem.description = %Q{Wepawet is a service for detecting and analyzing web-based malware. It currently handles Flash, JavaScript, and PDF files. http://wepawet.cs.ucsb.edu}
|
20
|
-
gem.email = "rubygems@chrislee.dhs.org"
|
21
|
-
gem.authors = ["Chris Lee"]
|
22
|
-
gem.add_runtime_dependency "multipart-post", ">= 1.1.0"
|
23
|
-
gem.add_runtime_dependency "libxml-ruby", ">= 1.1.4"
|
24
|
-
gem.executables = ["wepawet"]
|
25
|
-
gem.signing_key = "#{File.dirname(__FILE__)}/../gem-private_key.pem"
|
26
|
-
gem.cert_chain = ["#{File.dirname(__FILE__)}/../gem-public_cert.pem"]
|
27
|
-
end
|
28
|
-
Jeweler::RubygemsDotOrgTasks.new
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require "bundler/gem_tasks"
|
29
3
|
|
30
4
|
require 'rake/testtask'
|
31
|
-
Rake::TestTask.new(:test) do |test|
|
32
|
-
test.libs << 'lib' << 'test'
|
33
|
-
test.pattern = 'test/**/test_*.rb'
|
34
|
-
test.verbose = true
|
35
|
-
end
|
36
5
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
test.verbose = true
|
6
|
+
Rake::TestTask.new do |t|
|
7
|
+
t.libs << 'lib'
|
8
|
+
t.test_files = FileList['test/test_*.rb']
|
9
|
+
t.verbose = true
|
42
10
|
end
|
43
11
|
|
44
|
-
task :default => :test
|
45
|
-
|
46
|
-
require 'rake/rdoctask'
|
47
|
-
Rake::RDocTask.new do |rdoc|
|
48
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
49
|
-
|
50
|
-
rdoc.rdoc_dir = 'rdoc'
|
51
|
-
rdoc.title = "wepawet #{version}"
|
52
|
-
rdoc.rdoc_files.include('README*')
|
53
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
|
-
end
|
12
|
+
task :default => :test
|
data/bin/wepawet
CHANGED
data/lib/wepawet.rb
CHANGED
@@ -1 +1,116 @@
|
|
1
|
-
require
|
1
|
+
require "wepawet/version"
|
2
|
+
require 'net/http'
|
3
|
+
require 'net/https'
|
4
|
+
require 'uri'
|
5
|
+
require 'net/http/post/multipart'
|
6
|
+
require 'xml'
|
7
|
+
require 'cgi'
|
8
|
+
|
9
|
+
# The Wepawet module contains all the query and submission classes for wepawet
|
10
|
+
module Wepawet
|
11
|
+
|
12
|
+
# Wepawet::Submit is used to submit new files and/or URLs into the wepawet system.
|
13
|
+
class Submit
|
14
|
+
def initialize(config = {
|
15
|
+
'wepawetSubmitUrl' => 'http://wepawet.cs.ucsb.edu/services/upload.php',
|
16
|
+
'wepawetQueryUrl' => 'http://wepawet.cs.ucsb.edu/services/query.php',
|
17
|
+
'wepawetDomainUrl' => 'http://wepawet.cs.ucsb.edu/services/domain.php',
|
18
|
+
'wepawetUrlUrl' => 'http://wepawet.cs.ucsb.edu/services/url.php',
|
19
|
+
})
|
20
|
+
@config = config
|
21
|
+
end
|
22
|
+
|
23
|
+
def submit_file(filename, resource_type='js')
|
24
|
+
params = {'resource_type' => resource_type}
|
25
|
+
['user','passwd','referer'].each do |opt|
|
26
|
+
params[opt] = @config[opt] if @config[opt]
|
27
|
+
end
|
28
|
+
file = File.open(filename)
|
29
|
+
params['file'] = UploadIO.new(file, "application/octet-stream", File.basename(filename))
|
30
|
+
uri = URI.parse(@config['wepawetSubmitUrl'])
|
31
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
32
|
+
http.use_ssl = (uri.scheme == 'https')
|
33
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
34
|
+
request = Net::HTTP::Post::Multipart.new(uri.path, params)
|
35
|
+
request.add_field("User-Agent", "Ruby/#{RUBY_VERSION} wepawet gem v#{Wepawet::VERSION}")
|
36
|
+
response = http.request(request)
|
37
|
+
parse_response(response.body)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Wepawet::Submit#submit_url(url) submits a new URL to the wepawet system and returns a task ID (a hash).
|
41
|
+
def submit_url(url, resource_type='js')
|
42
|
+
params = {'resource_type' => resource_type, 'url' => url}
|
43
|
+
['user','passwd','referer'].each do |opt|
|
44
|
+
params[opt] = @config[opt] if @config[opt]
|
45
|
+
end
|
46
|
+
uri = URI.parse(@config['wepawetSubmitUrl'])
|
47
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
48
|
+
http.use_ssl = (uri.scheme == 'https')
|
49
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
50
|
+
request = Net::HTTP::Post.new(uri.path)
|
51
|
+
request.set_form_data(params)
|
52
|
+
request.add_field("User-Agent", "Ruby/#{RUBY_VERSION} wepawet gem v#{Wepawet::VERSION}")
|
53
|
+
response = http.request(request)
|
54
|
+
parse_response(response.body)
|
55
|
+
end
|
56
|
+
|
57
|
+
def parse_response(doc)
|
58
|
+
xml = XML::Document.string(doc)
|
59
|
+
h = xml.find("hash")
|
60
|
+
h[0].child.to_s
|
61
|
+
rescue Exception
|
62
|
+
return nil
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
class Query
|
67
|
+
def initialize(config = {
|
68
|
+
'wepawetSubmitUrl' => 'http://wepawet.cs.ucsb.edu/services/upload.php',
|
69
|
+
'wepawetQueryUrl' => 'http://wepawet.cs.ucsb.edu/services/query.php',
|
70
|
+
'wepawetDomainUrl' => 'http://wepawet.cs.ucsb.edu/services/domain.php',
|
71
|
+
'wepawetUrlUrl' => 'http://wepawet.cs.ucsb.edu/services/url.php',
|
72
|
+
})
|
73
|
+
@config = config
|
74
|
+
end
|
75
|
+
|
76
|
+
def by_whatever(whatever, value)
|
77
|
+
params = {'resource_type' => 'js', whatever => value}
|
78
|
+
urlkey = (whatever == 'hash') ? 'wepawetQueryUrl' : (whatever == 'domain') ? 'wepawetDomainUrl' : (whatever == 'url') ? 'wepawetUrlUrl' : 'wepawetQueryUrl'
|
79
|
+
uri = URI.parse(@config[urlkey]+"?"+params.map{|k,v| "#{k}=#{v}"}.join("&"))
|
80
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
81
|
+
http.use_ssl = (uri.scheme == 'https')
|
82
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
83
|
+
request = Net::HTTP::Get.new(uri.path+"?"+uri.query)
|
84
|
+
request.add_field("User-Agent", "Ruby/#{RUBY_VERSION} wepawet gem v#{Wepawet::VERSION}")
|
85
|
+
response = http.request(request)
|
86
|
+
_parse_response(response.body)
|
87
|
+
end
|
88
|
+
|
89
|
+
def by_taskid(taskid)
|
90
|
+
by_whatever('hash',taskid)
|
91
|
+
end
|
92
|
+
|
93
|
+
alias :by_hash :by_taskid
|
94
|
+
|
95
|
+
def by_domain(domain)
|
96
|
+
by_whatever('domain',domain)
|
97
|
+
end
|
98
|
+
|
99
|
+
def by_url(url)
|
100
|
+
by_whatever('url', CGI.escape(url))
|
101
|
+
end
|
102
|
+
|
103
|
+
def _parse_response(doc)
|
104
|
+
xml = XML::Document.string(doc)
|
105
|
+
hash = {}
|
106
|
+
xml.child.children.each do |node|
|
107
|
+
if node.name =~ /\w/ and node.child
|
108
|
+
hash[node.name] = node.child.content
|
109
|
+
end
|
110
|
+
end
|
111
|
+
hash
|
112
|
+
rescue Exception
|
113
|
+
return nil
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
data/test/helper.rb
CHANGED
@@ -1,18 +1,2 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
1
|
require 'test/unit'
|
11
|
-
require '
|
12
|
-
|
13
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
14
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
-
require 'wepawet'
|
16
|
-
|
17
|
-
class Test::Unit::TestCase
|
18
|
-
end
|
2
|
+
require File.expand_path('../../lib/wepawet.rb', __FILE__)
|
data/test/test_wepawet.rb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
unless Kernel.respond_to?(:require_relative)
|
2
|
+
module Kernel
|
3
|
+
def require_relative(path)
|
4
|
+
require File.join(File.dirname(caller[0]), path.to_str)
|
5
|
+
end
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
require_relative 'helper'
|
10
|
+
|
3
11
|
class TestWepawet < Test::Unit::TestCase
|
4
|
-
|
12
|
+
def test_submit_example_com_for_analysis
|
5
13
|
config = {
|
6
14
|
'wepawetSubmitUrl' => 'http://wepawet.cs.ucsb.edu/services/upload.php',
|
7
15
|
'wepawetQueryUrl' => 'http://wepawet.cs.ucsb.edu/services/query.php',
|
@@ -17,7 +25,6 @@ class TestWepawet < Test::Unit::TestCase
|
|
17
25
|
sleep 2
|
18
26
|
resp = q.by_taskid(hash)
|
19
27
|
end while resp['status'] == 'queued'
|
20
|
-
pp resp
|
21
28
|
resp = q.by_taskid(hash)
|
22
29
|
assert("http://example.com", resp['url'])
|
23
30
|
assert("benign", resp['result'])
|
data/wepawet.gemspec
CHANGED
@@ -1,80 +1,29 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'wepawet/version'
|
5
5
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "wepawet"
|
8
|
+
spec.version = Wepawet::VERSION
|
9
|
+
spec.authors = ["chrislee35"]
|
10
|
+
spec.email = ["rubygems@chrislee.dhs.org"]
|
11
|
+
spec.description = %q{Wepawet is a service for detecting and analyzing web-based malware. It currently handles Flash, JavaScript, and PDF files. http://wepawet.cs.ucsb.edu}
|
12
|
+
spec.summary = %q{provides an interface to UCSB's wepawet malicious URL analysis project}
|
13
|
+
spec.homepage = "http://github.com/chrislee35/wepawet"
|
14
|
+
spec.license = "MIT"
|
9
15
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
s.description = %q{Wepawet is a service for detecting and analyzing web-based malware. It currently handles Flash, JavaScript, and PDF files. http://wepawet.cs.ucsb.edu}
|
15
|
-
s.email = %q{rubygems@chrislee.dhs.org}
|
16
|
-
s.executables = ["wepawet"]
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"LICENSE.txt",
|
19
|
-
"README.rdoc"
|
20
|
-
]
|
21
|
-
s.files = [
|
22
|
-
".document",
|
23
|
-
"Gemfile",
|
24
|
-
"Gemfile.lock",
|
25
|
-
"LICENSE.txt",
|
26
|
-
"README.rdoc",
|
27
|
-
"Rakefile",
|
28
|
-
"VERSION",
|
29
|
-
"bin/wepawet",
|
30
|
-
"lib/wepawet.rb",
|
31
|
-
"lib/wepawet/wepawet.rb",
|
32
|
-
"test/helper.rb",
|
33
|
-
"test/test_wepawet.rb",
|
34
|
-
"wepawet.gemspec"
|
35
|
-
]
|
36
|
-
s.homepage = %q{http://github.com/chrislee35/wepawet}
|
37
|
-
s.licenses = ["MIT"]
|
38
|
-
s.require_paths = ["lib"]
|
39
|
-
s.rubygems_version = %q{1.7.2}
|
40
|
-
s.signing_key = %q{/Users/chris/Documents/projects/rubygems/wepawet/../gem-private_key.pem}
|
41
|
-
s.summary = %q{provides an interface to UCSB's wepawet malicious URL analysis project}
|
42
|
-
s.test_files = [
|
43
|
-
"test/helper.rb",
|
44
|
-
"test/test_wepawet.rb"
|
45
|
-
]
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
46
20
|
|
47
|
-
|
48
|
-
|
21
|
+
spec.add_runtime_dependency "multipart-post", ">= 1.1.0"
|
22
|
+
spec.add_runtime_dependency "libxml-ruby", ">= 1.1.4"
|
23
|
+
spec.add_runtime_dependency "configparser", "~> 0.1.1"
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
25
|
+
spec.add_development_dependency "rake"
|
49
26
|
|
50
|
-
|
51
|
-
|
52
|
-
s.add_runtime_dependency(%q<libxml-ruby>, [">= 1.1.4"])
|
53
|
-
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
54
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
55
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
56
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
57
|
-
s.add_runtime_dependency(%q<multipart-post>, [">= 1.1.0"])
|
58
|
-
s.add_runtime_dependency(%q<libxml-ruby>, [">= 1.1.4"])
|
59
|
-
else
|
60
|
-
s.add_dependency(%q<multipart-post>, [">= 1.1.0"])
|
61
|
-
s.add_dependency(%q<libxml-ruby>, [">= 1.1.4"])
|
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<multipart-post>, [">= 1.1.0"])
|
67
|
-
s.add_dependency(%q<libxml-ruby>, [">= 1.1.4"])
|
68
|
-
end
|
69
|
-
else
|
70
|
-
s.add_dependency(%q<multipart-post>, [">= 1.1.0"])
|
71
|
-
s.add_dependency(%q<libxml-ruby>, [">= 1.1.4"])
|
72
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
73
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
74
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
75
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
76
|
-
s.add_dependency(%q<multipart-post>, [">= 1.1.0"])
|
77
|
-
s.add_dependency(%q<libxml-ruby>, [">= 1.1.4"])
|
78
|
-
end
|
27
|
+
spec.signing_key = "#{File.dirname(__FILE__)}/../gem-private_key.pem"
|
28
|
+
spec.cert_chain = ["#{File.dirname(__FILE__)}/../gem-public_cert.pem"]
|
79
29
|
end
|
80
|
-
|
metadata
CHANGED
@@ -1,224 +1,151 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: wepawet
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 3
|
10
|
-
version: 0.1.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.5
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
13
|
-
-
|
6
|
+
authors:
|
7
|
+
- chrislee35
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
|
-
cert_chain:
|
10
|
+
cert_chain:
|
17
11
|
- |
|
18
12
|
-----BEGIN CERTIFICATE-----
|
19
13
|
MIIDYjCCAkqgAwIBAgIBADANBgkqhkiG9w0BAQUFADBXMREwDwYDVQQDDAhydWJ5
|
20
14
|
Z2VtczEYMBYGCgmSJomT8ixkARkWCGNocmlzbGVlMRMwEQYKCZImiZPyLGQBGRYD
|
21
|
-
|
22
|
-
|
15
|
+
ZGhzMRMwEQYKCZImiZPyLGQBGRYDb3JnMB4XDTEzMDUyMjEyNTk0N1oXDTE0MDUy
|
16
|
+
MjEyNTk0N1owVzERMA8GA1UEAwwIcnVieWdlbXMxGDAWBgoJkiaJk/IsZAEZFghj
|
23
17
|
aHJpc2xlZTETMBEGCgmSJomT8ixkARkWA2RoczETMBEGCgmSJomT8ixkARkWA29y
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
18
|
+
ZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANcPrx8BZiWIR9xWWG8I
|
19
|
+
tqR538tS1t+UJ4FZFl+1vrtU9TiuWX3Vj37TwUpa2fFkziK0n5KupVThyEhcem5m
|
20
|
+
OGRjvgrRFbWQJSSscIKOpwqURHVKRpV9gVz/Hnzk8S+xotUR1Buo3Ugr+I1jHewD
|
21
|
+
Cgr+y+zgZbtjtHsJtsuujkOcPhEjjUinj68L9Fz9BdeJQt+IacjwAzULix6jWCht
|
22
|
+
Uc+g+0z8Esryca2G6I1GsrgX6WHw8dykyQDT9dCtS2flCOwSC1R0K5T/xHW54f+5
|
23
|
+
wcw8mm53KLNe+tmgVC6ZHyME+qJsBnP6uxF0aTEnGA/jDBQDhQNTF0ZP/abzyTsL
|
24
|
+
zjUCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFO8w
|
25
|
+
+aeP7T6kVJblCg6eusOII9DfMA0GCSqGSIb3DQEBBQUAA4IBAQBCQyRJLXsBo2Fy
|
26
|
+
8W6e/W4RemQRrlAw9DK5O6U71JtedVob2oq+Ob+zmS+PifE2+L+3RiJ2H6VTlOzi
|
27
|
+
x+A061MUXhGraqVq4J2FC8kt4EQywAD0P0Ta5GU24CGSF08Y3GkJy1Sa4XqTC2YC
|
28
|
+
o51s7JP+tkCCtpVYSdzJhTllieRAWBpGV1dtaoeUKE6tYPMBkosxSRcVGczk/Sc3
|
29
|
+
7eQCpexYy9JlUBI9u3BqIY9E+l+MSn8ihXSPmyK0DgrhaCu+voaSFVOX6Y+B5qbo
|
30
|
+
jLXMQu2ZgISYwXNjNbGVHehut82U7U9oiHoWcrOGazaRUmGO9TXP+aJLH0gw2dcK
|
31
|
+
AfMglXPi
|
38
32
|
-----END CERTIFICATE-----
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
44
|
-
none: false
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
hash: 19
|
49
|
-
segments:
|
50
|
-
- 1
|
51
|
-
- 1
|
52
|
-
- 0
|
53
|
-
version: 1.1.0
|
54
|
-
requirement: *id001
|
55
|
-
prerelease: false
|
33
|
+
date: 2013-06-03 00:00:00.000000000 Z
|
34
|
+
dependencies:
|
35
|
+
- !ruby/object:Gem::Dependency
|
56
36
|
name: multipart-post
|
37
|
+
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 1.1.0
|
57
42
|
type: :runtime
|
58
|
-
- !ruby/object:Gem::Dependency
|
59
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
60
|
-
none: false
|
61
|
-
requirements:
|
62
|
-
- - ">="
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
hash: 27
|
65
|
-
segments:
|
66
|
-
- 1
|
67
|
-
- 1
|
68
|
-
- 4
|
69
|
-
version: 1.1.4
|
70
|
-
requirement: *id002
|
71
43
|
prerelease: false
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 1.1.0
|
49
|
+
- !ruby/object:Gem::Dependency
|
72
50
|
name: libxml-ruby
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.1.4
|
73
56
|
type: :runtime
|
74
|
-
- !ruby/object:Gem::Dependency
|
75
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
76
|
-
none: false
|
77
|
-
requirements:
|
78
|
-
- - ">="
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
hash: 3
|
81
|
-
segments:
|
82
|
-
- 0
|
83
|
-
version: "0"
|
84
|
-
requirement: *id003
|
85
57
|
prerelease: false
|
86
|
-
|
87
|
-
|
88
|
-
-
|
89
|
-
|
90
|
-
|
91
|
-
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 1.1.4
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: configparser
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
92
67
|
- - ~>
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
|
95
|
-
|
96
|
-
- 1
|
97
|
-
- 0
|
98
|
-
- 0
|
99
|
-
version: 1.0.0
|
100
|
-
requirement: *id004
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.1.1
|
70
|
+
type: :runtime
|
101
71
|
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.1.1
|
77
|
+
- !ruby/object:Gem::Dependency
|
102
78
|
name: bundler
|
103
|
-
|
104
|
-
|
105
|
-
version_requirements: &id005 !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
|
-
requirements:
|
79
|
+
requirement: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
108
81
|
- - ~>
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
|
111
|
-
segments:
|
112
|
-
- 1
|
113
|
-
- 5
|
114
|
-
- 2
|
115
|
-
version: 1.5.2
|
116
|
-
requirement: *id005
|
117
|
-
prerelease: false
|
118
|
-
name: jeweler
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '1.3'
|
119
84
|
type: :development
|
120
|
-
- !ruby/object:Gem::Dependency
|
121
|
-
version_requirements: &id006 !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
|
-
requirements:
|
124
|
-
- - ">="
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
hash: 3
|
127
|
-
segments:
|
128
|
-
- 0
|
129
|
-
version: "0"
|
130
|
-
requirement: *id006
|
131
85
|
prerelease: false
|
132
|
-
|
86
|
+
version_requirements: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ~>
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '1.3'
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: rake
|
93
|
+
requirement: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
133
98
|
type: :development
|
134
|
-
- !ruby/object:Gem::Dependency
|
135
|
-
version_requirements: &id007 !ruby/object:Gem::Requirement
|
136
|
-
none: false
|
137
|
-
requirements:
|
138
|
-
- - ">="
|
139
|
-
- !ruby/object:Gem::Version
|
140
|
-
hash: 19
|
141
|
-
segments:
|
142
|
-
- 1
|
143
|
-
- 1
|
144
|
-
- 0
|
145
|
-
version: 1.1.0
|
146
|
-
requirement: *id007
|
147
|
-
prerelease: false
|
148
|
-
name: multipart-post
|
149
|
-
type: :runtime
|
150
|
-
- !ruby/object:Gem::Dependency
|
151
|
-
version_requirements: &id008 !ruby/object:Gem::Requirement
|
152
|
-
none: false
|
153
|
-
requirements:
|
154
|
-
- - ">="
|
155
|
-
- !ruby/object:Gem::Version
|
156
|
-
hash: 27
|
157
|
-
segments:
|
158
|
-
- 1
|
159
|
-
- 1
|
160
|
-
- 4
|
161
|
-
version: 1.1.4
|
162
|
-
requirement: *id008
|
163
99
|
prerelease: false
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
100
|
+
version_requirements: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
description: Wepawet is a service for detecting and analyzing web-based malware. It
|
106
|
+
currently handles Flash, JavaScript, and PDF files. http://wepawet.cs.ucsb.edu
|
107
|
+
email:
|
108
|
+
- rubygems@chrislee.dhs.org
|
109
|
+
executables:
|
169
110
|
- wepawet
|
170
111
|
extensions: []
|
171
|
-
|
172
|
-
|
173
|
-
-
|
174
|
-
- README.rdoc
|
175
|
-
files:
|
176
|
-
- .document
|
112
|
+
extra_rdoc_files: []
|
113
|
+
files:
|
114
|
+
- .gitignore
|
177
115
|
- Gemfile
|
178
|
-
- Gemfile.lock
|
179
116
|
- LICENSE.txt
|
180
|
-
- README.
|
117
|
+
- README.md
|
181
118
|
- Rakefile
|
182
|
-
- VERSION
|
183
119
|
- bin/wepawet
|
184
120
|
- lib/wepawet.rb
|
185
|
-
- lib/wepawet/
|
121
|
+
- lib/wepawet/version.rb
|
186
122
|
- test/helper.rb
|
187
123
|
- test/test_wepawet.rb
|
188
124
|
- wepawet.gemspec
|
189
125
|
homepage: http://github.com/chrislee35/wepawet
|
190
|
-
licenses:
|
126
|
+
licenses:
|
191
127
|
- MIT
|
128
|
+
metadata: {}
|
192
129
|
post_install_message:
|
193
130
|
rdoc_options: []
|
194
|
-
|
195
|
-
require_paths:
|
131
|
+
require_paths:
|
196
132
|
- lib
|
197
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
none: false
|
208
|
-
requirements:
|
209
|
-
- - ">="
|
210
|
-
- !ruby/object:Gem::Version
|
211
|
-
hash: 3
|
212
|
-
segments:
|
213
|
-
- 0
|
214
|
-
version: "0"
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
215
143
|
requirements: []
|
216
|
-
|
217
144
|
rubyforge_project:
|
218
|
-
rubygems_version:
|
145
|
+
rubygems_version: 2.0.3
|
219
146
|
signing_key:
|
220
|
-
specification_version:
|
147
|
+
specification_version: 4
|
221
148
|
summary: provides an interface to UCSB's wepawet malicious URL analysis project
|
222
|
-
test_files:
|
149
|
+
test_files:
|
223
150
|
- test/helper.rb
|
224
151
|
- test/test_wepawet.rb
|
metadata.gz.sig
CHANGED
Binary file
|
data/.document
DELETED
data/Gemfile.lock
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
git (1.2.5)
|
5
|
-
jeweler (1.5.2)
|
6
|
-
bundler (~> 1.0.0)
|
7
|
-
git (>= 1.2.5)
|
8
|
-
rake
|
9
|
-
libxml-ruby (1.1.4)
|
10
|
-
multipart-post (1.1.0)
|
11
|
-
rake (0.8.7)
|
12
|
-
rcov (0.9.9)
|
13
|
-
shoulda (2.11.3)
|
14
|
-
|
15
|
-
PLATFORMS
|
16
|
-
ruby
|
17
|
-
|
18
|
-
DEPENDENCIES
|
19
|
-
bundler (~> 1.0.0)
|
20
|
-
jeweler (~> 1.5.2)
|
21
|
-
libxml-ruby (>= 1.1.4)
|
22
|
-
multipart-post (>= 1.1.0)
|
23
|
-
rcov
|
24
|
-
shoulda
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.1.3
|
data/lib/wepawet/wepawet.rb
DELETED
@@ -1,115 +0,0 @@
|
|
1
|
-
require 'net/http'
|
2
|
-
require 'net/https'
|
3
|
-
require 'uri'
|
4
|
-
require 'net/http/post/multipart'
|
5
|
-
require 'xml'
|
6
|
-
require 'cgi'
|
7
|
-
|
8
|
-
# The Wepawet module contains all the query and submission classes for wepawet
|
9
|
-
module Wepawet
|
10
|
-
|
11
|
-
# Wepawet::Submit is used to submit new files and/or URLs into the wepawet system.
|
12
|
-
class Submit
|
13
|
-
def initialize(config = {
|
14
|
-
'wepawetSubmitUrl' => 'http://wepawet.cs.ucsb.edu/services/upload.php',
|
15
|
-
'wepawetQueryUrl' => 'http://wepawet.cs.ucsb.edu/services/query.php',
|
16
|
-
'wepawetDomainUrl' => 'http://wepawet.cs.ucsb.edu/services/domain.php',
|
17
|
-
'wepawetUrlUrl' => 'http://wepawet.cs.ucsb.edu/services/url.php',
|
18
|
-
})
|
19
|
-
@config = config
|
20
|
-
end
|
21
|
-
|
22
|
-
def submit_file(filename, resource_type='js')
|
23
|
-
params = {'resource_type' => resource_type}
|
24
|
-
['user','passwd','referer'].each do |opt|
|
25
|
-
params[opt] = @config[opt] if @config[opt]
|
26
|
-
end
|
27
|
-
file = File.open(filename)
|
28
|
-
params['file'] = UploadIO.new(file, "application/octet-stream", File.basename(filename))
|
29
|
-
uri = URI.parse(@config['wepawetSubmitUrl'])
|
30
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
31
|
-
http.use_ssl = (uri.scheme == 'https')
|
32
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
33
|
-
request = Net::HTTP::Post::Multipart.new(uri.path, params)
|
34
|
-
request.add_field("User-Agent", "Ruby/#{RUBY_VERSION} wepawet gem (https://github.com/chrislee35/wepawet)")
|
35
|
-
response = http.request(request)
|
36
|
-
parse_response(response.body)
|
37
|
-
end
|
38
|
-
|
39
|
-
# Wepawet::Submit#submit_url(url) submits a new URL to the wepawet system and returns a task ID (a hash).
|
40
|
-
def submit_url(url, resource_type='js')
|
41
|
-
params = {'resource_type' => resource_type, 'url' => url}
|
42
|
-
['user','passwd','referer'].each do |opt|
|
43
|
-
params[opt] = @config[opt] if @config[opt]
|
44
|
-
end
|
45
|
-
uri = URI.parse(@config['wepawetSubmitUrl'])
|
46
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
47
|
-
http.use_ssl = (uri.scheme == 'https')
|
48
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
49
|
-
request = Net::HTTP::Post.new(uri.path)
|
50
|
-
request.set_form_data(params)
|
51
|
-
request.add_field("User-Agent", "Ruby/#{RUBY_VERSION} wepawet gem (https://github.com/chrislee35/wepawet)")
|
52
|
-
response = http.request(request)
|
53
|
-
parse_response(response.body)
|
54
|
-
end
|
55
|
-
|
56
|
-
def parse_response(doc)
|
57
|
-
xml = XML::Document.string(doc)
|
58
|
-
h = xml.find("hash")
|
59
|
-
h[0].child.to_s
|
60
|
-
rescue Exception
|
61
|
-
return nil
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
class Query
|
66
|
-
def initialize(config = {
|
67
|
-
'wepawetSubmitUrl' => 'http://wepawet.cs.ucsb.edu/services/upload.php',
|
68
|
-
'wepawetQueryUrl' => 'http://wepawet.cs.ucsb.edu/services/query.php',
|
69
|
-
'wepawetDomainUrl' => 'http://wepawet.cs.ucsb.edu/services/domain.php',
|
70
|
-
'wepawetUrlUrl' => 'http://wepawet.cs.ucsb.edu/services/url.php',
|
71
|
-
})
|
72
|
-
@config = config
|
73
|
-
end
|
74
|
-
|
75
|
-
def by_whatever(whatever, value)
|
76
|
-
params = {'resource_type' => 'js', whatever => value}
|
77
|
-
urlkey = (whatever == 'hash') ? 'wepawetQueryUrl' : (whatever == 'domain') ? 'wepawetDomainUrl' : (whatever == 'url') ? 'wepawetUrlUrl' : 'wepawetQueryUrl'
|
78
|
-
uri = URI.parse(@config[urlkey]+"?"+params.map{|k,v| "#{k}=#{v}"}.join("&"))
|
79
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
80
|
-
http.use_ssl = (uri.scheme == 'https')
|
81
|
-
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
82
|
-
request = Net::HTTP::Get.new(uri.path+"?"+uri.query)
|
83
|
-
request.add_field("User-Agent", "Ruby/#{RUBY_VERSION} wepawet gem (https://github.com/chrislee35/wepawet)")
|
84
|
-
response = http.request(request)
|
85
|
-
_parse_response(response.body)
|
86
|
-
end
|
87
|
-
|
88
|
-
def by_taskid(taskid)
|
89
|
-
by_whatever('hash',taskid)
|
90
|
-
end
|
91
|
-
|
92
|
-
alias :by_hash :by_taskid
|
93
|
-
|
94
|
-
def by_domain(domain)
|
95
|
-
by_whatever('domain',domain)
|
96
|
-
end
|
97
|
-
|
98
|
-
def by_url(url)
|
99
|
-
by_whatever('url', CGI.escape(url))
|
100
|
-
end
|
101
|
-
|
102
|
-
def _parse_response(doc)
|
103
|
-
xml = XML::Document.string(doc)
|
104
|
-
hash = {}
|
105
|
-
xml.child.children.each do |node|
|
106
|
-
if node.name =~ /\w/ and node.child
|
107
|
-
hash[node.name] = node.child.content
|
108
|
-
end
|
109
|
-
end
|
110
|
-
hash
|
111
|
-
rescue Exception
|
112
|
-
return nil
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|