File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 11import logging
22import os
3+ import re
34
45from ssh_proxy_server .forwarders .ssh import SSHForwarder
56
@@ -36,7 +37,8 @@ def forward_stdin(self):
3637 self .executing = False
3738 self .script .close ()
3839 self .output .close ()
39- super (SSHScriptedForwarder , self ).forward_stdin ()
40+ # Resets Shell prompt for user (OpenSSH Server Last Login is omitted)
41+ self .server_channel .sendall (b'\n ' )
4042 elif line != "" :
4143 self .server_channel .sendall (line )
4244 return
@@ -46,8 +48,11 @@ def forward_stdin(self):
4648 super (SSHScriptedForwarder , self ).forward_stdin ()
4749
4850 def stdout (self , text ):
51+ def escape_ansi (line ):
52+ ansi_escape = re .compile (r'(?:\x1B[@-_]|[\x80-\x9F])[0-?]*[ -/]*[@-~]' )
53+ return ansi_escape .sub ('' , line )
4954 if self .executing :
50- self .output .write (text .decode ('utf-8' ))
55+ self .output .write (escape_ansi ( text .decode ('utf-8' ) ))
5156 return ""
5257 return text
5358
You can’t perform that action at this time.
0 commit comments