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

Instance Method Summary collapse

Class Method Details

.atime(name) ⇒ Object

autogen’d stat passthroughs



97
98
99
# File 'lib/rex/post/file.rb', line 97

def File.atime(name)
	stat(name).atime
end

.basename(*a) ⇒ Object

proxy these methods



42
43
44
# File 'lib/rex/post/file.rb', line 42

def File.basename(*a)
	::File.basename(*a)
end

.blockdev?(name) ⇒ Boolean

Returns:

  • (Boolean)


100
101
102
# File 'lib/rex/post/file.rb', line 100

def File.blockdev?(name)
	stat(name).blockdev?
end

.chardev?(name) ⇒ Boolean

Returns:

  • (Boolean)


103
104
105
# File 'lib/rex/post/file.rb', line 103

def File.chardev?(name)
	stat(name).chardev?
end

.chmodObject



57
58
59
# File 'lib/rex/post/file.rb', line 57

def File.chmod
	raise NotImplementedError
end

.chownObject



60
61
62
# File 'lib/rex/post/file.rb', line 60

def File.chown
	raise NotImplementedError
end

.ctime(name) ⇒ Object



106
107
108
# File 'lib/rex/post/file.rb', line 106

def File.ctime(name)
	stat(name).ctime
end

.delete(*a) ⇒ Object



63
64
65
# File 'lib/rex/post/file.rb', line 63

def File.delete(*a)
	unlink(*a)
end

.directory?(name) ⇒ Boolean

Returns:

  • (Boolean)


109
110
111
# File 'lib/rex/post/file.rb', line 109

def File.directory?(name)
	stat(name).directory?
end

.dirname(*a) ⇒ Object



45
46
47
# File 'lib/rex/post/file.rb', line 45

def File.dirname(*a)
	::File.dirname(*a)
end

.executable?(name) ⇒ Boolean

Returns:

  • (Boolean)


112
113
114
# File 'lib/rex/post/file.rb', line 112

def File.executable?(name)
	stat(name).executable?
end

.executable_real?(name) ⇒ Boolean

Returns:

  • (Boolean)


115
116
117
# File 'lib/rex/post/file.rb', line 115

def File.executable_real?(name)
	stat(name).executable_real?
end

.expand_pathObject

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



84
85
86
# File 'lib/rex/post/file.rb', line 84

def File.expand_path
	raise NotImplementedError
end

.extname(*a) ⇒ Object



48
49
50
# File 'lib/rex/post/file.rb', line 48

def File.extname(*a)
	::File.extname(*a)
end

.file?(name) ⇒ Boolean

Returns:

  • (Boolean)


118
119
120
# File 'lib/rex/post/file.rb', line 118

def File.file?(name)
	stat(name).file?
end

.fnmatch(*a) ⇒ Object



87
88
89
# File 'lib/rex/post/file.rb', line 87

def File.fnmatch(*a)
	fnmatch?(*a)
end

.fnmatch?Boolean

Returns:

  • (Boolean)

Raises:



90
91
92
# File 'lib/rex/post/file.rb', line 90

def File.fnmatch?
	raise NotImplementedError
end

.ftype(name) ⇒ Object



121
122
123
# File 'lib/rex/post/file.rb', line 121

def File.ftype(name)
	stat(name).ftype
end

.grpowned?(name) ⇒ Boolean

Returns:

  • (Boolean)


124
125
126
# File 'lib/rex/post/file.rb', line 124

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.



53
54
55
# File 'lib/rex/post/file.rb', line 53

def File.join(*a)
	::File.join(*a)
end

.lchmodObject



69
70
71
# File 'lib/rex/post/file.rb', line 69

def File.lchmod
	raise NotImplementedError
end

.lchownObject



72
73
74
# File 'lib/rex/post/file.rb', line 72

def File.lchown
	raise NotImplementedError
end


75
76
77
# File 'lib/rex/post/file.rb', line 75

def File.link
	raise NotImplementedError
end

.lstatObject



78
79
80
# File 'lib/rex/post/file.rb', line 78

def File.lstat
	raise NotImplementedError
end

.mtime(name) ⇒ Object



127
128
129
# File 'lib/rex/post/file.rb', line 127

def File.mtime(name)
	stat(name).mtime
end

.owned?(name) ⇒ Boolean

Returns:

  • (Boolean)


130
131
132
# File 'lib/rex/post/file.rb', line 130

def File.owned?(name)
	stat(name).owned?
end

.pipe?(name) ⇒ Boolean

Returns:

  • (Boolean)


133
134
135
# File 'lib/rex/post/file.rb', line 133

def File.pipe?(name)
	stat(name).pipe?
end

.readable?(name) ⇒ Boolean

Returns:

  • (Boolean)


136
137
138
# File 'lib/rex/post/file.rb', line 136

def File.readable?(name)
	stat(name).readable?
end

.readable_real?(name) ⇒ Boolean

Returns:

  • (Boolean)


139
140
141
# File 'lib/rex/post/file.rb', line 139

def File.readable_real?(name)
	stat(name).readable_real?
end

.setgid?(name) ⇒ Boolean

Returns:

  • (Boolean)


145
146
147
# File 'lib/rex/post/file.rb', line 145

def File.setgid?(name)
	stat(name).setgid?
end

.setuid?(name) ⇒ Boolean

Returns:

  • (Boolean)


142
143
144
# File 'lib/rex/post/file.rb', line 142

def File.setuid?(name)
	stat(name).setuid?
end

.size(name) ⇒ Object



148
149
150
# File 'lib/rex/post/file.rb', line 148

def File.size(name)
	stat(name).size
end

.socket?(name) ⇒ Boolean

Returns:

  • (Boolean)


151
152
153
# File 'lib/rex/post/file.rb', line 151

def File.socket?(name)
	stat(name).socket?
end

.sticky?(name) ⇒ Boolean

Returns:

  • (Boolean)


154
155
156
# File 'lib/rex/post/file.rb', line 154

def File.sticky?(name)
	stat(name).sticky?
end

.symlink?(name) ⇒ Boolean

Returns:

  • (Boolean)


157
158
159
# File 'lib/rex/post/file.rb', line 157

def File.symlink?(name)
	stat(name).symlink?
end


66
67
68
# File 'lib/rex/post/file.rb', line 66

def File.unlink
	raise NotImplementedError
end

.writeable?(name) ⇒ Boolean

Returns:

  • (Boolean)


160
161
162
# File 'lib/rex/post/file.rb', line 160

def File.writeable?(name)
	stat(name).writeable?
end

.writeable_real?(name) ⇒ Boolean

Returns:

  • (Boolean)


163
164
165
# File 'lib/rex/post/file.rb', line 163

def File.writeable_real?(name)
	stat(name).writeable_real?
end

.zero?(name) ⇒ Boolean

Returns:

  • (Boolean)


166
167
168
# File 'lib/rex/post/file.rb', line 166

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..



31
32
# File 'lib/rex/post/file.rb', line 31

def initialize(name, mode='r', perm=0)
end

#pathObject



34
35
36
# File 'lib/rex/post/file.rb', line 34

def path
	filename
end