Commit Graph

285 Commits (d6bce4410c27c7d8e25bf8f8bd575d5dfe55dae5)

Author SHA1 Message Date
Adam Cammack 4375a3fbfb
Fix lurking bugs in the shell's prompt_yesno 2018-08-16 09:05:22 -05:00
Adam Cammack c045f70e80
Emulate `prompt_yesno` semantics for UI drivers 2018-08-15 17:30:37 -05:00
William Vu 2bce8b008e Fix history deduplication for system Readline 2018-08-07 16:53:24 -05:00
William Vu 298d5c3b30 Refactor history clearing 2018-08-07 16:53:17 -05:00
William Vu 3b2c3507d1 Refactor history deduplication on save
We move the check outside the block and clean up the syntax.
2018-08-07 11:18:13 -05:00
Auxilus cb01216e0c
fix history issues as stated in #10423 2018-08-06 11:27:47 +05:30
William Vu a0962855bd Refactor history deduplication
We don't need to know the absolute index. We also fix the IndexError.
2018-08-05 14:28:10 -05:00
Auxilus fce19cf5b8
Prevent adding the same command to history 2018-08-05 22:33:00 +05:30
Adam Cammack ef264e78f0
Refactor grep command to use optparse
This is an experiment to see what it would take to convert *all* option
assignment, parsing, and validation to use Ruby's builtin optparse. Our
current situation in the command dispatchers is a mishmash of bespoke
and Rex code, both with odd behaviors. Modules use a more formalized
system, but it is also a bit janky and unlike most other tools a
pentester might use.

The first step is to refactor the console commands to use Ruby's builtin
option parsing to reduce code and increase homogeneity among the various
functions. Next we plan to explore what it would take to invoke modules
from within Metasploit this way (this would be Metasploit 5+ only).

Refactoring `grep` seems to have been a success. There is now less code;
the code that declares and handles the options are now in the same
place; long options are now supported; adjacent, argument-less short
opts now work as expected; patterns can now begin with a `-`; and option
arguments are now validated. Additionally, optparse's argument
coercion/validation code can be extended for custom types/validations to
support more specialized commands.
2018-07-19 12:11:09 -05:00
asoto-r7 ef78d70a00
Land #9356. Remove ring buffers from command dispatcher. 2018-07-06 13:12:13 -05:00
Green-m cfb3c4d3ad Ignore case when use tab to complete 2018-06-01 07:37:23 -04:00
William Vu 6f1e75e097 Remove loopback restriction
It's occasionally useful, and we already warn when setting it.
2018-05-24 15:44:32 -05:00
William Vu da3df23f03 Fix Socket#getifaddrs with ::
Rex::Socket#getifaddrs doesn't exist.
2018-05-24 14:53:41 -05:00
Brent Cook 7a95024062 remove more ring operations 2018-04-06 13:49:16 -05:00
Brent Cook 2ee7b1ec5c Fix native 'readline' (msfconsole -L) support for Ruby 2.5 onward 2018-04-03 08:00:08 -05:00
Brent Cook 99965c142b remove duplicate check 2018-02-20 04:42:49 -06:00
Brent Cook bb3a11dd20 use ctrl-d to cancel input instead 2018-02-20 04:40:00 -06:00
Brent Cook f5f7b4d25a handle sessions still open 2018-02-20 03:31:20 -06:00
Brent Cook e995ccfc33 make this a little easier to read 2018-02-20 03:27:55 -06:00
Brent Cook e26fb49c99 if we have no more input from the console, quit 2018-02-20 03:27:38 -06:00
Spencer McIntyre 214c137b4a Don't use parenthesis around pgets 2018-02-07 15:53:11 -05:00
Spencer McIntyre 0ad7d10e05 Use a continuation flag to disable tab completion 2018-02-06 14:44:55 -05:00
Spencer McIntyre 6d7579d907 Support breaking commands into multiple lines 2018-02-06 14:29:11 -05:00
William Vu 65412cd2f1
Land #9201, enhanced tab completion 2017-11-27 11:37:04 -06:00
Spencer McIntyre bc691cbd00 Document the new tab completion functions 2017-11-11 17:17:48 -05:00
Spencer McIntyre fb7635502d Tab completion for exploit and handler commands 2017-11-11 17:11:54 -05:00
Spencer McIntyre 68a43fef36 Add the new generic tab completion functoin 2017-11-11 16:47:11 -05:00
William Vu 5de190f092
Land #9145, ERB/<ruby> for Meterpreter resource 2017-11-01 13:48:51 -05:00
Brent Cook 90766ceceb remove more unusual raise RuntimeError patterns 2017-11-01 05:59:12 -05:00
Spencer McIntyre 940573ad49 Support ruby directives in Meterpreter rc scripts 2017-10-29 15:57:33 -04:00
James Lee af42f517b8 Default PromptTimeFormat to %T 2017-10-17 16:39:44 -05:00
William Vu 4098c66efb Restore MinGW code and use =begin/=end for indent 2016-12-21 00:38:08 -06:00
Brent Cook d0d84b418b disable async output until we have a better handle on new quirks 2016-12-20 23:50:43 -06:00
cypher 27ba8f00df check for nil msg in print_error 2016-12-14 21:10:10 -08:00
Brendan 7dd2d3e226 Fix the prompt again 2016-12-07 14:32:54 -06:00
David Maloney c9b5e43201
only use ANSI ctrl chars in stdio output
the async output fix was put in the parent UI IO
class when it only really makes sense in stdio.
Those ctrl sequences will noly be understood if output to a
terminal.

