Commit Graph

307 Commits (b5df80d64b19bdc7e5cea64354bf4a778b1f5478)

Author SHA1 Message Date
William Vu 185931ca91
Land #10625, repeat command to repeat commands 2018-09-20 15:24:03 -05:00
William Vu 6f72a0516f Fix remaining typos 2018-09-20 15:23:15 -05:00
Adam Cammack 7c6c621a8f
Remember to assign `self.prompt` in shell.rb
Not everything updates the prompt all the time, make them feel welcome.
2018-09-13 15:51:07 -05:00
Adam Cammack 04cc7843a4
Typo fixes 2018-09-13 11:19:13 -05:00
William Vu 68a51da27b
Land #10477, console prompt fixes and refactor 2018-09-12 18:00:48 -05:00
Adam Cammack d017f420bf
Fix missing exception capture 2018-09-11 17:58:41 -05:00
Adam Cammack de0f0a97fb
Add mode to Shell#run_single to re-raise errors 2018-09-11 17:23:56 -05:00
Adam Cammack da25391426
Relocate option parsing error handling up a level 2018-09-11 17:22:05 -05:00
Adam Cammack 7414b18f20
Move prompt_char space to correct place 2018-08-29 10:38:28 -05:00
William Vu e955e8dc15 Clean up code
And hope I didn't break anything.
2018-08-24 18:05:52 -05:00
Green-m 418b574161
Merge branch 'master' and resolve conflict. 2018-08-23 23:24:23 -04:00
asoto-r7 4aee3a4ae2
Land #10448, Implementation of CTRL+C to send SIGINT signal 2018-08-20 18:14:29 -05:00
Adam Cammack 94dd67f3a5
Add public readers for prompt and prompt_char
This allows various things to inspect the state of the console before
calling `update_prompt`.
2018-08-17 14:41:48 -05:00
Adam Cammack 410eee8537
Remove 'append' mode from update_prompt
Nothing used it meaningfully. Also, due to the way `init_prompt` was set
prior to b1401e2e4e, it would have been
very broken: the prompt_char would have been included in the line twice
and prompt substitutions like %T would have been cached. Even more,
trying to append the empty string to the prompt (removed in that commit)
caused us to add a number of workarounds removed in
1df442e0cf.
2018-08-17 14:32:48 -05:00
Adam Cammack b1401e2e4e
Update the prompt every shell tick
This was inadvertently done as part of the tab completion
initialization but is what we want. Also move the prompt formatting to
the prompt update and make the code more readable.
2018-08-17 14:10:28 -05:00
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
Wang Yihang 6c33854ffc [+] Exit vim opened in reverse shell via signal USR1 2018-08-12 06:07:18 +08:00
Wang Yihang 6578950533 [-] Remove debug message 2018-08-09 16:32:27 +08:00
Wang Yihang f6c28106b9 Merge remote-tracking branch 'upstream/master' into add-resource-meta-shell-command 2018-08-09 16:20:26 +08: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
Wang Yihang c90b03808a Merge remote-tracking branch 'upstream/master' into add-resource-meta-shell-command 2018-07-30 13:25:26 +08:00
Green-m 3f8906596d Fix issue 10372, match mutiple slashes better 2018-07-26 05:35:04 -04:00
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
Green-m 00a748a92c Add tab_complete_directory 2018-07-17 06:29:12 -04:00
WangYihang 85bfca95fd [+] Fixed meterpreter resource bug 2018-07-09 11:27:30 +08: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