Top Level Namespace

Defined Under Namespace

Modules: WPScan

Instance Method Summary collapse

Instance Method Details

#classify_slug(slug) ⇒ Symbol

Note:

As a class can not start with a digit or underscore, a D_ is

put as a prefix in such case. Ugly but well :x Not only used to classify slugs though, but Dynamic Finder names as well

Returns:

  • (Symbol)


11
12
13
14
15
16
# File 'lib/wpscan/helper.rb', line 11

def classify_slug(slug)
  classified = slug.to_s.tr('-', '_').camelize.to_s
  classified = "D_#{classified}" if classified[0] =~ /\d/

  classified.to_sym
end

#read_json_file(file) ⇒ Object



1
2
3
4
5
# File 'lib/wpscan/helper.rb', line 1

def read_json_file(file)
  JSON.parse(File.read(file))
rescue StandardError => e
  raise "JSON parsing error in #{file} #{e}"
end