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