Skip to content
Snippets Groups Projects
Commit 651a3c06 authored by deuce's avatar deuce
Browse files

Now strips telnet commands.

parent 956d1533
No related branches found
No related tags found
No related merge requests found
...@@ -116,7 +116,7 @@ int spyon(char *sockname) { ...@@ -116,7 +116,7 @@ int spyon(char *sockname) {
struct sockaddr_un spy_name; struct sockaddr_un spy_name;
socklen_t spy_len; socklen_t spy_len;
char key; char key;
char buf[1]; char buf;
int i; int i;
struct termios tio; struct termios tio;
struct termios old_tio; struct termios old_tio;
...@@ -125,6 +125,7 @@ int spyon(char *sockname) { ...@@ -125,6 +125,7 @@ int spyon(char *sockname) {
int retval=0; int retval=0;
char ANSIbuf[32]; char ANSIbuf[32];
int parsing=0; int parsing=0;
int telnet_strip=0;
/* ToDo Test for it actually being a socket! */ /* ToDo Test for it actually being a socket! */
/* Well, it will fail to connect won't it? */ /* Well, it will fail to connect won't it? */
...@@ -222,7 +223,20 @@ int spyon(char *sockname) { ...@@ -222,7 +223,20 @@ int spyon(char *sockname) {
} }
if(spy_sock != INVALID_SOCKET && FD_ISSET(spy_sock,&rd)) { if(spy_sock != INVALID_SOCKET && FD_ISSET(spy_sock,&rd)) {
if((i=read(spy_sock,&buf,1))==1) { if((i=read(spy_sock,&buf,1))==1) {
write(STDOUT_FILENO,buf,1); if(telnet_strip) {
telnet_strip++;
if(buf=='\xff' && telnet_strip==2) {
telnet_strip=0;
write(STDOUT_FILENO,&buf,1);
}
if(telnet_strip==3)
telnet_strip=0;
}
else
if(buf=='\xff')
telnet_strip=1;
else
write(STDOUT_FILENO,&buf,1);
} }
else if(i<0) { else if(i<0) {
close(spy_sock); close(spy_sock);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment