Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #138, add globbing to stdapi_fs_ls #139

Merged
merged 2 commits into from
Dec 4, 2018
Merged

Conversation

timwr
Copy link
Contributor

@timwr timwr commented Oct 6, 2018

This implements support for globbing on stdapi_fs_ls.
This is mostly useful because it fixes the tab completion :)

Unfortunately we still get:

meterpreter > ls me*
File globbing not supported with this session
meterpreter >

even though it is supported by this pr.
To fix that we can either implement stdapi_fs_search (in a separate pull request) or find another way for the framework side of things to know if globbing is supported.
See #138 for more details.

@timwr
Copy link
Contributor Author

timwr commented Oct 20, 2018

This is timing out currently on iOS

@timwr timwr added the delayed label Oct 20, 2018
@busterb
Copy link
Member

busterb commented Oct 22, 2018

What do you mean by timing out?

@busterb
Copy link
Member

busterb commented Oct 22, 2018

We might just override glob in iOS's libc with the musl one unconditionally https://git.musl-libc.org/cgit/musl/tree/src/regex/glob.c

@timwr
Copy link
Contributor Author

timwr commented Oct 23, 2018

It seems the call to glob (https://github.com/rapid7/mettle/pull/139/files#diff-5bf4b5b8f1b639f9de20cda70d2fdb28R93) never returns so we get:

meterpreter > ls
[-] Error running command ls: Rex::TimeoutError Operation timed out

How would I go about overriding the libc version? Just add it to mettle/src/compat/glob.c?

@busterb
Copy link
Member

busterb commented Oct 23, 2018

That could be one way. If glob is not a weak symbol in libc (meaning you can easily override it via the linker), you could also rename the exported function to 'musl_glob' or something.

If you wanted to selectively redirect 'glob' to 'musl_glob' then, you could do something like this with a preprocessor define, or just call it directly: https://github.com/libressl-portable/portable/blob/master/include/compat/stdio.h#L33

@busterb busterb self-assigned this Oct 25, 2018
@busterb busterb removed the delayed label Oct 25, 2018
@busterb
Copy link
Member

busterb commented Oct 25, 2018

Marking this unblocked, @space-r7 and I can look at it today.

@busterb
Copy link
Member

busterb commented Dec 4, 2018

Looks good, landing.

@busterb busterb merged commit 73de19d into rapid7:master Dec 4, 2018
busterb added a commit that referenced this pull request Dec 4, 2018
busterb added a commit to busterb/metasploit-framework that referenced this pull request Dec 7, 2018
This is a large update to mettle payloads including:

 * Adds globbing support to the `ls` command (rapid7/mettle#139)
 * Fixes crashes on iOS platforms when cryptTLV is enabled (rapid7/mettle#142)
 * Fixes display of the OS version on macOS and iOS (rapid7/mettle#143)
 * Fixes the local port handling for pivoted client network connections (rapid7/mettle#144)
 * Fixes an unaligned memory access in TLV packet handling, needed for some CPUs (rapid7/mettle#145)
 * Fixes some compatibility issues building on Solaris (rapid7/mettle#147)
 * Updated libpcap, mbedtls, and libcurl to the latest versions (rapid7/mettle#146)
@busterb
Copy link
Member

busterb commented Dec 8, 2018

Now that we have this, I say we just go ahead and implement fs_search. I can probably pull that together real quick since we have the primitives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants