forked from rastating/wordpress-exploit-framework
-
Notifications
You must be signed in to change notification settings - Fork 1
/
wpxf.rb
executable file
·92 lines (79 loc) · 2.7 KB
/
wpxf.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
#!/usr/bin/env ruby
# frozen_string_literal: true
require_relative 'env'
require 'cli/console'
begin
Slop.parse do |o|
version_file_path = File.join(Wpxf.app_path, 'VERSION')
o.on '--update', 'check for updates' do
current_version = File.read(version_file_path).strip
updater = Wpxf::GitHubUpdater.new
update = updater.get_update(current_version)
if update.nil?
puts 'No updates available'
exit
end
puts 'A new update is available!'
puts
puts '-- Release Notes --'
puts update[:release_notes]
puts
puts "Downloading latest update (#{update[:release_name]})..."
updater.download_and_apply_update(update[:zip_url])
puts 'Update finished! Make sure to run "bundle install" in the WPXF directory.'
puts
exit
end
o.on '--version', 'print the version' do
puts File.read(version_file_path).strip
exit
end
end
rescue Slop::UnknownOption => e
puts e.message
exit
end
puts ' _'
puts ' __ _____ _ __ __| |_ __ _ __ ___ ___ ___'
puts ' \ \ /\ / / _ \| \'__/ _` | \'_ \| \'__/ _ \/ __/ __|'
puts ' \ V V / (_) | | | (_| | |_) | | | __/\__ \__ \\'
puts ' \_/\_/ \___/|_| \__,_| .__/|_| \___||___/___/'
puts ' |_|'
puts ' _ _ _'
puts ' _____ ___ __ | | ___ (_) |_'
puts ' / _ \ \/ / \'_ \| |/ _ \| | __|'
puts ' | __/> <| |_) | | (_) | | |_'
puts ' \___/_/\_\ .__/|_|\___/|_|\__|'
puts ' |_|'
puts ' __ _'
puts ' / _|_ __ __ _ _ __ ___ _____ _____ _ __| | __'
puts ' | |_| \'__/ _` | \'_ ` _ \ / _ \ \ /\ / / _ \| \'__| |/ /'
puts ' | _| | | (_| | | | | | | __/\ V V / (_) | | | <'
puts ' |_| |_| \__,_|_| |_| |_|\___| \_/\_/ \___/|_| |_|\_\\'
puts
console = Cli::Console.new
puts " Loaded #{Wpxf::Auxiliary.module_list.size} auxiliary modules, "\
"#{Wpxf::Exploit.module_list.size} exploits, "\
"#{Wpxf::Payloads.payload_count} payloads"
puts
Dir.chdir(Dir.tmpdir) do
temp_directories = Dir.glob('wpxf_*')
unless temp_directories.empty?
print '[!] '.yellow
puts "#{temp_directories.length} temporary files were found that "\
'appear to no longer be needed.'
print ' Would you like to remove these files? [y/n]: '
temp_directories.each { |d| FileUtils.rm_r(d) } if gets.chomp =~ /^y$/i
puts
end
end
found_env_var = false
ENV.each do |name, value|
match = name.match(/^wpxf_(.+)/i)
if match
console.gset match.captures[0], value
found_env_var = true
end
end
puts if found_env_var
console.start