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

Extending ls functionality #497

Merged
merged 3 commits into from Aug 18, 2021
Merged

Extending ls functionality #497

merged 3 commits into from Aug 18, 2021

Conversation

RafBishopFox
Copy link
Contributor

This PR extends the functionality of ls:

  • Shows new fields: modified time and file permissions
    • Modified time is sent from the implant as the number of seconds since epoch, and formatting is done on the client, so we can change the formatting all we want client side and it does not affect the implant.
    • Modified time is adjusted for the implant's local time zone.
  • Supports sorting by name, size, or modified time (you can also reverse the sort)
  • File names are sorted case-insensitive
  • Supports globbing. You can ask for files that just start with n (n*) or all exes (*.exe). There are additional ways to filter the listing and those are outlined in the help.

The one down side is that filtering is done client side, so the entire directory list is sent from the implant.

The code makes use of the Golang standard library, so functionality should be the same across all platforms that Go supports.
This PR has been tested on the following platforms (all on amd64):

  • Windows (10)
  • Linux
  • NetBSD (9.2)
  • OpenBSD (6.9)
  • FreeBSD (13.0)

Example:

[server] sliver (MISERABLE_CAULIFLOWER) > ls /etc/p*

/etc
====
drwxr-xr-x  pam.d           <dir>    Fri Aug 06 08:15:33 -0400 2021
-rw-r--r--  papersize       68 B     Wed Jan 27 05:48:49 -0400 2021
-rw-r--r--  passwd          2.4 KiB  Mon Jul 19 13:44:49 -0400 2021
-rw-r--r--  passwd-         2.4 KiB  Fri Apr 23 06:57:13 -0400 2021
-rw-r--r--  passwdqc.conf   99 B     Sat Mar 13 17:21:58 -0400 2010
-rw-r--r--  pinforc         2.8 KiB  Thu Jan 28 00:00:22 -0400 2021
drwxr-xr-x  pkcs11          <dir>    Fri Apr 23 06:56:03 -0400 2021
drwxr-xr-x  pkgconfig       <dir>    Fri Apr 23 06:56:57 -0400 2021
drwxr-xr-x  pki             <dir>    Fri Apr 23 06:57:05 -0400 2021
drwxr-xr-x  plymouth        <dir>    Fri Apr 23 06:56:20 -0400 2021
drwxr-xr-x  pm              <dir>    Fri Apr 23 06:55:58 -0400 2021
drwxr-xr-x  polkit-1        <dir>    Thu Jun 03 08:29:10 -0400 2021
drwxr-xr-x  popt.d          <dir>    Sat Mar 06 04:29:10 -0400 2021
drwxr-xr-x  ppp             <dir>    Fri Apr 23 06:56:59 -0400 2021
drwxr-xr-x  prelink.conf.d  <dir>    Mon Jul 19 13:54:08 -0400 2021
-rw-r--r--  printcap        233 B    Tue Jun 23 02:11:43 -0400 2020
-rw-r--r--  profile         1.8 KiB  Tue Jun 23 02:11:43 -0400 2020
drwxr-xr-x  profile.d       <dir>    Mon Jul 19 14:11:19 -0400 2021
-rw-r--r--  protocols       6.4 KiB  Tue Jun 23 02:11:43 -0400 2020
drwxr-xr-x  pulse           <dir>    Fri Apr 23 06:56:07 -0400 2021
drwxr-xr-x  purple          <dir>    Fri Apr 23 06:57:00 -0400 2021

client/command/help/long-help.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants