-
Notifications
You must be signed in to change notification settings - Fork 2
/
rscan
123 lines (118 loc) · 2.84 KB
/
rscan
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/ruby
require 'socket'
require_relative 'src/help'
require_relative 'src/scan'
require_relative 'stats/messages'
require 'resolv'
ARG_ONE = ARGV[0]
PARSE_ONE = ARGV[1]
ARG_TWO = ARGV[2]
PARSE_TWO = ARGV[3]
ARG_THRE = ARGV[4]
PARSE_THRE = ARGV[5]
if ARG_ONE == '-h' || ARG_ONE == '--help'
print_help()
exit(0)
end
if ARG_ONE == "-d" || ARG_ONE == "--dns-resolver"
message_dns(PARSE_ONE)
url = PARSE_ONE.to_s
if not url.end_with? '/' and not url.include? 'https:'
Resolv.each_address(url) do |ip|
puts(ip)
end
end
if url.include? 'https:' and not url.end_with? '/'
a = url.tr('https://', '')
Resolv.each_address(a) do |ip|
puts(ip)
end
end
if url.end_with? '/' and url.include? 'https://'
a = url.tr('https://', '')
Resolv.each_address(a) do |ip|
puts(ip)
end
end
exit(0)
end
if ARG_ONE == '-i' || ARG_ONE == '--ip'
message_start(PARSE_ONE)
top_scan(PARSE_ONE)
exit(0)
elsif ARG_ONE == '-i' || ARG_ONE == '--ip'
if ARG_TWO == '-t' || ARG_TWO == '--timeout'
if not PARSE_TWO
puts "ERROR: Invalid argument!"
exit(0)
end
timeout = PARSE_TWO.to_i
scan_time(PARSE_ONE, timeout)
scan_timeout(PARSE_ONE, timeout)
exit(0)
end
message_start(PARSE_ONE)
top_scan(PARSE_ONE)
exit(0)
elsif ARG_ONE == '-s' || ARG_ONE == '--simple'
if ARG_TWO == '-t' || ARG_TWO == '--timeout'
timeout = PARSE_TWO.to_i
scan_time(PARSE_ONE, timeout)
scan_timeout(PARSE_ONE, timeout)
exit(0)
end
simple(PARSE_ONE)
simple_scan(PARSE_ONE)
exit(0)
elsif ARG_ONE == '-v' || ARG_ONE == '--verbose'
if(PARSE_ONE == 'true' || PARSE_ONE == 't')
if(ARG_TWO == '-i' || ARG_TWO == '--ip')
verbose_scan(PARSE_TWO)
exit(0)
else
puts "ERROR: ARGS -i || --ip REQUIRED!"
exit(0)
end
elsif(PARSE_ONE == 'false' || PARSE_ONE == 'f')
if(ARG_TWO == '-i' || ARG_TWO == '--ip')
message_start(PARSE_TWO)
top_scan(PARSE_TWO)
exit(0)
else
puts "ERROR: ARGS -i || --ip REQUIRED!"
end
else
puts "ERROR: ARGS -v || --verbose VALUE REQUIRED!"
end
elsif ARG_ONE == '-u' || ARG_ONE == '--url'
if not PARSE_ONE
puts "ERROR: ARGS -u || --url REQUIRED!"
end
url = PARSE_ONE.to_s
if not url.end_with? '/' and not url.include? 'https:'
Resolv.each_address(url) do |ip|
message_start(ip)
top_scan(ip)
end
end
if url.include? 'https:' and not url.end_with? '/'
a = url.tr('https://', '')
Resolv.each_address(a) do |ip|
message_start(ip)
top_scan(ip)
end
end
if url.end_with? '/' and url.include? 'https://'
a = url.tr('https://', '')
Resolv.each_address(a) do |ip|
message_start(ip)
top_scan(ip)
end
end
elsif ARG_ONE == '-V' || ARG_ONE == '--version'
puts "This program are in version 1.5v"
exit(0)
else
puts "Invalid ARGS"
print_help()
end