@@ -12,7 +12,7 @@ def cd(path)
12
12
if session . type == "meterpreter"
13
13
session . fs . dir . chdir ( e_path )
14
14
else
15
- session . shell_command_token ( "cd ' #{ e_path } ' " )
15
+ session . shell_command_token ( "cd \" #{ e_path } \" " )
16
16
end
17
17
end
18
18
@@ -67,7 +67,7 @@ def directory?(path)
67
67
if session . platform =~ /win/
68
68
f = cmd_exec ( "cmd.exe /C IF exist \" #{ path } \\ *\" ( echo true )" )
69
69
else
70
- f = session . shell_command_token ( "test -d ' #{ path } ' && echo true" )
70
+ f = session . shell_command_token ( "test -d \" #{ path } \" && echo true" )
71
71
end
72
72
73
73
return false if f . nil? or f . empty?
@@ -104,7 +104,7 @@ def file?(path)
104
104
f = cmd_exec ( "cmd.exe /C IF exist \" #{ path } \\ \\ \" ( echo false ) ELSE ( echo true )" )
105
105
end
106
106
else
107
- f = session . shell_command_token ( "test -f ' #{ path } ' && echo true" )
107
+ f = session . shell_command_token ( "test -f \" #{ path } \" && echo true" )
108
108
end
109
109
110
110
return false if f . nil? or f . empty?
@@ -127,7 +127,7 @@ def exist?(path)
127
127
if session . platform =~ /win/
128
128
f = cmd_exec ( "cmd.exe /C IF exist \" #{ path } \" ( echo true )" )
129
129
else
130
- f = cmd_exec ( "test -e ' #{ path } ' && echo true" )
130
+ f = cmd_exec ( "test -e \" #{ path } \" && echo true" )
131
131
end
132
132
133
133
return false if f . nil? or f . empty?
@@ -261,7 +261,7 @@ def read_file(file_name)
261
261
if session . platform =~ /win/
262
262
data = session . shell_command_token ( "type \" #{ file_name } \" " )
263
263
else
264
- data = session . shell_command_token ( "cat \' #{ file_name } \' " )
264
+ data = session . shell_command_token ( "cat \" #{ file_name } \" " )
265
265
end
266
266
267
267
end
@@ -340,7 +340,7 @@ def rm_f(*remote_files)
340
340
if session . platform =~ /win/
341
341
cmd_exec ( "del /q /f \" #{ remote } \" " )
342
342
else
343
- cmd_exec ( "rm -f ' #{ remote } ' " )
343
+ cmd_exec ( "rm -f \" #{ remote } \" " )
344
344
end
345
345
end
346
346
end
@@ -522,7 +522,7 @@ def _write_file_unix_shell(file_name, data, append=false)
522
522
# The first command needs to use the provided redirection for either
523
523
# appending or truncating.
524
524
cmd = command . sub ( "CONTENTS" ) { chunks . shift }
525
- session . shell_command_token ( "#{ cmd } #{ redirect } ' #{ file_name } ' " )
525
+ session . shell_command_token ( "#{ cmd } #{ redirect } \" #{ file_name } \" " )
526
526
527
527
# After creating/truncating or appending with the first command, we
528
528
# need to append from here on out.
0 commit comments