Class: VOODOO::CLI
- Inherits:
-
Thor
- Object
- Thor
- VOODOO::CLI
- Defined in:
- lib/voodoo/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
- #intercept ⇒ Object
- #keylogger ⇒ Object
- #script(path_or_js) ⇒ Object
- #template(path) ⇒ Object
- #version ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
155 156 157 |
# File 'lib/voodoo/cli.rb', line 155 def self.exit_on_failure? true end |
Instance Method Details
#intercept ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/voodoo/cli.rb', line 28 def intercept browser = get_browser [:browser] output_handler = Output.new(file: [:output], in_format: [:format], for_command: 'intercept') browser.intercept(matches: [:matches], url_include: [:url_include], body_include: [:body_include], max_events: [:max_events]) do |event| output_handler.handle(event) end browser.hijack [:urls] end |
#keylogger ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'lib/voodoo/cli.rb', line 83 def keylogger browser = get_browser [:browser] output_handler = Output.new(file: [:output], in_format: [:format], for_command: 'keylogger') browser.keylogger(matches: [:matches], max_events: [:max_events]) do |event| output_handler.handle(event) end browser.hijack [:urls] end |
#script(path_or_js) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/voodoo/cli.rb', line 51 def script(path_or_js) browser = get_browser [:browser] browser. [:permissions] output_handler = Output.new(file: [:output], in_format: [:format], for_command: 'script') file = nil content = nil if File.exists? path_or_js file = path_or_js else content = path_or_js end if output_handler.writable browser.add_script file: file, content: content, options: [:params], max_events: [:max_events] do |event| output_handler.handle(event) end else browser.add_script file: file, content: content, options: [:params] end browser.hijack [:urls] end |
#template(path) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/voodoo/cli.rb', line 99 def template(path) pwd = Dir.pwd if File.directory? path pwd = File.(File.join(pwd, path)) template = YAML.load_file(File.join(path, 'voodoo.yaml')) else pwd = File.(File.join(pwd, File.dirname(path))) template = YAML.load_file(path) end browser_inst = template['browser'] || {} browser = get_browser([:browser] || browser_inst['name'] || browser_inst['default'] || 'chrome') if template['permissions'] browser. template['permissions'] end output_format = [:format] is_default = output_format == 'none' if is_default && template['format'] output_format = template['format'] end output_handler = Output.new(file: [:output], in_format: output_format, for_command: 'template') template['scripts'].each do |script| file = File.(File.join(pwd, script['file'])) if script['file'] content = script['content'] matches = script['matches'] background = script['background'] || false communication = true if script.keys.include? 'communication' communication = script['communication'] end if output_handler.writable browser.add_script(max_events: [:max_events], matches: matches, file: file, content: content, options: [:params], background: background, communication: communication) do |event| output_handler.handle(event) end else browser.add_script(matches: matches, content: content, file: file, options: [:params], background: background) end end urls = [:urls] if urls.length == 0 && browser_inst['urls'] urls = browser_inst['urls'] end browser.hijack urls, flags: browser_inst['flags'] || '' end |
#version ⇒ Object
14 15 16 |
# File 'lib/voodoo/cli.rb', line 14 def version puts VERSION end |