-
Notifications
You must be signed in to change notification settings - Fork 43
/
vsaudit.rb
91 lines (77 loc) · 2.92 KB
/
vsaudit.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
84
85
86
87
88
89
90
91
#!/usr/bin/env ruby
#
# vsaudit.rb - voip auditing framework.
#
# Federico Fazzi <eurialo@deftcode.ninja>
# (c) 2017 - MIT License.
#
['readline',
'resolv',
Dir.pwd + '/core/environment',
Dir.pwd + '/core/auditer',
Dir.pwd + '/core/utility'].each(&method(:require))
# TAB Completion.
LIST = ['set', 'get', 'env',
'fcheck', 'scan', 'enum', 'bruteforce',
'info', 'report', 'exts', 'session',
'live', 'intercept', 'decode',
'help', 'exit', 'quit'].sort
# Instance the base app objects.
$environ = Environment.new
$auditer = Auditer.new
$utility = Utility.new
# Custom modules instances.
$modules = []
# Initialize the interactive
# pseudo-terminal interface.
def run_pts
begin
# Pass the completion to proc every-time.
Readline.completion_append_character = ' '
Readline.completion_proc = proc { |s| LIST.grep(/^#{Regexp.escape(s)}/) }
# Read the input command.
while line = Readline.readline("#{GB}vsaudit > #{RST}", true)
command = line.split(' ')
case command.first
# Environment commands.
when 'set', 's' then $environ::set_env(command)
when 'get', 'g' then $environ::get_env(command)
when 'env', 'e' then $environ::list_env
# Audit commands.
when 'fcheck', 'f' then $auditer::verify_conf_files
when 'scan', 'sn' then $auditer::pscan(command)
when 'enum', 'en' then $auditer::enum_extensions(command)
when 'bruteforce', 'bf' then $auditer::bruteforce(command)
# Info commands.
when 'info', 'i' then $utility::get_info(command)
when 'report', 'r' then $auditer::report_scan
when 'exts', 'ex' then $auditer::report_extensions
when 'session', 'se' then $auditer::session(command)
when 'live', 'lv' then $auditer::live(command)
when 'intercept', 'in' then $auditer::intercept(command)
when 'decode', 'dc' then $auditer::decode(command)
# Global commands.
when 'help', 'h' then $utility::print_help(command)
when 'exit', 'quit','q' then
puts "#{GB}+ exiting..#{RST}"
raise Exception
# Try the shell commands.
else
$utility.do_sh_command?(command)
end
end
rescue SystemExit, SignalException
print "\r\n"
run_pts
rescue Exception
system 'setterm -cursor on'
exit
end
end
system 'clear'
system 'setterm -cursor off'
# Load the custom modules.
$utility::load_modules
# Set the base environment options.
$utility::set_base_env
run_pts