Commit Graph

165 Commits

Author SHA1 Message Date
msutovsky-r7 7a1892e6e7 Land #19745, applying argument escaping to other shells
Apply escaping args to other command shells
2025-03-05 09:24:15 +01:00
jheysel-r7 6861b1fb67 Merge pull request #19729 from sempervictus/bug/shell_command_overlap
Fix overlap of shell built-in commands with host's
2025-02-06 10:27:12 -08:00
Ashley Donaldson 25cb21908a Apply escaping args to other command shells 2024-12-18 10:44:38 +11:00
RageLtMan df6bd846e5 Add . prefix tip to shell command help 2024-12-15 18:28:18 -05:00
RageLtMan 54bec338c3 Fix overlap of shell built-in commands with host's
When a shell session is established against a system which offers
limited shells, its very common to run into something like "help"
being a native command in the target. MSF now intercepts those as
built-ins and presents the MSF shell help instead of letting the
user see the relevant output from the target.

Implement a fix by allowing the user to prepend built-ins with '.'
to pass-through execution of the intended command (such as '.help'
being executed as 'help') to the target.

Testing:
  Local testing with racadm SSH shell - works as intended
2024-12-15 18:06:33 -05:00
Ashley Donaldson 205adfe2fd Handle edge case in command shell when input contains backslash-quote combination already 2024-10-16 10:26:29 +11:00
Ashley Donaldson d9ed8ec4dc Rework unix command line based on testing 2024-10-12 14:36:08 +11:00
adfoster-r7 6a31ceb9e6 Improve setg SessionLogging support 2024-07-24 17:22:11 +01:00
Zach Goldman c16b8e6e64 adds help command to basic shells 2024-03-20 14:18:36 -05:00
h00die 6a851855a8 spelling fixes for lib folder 2024-01-06 15:54:49 -05:00
Dean Welch ea41ec7a5d Fix tests leaving behind threads 2023-11-07 17:43:43 +00:00
Dean Welch 3f3531d119 Add test for command shell sessions 2023-10-31 16:35:58 +00:00
Simon Janusz faa3dd6b85 Land #18372, Fix error downloading a file from generic shell 2023-10-05 17:47:27 +01:00
h00die d64ed33cdf code spell for a bunch of modules 2023-09-24 17:42:00 -04:00
adfoster-r7 a60e048e78 Fix msfrpc hanging when updating saved command history 2023-09-15 12:42:40 +01:00
Carmix 1efb3f733f solves #18371 2023-09-15 11:36:15 +02:00
adfoster-r7 449af8daa7 Fix broken msfconsole histories when switching between shell sessions 2023-07-27 16:12:57 +01:00
Spencer McIntyre 120dc877ad Pr/collab/17430 (#41)
* Prevent using post modules with the session

It doesn't work reliably because of winpty and how the output is
mangled.

* Set the limit correctly

* Fix Linux PTY downgrade issues

* Remove filtering

The filtering implementation is incomplete and unnecessary.

Filtering is unnecessary because Linux sessions execute a stub on
session start up that uses a combiantion of stty and a fifo to emulate a
PTY-less session. Windows sessions do not need filtering because they
have been explictly marked as being incompatible with the Post API which
is confused by the extra characters.

The filtering implementation is incomplete because it does not account for
echo fragments that are split across lines. It also does not account for
all of the ANSI escape codes.

* Add module docs for enum_ssm
2023-05-22 17:11:16 -04:00
RageLtMan 713ec6ae76 Merge branch 'master' into feature/aws_ssm_sessions 2023-05-16 14:39:37 -04:00
Spencer McIntyre 2e3a2b6f6d Combine AWS SSM modules, autodetect platform 2023-04-19 18:05:50 -04:00
Spencer McIntyre d1f5fa06cf Don't use File in cmd_upload / cmd_download
It does not look like shell sessions define their own File class,
meaning that the local-platform specific one is always used. Instead
we'll define the separator ourselves since it's all we need to perform
the basic operations necessary to analyze the path string.
2022-12-15 10:05:02 -05:00
Ashley Donaldson 5fd6103a70 Use boolean output of write_file for cmd_upload
Also fixed powershell upload, which failed at around 20000 bytes per command.
I believe this is related to powerfun, which seems to truncate to 20000 bytes.
2022-12-14 20:46:31 +11:00
Spencer McIntyre 34451940c7 Fix uploading from shell sessions 2022-12-12 12:02:33 -05:00
Spencer McIntyre 59d4f9b7e9 Fix downloading from shells to a directory
Prior to this change if the destination argument issued to a shell
session's internal `download` command was a directory, the command would
crash and the shell would be lost.
2022-12-12 10:42:11 -05:00
adfoster-r7 e2d052322d Support upload and download command for powershell sessions 2022-10-26 11:48:31 +01:00
space-r7 184795513f Land #15831, add more ssh session support 2021-12-16 15:39:55 -06:00
Grant Willcox 5c2afd6750 Land #15882, Prevent payloads being used if can't clean up files 2021-12-16 15:05:27 -06:00
Tim W 80e2559f0f Fix #15912, handle unmatched double quote on command shell sessions 2021-11-28 11:51:18 +00:00
Ashley Donaldson f54f03fc92 Prevent payloads being used if can't clean up files 2021-11-17 15:40:16 +11:00
Spencer McIntyre 726c5f26e3 SSH session consistency with auto-platform IDing 2021-11-12 16:03:27 -05:00
William Vu 3e168149ca Increase AutoVerifySession timeout for PSH shells
The sweet spot is five seconds, which is also the default.
2021-10-14 16:58:04 -05:00
Christophe De La Fuente d3eff6fc14 Land #15600, Fixes issues with encrypted payloads by moving session bootstrap logic 2021-09-23 16:14:10 +02:00
A Galway cae29ccc2e PR Cleanup 2021-09-23 11:56:34 +01:00
A Galway 81a86379d7 handles unverified shells & warns db/mingw not installed 2021-09-10 17:56:08 +01:00
Ashley Donaldson 16af8ad028 Honour the timeout parameter for reading from the shell 2021-09-10 22:39:27 +10:00
Ashley Donaldson 12546865de Support Ctrl+C now we're using Command Shell rather than Powershell 2021-09-10 18:15:43 +10:00
A Galway 4a3fb6920e adds cmd_shell initial output reading to bootstrap 2021-09-09 16:34:21 +01:00
Spencer McIntyre b85031ff6a Fallback to Python3 in sshexec when it's available 2021-06-18 13:35:23 -04:00
Gaurav Purswani 379b0825b3 Merge branch 'master' into separate_session_history 2021-05-27 20:20:01 +05:30
Spencer McIntyre 0ea33ffee0 Consolidate session and shell context changes 2021-05-27 20:08:14 +05:30
Spencer McIntyre f2b69a559b Add and use a #with_context method 2021-05-27 20:08:09 +05:30
pingport80 eed82f5d17 add 'name' key to history contexts 2021-05-27 20:02:48 +05:30
pingport80 26f4d66897 add history_manager support for meterpreter 2021-05-27 20:02:38 +05:30
pingport80 ae74c44436 add history manager and fix pry history issue using that 2021-05-27 20:02:28 +05:30
dwelch-r7 a3a6c1b903 Land #15000, remove which command in binary_exists? method
remove `which` command in binary_exists? method
2021-04-30 11:24:11 +01:00
pingport80 cdcff2f0b2 fix msftidy err 2021-04-23 15:53:51 +05:30
pingport80 c2f145af89 add locale independent check 2021-04-23 14:32:10 +05:30
Gaurav Purswani b1a73c888e Update lib/msf/base/sessions/command_shell.rb
Co-authored-by: acammack-r7 <adam_cammack@rapid7.com>
2021-04-22 19:10:56 +05:30
Spencer McIntyre 69c525c2f7 Update the minimum WfsDelay setting
Now there's a minimum WfsDelay of 3 seconds with the user-configurable
value being added to it.
2021-04-20 13:05:37 -04:00
Spencer McIntyre c886af2e6d Allow disabling shell session verification 2021-04-15 10:33:42 -04:00