Class: Snackhack2::CommandInjection

Inherits:
Object
  • Object
show all
Defined in:
lib/snackhack2/indirect_command_injection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCommandInjection

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

#exeObject

Returns the value of attribute exe.



3
4
5
# File 'lib/snackhack2/indirect_command_injection.rb', line 3

def exe
  @exe
end

#promptObject

Returns the value of attribute prompt.



3
4
5
# File 'lib/snackhack2/indirect_command_injection.rb', line 3

def prompt
  @prompt
end

#titleObject

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

#conhostObject



19
20
21
# File 'lib/snackhack2/indirect_command_injection.rb', line 19

def conhost
  Process.spawn("conhost.exe #{@exe}")
end

#conhost_hideObject



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

#sshObject



28
29
30
# File 'lib/snackhack2/indirect_command_injection.rb', line 28

def ssh
  Process.spawn("ssh -o ProxyCommand=#{@exe} .")
end

#wlrmdr_With_promptObject



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_promptObject



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