forked from d3t0n4t0r/pagescan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpagescan.rb
executable file
·83 lines (68 loc) · 1.87 KB
/
pagescan.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
77
78
79
80
81
82
83
#!/usr/bin/ruby
#
# PageScan
# by d3t0n4t0r
#
# version: 0.2
#
#
# WTFPL - Do What The Fuck You Want To Public License
# ---------------------------------------------------
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
#
basedir = __FILE__
while File.symlink?(basedir)
basedir = File.expand_path(File.readlink(basedir), File.dirname(basedir))
end
$:.unshift(File.join(File.expand_path(File.dirname(basedir))))
require 'lib/lib.rb'
require 'lib/report.rb'
require 'optparse'
PSVER = "0.1"
if __FILE__ == $0
options = {}
opts = OptionParser.new do |opts|
opts.banner = "PageScan #{PSVER} by d3t0n4t0r\n\nUsage: #{$0} [options] [url]"
opts.separator "Options:"
opts.on("-u", "--user-agent <user-agent>", "Use the specified User Agent. If not specified, default User Agent will be used") do |u|
options['user_agent'] = u
end
opts.on("-r", "--referer <referer-addr>", "Use the specified Referer Address. If not specified, default referer address will be used") do |r|
options['referer'] = r
end
opts.on("-o", "--output <txt|html>", "Specified report format for further analysis") do |o|
options['output'] = o
end
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
end
begin
opts.parse!(ARGV)
rescue OptionParser::InvalidOption
puts "Invalid option, try -h for usage"
exit
end
if ARGV[0].nil?
puts "URL not specified, try -h for usage"
exit
end
url = ARGV[0]
$url = Array.new
$time = Array.new
get_redirection(url,options)
get_iframecon(options)
case options['output']
when 'txt'
print_txt
when 'html'
print_html
else
print_txt
end
end