Class: Vcsmap::Plugin::WordpressConfig
- Inherits:
-
BasePlugin
- Object
- BasePlugin
- Vcsmap::Plugin::WordpressConfig
- Defined in:
- lib/vcsmap/plugins/wordpress_config.rb
Instance Attribute Summary
Attributes inherited from BasePlugin
Instance Method Summary collapse
- #credentials(file) ⇒ Object
-
#initialize ⇒ WordpressConfig
constructor
A new instance of WordpressConfig.
- #table_header ⇒ Object
Methods inherited from BasePlugin
Constructor Details
#initialize ⇒ WordpressConfig
Returns a new instance of WordpressConfig.
4 5 6 7 8 9 10 |
# File 'lib/vcsmap/plugins/wordpress_config.rb', line 4 def initialize @search_string = 'filename:wp-config.php+DB_PASSWORD' @host_regex = /(?:\'|\")DB_HOST(?:\'|\")\,(?:\ |)(?:\'|\")(.*?)(?:\'|\")/i @username_regex = /(?:\'|\")DB_USER(?:\'|\")\,(?:\ |)(?:\'|\")(.*?)(?:\'|\")/i @password_regex = /(?:\'|\")DB_PASSWORD(?:\'|\")\,(?:\ |)(?:\'|\")(.*?)(?:\'|\")/i @database_regex = /(?:\'|\")DB_NAME(?:\'|\")\,(?:\ |)(?:\'|\")(.*?)(?:\'|\")/i end |
Instance Method Details
#credentials(file) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/vcsmap/plugins/wordpress_config.rb', line 12 def credentials(file) @host = capture_match(@host_regex, file) @user = capture_match(@username_regex, file) @pass = capture_match(@password_regex, file) @database = capture_match(@database_regex, file) ['MySQL', @host, @user, @pass, @database] rescue NoMethodError [] end |
#table_header ⇒ Object
22 23 24 |
# File 'lib/vcsmap/plugins/wordpress_config.rb', line 22 def table_header %w(Protocol Host Username Password Database) end |