Jump to content

GateOne Javascript help

l11h

Hi,

 

I am using GateOne for my school project as a terminal, and I want parsing in the terminal.

 

The current code I have is this:

 

 var rmWarning = function() {
    console.log(GateOne.Terminal.Input.commandBuffer); // So you can see what's in the buffer (for debugging)
    if (GateOne.Terminal.Input.commandBuffer.indexOf('rm -rf') != -1) { // "if the command starts with 'rm -rf'..."
        GateOne.Visual.displayMessage("You're about to execute a very dangerous command.  Press Enter again if you're absolutely sure you want to execute it.");
        GateOne.Terminal.Input.charBuffer = []; // Empty the character buffer so the enter key doesn't get sent
    }
}
GateOne.Events.on("terminal:enter_key", rmWarning);
 
What that basically does is if the terminal detects rm -rf it will display a message saying that this cannot be executed.
 
What I want to do is delete that command, the user inputs.
The Gateone.Terminal.Input.charBuffer = []; allows me to input text into the terminal, so if I input ["test"], when the user hits enter the word test is shown.
 
So what I am struggling with is how do i execute Ctrl-C or even a bunch of backspaces? 
 
Any help will be appreciated.
 
Thank you. :)

 

Link to comment
Share on other sites

Link to post
Share on other sites

I just need some ideas or places to look in order to get this to work, if you know exactly then that will be great, but some helpful tips will be greatly appreciated.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×