Posts

Showing posts with the label Terminal

Send photo to email when entering wrong password

Step 1 : Prerequisites installation (Optional if available) ffmpeg (Photo app) s-nail  (Mail app) For more ways to take picture refer this article . $ sudo apt update $ sudo apt install ffmpeg s-nail Step 2 : Create App password from google account Check this to create app passwords. Step 3 : Change the email and password(App password) in the script Create file sudo nano /usr/local/bin/takepic filename=`date +%s` ffmpeg -f video4linux2 -s vga -i /dev/video0 -vframes 1 /tmp/$filename.jpg echo ' ALERT Usage detected:'  `date` `who` | s-nail -a /tmp/$filename -S smtp-use-starttls -S ssl-verify=ignore -S smtp-auth=login -S smtp=smtp://smtp.gmail.com:587 -S from=" username @gmail.com" -S smtp-auth-user=username@gmail.com -S smtp-auth-password= ashalkshalkhsbzxn -S ssl-verify=ignore  -s "LOGIN ALERT" -v " tousername @gmail.com" exit 0  Save and close. $ sudo chmod +x /usr/local/bin/takepic Step 4 : Change the pam.d Backup the original file $ sudo cp...

How to send mail from terminal in Ubuntu

Image
There are multiple ways to send mail. Postfix is one of them.  Step 1: Install Postfix  $ sudo apt update $ sudo apt install postfix Select Internet site.  Next, You can type any domain here. we can change it later. Step 2: Save Gmail password Create a new file $ sudo nano /etc/postfix/gpasswd     [smtp.gmail.com]:587 username@gmail.com:password Step 3: Configure postfix $ sudo nano /etc/postfix/main.cf Add or update the properties smtp_use_tls = yes smtp_sasl_auth_enable = yes smtp_sasl_security_options = smtp_sasl_password_maps = hash:/etc/postfix/gpasswd smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt $ sudo postmap /etc/postfix/gpasswd $ sudo systemctl restart postfix  mail -s "Subn" username@gmail.com CC: Enter the message Press Ctrl + D to send message. That's it folks.

How to send email on user login in ubuntu

Image
Step 1: Go to your gmail account. Step 2: Click Manage your Google Account.   Step 3: Go to Security.  Step 4: Click App Passwords (Check 2 - step verification  is ON).   Step 5: Select App as Mail and Device as other(type anything) and click GENERATE. Step 6: Copy the generated key in the yellow box   Step 7: Update the following command with your details(frommail, tomail, copied passcode). echo ' ALERT - Root Shell Access on:'  `date` `who` | s-nail -S smtp-use-starttls -S ssl-verify=ignore -S smtp-auth=login -S smtp=smtp://smtp.gmail.com:587 -S from="frommail" -S smtp-auth-user=frommail -S smtp-auth-password=passcode -S ssl-verify=ignore  -s "LOGIN ALERT" -v "tomail" Step 8: Open .bashrc nano .bashrc Step 9: Paste the command in step 7 in last line of the file and save it.  That's it!

Git Intro and Installation on Ubuntu in 2 simple steps

Image
What is a version control system?  VCS or Version Control System is similar to history which records events happened on a particular date (June 29, 2007 - First iPhone launch) where as VCS record events happened on a particular revision/commit (commit id - files updated). VCS Tools: Git Subversion (SVN) Concurrent Versions System (CVS) Distributed VCS When you checkout a repository   instead of getting only the tip of the source it actually clones the entire repository. So basically each copy of repo itself a backup of central repository. In case of failure of central repo you can create a new repo a push your copy to the central repo. (which is considering you are in sync with central repo) What is Git ? Git is Distributed version control system free and open source used by almost all companies (Google, Facebook, Microsoft, ...) a must know tool for developers Steps 1 : Update package manager $ sudo apt update Step 2 : Install git $ sudo apt install git-all  Bonu...

How to take a picture from terminal

Image
 Step 1 : Choose any one of the following software ffmpeg streamer fsm Step 2 : Installation  Install ffmped  $ sudo apt update $ sudo apt install ffmpeg Install streamer $ sudo apt-get install streamer Install fswebcam $ sudo apt-get install fswebcam Step 3 : Sample shot Snapshot using ffmped $ ffmpeg -f video4linux2 -s vga -i /dev/video0 -vframes 3 /tmp/sample.jpg Snapshot using fswebcam $ fswebcam sample.jpg Snapshot using streamer streamer -f jpeg -o sample.jpeg   $ - requires given linux commands to be executed as a regular non-privileged user

Terminal Hacked - Tips and Tricks Part 2

Image
 This article is a continuation of the previous article Terminal Hacked - Tips and Tricks. Click me to view Previous Article. In this blog article, we are going to see some simple tricks for using terminal efficiently. To execute the command from history !# where the hash is the command entry in the history To rev a string(word) rev command comes handy rev   To find factorial use factor number To find the location of the file use locate locate fileName.extension To see the files in the background bg To go to the background file fg Shred is similar to delete but completely destroy the file while delete cuts the link of the file to the location but the file can be recovered.It overwrites the file with 0 and ones as we command. To shred a file completely which makes it difficult to recover. shred filename    v - Verbose (To display the process in words)  n - Overwrite n times  u - Truncate and remove the fi...