Method: Rex::Proto::PJL::Client#fsdirlist

Defined in:
lib/rex/proto/pjl/client.rb

#fsdirlist(pathname, count = COUNT_MAX) ⇒ String

List a directory

Parameters:

  • pathname (String)

    Pathname

  • count (Fixnum) (defaults to: COUNT_MAX)

    Number of entries to list

Returns:

  • (String)

    Directory listing



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/rex/proto/pjl/client.rb', line 125

def fsdirlist(pathname, count = COUNT_MAX)
  if pathname !~ /^[0-2]:/
    raise ArgumentError, "Pathname must begin with 0:, 1:, or 2:"
  end

  listing = nil

  @sock.put(%Q{#{FSDIRLIST} NAME = "#{pathname}" ENTRY=1 COUNT=#{count}\n})

  if @sock.get(DEFAULT_TIMEOUT) =~ /ENTRY=1\r?\n(.*?)\f/m
    listing = $1
  end

  listing
end