Module: PWN::Plugins::JSONPathify

Defined in:
lib/pwn/plugins/json_pathify.rb

Overview

This plugin is for leveraging XPath-like searching capabilities for JSON data structures

Class Method Summary collapse

Class Method Details

.authorsObject

Author(s)

0day Inc. <[email protected]>



27
28
29
30
31
# File 'lib/pwn/plugins/json_pathify.rb', line 27

public_class_method def self.authors
  "AUTHOR(S):
    0day Inc. <[email protected]>
  "
end

.helpObject

Display Usage for this Module



35
36
37
38
39
40
41
42
43
# File 'lib/pwn/plugins/json_pathify.rb', line 35

public_class_method def self.help
  puts %{USAGE:
    json_path_arr = #{self}.search_key(
      json_data_struct: "required JSON data structure",
      key: "required key to find in JSON data structure. returns key values"
    )
    #{self}.authors
  }
end

.search_key(opts = {}) ⇒ Object

Supported Method Parameters

PWN::Plugins::JSONPathify.search_key(

json_data_struct: "required JSON data structure",
key: "required key to find in JSON data structure. returns key values"

)



15
16
17
18
19
20
21
22
23
# File 'lib/pwn/plugins/json_pathify.rb', line 15

public_class_method def self.search_key(opts = {})
  key = opts[:key]
  json_data_struct = opts[:json_data_struct]

  json_path = JsonPath.new("$..#{key}")
  json_path.on(json_data_struct)
rescue StandardError => e
  raise e
end