Metasploit mailing list archives

"clear" in msfconsole


From: Joshua Smith <lazydj98 () gmail com>
Date: Mon, 5 Sep 2011 02:35:52 -0400

I found a half-assed way to add a "clear" command to msfconsole, at
least in linux/bash:
Create a file containing the following code as a file called clear in
your install root.  Though you can obviously skip the comments

<ruby>
        # to modify this script for your OS & shell do the following
        # enter %x{clear} in irb, put the resulting string below
        # If you're running msf in Cygwin, in Windows, make sure to run
        # the irb command in Cygwin (untested)
        # Tested on BT5r1, with BASH
        
        $stdout.print "\e[H\e[2J"
</ruby>

then just run 'resource clear' to clear the screen.


I tried to see if I could make it more generic by dynamically figuring
out the string to print, but I get an 'xterm' unknown terminal when I
try.  I've also been looking into how to add it as a core console
command, but I'm guessing a dev could do it way better & faster, but I
was hoping to provide a patch.  I know I would need to add something
like def cmd_clear to lib/msf/ui/console/command_dispatcher but I'm
not sure how the console knows to call this method when the user
enters 'clear'.  But I'm continuing to investigate.  If someone wants
to point me in the right direction, just hit me up off-list or on irc
(kernelsmith)

-- 
- Josh
_______________________________________________
https://mail.metasploit.com/mailman/listinfo/framework


Current thread: