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 ⇒ CommandInjection
constructor
A new instance of CommandInjection.
- #ssh ⇒ Object
- #wlrmdr_With_prompt ⇒ Object
- #wlrmdr_without_prompt ⇒ Object
Constructor Details
#initialize ⇒ CommandInjection
Returns a new instance of CommandInjection.
5 6 7 8 9 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 5 def initialize @exe = "calc.exe" @title = "Click me!" @prompt = "To run calculator" end |
Instance Attribute Details
#exe ⇒ Object
Returns the value of attribute exe.
3 4 5 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 3 def exe @exe end |
#prompt ⇒ Object
Returns the value of attribute prompt.
3 4 5 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 3 def prompt @prompt end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 3 def title @title end |
Instance Method Details
#conhost ⇒ Object
19 20 21 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 19 def conhost Process.spawn("conhost.exe #{@exe}") end |
#conhost_hide ⇒ Object
23 24 25 26 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 23 def conhost_hide # Specify --headless parameter to hide child process window (if applicable) Process.spawn("conhost.exe --headless #{@exe}") end |
#ssh ⇒ Object
28 29 30 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 28 def ssh Process.spawn("ssh -o ProxyCommand=#{@exe} .") end |
#wlrmdr_With_prompt ⇒ Object
11 12 13 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 11 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
15 16 17 |
# File 'lib/snackhack2/indirect_command_injection.rb', line 15 def wlrmdr_without_prompt Process.spawn("wlrmdr.exe -s 3600 -f 0 -t _ -m _ -a 11 -u #{@exe}") end |