Commit Graph

134 Commits

Author SHA1 Message Date
Ashley Donaldson 9d8193150f
Allow running a shell command separately to the currently interactive shell 2021-09-21 19:12:49 +10:00
Ashley Donaldson 91d0a6cc55
Re-auth after the session times out
This seems to happen after 8 hours. WinRM doesn't like having bodies
in the authentication requests, so we force the HTTP client to send
an empty one first
2021-09-17 07:32:18 +10:00
Ashley Donaldson 5dceb48553
Fixed rubocop issues 2021-09-13 11:40:03 +10:00
Ashley Donaldson 44455fd165
Added some comments for clarity 2021-09-12 19:38:16 +10:00
Ashley Donaldson 50e31917da
Emulate a stream to make the base command shell happy 2021-09-10 17:45:08 +10:00
Ashley Donaldson 0927737948
Adapted WinRM module logging to MSF logging
Separated WinRM module into separate files
2021-09-10 15:54:50 +10:00
Ashley Donaldson b0e1502c86
Implemented suggestions from code review
- Use a literal hash
- Comment meaning of NTLM transforms
- store loot with data ready to go, to keep database in sync with file
2021-09-10 08:25:25 +10:00
Ashley Donaldson 5cffa86e30
Removed unused code 2021-09-10 07:46:05 +10:00
Ashley Donaldson cf09d56be0
Support re-authentication during the shell
After 8 hours, the server requests re-authentication, so need to support that.
2021-09-10 07:41:31 +10:00
Ashley Donaldson 9ea3be903d
Just use cmd, as powershell <= 3.0 doesn't actually use stdout/stderr 2021-09-09 22:40:43 +10:00
Ashley Donaldson c33b850ff8
Support terminating processes early by sending a Ctrl+C signal 2021-09-09 22:08:33 +10:00
Ashley Donaldson 3acddf75b4
Suggested changes from code review
* Report socket info
* Use existing Event class
* Remove debugging prints
* Comment obscure constant
2021-09-08 07:36:59 +10:00
Ashley Donaldson 00100f426c
Handle the server ceasing to respond 2021-09-06 23:24:23 +10:00
Ashley Donaldson 0e103e8550
Enabled encryption for WinRM when using Negotiate auth 2021-09-06 22:25:34 +10:00
Ashley Donaldson eeef8a3085
Support domain login in WinRM module 2021-09-06 10:25:36 +10:00
Ashley Donaldson 7a75a91dc6
Request stdout on a separate thread, so we are alerted when the shell dies. 2021-09-06 09:33:44 +10:00
Ashley Donaldson b50a1aa988
Moved reusable functionality into separate file 2021-09-02 21:58:07 +10:00
Spencer McIntyre 51f8808bed Fix the representation of IPv6 addresses 2021-06-29 14:21:36 -04:00
CSharperMantle d99c2ac783 linguistic fixes of 'does not exists' 2020-12-23 11:36:38 +08:00
Spencer McIntyre f8fe5974be Properly skip over unsupported RRs when doing DNS zone transfers 2020-05-06 13:15:33 -04:00
William Vu e9b3502f98 Fix Net::SSH::CommandStream session open failure
I suspected this might be a problem for libssh servers.
2018-11-02 01:08:05 -05:00
William Vu 4182777488 Support SSH shell/exec channel request output
Looks like channel[:data] was initialized but never used.
2018-10-23 09:34:12 -05:00
William Vu cf00f20e11 Update Net::SSH::CommandStream exception handling 2018-10-18 22:45:16 -05:00
William Vu 6fd53fcb6a Fix whitespace further 2018-10-17 15:45:02 -05:00
William Vu 1e1950c83d Prefer keyword args after all
SINCE we've been using only the first two params, we're fine!
2018-10-17 15:41:19 -05:00
William Vu a453760aa4 Add PTY option to Net::SSH::CommandStream
This allows us to spawn a PTY for our shell session. Note that this will
write us to {u,w}tmp and lastlog, so use this option with care.

