Spllited Database risk over LAN Network challenge ,please how to Secure? (1 Viewer)

Isaac

Lifelong Learner
Local time
Today, 07:58
Joined
Mar 14, 2017
Messages
8,738
Include cellular jamming system in your database - actually that may not be enough - it may need to wipe the phone completely, like those 20 people in Robert Mueller's team whose phones were all accidentally wipe erased near the end of the investigation. If that doesn't work, maybe put your database in a special terminal, 15 feet behind a metal grate - like those vending machines in rest areas on the highway, so no one can get close enough to take a picture without using tiny drones....
(Disclaimer: I'm just joking)
 

isladogs

MVP / VIP
Local time
Today, 14:58
Joined
Jan 14, 2017
Messages
18,186
this will lead to another security measure , can we via VBA prevent Printscreen from keyboard hardware or softeware , @isladogs is there any VBA for this?
To directly answer your question, you can block certain key or key combination using the Form_KeyDown event
The following code blocks Ctrl+C, Ctrl+V, PtrtSc & Alt+PrtSc

Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

On Error GoTo Err_Handler

'Used to disable selected input key values

Select Case Shift
   
    Case acCtrlMask
      'Control pressed
     
        If KeyCode = vbKeyV Then
            MsgBox "Sorry - pasting text is not allowed on this form", vbCritical, "ERROR"
            KeyCode = 0
        End If
       
        If KeyCode = vbKeyC Then
            MsgBox "Sorry - copying text is not allowed on this form", vbCritical, "ERROR"
            KeyCode = 0
        End If
     
        'Exit Sub
       
    Case acAltMask
    'Alt pressed
    If KeyCode = vbKeyPrint Then KeyCode = 0  'Alt + PtrSc pressed - don't allow it
       
    End Select
   
    Select Case KeyCode

    Case vbKeyPrint
        'PtrSc pressed - don't allow it
        KeyCode = 0
       
    End Select
   
Exit_Handler:
    Exit Sub

Err_Handler:
    MsgBox "Error " & Err.Number & " in Form_KeyDown procedure : " & Err.Description
    Resume Exit_Handler
   
End Sub

For this to work, set Key Preview = Yes in the form property sheet.

However, whilst I often block Ctrl+C & Ctrl+V, I agree with recent comments that trying to block screenshots is completely futile.
If I can't use Print Screen, I would just use the Windows Snipping Tool or take a photo on my phone etc, etc ....
 
Last edited:

Isaac

Lifelong Learner
Local time
Today, 07:58
Joined
Mar 14, 2017
Messages
8,738
@isladogs
Just out of curiosity, I was thinking of keypress too but isn't that sadly dependent on Focus?
For example, if you have a database screen showing on your computer, with, say, the Desktop in the background. (all other windows are minimized). While looking at the db screen, you mouse click on a blank spot on the Desktop, to the side(behind).
At that point the whole database will still be showing, but won't have the focus, and the key events won't really be caught, right?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 09:58
Joined
Feb 28, 2001
Messages
26,999
When I studied for my Security+ certificate for the Navy, we discussed the fact that that is an inverse relationship between security and usability. The most secure computer in the world is the one that isn't plugged in - but it isn't worth a damn because nobody can use it. The whole point of a shared data system is to share data. Therefore, when asking security questions, you have to determine what would and what would not be within the intended scope of usage of your system. The starting point is, of course, that you NEVER EVER let a user see anything but forms, and then you very carefully control what those forms can do. Outside of the DB app, secure the pathways to the folders where that app and data are stored. But you have to also identify things that are within the scope of work of someone just "doing their job" innocently.

Past a certain point, you have to realize that your problem isn't securing the database. It is securing the people by knowing who is using what parts and knowing whether they are worthy of trust to use the data. You are stuck with a reality that sounds terrible, but it is a reality. There is no way that a usable system can be 100% secure. But you can improve the odds with appropriate training of your employees to include discussions of WHY you guys are so paranoid about what they can and cannot do.

In the end analysis, you are looking at a risk/reward situation. What is the risk of allowing users to see the data? What reward do you get if they do? What is the cost to allow that type of usage? What is the cost of abuse of that usage? It is all a balancing act. Some of the decisions must be made by higher management in light of the inverse relation between security and utility. In a really small company, all of that might be on one person, but in a decent-sized business, the programmer and the manager are not the same person. The decision-makers need to be in the loop at some point to decide what risks are involved.
 

Isaac

Lifelong Learner
Local time
Today, 07:58
Joined
Mar 14, 2017
Messages
8,738
The most secure computer in the world is the one that isn't plugged in - but it isn't worth a damn because nobody can use it
Unless you're on Rudy G.'s investigative team! :ROFLMAO:
 

kokowawa

Member
Local time
Today, 16:58
Joined
May 11, 2020
Messages
51
You're not paying attention. Even if you find a way to disable print screen keyboard, users can use 3d party applications or even windows' snipping tool.
If you disable them too, you can't use vba to prevent them to take a photo of the screen with their phones.

Try to work with customer's ID and don't show their names or other confidential info on the screen.

i am paying attention , thats why i am asking for VBA code for this , i will do the maximum i can do in my app , the rest might be disabled by the company IT , and for sure there is security cameras in the offices that will help detecting who try taking photos by his mobile phone.
 

kokowawa

Member
Local time
Today, 16:58
Joined
May 11, 2020
Messages
51
To directly answer your question, you can block certain key or key combination using the Form_KeyDown event
The following code blocks Ctrl+C, Ctrl+V, PtrtSc & Alt+PrtSc

Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

On Error GoTo Err_Handler

'Used to disable selected input key values

Select Case Shift
 
    Case acCtrlMask
      'Control pressed
   
        If KeyCode = vbKeyV Then
            MsgBox "Sorry - pasting text is not allowed on this form", vbCritical, "ERROR"
            KeyCode = 0
        End If
     
        If KeyCode = vbKeyC Then
            MsgBox "Sorry - copying text is not allowed on this form", vbCritical, "ERROR"
            KeyCode = 0
        End If
   
        'Exit Sub
     
    Case acAltMask
    'Alt pressed
    If KeyCode = vbKeyPrint Then KeyCode = 0  'Alt + PtrSc pressed - don't allow it
     
    End Select
 
    Select Case KeyCode

    Case vbKeyPrint
        'PtrSc pressed - don't allow it
        KeyCode = 0
     
    End Select
 
Exit_Handler:
    Exit Sub

Err_Handler:
    MsgBox "Error " & Err.Number & " in Form_KeyDown procedure : " & Err.Description
    Resume Exit_Handler
 
End Sub

For this to work, set Key Preview = Yes in the form property sheet.

However, whilst I often block Ctrl+C & Ctrl+V, I agree with recent comments that trying to block screenshots is completely futile.
If I can't use Print Screen, I would just use the Windows Snipping Tool or take a photo on my phone etc, etc ....
thank you for the code , i will work on it , but i will edit few things in it , such as instead of showing the user a warning msg , i will add a line that will add record to a table that warn the admin or the company owner there this user was trying to print screen a form with details of time , user , computer and form name.

this will help detecting and spotting thieves .

and in case of form lost focus it will be auto minimized
 
Last edited:

kokowawa

Member
Local time
Today, 16:58
Joined
May 11, 2020
Messages
51
@isladogs
Just out of curiosity, I was thinking of keypress too but isn't that sadly dependent on Focus?
For example, if you have a database screen showing on your computer, with, say, the Desktop in the background. (all other windows are minimized). While looking at the db screen, you mouse click on a blank spot on the Desktop, to the side(behind).
At that point the whole database will still be showing, but won't have the focus, and the key events won't really be caught, right?

good point in that case we can code the form in case of it lost focus it will be auto minimized or closed
 

isladogs

MVP / VIP
Local time
Today, 14:58
Joined
Jan 14, 2017
Messages
18,186
@isladogs
Just out of curiosity, I was thinking of keypress too but isn't that sadly dependent on Focus?
For example, if you have a database screen showing on your computer, with, say, the Desktop in the background. (all other windows are minimized). While looking at the db screen, you mouse click on a blank spot on the Desktop, to the side(behind).
At that point the whole database will still be showing, but won't have the focus, and the key events won't really be caught, right?

Well obviously that would have no meaningful impact on keycodes like Ctrl+P or indeed Alt+PrtSc (as that grabs the active window)

Whilst it could be done to overcome any blocking of PrtSc used on its own, that's easy to prevent by several methods including:
a) maximizing the app & preventing it being restored
b) restricting the mouse to the application area so users cannot click outside it

