demo scripts

git-svn-id: file:///home/svn/incoming/trunk@2415 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
Matt Miller 2005-04-18 02:55:01 +00:00
parent 9ea2b1f1c1
commit 4a41fbb4b5
2 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,5 @@
#!/usr/bin/ruby -I../../lib
require 'Rex/Post'
netconf = false
@ -122,6 +124,8 @@ end
if (dir)
puts "Testing dir...\n\n"
puts "%WINDIR% is #{client.fs.file.expand_path('%WINDIR%')}"
puts "Getting contents of C:\\"
client.fs.dir.foreach("C:\\") { |name|

View File

@ -35,6 +35,17 @@ Separator = "\\"
return $2
end
# Expands a file path
def File.expand_path(path)
request = Packet.create_request('stdapi_fs_file_expand_path')
request.add_tlv(TLV_TYPE_FILE_PATH, path)
response = client.send_request(request)
return response.get_tlv_value(TLV_TYPE_FILE_PATH)
end
def File.stat(name)
return client.fs.filestat.new(name)
end