-
Notifications
You must be signed in to change notification settings - Fork 0
/
scanner2.rb
58 lines (51 loc) · 1.39 KB
/
scanner2.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
#!/usr/bin/env ruby
def display_menu
puts "\nSelect a tool to run:"
puts "1. Nmap"
puts "2. Nikto"
puts "3. DirBuster"
puts "4. GoBuster"
puts "5. SQLMap"
puts "6. Exit"
end
def handle_choice(choice, target)
case choice
when 1
execute_command("nmap", target, "Optional Nmap parameters (just hit enter for default):")
when 2
execute_command("nikto -h", target)
when 3
execute_command("REPLACE WITH DEFAULT DIRBUSTER COMMAND", target)
when 4
execute_command("REPLACE WITH GOBUSTER DEFAULT COMMAND", target)
when 5
execute_command("sqlmap -u", target, "Optional SQLMap parameters (e.g., --dbs, just hit enter for default):")
when 6
puts "Exiting..."
exit
else
puts "Invalid choice"
end
end
def execute_command(base_cmd, target, prompt = nil)
params = ""
if prompt
puts prompt
params = gets.chomp
end
cmd = "#{base_cmd} #{params} #{target} > logs/#{base_cmd.split.first}_#{target}.log"
system(cmd)
puts "#{base_cmd.split.first.capitalize} scan completed and logged to logs/#{base_cmd.split.first}_#{target}.log"
end
def main
Dir.mkdir('logs') unless Dir.exist?('logs') # Ensure logs directory exists
loop do
puts "\nEnter the target IP or domain (or 'exit' to quit):"
target = gets.chomp
break if target.downcase == 'exit'
display_menu
choice = gets.chomp.to_i
handle_choice(choice, target)
end
end
main