Class: Snackhack2::CommandInjection
- Inherits:
-
Object
- Object
- Snackhack2::CommandInjection
- Defined in:
- lib/snackhack2/indirect_command_injection.rb
Instance Attribute Summary collapse
-
#exe ⇒ Object
Returns the value of attribute exe.
-
#prompt ⇒ Object
Returns the value of attribute prompt.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #conhost ⇒ Object
- #conhost_hide ⇒ Object
-
#initialize(exe, title, prompt) ⇒ CommandInjection
constructor
A new instance of CommandInjection.
- #ssh ⇒ Object
- #wlrmdr_With_prompt ⇒ Object
- #wlrmdr_without_prompt ⇒ Object
Constructor Details
#initialize(exe, title, prompt) ⇒ CommandInjection
Returns a new instance of CommandInjection.
7 8 9 10 11 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 7 def initialize(exe, title, prompt) @exe = 'calc.exe' @title = 'Click me!' @prompt = 'To run calculator' end |
Instance Attribute Details
#exe ⇒ Object
Returns the value of attribute exe.
5 6 7 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 5 def exe @exe end |
#prompt ⇒ Object
Returns the value of attribute prompt.
5 6 7 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 5 def prompt @prompt end |
#title ⇒ Object
Returns the value of attribute title.
5 6 7 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 5 def title @title end |
Instance Method Details
#conhost ⇒ Object
21 22 23 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 21 def conhost Process.spawn("conhost.exe #{@exe}") end |
#conhost_hide ⇒ Object
25 26 27 28 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 25 def conhost_hide # Specify --headless parameter to hide child process window (if applicable) Process.spawn("conhost.exe --headless #{@exe}") end |
#ssh ⇒ Object
30 31 32 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 30 def ssh Process.spawn("ssh -o ProxyCommand=#{@exe} .") end |
#wlrmdr_With_prompt ⇒ Object
13 14 15 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 13 def wlrmdr_With_prompt Process.spawn("wlrmdr.exe -s 3600 -f 0 -t #{title} -m #{@prompt} -a 10 -u #{@exe}") end |
#wlrmdr_without_prompt ⇒ Object
17 18 19 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 17 def wlrmdr_without_prompt Process.spawn("wlrmdr.exe -s 3600 -f 0 -t _ -m _ -a 11 -u #{@exe}") end |