And yes, I did change the API, but up until now, we've been using only
the first two parameters. We should be using keyword args. /shrug
2018-10-17 15:40:13 -05:00
Sonny Gonzalez f5ccdcfcd2
Net SSH CommandStream fixes implemented
* Net::SSH::CommandStream typos fixed
* Net::SSH::CommandStream cleanup made more robust and refactored
* require 'net/ssh/command_stream' added to various modules
2018-07-25 11:22:28 -05:00
Brent Cook b1d0529161 prefer 'shell' channels over 'exec' channels for ssh
If a command is not specified to CommandStream, request a "shell"
session rather than running exec. This allows targets that do not have a
true "shell" which supports exec to instead return a raw shell session.
2018-02-08 02:21:16 -06:00
RageLtMan 7cc7fe71db Address net-dns additional records empty array
Conversion between packet formats can create empty additional
answers fields, which net-dns cannot handle.

Update net-dns' packet parser to be able to deal with empty arrays
such that it doesn't try to call :data on a nil, which is the only
element of an empty array.

Props to mubix for identifying this issues.
2017-06-24 20:27:19 -04:00
Carter Harwood 6e312fd009 Minor spelling correction: lenght => length 2017-05-05 10:42:33 -05:00
Brent Cook f69b4a330e handle Ruby 2.4 Fixnum/Bignum -> Integer deprecations 2017-01-22 10:20:03 -06:00
David Maloney 06ff7303a6
make pubkey verifier work with old module
make the new pubkey verifier class and
the old identify_pubkeys aux module work
together

7321
2016-09-19 15:20:35 -05:00
David Maloney 2f17ae0946
add pubkey_verifier class to framework
this class provides a new way to do
public key only verification tests
for SSH

7321
2016-09-19 14:35:59 -05:00
David Maloney 3e94abe555
put net:ssh::commandstream back
this was apparently our own creation for doing
ssh sessions

MD-1688
2016-06-22 15:02:36 -05:00
David Maloney 140621ad9b
start to move to canonical net-ssh
removed vendored net::ssh
pulled in net:ssh gem
made Rex::Socket::SSHFactory clas to bridge rex sockets in
Renamed getpeername to getpeername-as_array to not override
core socket behaviour

MS-1688
2016-06-22 14:52:33 -05:00
Jon Hart 7c70a554ea
Merge branch 'pr/6187' into pr/fixup-6187 for pre-master merge testing 2016-04-08 16:56:38 -07:00
wchen-r7 f7dd326b16
Land #6455, Fix dns labels/names size limits for lib/net/dns/names/names 2016-04-01 21:57:09 -05:00
RubenRocha 72a69fcd16 Fixed timeout warning 2016-02-19 21:14:54 +00:00
Jon Hart af33980b72
Load hinfo support, fix broken hinfo code 2016-02-18 23:22:17 -08:00
Jon Hart a2a932e176
Dont store AXFR answers if there are no answers 2016-02-04 10:28:11 -08:00
Jon Hart 6882bf275e
Break out of the wait loop for this ns after a response is received 2016-02-04 10:07:53 -08:00
Adam Cammack d544488409
Land #6461, backport net-ssh ECDH kex algorithms 2016-01-20 14:05:39 -06:00
Brent Cook e1be57d658
Land #6458, Backport net-ssh AES CTR ciphers 2016-01-14 14:44:49 -06:00
Christopher Moore 8102fc2af2
add support for ECDH SHA2 NIST key exchanges 2016-01-10 18:01:49 +00:00
Christopher Moore 96b6eb6b06
remove extraneous comma 2016-01-10 17:13:15 +00:00
Christopher Moore b7e3d97935
remove extra spacing 2016-01-10 17:12:41 +00:00
Christopher Moore b3e42c3611
add missing coding preamble 2016-01-10 17:10:23 +00:00
Christopher Moore 8f72166f66
add missing coding preamble 2016-01-10 17:08:58 +00:00
Christopher Moore 9ff5ffd1ac
fix erroneous comment 2016-01-09 17:56:11 +00:00
Christopher Moore 888be6133c
KEx availability depends on OpenSSL support 2016-01-09 13:45:23 +00:00