wappalyzer 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/wappalyzer.rb ADDED
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "wappalyzer/version"
4
+
5
+ require 'net/http'
6
+ require 'v8'
7
+ require 'json'
8
+
9
+ Encoding.default_external = Encoding::UTF_8
10
+
11
+ module Wappalyzer
12
+ class Detector
13
+ def initialize
14
+ @realdir = File.dirname(File.realpath(__FILE__))
15
+ file = File.join(@realdir, 'apps.json')
16
+ @json = JSON.parse(IO.read(file))
17
+ @categories, @apps = @json['categories'], @json['apps']
18
+ end
19
+
20
+ def analyze(url)
21
+ uri, body, headers = URI(url), nil, {}
22
+ Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https', :open_timeout => 5) do |http|
23
+ resp = http.get(uri.request_uri)
24
+ resp.each_header{|k,v| headers[k.downcase] = v}
25
+ body = resp.body.encode('UTF-8', :invalid => :replace, :undef => :replace)
26
+ end
27
+
28
+ cxt = V8::Context.new
29
+ cxt.load File.join(@realdir, 'js', 'wappalyzer.js')
30
+ cxt.load File.join(@realdir, 'js', 'driver.js')
31
+ data = {'host' => uri.hostname, 'url' => url, 'html' => body, 'headers' => headers}
32
+ output = cxt.eval("w.apps = #{@apps.to_json}; w.categories = #{@categories.to_json}; w.driver.data = #{data.to_json}; w.driver.init();")
33
+ JSON.load(output)
34
+ end
35
+ end
36
+ end
37
+
38
+ if $0 == __FILE__
39
+ url = ARGV[0]
40
+ if url
41
+ puts JSON.pretty_generate(Wappalyzer::Detector.new.analyze(ARGV[0]))
42
+ else
43
+ puts "Usage: #{__FILE__} http://example.com"
44
+ end
45
+ end
@@ -0,0 +1,3 @@
1
+ module Wappalyzer
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'wappalyzer/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "wappalyzer"
8
+ spec.version = Wappalyzer::VERSION
9
+ spec.authors = ["pulkit21"]
10
+ spec.email = ["pulkit.ag02@gmail.com"]
11
+
12
+ spec.summary = %q{Analyzes a provided url and returns any services it can detect}
13
+ spec.description = %q{This is merely a port of the javascript parts of Wappalyzer extension for Firefox and Chrome. It analyzes a url and tries to guess what software it uses (like server software, CMS, framework, programming language).}
14
+ spec.homepage = "https://github.com/pulkit21/wappalyzer"
15
+
16
+
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency "bundler", "~> 1.11"
24
+ spec.add_dependency "rake", "~> 10.0"
25
+ spec.add_dependency "rspec", "~> 3.0"
26
+ spec.add_dependency "therubyracer", "~> 0.12.2"
27
+ end
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wappalyzer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - pulkit21
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-03-03 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.11'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: therubyracer
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.12.2
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.12.2
69
+ description: This is merely a port of the javascript parts of Wappalyzer extension
70
+ for Firefox and Chrome. It analyzes a url and tries to guess what software it uses
71
+ (like server software, CMS, framework, programming language).
72
+ email:
73
+ - pulkit.ag02@gmail.com
74
+ executables: []
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".gitignore"
79
+ - ".rspec"
80
+ - ".travis.yml"
81
+ - CODE_OF_CONDUCT.md
82
+ - Gemfile
83
+ - README.md
84
+ - Rakefile
85
+ - bin/console
86
+ - bin/setup
87
+ - lib/apps.json
88
+ - lib/js/driver.js
89
+ - lib/js/wappalyzer.js
90
+ - lib/wappalyzer.rb
91
+ - lib/wappalyzer/version.rb
92
+ - wappalyzer.gemspec
93
+ homepage: https://github.com/pulkit21/wappalyzer
94
+ licenses: []
95
+ metadata: {}
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirements: []
111
+ rubyforge_project:
112
+ rubygems_version: 2.5.1
113
+ signing_key:
114
+ specification_version: 4
115
+ summary: Analyzes a provided url and returns any services it can detect
116
+ test_files: []
117
+ has_rdoc: