-
Notifications
You must be signed in to change notification settings - Fork 47
/
fingerprinter.rb
executable file
·76 lines (60 loc) · 1.8 KB
/
fingerprinter.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'bundler' # Fixes Bundler issue with Ruby 2.6.1, see https://www.reddit.com/r/ruby/comments/an5bfk/requiring_bundlersetup_gets_wrong_version_of/
require 'bundler/setup'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
require 'helper'
require 'fingerprinters'
begin
require 'cli_options'
if @options[:update_all]
(SUPPORTED_APPS - %w[wordpress-plugin wordpress-theme]).each do |app|
begin
puts "Updating #{app}:"
Fingerprinter.load(app, @options).auto_update(display_skipped: false)
rescue StandardError => e
puts "An error occured: #{e.message}, skipping the app"
ensure
puts
end
end
exit(1)
end
raise 'No app-name supplied' unless @options[:app]
Typhoeus::Config.user_agent = @options[:user_agent]
f = Fingerprinter.load(@options[:app], @options)
if f.respond_to?(:experimental?)
puts
puts 'This Fingerprinter has not been tested on a real target yet.'
puts 'Please report any working options or issues'
puts
end
if @options[:update]
if @options[:manual]
f.manual_update(@options)
else
f.auto_update
end
end
if @options[:list_versions]
f.list_versions
exit(1)
end
if @options[:list_files]
f.list_files(@options[:list_files])
exit(1)
end
f.list_unique_fingerprints(@options[:list_unique_fingerprints]) if @options[:list_unique_fingerprints]
f.search_hash(@options[:hash]) if @options[:hash]
f.search_file(@options[:file]) if @options[:file]
if @options[:target]
if @options[:passive]
f.passive_fingerprint(@options[:target], @options)
else
f.fingerprint(@options[:target], @options)
end
end
rescue StandardError => e
puts e.message
puts e.backtrace.join("\n")
end