However that's all rather irrelevant in the case of screenshots when they can be done outside the app anyway

thank you for the code , i will work on it , but i will edit few things in it , such as instead of showing the user a warning msg , i will add a line that will add record to a table that warn the admin or the company owner there this user was trying to print screen a form with details of time , user , computer and form name.

this will help detecting and spotting thieves .

and in case of form lost focus it will be auto minimized

The code was just intended as an example. Feel free to add to it or modify it as you wish.
Perhaps you could upload your own version when done for the benefit of others
However beware spending lots of time creating monitoring code that may be rarely if ever used in practice
 

Isaac

Lifelong Learner
Local time
Today, 07:58
Joined
Mar 14, 2017
Messages
8,738
Well obviously that would have no meaningful impact on keycodes like Ctrl+P or indeed Alt+PrtSc (as that grabs the active window)
I was thinking Ctrl+PrtScr, would still capture window active or not, but loss of focus on db window would prevent key events from firing.

Good idea though - about maximizing app, or restricting mouse movement (I didn't know the second one was possible).
 

isladogs

MVP / VIP
Local time
Today, 14:58
Joined
Jan 14, 2017
Messages
18,186
I'm not aware that Ctrl+PtrSc does anything ... though Alt+PtrSc is a valid combination

However I had forgotten about Win+PrtSc and of course there is Windows + Shift + S for running the new Snipping Tool.
There are so many ways around it, I don't even try to disable screenshots

Anyway, yes - you can confine user movement within the application window.
For example the attached app does that at startup ...although I also provide code to undo that feature on a button click
 

Attachments

  • Multi Monitors v3.zip
    114.5 KB · Views: 150
Last edited:

Isaac

Lifelong Learner
Local time
Today, 07:58
Joined
Mar 14, 2017
Messages
8,738
I'm not aware that Ctrl+PtrSc does anything
That's all I use for printscreens.

Anyway, yes - you can confine user movement within the application window.
For example the attached app does that at startup ...although in that case I also provide code to undo that feature
That's awesome! Thanks for posting
 

isladogs

MVP / VIP
Local time
Today, 14:58
Joined
Jan 14, 2017
Messages
18,186
Oh yes, I just remembered Ctrl+PtrSc can be used to send to Dropbox rather than to the clipboard
 

Isaac

Lifelong Learner
Local time
Today, 07:58
Joined
Mar 14, 2017
Messages
8,738
I just hit Ctrl+PrtScr, then paste into Paint.
 

isladogs

MVP / VIP
Local time
Today, 14:58
Joined
Jan 14, 2017
Messages
18,186
In that case, you just need PrtSc for the entire screen or Alt+PrtSc for the active window.
 

Isaac

Lifelong Learner
Local time
Today, 07:58
Joined
Mar 14, 2017
Messages
8,738
In that case, you just need PrtSc for the entire screen or Alt+PrtSc for the active window.
Wow! I never knew that. Who knows when or how? I must have gotten the impression at some point that I needed Ctrl. (maybe laptop is different depending on different/multi-purposed keys?) But at least on my regular keyboard, I now know I can stop including Ctrl. Thanks for that.

This has been a week of surprises for me, finding out the odd things I never knew but should have. Like the existence of SaveCopyAs in Excel VBA.
 

kokowawa

Member
Local time
Today, 16:58
Joined
May 11, 2020
Messages
51
The code was just intended as an example. Feel free to add to it or modify it as you wish.
Perhaps you could upload your own version when done for the benefit of others
However beware spending lots of time creating monitoring code that may be rarely if ever used in practice

thank you , i will modify it somehow and will let you know.
and for sure once i am done i will post an example of it as for the others.
if it catch even 1 person better than having some thive among us and we don't know ,also it is better to do everything while building the app as long as i still have the time for it .
 

isladogs

MVP / VIP
Local time
Today, 14:58
Joined
Jan 14, 2017
Messages
18,186
BTW I just retested the code to block vbKeyPrint (PrtSc) and it did absolutely nothing despite being the correct descriptor for that key.

No idea why it no longer works. Sorry about that!
 

Sun_Force

Active member
Local time
Today, 23:58
Joined
Aug 29, 2020
Messages
396
Anybody else who knows about win+alt+r keys in windows 10?
 

isladogs

MVP / VIP
Local time
Today, 14:58
Joined
Jan 14, 2017
Messages
18,186
Thanks. I do now! Is that from the XBox?
Never seen that before. Seems to only work if you're on the taskbar.

Perhaps you can tell me the purpose of the Ctrl+T shortcut in the VBE.
It does the same thing in all Office apps and has done for many if not all versions back to 1.0 ... but I've no idea what its purpose is
 

Users who are viewing this thread

Top Bottom