Commit Graph

187 Commits

Author SHA1 Message Date
h00die d64ed33cdf code spell for a bunch of modules 2023-09-24 17:42:00 -04:00
Spencer McIntyre 396029a58e Fix connectivity issues
The connection needs to slowly send data to the remote end for
stability. Additionally, the `exit` command should be issued when
closing the connction so it is reset back to the logon prompt.
2023-08-01 15:04:32 -04:00
adfoster-r7 552b76aa8f Initialize to an empty string 2023-06-15 01:44:42 +01:00
adfoster-r7 fb6bb4031c Fix issue that falsely caused empty file reads on meterpreter 2023-06-14 17:50:54 +01:00
Spencer McIntyre ed5d516c21 Sync the .NET working path for Powershell sessions
See: https://github.com/PowerShell/PowerShell/issues/10278
2023-05-23 15:21:52 -04:00
RageLtMan 62e59e6250 Replace [System.IO.File]::Exists with Test-Path
The exists? method in post/file has a different implementation for
PSH sessions than other shells which are testing for the existence
of a path, not the presence of a file.

Fix this by replacing [System.IO.File]::Exists with Test-Path.

Testing:
```
PS C:\Windows\system32> [System.IO.File]::Exists("C:\")
False
PS C:\Windows\system32>test-path C:\
PS C:\Windows\system32> test-path C:\
True
```
2023-05-10 11:10:08 -04:00
Spencer McIntyre 8c15c31b56 Fix paths for directory checks
The path C:\ ends with a trailing backslash which will cause bash to
wait for another line if input. This places the shell in an undesirable
state.
2023-04-21 14:39:00 -04:00
Grant Willcox 08f07eccb6 Fix initial incorrect parameters in YARD documentation 2023-03-05 20:15:14 -06:00
Ashley Donaldson 5c2640178c Suggested changes from code review 2022-12-16 10:36:26 +11:00
Ashley Donaldson 5716fd0f4d Revert to use of set /p, but with dummy variable so that %errorlevel% is set to 0 2022-12-15 09:05:16 +11: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
Ashley Donaldson 6ac1c305cc Appropriate return values for windows (cmd and powershell) shells 2022-12-14 17:00:16 +11:00
Ashley Donaldson b38af39660 Unix shell knows whether or not it has succeeded in writing or appending a file 2022-12-14 12:48:46 +11:00
adfoster-r7 97ba3bf85c Fix uploading binary file to windows shell command with identical name 2022-10-28 17:14:31 +01:00
adfoster-r7 ffa68e2bdf Fix broken file writes on windows when newlines are present 2022-10-28 16:45:49 +01:00
bcoles cd656ecdbb Msf::Post::File.append_file: Append not overwrite on *nix shell sessions 2022-10-21 23:28:14 +11:00
bcoles b49e480c53 Msf::Post::File.file_remote_digest[md5|sha1]: Print session.fs.file errors 2022-08-13 15:06:57 +10:00
bcoles 703cc872d4 Msf::Post::File.file_remote_digest[md5|sha1]: Add :util to set hash utility 2022-08-06 19:15:30 +10:00
bcoles 50a2127f3c Msf::Post::File.file_remote_digest[md5|sha1]: Remote hashing for PS sessions 2022-08-06 18:56:39 +10:00
bcoles 7d71bf6875 Msf::Post::File.file_remote_digest[md5|sha1]: Use Meterpreter hash methods 2022-08-06 17:42:11 +10:00
bwatters 163d4d5b11 Land #16854, Add CVE-2022-31660 VMware Workspace ONE Access LPE
Merge branch 'land-16854' into upstream-master
2022-08-03 16:50:12 -05:00
Spencer McIntyre e4947cd127 Add ownership check for testing file writability 2022-05-24 08:44:12 -04:00
sjanusz 7103a619c2 Add validation opts, tables, custom stylers to exploit suggester 2022-05-19 16:22:47 +01:00
adfoster-r7 7f24482ade Remove railgun requirement from post file mixin 2022-04-14 17:14:18 +01:00
alanfoster 395ab1d77e Specify mode rb on file reads 2022-02-12 21:39:12 +00:00
adfoster-r7 24bf9e5e61 Add Meterpreter compatibility requirements to lib 2021-12-13 11:30:32 +00:00
Christophe De La Fuente 389fd55952 Land #15808, Fix #15804 powershell read_file on Windows Server 2012 2021-12-07 11:59:11 +01:00
bwatters b1f6937542 Updated exploit to compile on target, added control over directory creation
Added a method to get source code for the write and compile method
2021-12-01 14:54:47 -06:00
Tim W f351f3804a fix write_file_powershell_fragment on Windows 7 2021-11-30 06:30:58 +00:00
Tim W cb70c8e861 fix #15804, fix powershell read_file on Windows Server 2012 2021-11-30 06:30:58 +00:00
Tim W a5b88c6844 only return false in write_file for unsupported sessions 2021-11-29 09:46:28 +00:00
Tim W c7b4a31ae6 modify Post::File tests to check write_file return value 2021-11-25 03:37:06 +00:00
Tim W 9b5e24d55b Fix #12603, create _write_file_meterpreter function 2021-11-25 03:34:17 +00:00
Tim W bce463fa6a Fix #15896, write_file should return true on success 2021-11-22 04:26:54 +00:00
Tim W 86d1e3cb0a fix get_drives format 2021-10-25 17:30:47 +01:00
Tim W ca8094d1b8 fix dir on powershell sessions 2021-09-23 13:29:31 +01:00
Tim W d3a372e92b add support for shell sessions 2021-09-23 13:02:17 +01:00
Tim W f540c2ad8f move get_drives to file mixin 2021-09-23 13:02:17 +01:00
adfoster-r7 ed72ca217a Improve setuid nmap module 2021-09-21 01:47:59 +01:00
bwatters 07204dc99e Rubocop -A 2021-09-14 07:41:45 -05:00
bwatters ddebdbc770 Remove some debug prints I left in 2021-09-14 07:41:45 -05:00
bwatters 51c4c9bd4e Update file library and file test module to work correctly
- added file append
- changed powershell commands to script-style (they seem to work much better)
- cleaned out use of string literals for filenames in test module
2021-09-14 07:41:45 -05:00
bwatters d5fee988be Land #15560, Add a binary safe write_file method for powershell session type
Merge branch 'land-15560' into upstream-master
2021-09-08 14:07:44 -05:00
bwatters f5a8c7e918 Add missing end 2021-09-08 12:53:41 -05:00
Grant Willcox c4ab16aa75 Fix typo in lib/msf/core/post/file.rb that was preventing normal cmd shells from being able to rename files. 2021-09-03 11:15:10 -05:00
Gaurav Purswani 28c41f5ec9 Merge branch 'master' into bin_pwsh_write_file 2021-08-26 07:27:07 +05:30
Spencer McIntyre d90c0293ec Land #15477, Add read_file and readable? for psh 2021-08-23 17:49:44 -04:00
Spencer McIntyre 5d33303263 Land #15332, rename_file function improvements 2021-08-19 12:08:12 -04:00
Spencer McIntyre bb82b41184 Update the rename_file docs 2021-08-19 12:08:03 -04:00
pingport80 40f4fff278 update condition 2021-08-17 20:14:00 +05:30