forked from rapid7/metasploit-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
msfconsole
executable file
·48 lines (36 loc) · 1.15 KB
/
msfconsole
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
#!/usr/bin/env ruby
# -*- coding: binary -*-
#
# This user interface provides users with a command console interface to the
# framework.
#
#
# Standard Library
#
require 'pathname'
if ENV['METASPLOIT_FRAMEWORK_PROFILE'] == 'true'
gem 'perftools.rb'
require 'perftools'
formatted_time = Time.now.strftime('%Y%m%d%H%M%S')
root = Pathname.new(__FILE__).parent
profile_pathname = root.join('tmp', 'profiles', 'msfconsole', formatted_time)
profile_pathname.parent.mkpath
PerfTools::CpuProfiler.start(profile_pathname.to_path)
at_exit {
PerfTools::CpuProfiler.stop
puts "Generating pdf"
pdf_path = "#{profile_pathname}.pdf"
if Bundler.clean_system("pprof.rb --pdf #{profile_pathname} > #{pdf_path}")
puts "PDF saved to #{pdf_path}"
Rex::Compat.open_file(pdf_path)
end
}
end
#
# Project
#
# @see https://github.com/rails/rails/blob/v3.2.17/railties/lib/rails/generators/rails/app/templates/script/rails#L3-L5
require Pathname.new(__FILE__).realpath.expand_path.parent.join('config', 'boot')
require 'metasploit/framework/command/console'
require 'msf/core/payload_generator'
Metasploit::Framework::Command::Console.start