-
Notifications
You must be signed in to change notification settings - Fork 94
/
mad-metasploit.rb
105 lines (91 loc) · 3.46 KB
/
mad-metasploit.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# frozen_string_literal: true
require File.dirname(__FILE__) + '/config/config.rb' # Include Config File
def custom_modules
puts ' - Sync Custom Modules'
system "rm -rf #{$metasploit_path + '/modules/auxiliary/mad_metasploit'}"
system "mkdir #{$metasploit_path + '/modules/auxiliary/mad_metasploit'}"
system "cp -r mad-metasploit-modules/auxiliary #{$metasploit_path + '/modules/auxiliary/mad_metasploit'}"
puts ' - Auxiliary success..'
system "rm -rf #{$metasploit_path + '/modules/exploits/mad_metasploit'}"
system "mkdir #{$metasploit_path + '/modules/exploits/mad_metasploit'}"
system "cp -r mad-metasploit-modules/exploits #{$metasploit_path + '/modules/exploits/mad_metasploit'}"
puts ' - Exploits success..'
system "rm -rf #{$metasploit_path + '/modules/post/mad_metasploit'}"
system "mkdir #{$metasploit_path + '/modules/post/mad_metasploit'}"
system "cp -r mad-metasploit-modules/post #{$metasploit_path + '/modules/post/mad_metasploit'}"
puts ' - Posts success..'
end
def plugins
puts ' - Sync Custom Plugins'
system "rm -rf #{$metasploit_path + '/plugins/mad-metasploit'}"
system "mkdir #{$metasploit_path + '/plugins/mad-metasploit'}"
system "cp -r mad-metasploit-plugins/* #{$metasploit_path + '/plugins/mad-metasploit'}"
puts ' - Plugins success.'
end
def help
puts '- Metasploit-framewrk directory: ' + $metasploit_path
puts ' [!] please check and set ./conf/config.rb'
puts ''
puts '- Apply mad-metasploit to msf'
puts ' $ ruby mad-metasploit.rb'
puts ''
puts '- Apply mad-metasploit to msf (preset all)'
puts ' $ ruby mad-metasploit.rb [a/y/all/yes]'
puts ''
puts '- Update mad-metasploit'
puts ' $ ruby mad-metasploit.rb -u'
puts ''
puts '- Show help(this page)'
puts ' $ ruby mad-metasploit.rb -h'
end
def remove_mad
puts '[+] Remove mad-metasploit'
puts ' - remove mad-metasploit exploits'
system("rm -rf #{$metasploit_path}/modules/exploits/mad_metasploit")
puts ' - remove mad-metasploit auxiliary'
system("rm -rf #{$metasploit_path}/modules/auxiliary/mad_metasploit")
puts ' - remove mad-metasploit posts'
system("rm -rf #{$metasploit_path}/modules/post/mad_metasploit")
puts ' - remove mad-metasploit plugins'
system("rm -rf #{$metasploit_path}/plugins/mad-metasploit")
puts '[!] Finish :)'
end
def run(quick)
puts '[+] Sync Mad-Metasploit Modules/Plugins/Resource-Script to Metasploit-framework'
puts '[+] Metasploit-framewrk directory: ' + $metasploit_path
puts ' (set ./conf/config.rb)'
if quick
custom_modules
plugins
else
print '[*] Update archive(Those that are not added as msf)? [y/N] '
input = gets.chomp
system('ruby ./auto_archive.rb') if input.casecmp('y').zero?
print '[*] Apply custom modules to msf? [Y/n] '
input = gets.chomp
custom_modules unless input.casecmp('n').zero?
print '[*] Apply custom modules to msf? [Y/n] '
input = gets.chomp
plugins unless input.casecmp('n').zero?
end
puts '[!] Finish :)'
end
if (ARGV[0] == '-u') || (ARGV[0] == '--update')
puts '[+] Update MAD-METASPLOIT'
Dir.chdir(File.dirname(__FILE__))
system('git pull -v')
puts '[+] Complete'
else if (ARGV[0] == '-h') || (ARGV[0] == '--help')
help
exit
else if (ARGV[0] == '-r') || (ARGV[0] == '--remove')
remove_mad
exit
else if (ARGV[0] == '-y') || (ARGV[0] == '--yes') || (ARGV[0] == '-a') || (ARGV[0] == '--all')
run(true)
else
run(false)
end
end
end
end