Snoop function for UNIX version
This commit is contained in:
parent
439eb2a052
commit
32b416817e
|
@ -58,7 +58,6 @@ Const
|
|||
FocusMax = 4;
|
||||
|
||||
Var
|
||||
Console : TOutput;
|
||||
Keyboard : TInput;
|
||||
TelnetServer : TServerManager;
|
||||
FTPServer : TServerManager;
|
||||
|
@ -265,7 +264,6 @@ Procedure LocalLogin;
|
|||
Const
|
||||
BufferSize = 1024 * 4;
|
||||
Var
|
||||
Term : TTermAnsi;
|
||||
Client : TSocketClass;
|
||||
Res : LongInt;
|
||||
Buffer : Array[1..BufferSize] of Char;
|
||||
|
@ -338,6 +336,38 @@ Begin
|
|||
End;
|
||||
|
||||
{$IFDEF UNIX}
|
||||
Procedure Snoop;
|
||||
Begin
|
||||
If FocusCurrent <> FocusTelnet Then Exit;
|
||||
|
||||
If FocusPtr.ClientList[BarPos - 1] <> NIL Then Begin
|
||||
Term := TTermAnsi.Create(Console);
|
||||
|
||||
Console.TextAttr := 7;
|
||||
|
||||
Console.ClearScreen;
|
||||
|
||||
Console.SetWindow (1, 1, 80, 24, True);
|
||||
Console.WriteXY (1, 25, 112, strPadC('Snooping : Press [ESC] to Quit', 80, ' '));
|
||||
|
||||
TTelnetServer(FocusPtr.ClientList[BarPos - 1]).Snooping := True;
|
||||
|
||||
Repeat Until Keyboard.ReadKey = #27;
|
||||
|
||||
If TTelnetServer(FocusPtr.ClientList[BarPos - 1]) <> NIL Then
|
||||
TTelnetServer(FocusPtr.ClientList[BarPos - 1]).Snooping := False;
|
||||
|
||||
Term.Free;
|
||||
|
||||
Console.TextAttr := 7;
|
||||
Console.SetWindow (1, 1, 80, 25, True);
|
||||
|
||||
FocusCurrent := FocusMax;
|
||||
DrawStatusScreen;
|
||||
SwitchFocus;
|
||||
End;
|
||||
End;
|
||||
|
||||
Procedure ExecuteDaemon;
|
||||
Var
|
||||
PID : TPID;
|
||||
|
@ -468,7 +498,7 @@ Begin
|
|||
{$ENDIF}
|
||||
|
||||
Repeat
|
||||
If Keyboard.KeyWait(1000) Then
|
||||
If Keyboard.KeyWait(500) Then
|
||||
Case Keyboard.ReadKey of
|
||||
#00 : Case Keyboard.ReadKey of
|
||||
#72 : If BarPos > TopPage Then Begin
|
||||
|
@ -511,6 +541,7 @@ Begin
|
|||
End;
|
||||
End;
|
||||
#09 : SwitchFocus;
|
||||
#13 : {$IFDEF UNIX}Snoop{$ENDIF};
|
||||
#27 : Break;
|
||||
#32 : LocalLogin;
|
||||
End;
|
||||
|
|
|
@ -37,6 +37,12 @@ Const
|
|||
'u','t','d','o','w','n',' ',#24);
|
||||
Begin
|
||||
Console.LoadScreenImage(ImageData, ImageData_Length, ImageData_Width, 1, 1);
|
||||
|
||||
//Console.WriteXY (25, 1, 113, strPadC(mysVersionText, 30, ' '));
|
||||
|
||||
{$IFDEF UNIX}
|
||||
Console.WriteXY (1, 25, 113, strPadC('ENTER/Snoop SPACE/Local TELNET TAB/Switch ESC/Shutdown', 79, ' '));
|
||||
{$ELSE}
|
||||
Console.WriteXY (1, 25, 113, strPadC('SPACE/Local TELNET TAB/Switch ESC/Shutdown', 79, ' '));
|
||||
// Console.WriteXY (25, 1, 113, strPadC(mysVersionText, 30, ' '));
|
||||
{$ENDIF}
|
||||
End;
|
||||
|
|
|
@ -27,6 +27,7 @@ Function CreateTelnet (Owner: TServerManager; Config: RecConfig; ND: TNodeData;
|
|||
Type
|
||||
TTelnetServer = Class(TServerClient)
|
||||
ND : TNodeData;
|
||||
Snooping : Boolean;
|
||||
Constructor Create (Owner: TServerManager; ND: TNodeData; CliSock: TSocketClass);
|
||||
Procedure Execute; Override;
|
||||
Destructor Destroy; Override;
|
||||
|
@ -44,6 +45,7 @@ Begin
|
|||
Inherited Create(Owner, CliSock);
|
||||
|
||||
Self.ND := ND;
|
||||
Snooping := False;
|
||||
End;
|
||||
|
||||
{$IFDEF WINDOWS}
|
||||
|
@ -133,6 +135,9 @@ Begin
|
|||
While Proc.Output.NumBytesAvailable > 0 Do Begin
|
||||
bRead := Proc.Output.Read(Buffer, BufferSize);
|
||||
Client.WriteBuf (Buffer, bRead);
|
||||
|
||||
If Snooping Then
|
||||
Term.ProcessBuf(Buffer[1], bRead);
|
||||
End;
|
||||
End Else
|
||||
If Client.DataWaiting Then Begin
|
||||
|
@ -140,8 +145,9 @@ Begin
|
|||
|
||||
If bWrite < 0 Then Break;
|
||||
|
||||
If bWrite > 0 Then
|
||||
If bWrite > 0 Then Begin
|
||||
Proc.Input.Write(Buffer, bWrite);
|
||||
End;
|
||||
End Else
|
||||
Sleep(10);
|
||||
End;
|
||||
|
|
|
@ -4,10 +4,16 @@ Unit MIS_Common;
|
|||
|
||||
Interface
|
||||
|
||||
Uses
|
||||
m_Output,
|
||||
m_Term_Ansi;
|
||||
|
||||
{$I RECORDS.PAS}
|
||||
|
||||
Var
|
||||
bbsConfig : RecConfig;
|
||||
Console : TOutput;
|
||||
Term : TTermAnsi;
|
||||
|
||||
Function SearchForUser (UN: String; Var Rec: RecUser; Var RecPos: LongInt) : Boolean;
|
||||
Function CheckAccess (User: RecUser; IgnoreGroup: Boolean; Str: String) : Boolean;
|
||||
|
|
Loading…
Reference in New Issue