gengiscan 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.sw?
2
+ *.gem
3
+ *.rbc
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.3@gengiscan
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # gem 'mechanize'
4
+ gem 'nokogiri'
5
+ gem 'rake', :group=>[:development, :test]
6
+ gem 'rspec', :group=>[:test]
7
+ gem 'webmock', :group=>[:test]
8
+
9
+
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Paolo Perego
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # Gengiscan
2
+
3
+ Gengiscan is a CMS fingerprinting tool using Generator meta tag and Seerver HTTP response header to tell the technology behind a CMS serving a target website.
4
+ No intrusive attacks are performed, just a plain GET using Net::HTTP standard ruby library
5
+
6
+ ## Installation
7
+
8
+ To install gengiscan gem
9
+
10
+ $ gem install gengiscan
11
+
12
+ ## Usage
13
+
14
+ Using gengiscan it's easy:
15
+
16
+ require 'gengiscan'
17
+
18
+ puts Gengiscan.new.detect("http://www.targetcms.com")[:generator]
19
+
20
+ ## Contributing
21
+
22
+ 1. Fork it
23
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
24
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
25
+ 4. Push to the branch (`git push origin my-new-feature`)
26
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
3
+ require "rspec/core/rake_task"
4
+
5
+ RSpec::Core::RakeTask.new
6
+
7
+ task :default => :spec
8
+ task :test => :spec
data/bin/gengiscan ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ require 'gengiscan'
3
+
4
+
5
+ puts Gengiscan::Engine.new(ARGV[0]).detect
6
+
data/gengiscan.gemspec ADDED
@@ -0,0 +1,17 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/gengiscan/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Paolo Perego"]
6
+ gem.email = ["thesp0nge@gmail.com"]
7
+ gem.description = %q{gengiscan is a CMS fingerprinting tool using Generator meta tag and Server HTTP response header to fingerpring a CMS used by a website}
8
+ gem.summary = %q{gengiscan is a CMS fingerprinting tool using Generator meta tag and Server HTTP response header to fingerpring a CMS used by a website}
9
+ gem.homepage = ""
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "gengiscan"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Gengiscan::VERSION
17
+ end
data/lib/gengiscan.rb ADDED
@@ -0,0 +1,5 @@
1
+
2
+ require "gengiscan/version"
3
+ require "gengiscan/engine"
4
+
5
+
@@ -0,0 +1,36 @@
1
+ require 'net/http'
2
+ require 'nokogiri'
3
+
4
+ module Gengiscan
5
+ class Engine
6
+
7
+
8
+ attr_reader :res
9
+
10
+
11
+
12
+ def initialize(url)
13
+ @uri = URI(url)
14
+
15
+ end
16
+
17
+ def detect
18
+ @res = Net::HTTP.get_response(@uri)
19
+
20
+ {:code=>@res.code, :server=>@res['Server'], :generator=>get_generator_signature} #if res == Net::HTTPOK
21
+ end
22
+
23
+ private
24
+ def get_generator_signature
25
+
26
+ generator = ""
27
+ doc=Nokogiri::HTML(@res.body)
28
+ doc.xpath("//meta[@name='generator']/@content").each do |value|
29
+ generator = value.value
30
+ end
31
+
32
+ generator
33
+ end
34
+
35
+ end
36
+ end
@@ -0,0 +1,3 @@
1
+ module Gengiscan
2
+ VERSION = "0.10.0"
3
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+ include WebMock::API
3
+
4
+ describe 'gengiscan' do
5
+ let(:g) {Gengiscan::Engine.new('http://www.test.com/index.html')}
6
+
7
+ it 'is great' do
8
+ stub_request(:get, "http://www.test.com/index.html").
9
+ with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
10
+ to_return(:status=>200, :body=>"<!DOCTYPE html><html><head><meta name=\"generator\" content=\"WordPress 2.3\" /></head><body>A test cms powered</body></html>", :headers=>{})
11
+
12
+ hash = g.detect
13
+ hash[:generator].should == "WordPress 2.3"
14
+
15
+ end
16
+ end
@@ -0,0 +1,3 @@
1
+ require 'gengiscan'
2
+ require 'webmock/rspec'
3
+
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gengiscan
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.10.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Paolo Perego
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-12 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: gengiscan is a CMS fingerprinting tool using Generator meta tag and Server
15
+ HTTP response header to fingerpring a CMS used by a website
16
+ email:
17
+ - thesp0nge@gmail.com
18
+ executables:
19
+ - gengiscan
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - .gitignore
24
+ - .rvmrc
25
+ - Gemfile
26
+ - LICENSE
27
+ - README.md
28
+ - Rakefile
29
+ - bin/gengiscan
30
+ - gengiscan.gemspec
31
+ - lib/gengiscan.rb
32
+ - lib/gengiscan/engine.rb
33
+ - lib/gengiscan/version.rb
34
+ - spec/gengiscan_spec.rb
35
+ - spec/spec_helper.rb
36
+ homepage: ''
37
+ licenses: []
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ segments:
49
+ - 0
50
+ hash: 2616998851965209666
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubyforge_project:
59
+ rubygems_version: 1.8.24
60
+ signing_key:
61
+ specification_version: 3
62
+ summary: gengiscan is a CMS fingerprinting tool using Generator meta tag and Server
63
+ HTTP response header to fingerpring a CMS used by a website
64
+ test_files:
65
+ - spec/gengiscan_spec.rb
66
+ - spec/spec_helper.rb