Replace main.pas for final Release
This commit is contained in:
parent
d66f2c952e
commit
d457674862
173
main.pas
173
main.pas
|
@ -7,12 +7,13 @@ unit Main;
|
||||||
// Created at 23th of January 2020, by Linuxer (https://gitlab.com/psposito), from scratch with Free Pascal
|
// Created at 23th of January 2020, by Linuxer (https://gitlab.com/psposito), from scratch with Free Pascal
|
||||||
// Redesigned and further Developed at 28th of January 2020, by Linuxer (https://gitlab.com/psposito)
|
// Redesigned and further Developed at 28th of January 2020, by Linuxer (https://gitlab.com/psposito)
|
||||||
// to provide Camera and Mic status alone with On/Off and Mute/Unmute fuctions
|
// to provide Camera and Mic status alone with On/Off and Mute/Unmute fuctions
|
||||||
|
// Developed further for intrusion feeling and logging at 2nd of February 2020 by Linuxer (https://gitlab.com/psposito)
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
|
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
|
||||||
Menus, UTF8Process, VpClock, Unix, process, About;
|
Menus, PopupNotifier, UTF8Process, VpClock, Unix, process, About, Logs;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -22,11 +23,14 @@ type
|
||||||
Button1 : TButton;
|
Button1 : TButton;
|
||||||
Button2 : TButton;
|
Button2 : TButton;
|
||||||
ImageListCam : TImageList;
|
ImageListCam : TImageList;
|
||||||
|
ImageListStatus: TImageList;
|
||||||
ImageListMic : TImageList;
|
ImageListMic : TImageList;
|
||||||
AProcess : TProcessUTF8;
|
AProcess : TProcessUTF8;
|
||||||
MenuItem1 : TMenuItem;
|
MenuItem1 : TMenuItem;
|
||||||
MenuItem10 : TMenuItem;
|
MenuItem10 : TMenuItem;
|
||||||
MenuItem11 : TMenuItem;
|
MenuItem11 : TMenuItem;
|
||||||
|
MenuItem12: TMenuItem;
|
||||||
|
MenuItem13: TMenuItem;
|
||||||
MenuItem2 : TMenuItem;
|
MenuItem2 : TMenuItem;
|
||||||
MenuItem3 : TMenuItem;
|
MenuItem3 : TMenuItem;
|
||||||
MenuItem4 : TMenuItem;
|
MenuItem4 : TMenuItem;
|
||||||
|
@ -36,14 +40,18 @@ type
|
||||||
MenuItem8 : TMenuItem;
|
MenuItem8 : TMenuItem;
|
||||||
MenuItem9 : TMenuItem;
|
MenuItem9 : TMenuItem;
|
||||||
PopupMenu1 : TPopupMenu;
|
PopupMenu1 : TPopupMenu;
|
||||||
|
PopupMenu2: TPopupMenu;
|
||||||
ProcessUTF8_1 : TProcessUTF8;
|
ProcessUTF8_1 : TProcessUTF8;
|
||||||
TrayIcon1 : TTrayIcon;
|
TrayIcon1 : TTrayIcon;
|
||||||
TrayIcon2 : TTrayIcon;
|
TrayIcon2 : TTrayIcon;
|
||||||
|
TrayIcon3: TTrayIcon;
|
||||||
VpClock1 : TVpClock;
|
VpClock1 : TVpClock;
|
||||||
procedure Button1Click(Sender: TObject);
|
procedure Button1Click(Sender: TObject);
|
||||||
procedure Button2Click(Sender: TObject);
|
procedure Button2Click(Sender: TObject);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure MenuItem10Click(Sender: TObject);
|
procedure MenuItem10Click(Sender: TObject);
|
||||||
|
procedure MenuItem12Click(Sender: TObject);
|
||||||
|
procedure MenuItem13Click(Sender: TObject);
|
||||||
procedure MenuItem2Click(Sender: TObject);
|
procedure MenuItem2Click(Sender: TObject);
|
||||||
procedure MenuItem3Click(Sender: TObject);
|
procedure MenuItem3Click(Sender: TObject);
|
||||||
procedure MenuItem4Click(Sender: TObject);
|
procedure MenuItem4Click(Sender: TObject);
|
||||||
|
@ -52,6 +60,7 @@ type
|
||||||
procedure MenuItem9Click(Sender: TObject);
|
procedure MenuItem9Click(Sender: TObject);
|
||||||
procedure TrayIcon1Click(Sender: TObject);
|
procedure TrayIcon1Click(Sender: TObject);
|
||||||
procedure TrayIcon2Click(Sender: TObject);
|
procedure TrayIcon2Click(Sender: TObject);
|
||||||
|
procedure TrayIcon3Click(Sender: TObject);
|
||||||
procedure VpClock1SecondChange(Sender: TObject);
|
procedure VpClock1SecondChange(Sender: TObject);
|
||||||
private
|
private
|
||||||
CamImageIndex : integer;
|
CamImageIndex : integer;
|
||||||
|
@ -67,7 +76,14 @@ var
|
||||||
MicSwitchStr : String;
|
MicSwitchStr : String;
|
||||||
Password : String;
|
Password : String;
|
||||||
isMicOn : boolean;
|
isMicOn : boolean;
|
||||||
|
MicStatus : boolean;
|
||||||
|
CamStatus : boolean;
|
||||||
HasPassword : boolean;
|
HasPassword : boolean;
|
||||||
|
MicClicked : boolean;
|
||||||
|
CamClicked : boolean;
|
||||||
|
MicClicksCounter : byte;
|
||||||
|
CamClicksCounter : byte;
|
||||||
|
GridLine : Integer;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -93,10 +109,14 @@ begin
|
||||||
//showmessage(AStringList.Strings[AstringList.Count-1]);
|
//showmessage(AStringList.Strings[AstringList.Count-1]);
|
||||||
//showmessage(MicSwitchStr);
|
//showmessage(MicSwitchStr);
|
||||||
if CompareText(MicSwitchStr,'[On]') = 0 then
|
if CompareText(MicSwitchStr,'[On]') = 0 then
|
||||||
isMicOn := true
|
begin
|
||||||
|
isMicOn := true;
|
||||||
|
end
|
||||||
//if CompareText(MicSwitchStr,'[Off]') = 0 then
|
//if CompareText(MicSwitchStr,'[Off]') = 0 then
|
||||||
else
|
else
|
||||||
isMicOn := false;
|
begin
|
||||||
|
isMicOn := false;
|
||||||
|
end;
|
||||||
//if isMicOn = true then
|
//if isMicOn = true then
|
||||||
// showmessage('Mic is on');
|
// showmessage('Mic is on');
|
||||||
//if isMicOn = false then
|
//if isMicOn = false then
|
||||||
|
@ -133,31 +153,42 @@ begin
|
||||||
HasPassword := false;
|
HasPassword := false;
|
||||||
CamImageIndex := 0;
|
CamImageIndex := 0;
|
||||||
MicImageIndex := 0;
|
MicImageIndex := 0;
|
||||||
|
MicClicked := false;
|
||||||
|
CamClicked := false;
|
||||||
|
CamClicksCounter := 0;
|
||||||
|
MicClicksCounter := 0;
|
||||||
|
GridLine := 1;
|
||||||
|
|
||||||
VpClock1.Active := true;
|
VpClock1.Active := true;
|
||||||
|
|
||||||
GetMicCaptureStatus;
|
GetMicCaptureStatus;
|
||||||
|
|
||||||
if DirectoryExists('/dev/v4l/') then
|
if (DirectoryExists('/dev/v4l/') or DirectoryExists('/dev/video0')) then
|
||||||
begin
|
begin
|
||||||
ImageListCam.GetIcon(0, TrayIcon1.Icon);
|
ImageListCam.GetIcon(0, TrayIcon1.Icon);
|
||||||
|
CamStatus := true;
|
||||||
//ShowMessage('Camera is On');
|
//ShowMessage('Camera is On');
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
ImageListCam.GetIcon(1, TrayIcon1.Icon);
|
ImageListCam.GetIcon(1, TrayIcon1.Icon);
|
||||||
|
CamStatus := false;
|
||||||
//ShowMessage('Camera is Off');
|
//ShowMessage('Camera is Off');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if isMicOn = true then
|
if isMicOn = true then
|
||||||
begin
|
begin
|
||||||
ImageListMic.GetIcon(0, TrayIcon2.Icon);
|
ImageListMic.GetIcon(0, TrayIcon2.Icon);
|
||||||
|
MicStatus := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if isMicOn = false then
|
if isMicOn = false then
|
||||||
begin
|
begin
|
||||||
ImageListMic.GetIcon(1, TrayIcon2.Icon);
|
ImageListMic.GetIcon(1, TrayIcon2.Icon);
|
||||||
|
MicStatus := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
ImageListStatus.GetIcon(0, TrayIcon3.Icon);
|
||||||
//ImageListCam.GetIcon(0, TrayIcon1.Icon);
|
//ImageListCam.GetIcon(0, TrayIcon1.Icon);
|
||||||
//ImageListMic.GetIcon(0, TrayIcon2.Icon);
|
//ImageListMic.GetIcon(0, TrayIcon2.Icon);
|
||||||
//ShowMessage('Press Ok');
|
//ShowMessage('Press Ok');
|
||||||
|
@ -171,12 +202,28 @@ begin
|
||||||
ImageListCam.Free;
|
ImageListCam.Free;
|
||||||
ImageListMic.Free;
|
ImageListMic.Free;
|
||||||
PopupMenu1.Free;
|
PopupMenu1.Free;
|
||||||
|
PopupMenu2.Free;
|
||||||
TrayIcon1.Free;
|
TrayIcon1.Free;
|
||||||
TrayIcon2.Free;
|
TrayIcon2.Free;
|
||||||
|
TrayIcon3.Free;
|
||||||
Halt (0);
|
Halt (0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.MenuItem2Click(Sender: TObject);
|
procedure TForm1.MenuItem12Click(Sender: TObject); //ShowLogs;
|
||||||
|
begin
|
||||||
|
Logs.Form3.Show;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.MenuItem13Click(Sender: TObject); //ClearLogs;
|
||||||
|
begin
|
||||||
|
ImageListStatus.GetIcon(0, TrayIcon3.Icon);
|
||||||
|
Logs.Form3.StringGrid1.Clean;
|
||||||
|
GridLine := 1;
|
||||||
|
Logs.Form3.StringGrid1.InsertRowWithValues(0,['DateTime Stamp', 'Event Description']);
|
||||||
|
ImageListStatus.GetIcon(0, TrayIcon3.Icon);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.MenuItem2Click(Sender: TObject); // Password Reset
|
||||||
begin
|
begin
|
||||||
HasPassword := false;
|
HasPassword := false;
|
||||||
ShowMessage('Passsword, has been reset');
|
ShowMessage('Passsword, has been reset');
|
||||||
|
@ -214,30 +261,40 @@ begin
|
||||||
begin
|
begin
|
||||||
CameraOn;
|
CameraOn;
|
||||||
ImageListCam.GetIcon(0, TrayIcon1.Icon);
|
ImageListCam.GetIcon(0, TrayIcon1.Icon);
|
||||||
|
CamClicksCounter := 1;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
AskPassword;
|
AskPassword;
|
||||||
CameraOn;
|
CameraOn;
|
||||||
if HasPassword then
|
if HasPassword then
|
||||||
ImageListCam.GetIcon(0, TrayIcon1.Icon);
|
begin
|
||||||
|
ImageListCam.GetIcon(0, TrayIcon1.Icon);
|
||||||
|
CamClicksCounter := 1;
|
||||||
|
end
|
||||||
end;
|
end;
|
||||||
|
CamClicked := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.MenuItem4Click(Sender: TObject); // Camera Off
|
procedure TForm1.MenuItem4Click(Sender: TObject); // Camera Off
|
||||||
begin
|
begin
|
||||||
if HasPassword then
|
if HasPassword then
|
||||||
begin
|
begin
|
||||||
CameraOff;
|
CameraOff;
|
||||||
ImageListCam.GetIcon(1, TrayIcon1.Icon);
|
ImageListCam.GetIcon(1, TrayIcon1.Icon);
|
||||||
end
|
CamClicksCounter := 1;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
AskPassword;
|
AskPassword;
|
||||||
CameraOff;
|
CameraOff;
|
||||||
if HasPassword then
|
if HasPassword then
|
||||||
ImageListCam.GetIcon(1, TrayIcon1.Icon);
|
begin
|
||||||
|
ImageListCam.GetIcon(1, TrayIcon1.Icon);
|
||||||
|
CamClicksCounter := 1;
|
||||||
|
end
|
||||||
end;
|
end;
|
||||||
|
CamClicked := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.MenuItem6Click(Sender: TObject); // Microphone Mute
|
procedure TForm1.MenuItem6Click(Sender: TObject); // Microphone Mute
|
||||||
|
@ -245,6 +302,8 @@ begin
|
||||||
S := fpsystem('amixer set Capture nocap');
|
S := fpsystem('amixer set Capture nocap');
|
||||||
//ShowMessage('Microphone has been mutted');
|
//ShowMessage('Microphone has been mutted');
|
||||||
ImageListMic.GetIcon(1, TrayIcon2.Icon);
|
ImageListMic.GetIcon(1, TrayIcon2.Icon);
|
||||||
|
MicClicked := true;
|
||||||
|
MicClicksCounter := 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.MenuItem7Click(Sender: TObject); // Microphone Unmute
|
procedure TForm1.MenuItem7Click(Sender: TObject); // Microphone Unmute
|
||||||
|
@ -252,9 +311,11 @@ begin
|
||||||
S := fpsystem('amixer set Capture cap');
|
S := fpsystem('amixer set Capture cap');
|
||||||
//ShowMessage('Microphone has been mutted');
|
//ShowMessage('Microphone has been mutted');
|
||||||
ImageListMic.GetIcon(0, TrayIcon2.Icon);
|
ImageListMic.GetIcon(0, TrayIcon2.Icon);
|
||||||
|
MicClicked := true;
|
||||||
|
MicClicksCounter := 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TForm1.MenuItem9Click(Sender: TObject);
|
procedure TForm1.MenuItem9Click(Sender: TObject); // About
|
||||||
begin
|
begin
|
||||||
About.Form2.Label1.Caption:='Developer';
|
About.Form2.Label1.Caption:='Developer';
|
||||||
About.Form2.Label2.Caption:='Licence';
|
About.Form2.Label2.Caption:='Licence';
|
||||||
|
@ -281,30 +342,100 @@ begin
|
||||||
PopUpMenu1.PopUp;
|
PopUpMenu1.PopUp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TForm1.TrayIcon3Click(Sender: TObject);
|
||||||
|
begin
|
||||||
|
PopUpMenu2.PopUp;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TForm1.VpClock1SecondChange(Sender: TObject);
|
procedure TForm1.VpClock1SecondChange(Sender: TObject);
|
||||||
|
var
|
||||||
|
HackedTime : TDateTime;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
GetMicCaptureStatus;
|
GetMicCaptureStatus;
|
||||||
|
|
||||||
if DirectoryExists('/dev/v4l/') then
|
if (DirectoryExists('/dev/v4l/') or DirectoryExists('/dev/video0')) then
|
||||||
begin
|
begin
|
||||||
ImageListCam.GetIcon(0, TrayIcon1.Icon);
|
ImageListCam.GetIcon(0, TrayIcon1.Icon);
|
||||||
//ShowMessage('Camera is On');
|
If ((CamStatus = false) and (CamClicked = true) and (CamClicksCounter = 1)) then
|
||||||
|
begin
|
||||||
|
CamClicked := false;
|
||||||
|
CamClicksCounter := 0;
|
||||||
|
CamStatus := true;
|
||||||
|
end;
|
||||||
|
If ((CamStatus = false) and (CamClicked = false) and (CamClicksCounter = 0)) then
|
||||||
|
begin
|
||||||
|
HackedTime := now;
|
||||||
|
ShowMessage('Camera hacked !!! Please Check Log');
|
||||||
|
Logs.Form3.StringGrid1.InsertRowWithValues(GridLine,[FormatDateTime('dd/mm/yyyy, ', HackedTime) + RightStr(DateTimeToStr(VPClock1.Time), 8), 'Camera Hacked to On']);
|
||||||
|
GridLine := GridLine + 1;
|
||||||
|
CamStatus := true;
|
||||||
|
ImageListStatus.GetIcon(1, TrayIcon3.Icon);
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
ImageListCam.GetIcon(1, TrayIcon1.Icon);
|
ImageListCam.GetIcon(1, TrayIcon1.Icon);
|
||||||
|
If ((CamStatus = true) and (CamClicked = true) and (CamClicksCounter = 1)) then
|
||||||
|
begin
|
||||||
|
CamClicked := false;
|
||||||
|
CamClicksCounter := 0;
|
||||||
|
CamStatus := false;
|
||||||
|
end;
|
||||||
|
If ((CamStatus = true) and (CamClicked = false) and (CamClicksCounter = 0)) then
|
||||||
|
begin
|
||||||
|
HackedTime := now;
|
||||||
|
ShowMessage('Camera hacked !!! Please Check Log');
|
||||||
|
Logs.Form3.StringGrid1.InsertRowWithValues(GridLine,[FormatDateTime('dd/mm/yyyy, ', HackedTime) + RightStr(DateTimeToStr(VPClock1.Time), 8), 'Camera Hacked to Off']);
|
||||||
|
CamStatus := false;
|
||||||
|
GridLine := GridLine + 1;
|
||||||
|
ImageListStatus.GetIcon(1, TrayIcon3.Icon);
|
||||||
|
end;
|
||||||
//ShowMessage('Camera is Off');
|
//ShowMessage('Camera is Off');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if isMicOn = true then
|
if isMicOn = true then
|
||||||
begin
|
begin
|
||||||
ImageListMic.GetIcon(0, TrayIcon2.Icon);
|
ImageListMic.GetIcon(0, TrayIcon2.Icon);
|
||||||
|
If ((MicStatus = false) and (MicClicked = true) and (MicClicksCounter = 1)) then
|
||||||
|
begin
|
||||||
|
MicClicked := false;
|
||||||
|
MicClicksCounter := 0;
|
||||||
|
MicStatus := true;
|
||||||
|
end;
|
||||||
|
If ((MicStatus = false) and (MicClicked = false) and (MicClicksCounter = 0)) then
|
||||||
|
begin
|
||||||
|
ImageListStatus.GetIcon(1, TrayIcon3.Icon);
|
||||||
|
HackedTime := now;
|
||||||
|
ShowMessage('Microphone hacked !!! Please Check Log');
|
||||||
|
Logs.Form3.StringGrid1.InsertRowWithValues(GridLine,[FormatDateTime('dd/mm/yyyy, ', HackedTime) + RightStr(DateTimeToStr(VPClock1.Time), 8), 'Microphone Hacked to Muted']);
|
||||||
|
MicStatus := true;
|
||||||
|
GridLine := GridLine + 1;
|
||||||
|
ImageListStatus.GetIcon(1, TrayIcon3.Icon);
|
||||||
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if isMicOn = false then
|
if isMicOn = false then
|
||||||
begin
|
begin
|
||||||
ImageListMic.GetIcon(1, TrayIcon2.Icon);
|
ImageListMic.GetIcon(1, TrayIcon2.Icon);
|
||||||
|
If ((MicStatus = true) and (MicClicked = true) and (MicClicksCounter = 1)) then
|
||||||
|
begin
|
||||||
|
MicClicked := false;
|
||||||
|
MicClicksCounter := 0;
|
||||||
|
MicStatus := false;
|
||||||
|
end;
|
||||||
|
If ((MicStatus = true) and (MicClicked = false) and (MicClicksCounter = 0)) then
|
||||||
|
begin
|
||||||
|
ImageListStatus.GetIcon(1, TrayIcon3.Icon);
|
||||||
|
HackedTime := now;
|
||||||
|
ShowMessage('Microphone hacked !!! Please Check Log');
|
||||||
|
Logs.Form3.StringGrid1.InsertRowWithValues(GridLine,[FormatDateTime('dd/mm/yyyy, ', HackedTime) + RightStr(DateTimeToStr(VPClock1.Time), 8), 'Microphone Hacked to Unmuted']);
|
||||||
|
MicStatus := false;
|
||||||
|
GridLine := GridLine + 1;
|
||||||
|
ImageListStatus.GetIcon(1, TrayIcon3.Icon);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
Loading…
Reference in New Issue