module Rex::Post::File

This module simulates the behavior that one would expect from the Ruby File class against a remote entity. Refer to the ruby documentation for expected behavior.

Attributes

filename[RW]

inherits fd and mode from IO

Public Class Methods

atime(name) click to toggle source

autogen'd stat passthroughs

# File lib/rex/post/file.rb, line 95
def File.atime(name)
  stat(name).atime
end
basename(*a) click to toggle source

proxy these methods

# File lib/rex/post/file.rb, line 40
def File.basename(*a)
  ::File.basename(*a)
end
blockdev?(name) click to toggle source
# File lib/rex/post/file.rb, line 98
def File.blockdev?(name)
  stat(name).blockdev?
end
chardev?(name) click to toggle source
# File lib/rex/post/file.rb, line 101
def File.chardev?(name)
  stat(name).chardev?
end
chmod() click to toggle source
# File lib/rex/post/file.rb, line 55
def File.chmod
  raise NotImplementedError
end
chown() click to toggle source
# File lib/rex/post/file.rb, line 58
def File.chown
  raise NotImplementedError
end
ctime(name) click to toggle source
# File lib/rex/post/file.rb, line 104
def File.ctime(name)
  stat(name).ctime
end
delete(*a) click to toggle source
# File lib/rex/post/file.rb, line 61
def File.delete(*a)
  unlink(*a)
end
directory?(name) click to toggle source
# File lib/rex/post/file.rb, line 107
def File.directory?(name)
  stat(name).directory?
end
dirname(*a) click to toggle source
# File lib/rex/post/file.rb, line 43
def File.dirname(*a)
  ::File.dirname(*a)
end
executable?(name) click to toggle source
# File lib/rex/post/file.rb, line 110
def File.executable?(name)
  stat(name).executable?
end
executable_real?(name) click to toggle source
# File lib/rex/post/file.rb, line 113
def File.executable_real?(name)
  stat(name).executable_real?
end
expand_path() click to toggle source

this, along with all the other globbing/search stuff, probably won't get implemented, atleast for a bit…

# File lib/rex/post/file.rb, line 82
def File.expand_path
  raise NotImplementedError
end
extname(*a) click to toggle source
# File lib/rex/post/file.rb, line 46
def File.extname(*a)
  ::File.extname(*a)
end
file?(name) click to toggle source
# File lib/rex/post/file.rb, line 116
def File.file?(name)
  stat(name).file?
end
fnmatch(*a) click to toggle source
# File lib/rex/post/file.rb, line 85
def File.fnmatch(*a)
  fnmatch?(*a)
end
fnmatch?() click to toggle source
# File lib/rex/post/file.rb, line 88
def File.fnmatch?
  raise NotImplementedError
end
ftype(name) click to toggle source
# File lib/rex/post/file.rb, line 119
def File.ftype(name)
  stat(name).ftype
end
grpowned?(name) click to toggle source
# File lib/rex/post/file.rb, line 122
def File.grpowned?(name)
  stat(name).grpowned?
end
join(*a) click to toggle source

!!! we might actually want to handle this File::SEPERATOR stuff for win32 support, etc.

# File lib/rex/post/file.rb, line 51
def File.join(*a)
  ::File.join(*a)
end
lchmod() click to toggle source
# File lib/rex/post/file.rb, line 67
def File.lchmod
  raise NotImplementedError
end
lchown() click to toggle source
# File lib/rex/post/file.rb, line 70
def File.lchown
  raise NotImplementedError
end
lstat() click to toggle source
# File lib/rex/post/file.rb, line 76
def File.lstat
  raise NotImplementedError
end
mtime(name) click to toggle source
# File lib/rex/post/file.rb, line 125
def File.mtime(name)
  stat(name).mtime
end
new(name, mode='r', perm=0) click to toggle source

f = File.new(“testfile”, “r”) f = File.new(“newfile”, “w+”) f = File.new(“newfile”, File::CREAT|File::TRUNC|File::RDWR, 0644) !!! I suppose I should figure out the correct default for perm..

# File lib/rex/post/file.rb, line 29
def initialize(name, mode='r', perm=0)
end
owned?(name) click to toggle source
# File lib/rex/post/file.rb, line 128
def File.owned?(name)
  stat(name).owned?
end
pipe?(name) click to toggle source
# File lib/rex/post/file.rb, line 131
def File.pipe?(name)
  stat(name).pipe?
end
readable?(name) click to toggle source
# File lib/rex/post/file.rb, line 134
def File.readable?(name)
  stat(name).readable?
end
readable_real?(name) click to toggle source
# File lib/rex/post/file.rb, line 137
def File.readable_real?(name)
  stat(name).readable_real?
end
setgid?(name) click to toggle source
# File lib/rex/post/file.rb, line 143
def File.setgid?(name)
  stat(name).setgid?
end
setuid?(name) click to toggle source
# File lib/rex/post/file.rb, line 140
def File.setuid?(name)
  stat(name).setuid?
end
size(name) click to toggle source
# File lib/rex/post/file.rb, line 146
def File.size(name)
  stat(name).size
end
socket?(name) click to toggle source
# File lib/rex/post/file.rb, line 149
def File.socket?(name)
  stat(name).socket?
end
sticky?(name) click to toggle source
# File lib/rex/post/file.rb, line 152
def File.sticky?(name)
  stat(name).sticky?
end
writeable?(name) click to toggle source
# File lib/rex/post/file.rb, line 158
def File.writeable?(name)
  stat(name).writeable?
end
writeable_real?(name) click to toggle source
# File lib/rex/post/file.rb, line 161
def File.writeable_real?(name)
  stat(name).writeable_real?
end
zero?(name) click to toggle source
# File lib/rex/post/file.rb, line 164
def File.zero?(name)
  stat(name).zero?
end

Public Instance Methods

path() click to toggle source
# File lib/rex/post/file.rb, line 32
def path
  filename
end