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
124
125
126
127
|
# File 'lib/ronin/ui/command_line/commands/exploit.rb', line 62
def default
Database.setup(options[:database])
if options[:file]
load_exploit!
else
find_exploit!
end
unless @exploit
print_error "Could not find the specified exploit"
exit -1
end
if options[:target]
unless exploit.use_target!(options[:target])
print_error "Invalid target index: #{options[:target]}"
exit -1
end
elsif (options[:target_arch] || options[:target_os] ||
options[:target_product] || options[:target_version])
exploit.use_target! do |target|
if (options[:target_arch] && target.arch)
next unless target.arch.name == options[:target_arch]
end
if (options[:target_os] && target.os)
next unless target.os.name == options[:target_os]
end
if (options[:target_product] && target.product)
next unless target.product.name.include?(options[:target_product])
end
if (options[:target_version] && target.product)
next unless target.product.version == options[:target_version]
end
true
end
end
if options[:raw_payload]
exploit.raw_payload = options[:raw_payload]
elsif options[:payload_file]
load_payload!
elsif options[:payload_name]
find_payload!
end
params = Parameters::Parser.parse(options[:params])
params[:host] = options[:host] if options[:host]
params[:port] = options[:port] if options[:port]
params[:local_host] = options[:local_host] if options[:local_host]
params[:local_port] = options[:local_port] if options[:local_port]
params[:dry_run] = options.dry_run?
begin
@exploit.exploit!(params)
rescue Parameters::MissingParam,
Exploits::Exception,
Payloads::Exception => e
print_error(e.message)
end
end
|