Skip to content

Conversation

@carterburn
Copy link

Card

Add a new command to support operator-defined command aliases, similar to alias in bash. From the client, users will be able to specify an alias name, the command they are aliasing, and default arguments they want to always pass. Use of the command alias will expand the actual command and default arguments then append the remaining arguments provided to the invoked alias.

Details

  • New command tree: aka
  • aka create: defines a new alias. Takes the alias name, the command being aliased, and any default args the user wants to use for every invocation
  • aka / aka list: list out any created aliases
  • aka delete: remove any aliases created
  • Created aliases will be saved to disk in RootAppDir/aka-aliases.json. When creating aliases, the alias will be added to the file. When removing aliases, the alias will be removed from the file.

Usage examples for commonly used commands:

  • Faster background from the implant menu: aka create bg background. When in the implant menu, now users can simply run bg to background.
  • Quick running of Windows executables: aka create execw execute -o "C:\Windows\System32\cmd.exe" /c. When in the implant menu, users can run something like the arp -a command with: execw arp -a

Command aliases will allow a user to define "aliases" for shorthands and
to pass default arguments

Currently, aliases with more than one word commands (like a command
alias for "execute -o") require the use of single or double quotes to
pass the arguments correctly. Additionally, any use of flags in the
actual command will attempt to parse for the "aka" command and we want
the "aka create" command to be bare to just grab everything after the
command alias name.

Subsequent changes will include:
- better parsing of flags as described above
- saving command aliases to disk
- better help messages
Previous commit forced the user to use quotes in the creation command
and in any arguments that include spaces when expanded a command alias.

This commit removes that requirement and allows the user to manipulate
the shell interface as if they were typing commands directly.
Updated the way aka aliases are stored to support saving the aka aliases
to disk.

Aka aliases will automatically be saved to disk and loaded on client
startup.
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.

1 participant