clamby 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1693cf1781ac3eaead9999bd4aa25a0e0fb64f28
4
+ data.tar.gz: 9b93c18f81c7d06c1ade22065ba6e12f48eef4a0
5
+ SHA512:
6
+ metadata.gz: 4294bb0849e9da0a7db332305a43844018756c4b4e8f7a704e0a6a633f67d9bc66d04137c91ce6ae808108af41f6479774d789e029171810f6c66192c7103f45
7
+ data.tar.gz: 36c019f99df0504b0a812b1a9f4f48443c514d09c51fee9380041ad57868d78c9e187cb22b4a90b417b561dc49dd972f5893cbfeb6d17c8d926f165b8d3a5682
@@ -0,0 +1,17 @@
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
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in clamby.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 kobaltz
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.
@@ -0,0 +1,36 @@
1
+ # Clamby
2
+
3
+ This gem depends on the `clamscan` and `freshclam` daemons to be installed already.
4
+
5
+ If you have a file upload on your site and you do not scan the files for viruses then you not only compromise your software, but also the users of the software and their files. This gem's function is to simply scan a given file.
6
+
7
+ #Configuration
8
+
9
+ Configuration is rather limited right now. You can exclude the check if `clamscan` exists which will save a bunch of time for scanning your files. However, for development purposes, your machine may not have `clamscan` installed and you may wonder why it's not working properly. This is just to give you a reminder to install `clamscan` on your development machine and production machine. You can add the following to a config file, `clamby_setup.rb` to your initializers directory.
10
+
11
+ Clamby.configure do |config|
12
+ config.check = false
13
+ end
14
+
15
+
16
+ #Dependencies
17
+
18
+ ***Ubuntu***
19
+
20
+ `sudo apt-get install clamav`
21
+
22
+ ***Apple***
23
+
24
+ `brew install clamav`
25
+
26
+ #LICENSE
27
+
28
+ Copyright (c) 2014 kobaltz
29
+
30
+ MIT License
31
+
32
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
33
+
34
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
35
+
36
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'clamby/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "clamby"
8
+ spec.version = Clamby::VERSION
9
+ spec.authors = ["kobaltz"]
10
+ spec.email = ["dave@k-innovations.net"]
11
+ spec.summary = "Scan file uploads with ClamAV"
12
+ spec.description = "Clamby allows users to scan files uploaded with Paperclip or Carrierwave. If a file has a virus, then you can delete this file and discard it without causing harm to other users."
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
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"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,53 @@
1
+ require "clamby/version"
2
+
3
+ module Clamby
4
+
5
+ @config = {:check => true}
6
+
7
+ @valid_config_keys = @config.keys
8
+
9
+ def self.configure(opts = {})
10
+ opts.each {|k,v| @config[k.to_sym] = v if @valid_config_keys.include? k.to_sym}
11
+ end
12
+
13
+ def self.scan(path)
14
+ if self.scanner_exists?
15
+ if file_exists?(path)
16
+ scanner = system("clamscan #{path} --no-summary")
17
+ if scanner
18
+ return true
19
+ elsif not scanner
20
+ puts "VIRUS DETECTED on #{Time.now}: #{path}"
21
+ return false
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ def self.scanner_exists?
28
+ if @config[:check]
29
+ scanner = system('clamscan')
30
+ if not scanner
31
+ puts "CLAMSCAN NOT FOUND"
32
+ return false
33
+ else
34
+ return true
35
+ end
36
+ else
37
+ return true
38
+ end
39
+ end
40
+
41
+ def self.file_exists?(path)
42
+ if File.file?(path)
43
+ return true
44
+ else
45
+ puts "FILE NOT FOUND on #{Time.now}: #{path}"
46
+ return false
47
+ end
48
+ end
49
+
50
+ def self.config
51
+ @config
52
+ end
53
+ end
@@ -0,0 +1,3 @@
1
+ module Clamby
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: clamby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - kobaltz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-03-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.5'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Clamby allows users to scan files uploaded with Paperclip or Carrierwave.
42
+ If a file has a virus, then you can delete this file and discard it without causing
43
+ harm to other users.
44
+ email:
45
+ - dave@k-innovations.net
46
+ executables: []
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - ".gitignore"
51
+ - Gemfile
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - clamby.gemspec
56
+ - lib/clamby.rb
57
+ - lib/clamby/version.rb
58
+ homepage: ''
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.2.2
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Scan file uploads with ClamAV
82
+ test_files: []