CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/tools/dev/update_joomla_components.rb
Views: 15959
1
#!/usr/bin/env ruby
2
# -*- coding: binary -*-
3
4
#
5
# by h00die
6
#
7
8
require 'optparse'
9
require 'net/http'
10
require 'uri'
11
optparse = OptionParser.new do |opts|
12
opts.banner = 'Usage: ruby tools/dev/update_joomla_components.rb [options]'
13
opts.separator "This program updates data/wordlists/joomla.txt which is used by modules/auxiliary/scanner/http/joomla_scanner.rb to have the most up-to-date list of vuln components"
14
opts.separator ""
15
opts.on('-h', '--help', 'Display this screen.') do
16
puts opts
17
exit
18
end
19
end
20
optparse.parse!
21
22
# colors and puts templates from msftidy.rb
23
24
class String
25
def red
26
"\e[1;31;40m#{self}\e[0m"
27
end
28
29
def yellow
30
"\e[1;33;40m#{self}\e[0m"
31
end
32
33
def green
34
"\e[1;32;40m#{self}\e[0m"
35
end
36
37
def cyan
38
"\e[1;36;40m#{self}\e[0m"
39
end
40
end
41
42
#
43
# Display an error message, given some text
44
#
45
def error(txt)
46
puts "[#{'ERROR'.red}] #{cleanup_text(txt)}"
47
end
48
49
#
50
# Display a warning message, given some text
51
#
52
def warning(txt)
53
puts "[#{'WARNING'.yellow}] #{cleanup_text(txt)}"
54
end
55
56
#
57
# Display a info message, given some text
58
#
59
def info(txt)
60
puts "[#{'INFO'.cyan}] #{cleanup_text(txt)}"
61
end
62
63
uri = URI.parse('https://raw.githubusercontent.com/rezasp/joomscan/master/exploit/db/componentslist.txt')
64
new_com = Net::HTTP.get(uri)
65
66
old = File.read('data/wordlists/joomla.txt').split("\n")
67
68
new_com.each_line do |com|
69
unless old.include?("components/#{com.strip}/")
70
old << "components/#{com.strip}/"
71
info "Adding: components/#{com.strip}/"
72
end
73
end
74
75
old.sort!
76
File.open('data/wordlists/joomla.txt', 'w') do |file|
77
file.puts old
78
end
79