Determining your internet connection speed is important for the applications which depends mostly communicating over internet – For such cases speedtest-cli comes handy.
speedtest-cli is developed by www.speedtest.net team for speedtest over command line.
Installation of speedtest-cli: Installation can be carried on different in many ways as per user’s convenience. Today I’m going to show you two easiest methods 1. Installation using pip3 2. Installation using package manager (apt in Debian based systems)
Installation using pip3: To install speedtest-cli execute below command pip3 install speedtest-cli
Usage: Execute below command to start speedtest. speedtest
Installation using Package Manager: To install speedtest-cli execute below command sudo apt-get install speedtest-cli
Usage: Execute below command to start speedtest. speedtest
Detailed process is demonstrated in the video below.
Let’s consider a scenario, You are working for company and as per company policy you cannot share your developed linux shell script(s) in human readable format so that source code is not exposed to the users in human readable format but script file is needed to shared across multiple users to execute code without code being exposed.
To find out the process of securing / encrypting your script, please continue reading ..
What is the process /approach?
Shell script compiler compiles your shell script and generate encrypted script (binary file) which can be used to share across multiple users with assurance of your source code being secured.
Lets gets started….
Lets create a simple shell script which uses echo command to display message as shown in below screenshot
To download shell compiler from internet and configure please follow below steps
wget -c http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9b.tgz tar -zvxf shc-3.8.9b.tgz cd shc-3.8.9b make
Now SHELL Script Compiler is ready for use, below is the syntax and options that are allowed.
Below command needs to be executed to encrypt our script.sh which can be executed on any other supported linux system
shc -v -r -T -f /tmp/demo/script.sh
Now 2 files are created in the same path as of script.sh, these files are with extensions .x.c (ASCII C program text) and .x (executable binary file)
/tmp/demo/script.sh.x can be renamed and shared across and it is not possible to view the contents of this binary file.
/tmp/demo/script.sh.x can be used to execute and share – As it is encrypted and secured.
For feedback, queries and clarifications then please submit using below comment section.
What is ltracer? ltracer is a linux utility written in shell script to generate report for all the login attempts made on a linux via SSH.
Why to choose ltracer instead of any other utilities? Yes, there are numerous opensourced and patented utilities for linux systems to do the job but ltracer can also be considered as one of the useful tool because of following reasons. – Light weighted utility – Uses kernel utilities to generate login reports – Reports can be exported as CSV (Microsoft Excel compatible) format – No agents installed
Can I use this on Linux VM on cloud?
Yes, this utility can be used on RPM supported Linux VM provisioned in On-Premises, public cloud and private cloud environments like Azure cloud, etc.
How does ltracer works? Linux by default tracks all activities like user logins, system alerts, system boot & lots more into kernel DB. These kernel files will be binary files and cannot be viewed directly from shell prompt, these files are accessed by specific kernel utilities like last, lastb, lastlog,… and more. ltracer uses kernel utilities to translate binary files to human readable data format and then ltracer utility perform processing & formatting of data then it displays data fields that are mostly required to analyse login information such as username, source IP, timestamp. Processed data can be exported into CSV format which is Microsoft Excel compatible.
How to install and use ltracer? ltracer can be downloaded from official github page at ltracer.
Below are the steps to install ltracer: – Download rpm file using command wget https://raw.githubusercontent.com/sksaddamhussain/ltracer/master/ltracer-2.0.0-2.x86_64.rpm – Install rpm file by executing command rpm -ivh ltracer-2.0.0-2.x86_64.rpm – Now ltracer is installed on the linux machine
Below are the steps demonstrating the usage of the utility – Run ltracer utility as root user sudo ltracer – Now below shown menu appears waiting with prompt for your input
Option 1: This will list all the users that are currently logged in Option 2: This will list all the user attempts who had successfully logged in [This doesn’t include active session data] Option 3: This will list all login failure attempts made via SSH
Once you choose any one of the above options then it will list login details as shown below [In this example, I have selected Option 1, to display all active users on this linux machine]
After displaying requested data, now it will prompt to save data in CSV format – If you select ‘Y’ then data is exported into CSV file and its path is displayed as shown below.
Now CSV file is ready to be copied from linux machine to your local system for audit purposes.
Your suggestions and feedback are highly appreciated.