22 January 2020

Install latest linux kernel on Ubuntu server

Sometimes upgrading linux kernel may increase overall performance of your server (including network and task processing).

You can download any version of kernel from here

Latest Stable Kernel: 5.4.13 https://kernel.org

so we install kernel 5.4.13

cd /tmp/

wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.13/linux-headers-5.4.13-050413_5.4.13-050413.202001171431_all.deb

wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.13/linux-headers-5.4.13-050413-generic_5.4.13-050413.202001171431_amd64.deb

wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.13/linux-image-unsigned-5.4.13-050413-generic_5.4.13-050413.202001171431_amd64.deb

wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.13/linux-modules-5.4.13-050413-generic_5.4.13-050413.202001171431_amd64.deb

sudo dpkg -i *.deb

if your Ubuntu version is old you may need to install additional dependency packages

You can search any missing packages here https://packages.ubuntu.com/search and get their download links and install using dpkg -i .deb

3 November 2019

Telegram bot file_id parser

function base64url_decode($data) {
  return base64_decode(str_pad(strtr($data, '-_', '+/'), strlen($data) % 4, '=', STR_PAD_RIGHT));
 function rle_decode($string)
        $new = '';
        $last = '';
        $null = chr(0);
        foreach (str_split($string) as $cur) {
            if ($last === $null) {
                $new .= str_repeat($last, ord($cur));
                $last = '';
            } else {
                $new .= $last;
                $last = $cur;
        $string = $new.$last;
        return $string;
function parse($s)
$s = base64url_decode($s);
    return $r;


possbible file_type list

0 = thumbnail
2 = photo
3 = voice
4 = video
5 = document
8 = sticker
9 = audio
10 = gif
13 = video_note (round video)

Setup Network File System(NFS) Client and Server on Ubuntu

server side run the following commands.

apt install nfs-kernel-server

vi /etc/exports

add /path/you/want/to/share/with/client,sync,no_root_squash,no_subtree_check)

save it

run exportfs -v
run exportfs -ra

client side commands

apt install nfs-common

mount -t nfs -o vers=3 /local/path

for persistent mount, add entry in fstab.
vi /etc/fstab /local/path nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0

4 February 2019

TANGEDCO TNEB AE 2018 Results, Cut-off, Question papers and Answers

TANGEDCO TNEB AE 2018 exam which was conducted on 30/12/2018 its result was released today 04/02/2019 around 7pm-8pm.

i have collected question papers from their unstable website for all department with answers.

You can view or download questions and answer from google drive link https://drive.google.com/drive/folders/1cGjvM3tdMk0AaDKbS5fVTSVR9TC3Xx_B

Check your marks here  https://drive.google.com/open?id=1i40-NM-Pt4TxJc7sW-wakJzpG3yLsK5M
Cutt-off marks https://drive.google.com/open?id=1rLtPFxX9UTL76pljY8ehs1Qp-H0AavM-

better luck next time.

8 September 2018

execute root commands via php

Solution using a binary wrapper (with suid bit)

1) Create a script (preferrably .sh) that contains what you want to be ran as root.
# cat > php_shell.sh <<CONTENT
  /sbin/service sshd restart
2) This file should be owned by root, and since it will later run with root permissions make sure that only root has permission to write to the file.
# chown root php_shell.sh
# chmod u=rwx,go=xr php_shell.sh
3) To run the script as root no matter what user that executes it, we will need a binary wrapper. Create one that will execute our php_shell.sh.
# cat > wrapper.c <<CONTENT
  #include <stdlib.h>
  #include <sys/types.h>
  #include <unistd.h>

  main (int argc, char *argv[])
     setuid (0);

     /* WARNING: Only use an absolute path to the script to execute,
      *          a malicious user might fool the binary and execute
      *          arbitary commands if not.
      * */

     system ("/bin/sh /path/to/php_shell.sh");

     return 0;
4) Compile and set proper permissions, including the suid bit (saying that it should run with root privileges):
# gcc wrapper.c -o php_root
# chown root php_root
# chmod u=rwx,go=xr,+s php_root
php_root will now run with root permissions, and execute the commands specified in php_root.sh.

If you don't need to the option to easily change what commands that will be executed I'd recommend you to write the commands directly in wrapper.c under step 4. Then you don't need to have a binary executing a external script executing the commands in question.
In wrapper.c, use system ("your shell command here"); to specify what commands you'd like to execute

source https://stackoverflow.com/a/8532448

4 August 2017

bsnl 's digital india journey begins with blocking ssh port 22


As you may have noticed BSNL broadband users no longer able to access to their remote servers through SSH ,

also many users reported the same here https://broadbandforum.co/threads/bsnl-broadband-seems-to-have-blocked-ssh-port-22-on-their-network.151617/

if you have root access to your remote server you can use iptables's port redirect rule to fuck dumb bsnl bastards right in their holes.

run this simple command once you logged into your remote server using VPN or proxy.

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 222 -j REDIRECT --to-port 22

you can change 222 to any number you want but make sure the port number is not already in use.

after this, just change port from 22 to 222 in your putty or any ssh client,now you should be able to access your server without VPN or proxy.