Enabling usb wifi on CentOS 7

Enabling usb wifi  on Centos is really a difficult job. most of the times it requires drivers compilation and adding /removing modules which may be time consuming.

Its better to upgrade kernel to the latest release

To upgrade the kernel without kernel compilation follow below steps

Step 1: Install elrepo to your CentOS 7 system

# rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org

# rpm -ivh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm

# yum –enablerepo=elrepo-kernel list available |grep kernel

# yum –enablerepo=elrepo-kernel install kernel-ml*  (select kernel-ml as they are the stable release kernels)

# grub2-set-default “CentOS Linux (4.18.1-1.el7.elrepo.x86_64) 7 (Core)”

reboot your system and configure network to the wireless usb card.


Encrypting a shell script

Go to the link https://www.datsi.fi.upm.es/~frosal/sources/ and download latest stable source for shc
in this case the latest source is  shc-3.8.9b.tgz

1 ) cd /usr/local 
2 ) sudo wget  https://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9b.tgz
3 ) sudo tar -zxvf shc-3.8.9b.tgz
4) cd shc-3.8.9
5) make
6) make test
7) make strings
8) make expiration
9) mkdir -p /usr/local/man/man1
10) make install

now shc in installed on your system in /usr/local/bin

to encrypt the script

shc -help gives the complete information about how we can use the package

shc -help
shc Version 3.8.9b, Generic Script Compiler
shc Copyright (c) 1994-2015 Francisco Rosales <frosal@fi.upm.es>
shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-rvDTCAh] -f script

 -e %s Expiration date in dd/mm/yyyy format [none]
 -m %s Message to display upon expiration ["Please contact your provider"]
 -f %s File name of the script to compile
 -i %s Inline option for the shell interpreter i.e: -e
 -x %s eXec command, as a printf format i.e: exec('%s',@ARGV);
 -l %s Last shell option i.e: --
 -r Relax security. Make a redistributable binary
 -v Verbose compilation
 -D Switch ON debug exec calls [OFF]
 -T Allow binary to be traceable [no]
 -C Display license and exit
 -A Display abstract and exit
 -h Display help and exit

 Environment variables used:
 Name Default Usage
 CC cc C compiler command
 CFLAGS <none> C compiler flags

 Please consult the shc(1) man page.

###### simple encryption ####
write a test script like below

echo Test Script

shc -f test
This will create 2 files test.x (executable binary) and test.x.c(C source code) 

test.x is an executable file
test.x may or may not run on system depending upon kernel as it is non traceable

to overcome this problem we must compile our script as traceable and redistributable 
so that it can run on any system by any user.

shc -Tf test (or you can write it in simple way shc -T -f test)

### Encryption with expiration date and message #####

provide expiration date with -e in dd/mm/yyyy format and with -m type a message which you want to display after script expiration

shc -e 01/01/2000 -m "This script expired.Contact your admin" -Tf test

sice the date is in past the encrypted script is already expired and after running ./test.x it will give message "This script expired.Contact your admin"

### The one more thing you can do with this is compile the C source code into the binary by below command.##

gcc -o <binary-file-name> test.x.c

This will create c compiled binary file of your script. 
The only difference between the shc compiled binary and c compiled binary is shc compiled binary is stripped while the c compiled binary is not stripped. (non stripped binaries have debugging information built into it)
This is something different that you. should try. 

create tar archive from the list of files

If you want to create tar file from the list (The list may contain files from different folders).

then use below command

tar -zcvf  mytar.tar.gz -T list

This command will read list line by line and keep adding the file mentioned in list to the tar file

How to Setup Wpad Auto Proxy to your network

The Web Proxy Auto-Discovery Protocol (WPAD) is a method used by clients to locate a URL of a configuration file using DHCP and/or DNS discovery methods. Once detection and download of the configuration file is complete it can be executed to determine the proxy for a specified URL. The WPAD protocol only outlines the mechanism for discovering the location of this file.

Create a file wpad.dat with following contain :-

function FindProxyForURL(url, host) {
return "PROXY; DIRECT";


For the another requirement like two proxy servers or one proxy  with one vpn servers like configuration please refer my this post.

How to install flash player plugin in mozilla firefox

Step 1
go to http://get.adobe.com/flashplayer/
select .tar.gz for other linux
and then click on download to download it

Step 2
open the terminal and go to the Downloads folder
extract the source by command
tar -zxvf install_flash_player_some-version_linux_i386.tar.gz
a file libflashplayer.so will be extracted from source
copy that file to the mozilla plugins folder by following command
sudo cp libflashplayer.so /usr/lib/mozilla/plugins



ssmtp program to send emails

This is the program who sends email. it takes 8,192B of disk space after installation
its quit simple to use.

for that we have to edit /etc/ssmtp/ssmtp.conf like below
#$hostname=sysadmins —-> this line doesn’t affect after commenting


The normal command to send email via command line is
ssmtp recepient_name@gmail.com
To: recipient_name@gmail.com
From: username@gmail.com
Subject: Sent from a terminal!

script to send message using text file
function welcome_mail
echo enter user name
read username
echo enter full name

cat > /tmp/welcome-reciepent << welcome1
To: $USER@your_domain
From: System Administrator
Subject: Welcome! Please read the instructions

Welcome , Please go through the instructions given below

cat /file_path/instructions >> /tmp/welcome-reciepent

echo “Sending Welcome-mail”
ssmtp $USER@neuralit.com < /tmp/welcome-reciepent
echo “OK”

and the /file_path/instruction is a simple file in which instructions are written.
like this.

this is instruction1
this is instruction2
this is instruction3
this is instruction4
(Please don’t revert back. This is a system generated email)

merits: 1) simple to use and can be used to mail newly joined user.
2) the mail can be sent by using any mail account as the sender will not be shown (it will show the name we choose.)
3) user cant reply back as there is no emailid in sender

demerits : 1) we can not attach the file.(searching the solution)
2) we will have to install the software for it

Different sites through different ISP or VPN

Suppose I am running squid server with port 3218 and port 8080 is mapped with 3128 port of other squid server / VPN 

and I want the websites microsoft.com 411.com and tlo.com  and whatismyip.com shoud run through VPN then have to write a wpad.dat file like given below

function FindProxyForURL(url, host) {

if (dnsDomainIs(host, "tlo.com") ||
        shExpMatch(host, "(*.tlo.com|tlo.com)"))
        return "PROXY";

if (dnsDomainIs(host, "www.411.com") ||
        shExpMatch(host, "(*.411.com|411.com)"))
        return "PROXY";

if (dnsDomainIs(host, "www.microsoft.com") ||
        shExpMatch(host, "(*.microsoft.com|microsoft.com)"))
        return "PROXY";

if (dnsDomainIs(host, "whatismyip.com") ||
        shExpMatch(host, "(*.whatismyip.com|whatismy.p.com)"))
        return "PROXY";

return "PROXY; DIRECT";      <-- This line can be replaced  by return "DIRECT";    if  the ip is bypassed



 and in browser  for example in firefox  in network settings Automatic proxy Configuration url i hav to add the line http://IP web server where wpad file is kept >/wpad.dat