Module: Rex::Post::File
- Included in:
- Meterpreter::Extensions::Stdapi::Fs::File
- Defined in:
- lib/rex/post/file.rb
Overview
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.
Class Method Summary collapse
-
.atime(name) ⇒ Object
autogen’d stat passthroughs.
-
.basename(*a) ⇒ Object
proxy these methods.
- .blockdev?(name) ⇒ Boolean
- .chardev?(name) ⇒ Boolean
- .chmod ⇒ Object
- .chown ⇒ Object
- .ctime(name) ⇒ Object
- .delete(*a) ⇒ Object
- .directory?(name) ⇒ Boolean
- .dirname(*a) ⇒ Object
- .executable?(name) ⇒ Boolean
- .executable_real?(name) ⇒ Boolean
-
.expand_path ⇒ Object
this, along with all the other globbing/search stuff, probably won’t get implemented, atleast for a bit…
- .extname(*a) ⇒ Object
- .file?(name) ⇒ Boolean
- .fnmatch(*a) ⇒ Object
- .fnmatch? ⇒ Boolean
- .ftype(name) ⇒ Object
- .grpowned?(name) ⇒ Boolean
-
.join(*a) ⇒ Object
!!! we might actually want to handle this File::SEPERATOR stuff for win32 support, etc.
- .lchmod ⇒ Object
- .lchown ⇒ Object
- .link ⇒ Object
- .lstat ⇒ Object
- .mtime(name) ⇒ Object
- .owned?(name) ⇒ Boolean
- .pipe?(name) ⇒ Boolean
- .readable?(name) ⇒ Boolean
- .readable_real?(name) ⇒ Boolean
- .setgid?(name) ⇒ Boolean
- .setuid?(name) ⇒ Boolean
- .size(name) ⇒ Object
- .socket?(name) ⇒ Boolean
- .sticky?(name) ⇒ Boolean
- .symlink?(name) ⇒ Boolean
- .unlink ⇒ Object
- .writeable?(name) ⇒ Boolean
- .writeable_real?(name) ⇒ Boolean
- .zero?(name) ⇒ Boolean
Instance Method Summary collapse
-
#initialize(name, mode = 'r', perm = 0) ⇒ Object
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..
- #path ⇒ Object
Class Method Details
.atime(name) ⇒ Object
autogen’d stat passthroughs
96 97 98 |
# File 'lib/rex/post/file.rb', line 96 def File.atime(name) stat(name).atime end |
.basename(*a) ⇒ Object
proxy these methods
41 42 43 |
# File 'lib/rex/post/file.rb', line 41 def File.basename(*a) ::File.basename(*a) end |
.blockdev?(name) ⇒ Boolean
99 100 101 |
# File 'lib/rex/post/file.rb', line 99 def File.blockdev?(name) stat(name).blockdev? end |
.chardev?(name) ⇒ Boolean
102 103 104 |
# File 'lib/rex/post/file.rb', line 102 def File.chardev?(name) stat(name).chardev? end |
.chmod ⇒ Object
56 57 58 |
# File 'lib/rex/post/file.rb', line 56 def File.chmod raise NotImplementedError end |
.chown ⇒ Object
59 60 61 |
# File 'lib/rex/post/file.rb', line 59 def File.chown raise NotImplementedError end |
.ctime(name) ⇒ Object
105 106 107 |
# File 'lib/rex/post/file.rb', line 105 def File.ctime(name) stat(name).ctime end |
.delete(*a) ⇒ Object
62 63 64 |
# File 'lib/rex/post/file.rb', line 62 def File.delete(*a) unlink(*a) end |
.directory?(name) ⇒ Boolean
108 109 110 |
# File 'lib/rex/post/file.rb', line 108 def File.directory?(name) stat(name).directory? end |
.dirname(*a) ⇒ Object
44 45 46 |
# File 'lib/rex/post/file.rb', line 44 def File.dirname(*a) ::File.dirname(*a) end |
.executable?(name) ⇒ Boolean
111 112 113 |
# File 'lib/rex/post/file.rb', line 111 def File.executable?(name) stat(name).executable? end |
.executable_real?(name) ⇒ Boolean
114 115 116 |
# File 'lib/rex/post/file.rb', line 114 def File.executable_real?(name) stat(name).executable_real? end |
.expand_path ⇒ Object
this, along with all the other globbing/search stuff, probably won’t get implemented, atleast for a bit…
83 84 85 |
# File 'lib/rex/post/file.rb', line 83 def File. raise NotImplementedError end |
.extname(*a) ⇒ Object
47 48 49 |
# File 'lib/rex/post/file.rb', line 47 def File.extname(*a) ::File.extname(*a) end |
.file?(name) ⇒ Boolean
117 118 119 |
# File 'lib/rex/post/file.rb', line 117 def File.file?(name) stat(name).file? end |
.fnmatch(*a) ⇒ Object
86 87 88 |
# File 'lib/rex/post/file.rb', line 86 def File.fnmatch(*a) fnmatch?(*a) end |
.fnmatch? ⇒ Boolean
89 90 91 |
# File 'lib/rex/post/file.rb', line 89 def File.fnmatch? raise NotImplementedError end |
.ftype(name) ⇒ Object
120 121 122 |
# File 'lib/rex/post/file.rb', line 120 def File.ftype(name) stat(name).ftype end |
.grpowned?(name) ⇒ Boolean
123 124 125 |
# File 'lib/rex/post/file.rb', line 123 def File.grpowned?(name) stat(name).grpowned? end |
.join(*a) ⇒ Object
!!! we might actually want to handle this File::SEPERATOR stuff for win32 support, etc.
52 53 54 |
# File 'lib/rex/post/file.rb', line 52 def File.join(*a) ::File.join(*a) end |
.lchmod ⇒ Object
68 69 70 |
# File 'lib/rex/post/file.rb', line 68 def File.lchmod raise NotImplementedError end |
.lchown ⇒ Object
71 72 73 |
# File 'lib/rex/post/file.rb', line 71 def File.lchown raise NotImplementedError end |
.link ⇒ Object
74 75 76 |
# File 'lib/rex/post/file.rb', line 74 def File.link raise NotImplementedError end |
.lstat ⇒ Object
77 78 79 |
# File 'lib/rex/post/file.rb', line 77 def File.lstat raise NotImplementedError end |
.mtime(name) ⇒ Object
126 127 128 |
# File 'lib/rex/post/file.rb', line 126 def File.mtime(name) stat(name).mtime end |
.owned?(name) ⇒ Boolean
129 130 131 |
# File 'lib/rex/post/file.rb', line 129 def File.owned?(name) stat(name).owned? end |
.pipe?(name) ⇒ Boolean
132 133 134 |
# File 'lib/rex/post/file.rb', line 132 def File.pipe?(name) stat(name).pipe? end |
.readable?(name) ⇒ Boolean
135 136 137 |
# File 'lib/rex/post/file.rb', line 135 def File.readable?(name) stat(name).readable? end |
.readable_real?(name) ⇒ Boolean
138 139 140 |
# File 'lib/rex/post/file.rb', line 138 def File.readable_real?(name) stat(name).readable_real? end |
.setgid?(name) ⇒ Boolean
144 145 146 |
# File 'lib/rex/post/file.rb', line 144 def File.setgid?(name) stat(name).setgid? end |
.setuid?(name) ⇒ Boolean
141 142 143 |
# File 'lib/rex/post/file.rb', line 141 def File.setuid?(name) stat(name).setuid? end |
.size(name) ⇒ Object
147 148 149 |
# File 'lib/rex/post/file.rb', line 147 def File.size(name) stat(name).size end |
.socket?(name) ⇒ Boolean
150 151 152 |
# File 'lib/rex/post/file.rb', line 150 def File.socket?(name) stat(name).socket? end |
.sticky?(name) ⇒ Boolean
153 154 155 |
# File 'lib/rex/post/file.rb', line 153 def File.sticky?(name) stat(name).sticky? end |
.symlink?(name) ⇒ Boolean
156 157 158 |
# File 'lib/rex/post/file.rb', line 156 def File.symlink?(name) stat(name).symlink? end |
.unlink ⇒ Object
65 66 67 |
# File 'lib/rex/post/file.rb', line 65 def File.unlink raise NotImplementedError end |
.writeable?(name) ⇒ Boolean
159 160 161 |
# File 'lib/rex/post/file.rb', line 159 def File.writeable?(name) stat(name).writeable? end |
.writeable_real?(name) ⇒ Boolean
162 163 164 |
# File 'lib/rex/post/file.rb', line 162 def File.writeable_real?(name) stat(name).writeable_real? end |
.zero?(name) ⇒ Boolean
165 166 167 |
# File 'lib/rex/post/file.rb', line 165 def File.zero?(name) stat(name).zero? end |
Instance Method Details
#initialize(name, mode = 'r', perm = 0) ⇒ Object
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..
30 31 |
# File 'lib/rex/post/file.rb', line 30 def initialize(name, mode='r', perm=0) end |
#path ⇒ Object
33 34 35 |
# File 'lib/rex/post/file.rb', line 33 def path filename end |