MS-2298
2016-12-01 11:06:17 -06:00
Brent Cook 34aa79ca27 remove captured delimiter characters from output 2016-11-27 20:14:16 -06:00
Dylan Davis 991409fdd6 Make truthiness checks consistent 2016-11-21 19:37:48 -07:00
Dylan Davis 72609b3112 Don't use ANSI terminal sequences on Windows 2016-11-21 19:25:24 -07:00
h00die cd01b07682
Land #7565
Lands print_bad and vprint_bad from todb-r7
2016-11-18 13:29:39 -05:00
Dylan Davis 739c9c1315 Ensure cursor is positioned appropriately if it is not at the end of a line when async prints arrive 2016-11-16 21:07:50 -07:00
Dylan Davis 491a3a3162 Prevent the input prompt from being mangled by asynchronous prints. 2016-11-16 20:43:07 -07:00
Tod Beardsley 1deacad2be
Add a print_bad alias for print_error
Came up on Twitter, where Justin may have been trolling a little:

https://twitter.com/jstnkndy/status/798671298302017536

We have a `print_good` method, but not a `print_bad`, which seems a
little weird for Ruby -- opposite methods should be intuitive as Justin
is implying.

Anyway, I went with alias_method, thanks to the compelling argument at

https://github.com/bbatsov/ruby-style-guide#alias-method

...since Metasploit is all about the singleton, and didn't want to risk
some unexpected scoping thing.

Also dang, we define the `print_` methods like fifty billion times!
Really should fix that some day.
2016-11-15 19:20:42 -06:00
OJ af4b1cf48f
Add the `sess` command to MSF and Meterp shells
This new command is a simpler shortcut that allows for moving around sessions much faster from within the console.

* From inside MSF, `sess <id>` is shorthand for `sessions -i <id>`
* From inside Meterp, `sess <id>` is shorthand for `background; sessions -i <id>`

In the latter case, if the session being switched to is the same id, then no swiching happens.
2016-09-22 16:09:59 +10:00
David Maloney 405c59b8b8 move bidirectional pipe into rex/ui/text
this didn't really fit with the rest of rex::io and it inherits
from inside rex/ui/text so just put it there

MS-1715
2016-09-07 11:34:04 -05:00
David Maloney 4e678e4ce6
fix help table
there was a bad class refernece here that
needed to be cleaned up

MS-1875
2016-08-12 13:33:41 -05:00
David Maloney 42d6c9443d
remove unused ProgressTracker class
not sure if this was ever used, but it is certainly not being used
by anything now, so let's remove it

MS-1875
2016-08-11 10:35:10 -05:00
David Maloney 8489485cfd
move Rex::Ui::Text::Color out to rex::text gem
moved the text ansi color library out to the rex-text gem

MS-1875
2016-08-11 10:28:09 -05:00
David Maloney 3f530f1896
remove rex::ui::text:table
remove the class from msf, and update the rex-text
gem to pull the code in under the new version at Rex::Text::Table
modify all requires appropriately

MS-1875
2016-08-10 13:24:25 -05:00
ssyy201506 0a85f1d233 Fix an error when exiting a interactive shell 2016-06-30 16:19:10 +09:00