daily pastebin goal
47%
SHARE
TWEET

Untitled

a guest Apr 25th, 2018 1,648 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## 1. Start this script running in PowerShell
  2. ## 2. Close your laptop lid. The next time the lid opens, the script will send a mail.
  3.  
  4. $lastAwake = Get-Date; while($true) {
  5.     Start-Sleep -Seconds 1
  6.     $now = Get-Date
  7.     if(($now - $lastAwake).TotalSeconds -gt 3) {
  8.         $params = @{
  9.             To = 'user@example.com'
  10.             From = 'user@example.com'
  11.             Subject = 'Evil maid detected!'
  12.             Body = "Detected laptop opened at $now"
  13.             SmtpServer = 'smtp@example.com'
  14.         }
  15.         Send-MailMessage @params
  16.     }
  17.     $lastAwake = $now
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top