Logs Improvements. Save Logs and Auto Undo are still missing.

This commit is contained in:
PSposito 2020-02-20 10:02:48 +02:00
parent 0c56b8ef51
commit b3c47023bb
No known key found for this signature in database
GPG Key ID: 92E2BB27E8617EFC
1 changed files with 64 additions and 19 deletions

View File

@ -137,7 +137,7 @@ var
Password : String; Password : String;
isMicOn : boolean; isMicOn : boolean;
MicStatus : boolean; MicStatus : boolean;
// MicSavedStatus : boolean; //MicSavedStatus : boolean;
CamStatus : byte; CamStatus : byte;
CamSavedStatus : Byte; CamSavedStatus : Byte;
HasPassword : boolean; HasPassword : boolean;
@ -168,6 +168,8 @@ var
FromMain : boolean; FromMain : boolean;
OneVideoCard : boolean; OneVideoCard : boolean;
RebootNeededFlag : boolean; RebootNeededFlag : boolean;
VideoDevicesNumber : byte;
ActionTime : TDateTime;
implementation implementation
@ -349,7 +351,7 @@ begin
Inc(m); Inc(m);
//write('m = '); //write('m = ');
//write(m); //write(m);
if AStringList.Strings[n - 1] <> AStringList.Strings[n] then if CompareText(AStringList.Strings[n - 1], AStringList.Strings[n]) < 0 then
Inc(l); Inc(l);
//write(', l = '); //write(', l = ');
//writeln(l); //writeln(l);
@ -359,13 +361,15 @@ begin
if (AstringList.Count = 1) and (V4L2Val = 0) then if (AstringList.Count = 1) and (V4L2Val = 0) then
VideoCardsCountNumber := 1; VideoCardsCountNumber := 1;
VideoDevicesNumber := AstringList.Count; //m + 1;
end; end;
if (AstringList.Count >= 59) then if (AstringList.Count >= 59) then
RebootNeededFlag := true; RebootNeededFlag := true;
//write('VideoCardsCountNumber = '); //write('VideoCardsCountNumber = ' , VideoCardsCountNumber, ' ');
//writeln(AStringList.Text); //writeln(AStringList.Text);
//writeln(AstringList.Count, ' ', m, ' ', l, ' ', OneVideoCard); //writeln('CountNumber= ', AstringList.Count, ' m = ', m, ' l = ', l, ' ', OneVideoCard, ' VideoDevicesNumber = ', VideoDevicesNumber);
AStringList.Free; AStringList.Free;
AProcess.Free; AProcess.Free;
end; end;
@ -389,8 +393,10 @@ procedure TForm1.FormCreate(Sender: TObject);
begin begin
//ShowMessage(Concat('Video Status = ', BoolToStr(Form1.Video.Open))); //ShowMessage(Concat('Video Status = ', BoolToStr(Form1.Video.Open)));
ImageListCam1.GetIcon(0, TrayIcon5.Icon); //ImageListCam1.GetIcon(0, TrayIcon5.Icon);
SetReleaseNo; SetReleaseNo;
application.showmainform := false; // Hide Main form application.showmainform := false; // Hide Main form
HasPassword := false; HasPassword := false;
CamImageIndex := 0; CamImageIndex := 0;
@ -408,6 +414,7 @@ begin
V4L2Val := StrToInt(BoolToStr(not DirectoryExists('/dev/v4l/'))); V4L2Val := StrToInt(BoolToStr(not DirectoryExists('/dev/v4l/')));
FromMain := false; FromMain := false;
RebootNeededFlag := false; RebootNeededFlag := false;
VideoDevicesNumber := 0;
AdjustBalloonPosition; AdjustBalloonPosition;
@ -460,6 +467,9 @@ begin
CamClicked := false; CamClicked := false;
CamClicksCounter := 0; CamClicksCounter := 0;
CamSavedStatus := 2; CamSavedStatus := 2;
Logs.Form3.StringGrid1.InsertRowWithValues( GridLine,[IntToStr(GridLine), FormatDateTime('dd/mm/yyyy, ', ActionTime)
+ RightStr(DateTimeToStr(VPClock1.Time), 8), 'Camera is Captuting', IntToStr(VideoDevicesNumber)]);
Inc(GridLine);
end; end;
GetMicCaptureStatus; GetMicCaptureStatus;
@ -570,7 +580,7 @@ begin
ImageListStatus.GetIcon(0, TrayIcon3.Icon); ImageListStatus.GetIcon(0, TrayIcon3.Icon);
Logs.Form3.StringGrid1.Clean; Logs.Form3.StringGrid1.Clean;
GridLine := 1; GridLine := 1;
Logs.Form3.StringGrid1.InsertRowWithValues(0,['DateTime Stamp', 'Event Description']); Logs.Form3.StringGrid1.InsertRowWithValues(0,['Number','DateTime Stamp', 'Event Description', 'Video Devices Number']);
ImageListStatus.GetIcon(0, TrayIcon3.Icon); ImageListStatus.GetIcon(0, TrayIcon3.Icon);
if CamClicked then if CamClicked then
CamClicked := false; CamClicked := false;
@ -774,6 +784,9 @@ begin
VideoCapt := true; VideoCapt := true;
PopUpWebcamCaptures; PopUpWebcamCaptures;
PopUpWebcamCaptStatus := true; PopUpWebcamCaptStatus := true;
Logs.Form3.StringGrid1.InsertRowWithValues( GridLine,[IntToStr(GridLine), FormatDateTime('dd/mm/yyyy, ', ActionTime)
+ RightStr(DateTimeToStr(VPClock1.Time), 8), 'Camera is Captuting', IntToStr(VideoDevicesNumber)]);
Inc(GridLine);
end; end;
if CamStatus = 0 then if CamStatus = 0 then
@ -884,6 +897,10 @@ begin
MicClicked := true; MicClicked := true;
MicClicksCounter := 1; MicClicksCounter := 1;
MicStatus := false; MicStatus := false;
ActionTime := now;
Logs.Form3.StringGrid1.InsertRowWithValues( GridLine,[IntToStr(GridLine), FormatDateTime('dd/mm/yyyy, ', ActionTime)
+ RightStr(DateTimeToStr(VPClock1.Time), 8), 'Microphone Muted by the User', 'None']);
Inc(GridLine);
end; end;
end; end;
@ -898,6 +915,10 @@ begin
MicClicked := true; MicClicked := true;
MicClicksCounter := 1; MicClicksCounter := 1;
MicStatus := true; MicStatus := true;
ActionTime := now;
Logs.Form3.StringGrid1.InsertRowWithValues( GridLine,[IntToStr(GridLine), FormatDateTime('dd/mm/yyyy, ', ActionTime)
+ RightStr(DateTimeToStr(VPClock1.Time), 8), 'Microphone Unmuted by the User', 'None']);
Inc(GridLine);
end; end;
end; end;
@ -1037,6 +1058,7 @@ begin
if ((CamStatus = 1) and (CamSavedStatus = 1) and (CamClicked = true) and (CamClicksCounter= 1)) then // Webcam is On, User Clicked if ((CamStatus = 1) and (CamSavedStatus = 1) and (CamClicked = true) and (CamClicksCounter= 1)) then // Webcam is On, User Clicked
begin begin
ActionTime := now;
PopUpWebcamOn; PopUpWebcamOn;
ImageListCam1.GetIcon(2, TrayIcon5.Icon); ImageListCam1.GetIcon(2, TrayIcon5.Icon);
PopUpWebcamCaptStatus := false; PopUpWebcamCaptStatus := false;
@ -1044,10 +1066,14 @@ begin
PopUpWebcamCaptStatus := true; PopUpWebcamCaptStatus := true;
CamClicked := false; CamClicked := false;
CamClicksCounter := 0; CamClicksCounter := 0;
Logs.Form3.StringGrid1.InsertRowWithValues ( GridLine, [IntToStr(GridLine), FormatDateTime('dd/mm/yyyy, ', ActionTime)
+ RightStr(DateTimeToStr(VPClock1.Time), 8), 'Camera is On, by the User', IntToStr(VideoDevicesNumber)]);
Inc(GridLine);
end; end;
if (CamStatus = 2) and (CamSavedStatus = 1) then // Webcam Captures if (CamStatus = 2) and (CamSavedStatus = 1) then // Webcam Captures
begin begin
ActionTime := now;
ImageListCam1.GetIcon(1, TrayIcon5.Icon); ImageListCam1.GetIcon(1, TrayIcon5.Icon);
Form1.PopupNotifier2.Hide; Form1.PopupNotifier2.Hide;
PopUpWebcamCaptures; PopUpWebcamCaptures;
@ -1056,6 +1082,9 @@ begin
Form1.TrayIcon5.Hint := 'Camera On' + LineEnding + 'Camera is Enabled and Capturing'; Form1.TrayIcon5.Hint := 'Camera On' + LineEnding + 'Camera is Enabled and Capturing';
VideoCapt := true; VideoCapt := true;
CamSavedStatus := 2; CamSavedStatus := 2;
Logs.Form3.StringGrid1.InsertRowWithValues( GridLine,[IntToStr(GridLine), FormatDateTime('dd/mm/yyyy, ', ActionTime)
+ RightStr(DateTimeToStr(VPClock1.Time), 8), 'Camera is Captuting', IntToStr(VideoDevicesNumber)]);
Inc(GridLine);
end; end;
if (CamStatus = 2) and (CamSavedStatus = 0) then // Webcam Captures if (CamStatus = 2) and (CamSavedStatus = 0) then // Webcam Captures
@ -1078,11 +1107,15 @@ begin
ImageListCam1.GetIcon(2, TrayIcon5.Icon); ImageListCam1.GetIcon(2, TrayIcon5.Icon);
if (VideoCapt = true) then if (VideoCapt = true) then
begin begin
ActionTime := now;
PopUpWebcamNotCapturing; PopUpWebcamNotCapturing;
PopUpWebcamNoCapturing; PopUpWebcamNoCapturing;
PopUpWebcamCaptStatus := false; PopUpWebcamCaptStatus := false;
VideoCapt := false; VideoCapt := false;
CamSavedStatus := 1; CamSavedStatus := 1;
Logs.Form3.StringGrid1.InsertRowWithValues( GridLine,[IntToStr(GridLine), FormatDateTime('dd/mm/yyyy, ', ActionTime)
+ RightStr(DateTimeToStr(VPClock1.Time), 8), 'Camera Stopped Captuting', IntToStr(VideoDevicesNumber)]);
Inc(GridLine);
end; end;
end; end;
@ -1101,10 +1134,14 @@ begin
if ((CamStatus = 0) and (CamSavedStatus <= 2) and (CamClicked = true) and (CamClicksCounter= 1)) then // Webcam disabled, User Clicked if ((CamStatus = 0) and (CamSavedStatus <= 2) and (CamClicked = true) and (CamClicksCounter= 1)) then // Webcam disabled, User Clicked
begin begin
ActionTime := now;
ImageListCam1.GetIcon(0, TrayIcon5.Icon); ImageListCam1.GetIcon(0, TrayIcon5.Icon);
PopUpNoWebcam; PopUpNoWebcam;
CamClicked := false; CamClicked := false;
CamClicksCounter := 0; CamClicksCounter := 0;
Logs.Form3.StringGrid1.InsertRowWithValues ( GridLine, [IntToStr(GridLine), FormatDateTime('dd/mm/yyyy, ', ActionTime)
+ RightStr(DateTimeToStr(VPClock1.Time), 8), 'Camera is Off, by the User', IntToStr(VideoDevicesNumber)]);
Inc(GridLine);
end; end;
///////////////////////////////////////////////////////////////////////////// Hacking Checks //////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// Hacking Checks ////////////////////////////////////////////////////////////////////////////////////////
@ -1114,9 +1151,9 @@ begin
HackedTime := now; HackedTime := now;
PopUpWebcamHacked; PopUpWebcamHacked;
Logs.Form3.StringGrid1.InsertRowWithValues ( GridLine, [FormatDateTime('dd/mm/yyyy, ', HackedTime) Logs.Form3.StringGrid1.InsertRowWithValues ( GridLine, [IntToStr(GridLine), FormatDateTime('dd/mm/yyyy, ', HackedTime)
+ RightStr(DateTimeToStr(VPClock1.Time), 8), 'Camera Hacked to On']); + RightStr(DateTimeToStr(VPClock1.Time), 8), 'Camera Hacked to On', IntToStr(VideoDevicesNumber)]);
Inc(GridLine);
ImageListStatus.GetIcon(1, TrayIcon3.Icon); ImageListStatus.GetIcon(1, TrayIcon3.Icon);
ImageListCam1.GetIcon(2, TrayIcon5.Icon); ImageListCam1.GetIcon(2, TrayIcon5.Icon);
@ -1127,6 +1164,7 @@ begin
//PopUpWebcamCaptStatus := false; //PopUpWebcamCaptStatus := false;
PopUpWebcamNoCapturing; PopUpWebcamNoCapturing;
PopUpWebcamCaptStatus := true; PopUpWebcamCaptStatus := true;
Inc(GridLine);
end; end;
if ((CamStatus = 0) and (CamSavedStatus = 1) and (CamClicked = false) and (CamClicksCounter= 0)) then // Webcam went Off from On, No User Clicked -> Hacked if ((CamStatus = 0) and (CamSavedStatus = 1) and (CamClicked = false) and (CamClicksCounter= 0)) then // Webcam went Off from On, No User Clicked -> Hacked
@ -1134,9 +1172,8 @@ begin
HackedTime := now; HackedTime := now;
PopUpWebcamHacked; PopUpWebcamHacked;
Logs.Form3.StringGrid1.InsertRowWithValues ( GridLine, [FormatDateTime('dd/mm/yyyy, ', HackedTime) Logs.Form3.StringGrid1.InsertRowWithValues ( GridLine, [IntToStr(GridLine), FormatDateTime('dd/mm/yyyy, ', HackedTime)
+ RightStr(DateTimeToStr(VPClock1.Time), 8), 'Camera Hacked to Off']); + RightStr(DateTimeToStr(VPClock1.Time), 8), 'Camera Hacked to Off', IntToStr(VideoDevicesNumber)]);
Inc(GridLine);
ImageListStatus.GetIcon(1, TrayIcon3.Icon); ImageListStatus.GetIcon(1, TrayIcon3.Icon);
ImageListCam1.GetIcon(0, TrayIcon5.Icon); ImageListCam1.GetIcon(0, TrayIcon5.Icon);
@ -1147,15 +1184,15 @@ begin
//PopUpWebcamCaptStatus := false; //PopUpWebcamCaptStatus := false;
PopUpWebcamNoCapturing; PopUpWebcamNoCapturing;
PopUpWebcamCaptStatus := true; PopUpWebcamCaptStatus := true;
Inc(GridLine);
end; end;
if ((CamStatus = 1) and (CamSavedStatus = 0) and (CamClicked = false) and (CamClicksCounter = 0)) then // Webcam disabled (Off), No User Clicked -> Hacked if ((CamStatus = 1) and (CamSavedStatus = 0) and (CamClicked = false) and (CamClicksCounter = 0)) then // Webcam disabled (Off), No User Clicked -> Hacked
begin begin
HackedTime := now; HackedTime := now;
Logs.Form3.StringGrid1.InsertRowWithValues ( GridLine, [FormatDateTime('dd/mm/yyyy, ', HackedTime) Logs.Form3.StringGrid1.InsertRowWithValues ( GridLine, [IntToStr(GridLine), FormatDateTime('dd/mm/yyyy, ', HackedTime)
+ RightStr(DateTimeToStr(VPClock1.Time), 8), 'Camera Hacked to Off']); + RightStr(DateTimeToStr(VPClock1.Time), 8), 'Camera Hacked to Off', IntToStr(VideoDevicesNumber)]);
Inc(GridLine);
ImageListStatus.GetIcon(1, TrayIcon3.Icon); ImageListStatus.GetIcon(1, TrayIcon3.Icon);
ImageListCam1.GetIcon(0, TrayIcon5.Icon); ImageListCam1.GetIcon(0, TrayIcon5.Icon);
@ -1166,6 +1203,7 @@ begin
PopUpWebcamCaptStatus := false; PopUpWebcamCaptStatus := false;
//CamClicked := false; //CamClicked := false;
//CamClicksCounter := 1; //CamClicksCounter := 1;
Inc(GridLine);
end; end;
//LoopCounter := 0; //LoopCounter := 0;
@ -1179,6 +1217,7 @@ begin
MicClicked := false; MicClicked := false;
MicClicksCounter := 0; MicClicksCounter := 0;
MicStatus := true; MicStatus := true;
ActionTime := now;
end; end;
if ((isMicOn = true) and (MicStatus = false) and (MicClicked = false) and (MicClicksCounter = 0)) then if ((isMicOn = true) and (MicStatus = false) and (MicClicked = false) and (MicClicksCounter = 0)) then
begin begin
@ -1187,9 +1226,11 @@ begin
HackedTime := now; HackedTime := now;
//ShowMessage('Microphone hacked !!! Please Check Log'); //ShowMessage('Microphone hacked !!! Please Check Log');
PopUpMicHacked; PopUpMicHacked;
Logs.Form3.StringGrid1.InsertRowWithValues(GridLine,[FormatDateTime('dd/mm/yyyy, ', HackedTime) + RightStr(DateTimeToStr(VPClock1.Time), 8), 'Microphone Hacked to Unmuted']); Logs.Form3.StringGrid1.InsertRowWithValues ( GridLine,[IntToStr(GridLine), FormatDateTime('dd/mm/yyyy, ', HackedTime)
+ RightStr(DateTimeToStr(VPClock1.Time), 8), 'Microphone Hacked to Unmuted', 'None']);
MicStatus := true; MicStatus := true;
GridLine := GridLine + 1; Inc(GridLine);
end; end;
if ((isMicOn = false) and (MicStatus = true) and (MicClicked = true) and (MicClicksCounter = 1)) then if ((isMicOn = false) and (MicStatus = true) and (MicClicked = true) and (MicClicksCounter = 1)) then
@ -1206,10 +1247,14 @@ begin
HackedTime := now; HackedTime := now;
//ShowMessage('Microphone hacked !!! Please Check Log'); //ShowMessage('Microphone hacked !!! Please Check Log');
PopUpMicHacked; PopUpMicHacked;
Logs.Form3.StringGrid1.InsertRowWithValues(GridLine,[FormatDateTime('dd/mm/yyyy, ', HackedTime) + RightStr(DateTimeToStr(VPClock1.Time), 8), 'Microphone Hacked to Muted']); Logs.Form3.StringGrid1.InsertRowWithValues ( GridLine,[IntToStr(GridLine), FormatDateTime('dd/mm/yyyy, ', HackedTime)
+ RightStr(DateTimeToStr(VPClock1.Time), 8), 'Microphone Hacked to Muted', 'None']);
MicStatus := false; MicStatus := false;
GridLine := GridLine + 1; Inc(GridLine);
end; end;
//Logs.Form3.StringGrid1.SortColRow(true, 1, 1, Logs.Form3.StringGrid1.RowCount-1);
//VideoStringList.Free; //VideoStringList.Free;
end; end;