rapid7/meterpreter

python meterpreter ls command large files are not supported.

uyid opened this issue · 3 comments

uyid commented

In python meterpreter,if you dir exist a large file(>4GB?), Unable to display directories with ls.

in python:
Traceback (most recent call last):
File "/payload.py", line 1254, in create_response
result = handler(request, resp)
File "", line 1304, in stdapi_fs_ls
File "", line 673, in get_stat_buffer
error: integer out of range for 'I' format code
in msf console:
meterpreter > ls i:
[-] stdapi_fs_ls: Operation failed: Unknown error

because:
in ext_server_stdapi.py line 660
def get_stat_buffer(path):
si = os.stat(path)
rdev = 0
if hasattr(si, 'st_rdev'):
rdev = si.st_rdev
blksize = 0
if hasattr(si, 'st_blksize'):
blksize = si.st_blksize
blocks = 0
if hasattr(si, 'st_blocks'):
blocks = si.st_blocks
st_buf = struct.pack('<IHHH', si.st_dev, max(min(0xffff, si.st_ino), 0), si.st_mode, si.st_nlink)
st_buf += struct.pack('<HHHI', si.st_uid & 0xffff, si.st_gid & 0xffff, 0, rdev)
st_buf += struct.pack('<IIII', si.st_size, long(si.st_atime), long(si.st_mtime), long(si.st_ctime))# max file size is 4GB ,int32 max value limit file size
st_buf += struct.pack('<II', blksize, blocks)

Hi @uyid

This repo is actually out of date and has been migrated over to rapid7/metasploit-payloads. I'd recommend making your issue report over there. I'd also recommend following some markdown formatting for code blocks for better readability.

I did verify I'm seeing the same thing as you though, so you're definitely on to something!

uyid commented

I've moved the problem to rapid7/metasploit-payloads.thanks

Closing because of new PR