I used Putty most of the time. Once I discovered Kitty, I haven’t looked back as it is same as Putty but on steroids. In the world of secure shell (SSH) clients, Kitty stands out as a feature-rich and highly customizable option. While precompiled versions are readily available for different operating systems, I wanted to see how Kitty is compiled.
In this blog post, I will walk you through the process of compiling Kitty SSH client from source code.
Prerequisites
Before diving into the compilation process, ensure that you have the necessary tools and libraries installed on your system. I will use Ubuntu Linux virtual machine and will use docker image which comes with all necessary packages required for compiling.
Update the Installation
It is always a good approach to install latest updates
sudo apt-get update
sudo apt-get upgrade
Output
Hit:1 http://us-central1.gce.archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://us-central1.gce.archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
Get:3 http://us-central1.gce.archive.ubuntu.com/ubuntu jammy-backports InRelease [108 kB]
Hit:4 http://security.ubuntu.com/ubuntu jammy-security InRelease
Fetched 226 kB in 0s (523 kB/s)
Reading package lists… Done
Install Docker
We will use Docker to download image which has all the compiling tools required
sudo apt-get install docker.io -y
Output
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
libnuma1
Use 'sudo apt autoremove' to remove it.
The following additional packages will be installed:
bridge-utils containerd dns-root-data dnsmasq-base pigz runc ubuntu-fan
Suggested packages:
ifupdown aufs-tools cgroupfs-mount | cgroup-lite debootstrap docker-doc rinse zfs-fuse
| zfsutils
The following NEW packages will be installed:
bridge-utils containerd dns-root-data dnsmasq-base docker.io pigz runc ubuntu-fan
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 72.4 MB of archives.
After this operation, 287 MB of additional disk space will be used.
Get:1 http://us-central1.gce.archive.ubuntu.com/ubuntu jammy/universe amd64 pigz amd64 2.6-1 [63.6 kB]
Get:2 http://us-central1.gce.archive.ubuntu.com/ubuntu jammy/main amd64 bridge-utils amd64 1.7-1ubuntu3 [34.4 kB]
Get:3 http://us-central1.gce.archive.ubuntu.com/ubuntu jammy-updates/main amd64 runc amd64 1.1.4-0ubuntu1~22.04.3 [4244 kB]
Get:4 http://us-central1.gce.archive.ubuntu.com/ubuntu jammy-updates/main amd64 containerd amd64 1.6.12-0ubuntu1~22.04.1 [34.4 MB]
Get:5 http://us-central1.gce.archive.ubuntu.com/ubuntu jammy/main amd64 dns-root-data all 2021011101 [5256 B]
Get:6 http://us-central1.gce.archive.ubuntu.com/ubuntu jammy-updates/main amd64 dnsmasq-base amd64 2.86-1.1ubuntu0.3 [354 kB]
Get:7 http://us-central1.gce.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 docker.io amd64 20.10.21-0ubuntu1~22.04.3 [33.3 MB]
Get:8 http://us-central1.gce.archive.ubuntu.com/ubuntu jammy/universe amd64 ubuntu-fan all 0.12.16 [35.2 kB]
Fetched 72.4 MB in 2s (42.1 MB/s)
Preconfiguring packages ...
Selecting previously unselected package pigz.
(Reading database ... 64995 files and directories currently installed.)
Preparing to unpack .../0-pigz_2.6-1_amd64.deb ...
Unpacking pigz (2.6-1) ...
Selecting previously unselected package bridge-utils.
Preparing to unpack .../1-bridge-utils_1.7-1ubuntu3_amd64.deb ...
Unpacking bridge-utils (1.7-1ubuntu3) ...
Selecting previously unselected package runc.
Preparing to unpack .../2-runc_1.1.4-0ubuntu1~22.04.3_amd64.deb ...
Unpacking runc (1.1.4-0ubuntu1~22.04.3) ...
Selecting previously unselected package containerd.
Preparing to unpack .../3-containerd_1.6.12-0ubuntu1~22.04.1_amd64.deb ...
Unpacking containerd (1.6.12-0ubuntu1~22.04.1) ...
Selecting previously unselected package dns-root-data.
Preparing to unpack .../4-dns-root-data_2021011101_all.deb ...
Unpacking dns-root-data (2021011101) ...
Selecting previously unselected package dnsmasq-base.
Preparing to unpack .../5-dnsmasq-base_2.86-1.1ubuntu0.3_amd64.deb ...
Unpacking dnsmasq-base (2.86-1.1ubuntu0.3) ...
Selecting previously unselected package docker.io.
Preparing to unpack .../6-docker.io_20.10.21-0ubuntu1~22.04.3_amd64.deb ...
Unpacking docker.io (20.10.21-0ubuntu1~22.04.3) ...
Selecting previously unselected package ubuntu-fan.
Preparing to unpack .../7-ubuntu-fan_0.12.16_all.deb ...
Unpacking ubuntu-fan (0.12.16) ...
Setting up dnsmasq-base (2.86-1.1ubuntu0.3) ...
Setting up runc (1.1.4-0ubuntu1~22.04.3) ...
Setting up dns-root-data (2021011101) ...
Setting up bridge-utils (1.7-1ubuntu3) ...
Setting up pigz (2.6-1) ...
Setting up containerd (1.6.12-0ubuntu1~22.04.1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/containerd.service → /lib/systemd/system/containerd.service.
Setting up ubuntu-fan (0.12.16) ...
Created symlink /etc/systemd/system/multi-user.target.wants/ubuntu-fan.service → /lib/systemd/system/ubuntu-fan.service.
Setting up docker.io (20.10.21-0ubuntu1~22.04.3) ...
Adding group `docker' (GID 122) ...
Done.
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /lib/systemd/system/docker.service.
Created symlink /etc/systemd/system/sockets.target.wants/docker.socket → /lib/systemd/system/docker.socket.
Processing triggers for dbus (1.12.20-2ubuntu4.1) ...
Processing triggers for man-db (2.10.2-1) ...
Scanning processes...
Scanning linux images...
Running kernel seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
Create Working Directory
We will create directory which will be mounted inside the container to save the compiled binaries
mkdir builds && ls -l
Output
total 4
drwxrwxr-x 2 wazeem wazeem 4096 Jul 1 12:36 builds
Download Docker Image
Download the docker image by cyd01 which has necessary components for compilation
sudo docker pull cyd01/cross-gcc
Output
Using default tag: latest
latest: Pulling from cyd01/cross-gcc
d99de3d304f0: Pull complete
Digest: sha256:76e39c62686d0accda705b9f4b53bda43a08b15fbf1ceba54dc7620b347ed61a
Status: Downloaded newer image for cyd01/cross-gcc:latest
docker.io/cyd01/cross-gcc:latest
Run the Container
Now we will use a container from this image for code compilation. This command will drop us in container shell
sudo docker run --rm -it -v $(pwd)/builds:/builds cyd01/cross-gcc
Output
user@cross-gcc:/sources$
Download Source Code
Pull the source code from Github repository
git clone https://github.com/cyd01/KiTTY.git
Output
Cloning into 'KiTTY'...
remote: Enumerating objects: 4049, done.
remote: Counting objects: 100% (914/914), done.
remote: Compressing objects: 100% (281/281), done.
remote: Total 4049 (delta 641), reused 823 (delta 611), pack-reused 3135
Receiving objects: 100% (4049/4049), 10.02 MiB | 23.91 MiB/s, done.
Resolving deltas: 100% (2573/2573), done.
Modify the Code
Now we can make changes to code before compilation. For this demo, I will change the ssh client version. Using sed or vi, I am going to change ssh client version from “PuTTY-KiTTY” to “libssh_0.7.4“. Also make sure there is not spaces in the version name after “\0”
vi KiTTY/0.76b_My_PuTTY/utils/version.c
Save the changes and verify
cat KiTTY/0.76b_My_PuTTY/version.c |grep libssh
Output
const char sshver[] = "libssh_0.7.4\0" ;
Compile the Code
Now, we will compile the windows binaries
cd KiTTY/0.76b_My_PuTTY/windows
make -f MAKEFILE.MINGW cross
Output
sed -i 's#^typedef enum _WTS_VIRTUAL_CLASS #// typedef enum _WTS_VIRTUAL_CLASS #' window.c
sed -i 's/0/999/' version_major.txt
make -e TOOLPATH=/usr/bin/i686-w64-mingw32- -f MAKEFILE.MINGW putty.exe plink.exe pscp.exe psftp.exe pageant.exe puttygen.exe
make[1]: Entering directory '/sources/KiTTY/0.76b_My_PuTTY/windows'
/usr/bin/i686-w64-mingw32-gcc -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT -D_NO_OLDNAMES -D__USE_MINGW_ANSI_STDIO=1 -I.././ -I../charset/ -I../windows/ -I../unix/ -I../crypto/ -I../proxy/ -I../ssh/ -I../terminal/ -I../utils/ -D_WIN32_IE=0x0500 -DWINVER=0x0501 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0501 -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP -DFLJ1 -DMOD_WTS -DMOD_PERSO -DMOD_STARTBUTTON -DMOD_SAVEDUMP -DMOD_DISABLEALTGR -DMOD_KEYMAPPING -DMOD_PUTTYX -DMOD_PORTKNOCKING -DMOD_HYPERLINK -DMOD_PRINTCLIP -DMOD_LAUNCHER -DMOD_RECONNECT -DMOD_RUTTY -DMOD_TUTTY -DMOD_ADB -DMOD_BACKGROUNDIMAGE -DMOD_ZMODEM -DMOD_PROXY -DMOD_FAR2L -I.././ -I../../ -I../charset/ -I../windows/ -I../unix/ -I../mac/ -I../macosx -I../../base64 -I../../bcrypt -I../../md5 -I../../regex -I../../url -I../../rutty -c ../ssh/agentf.c
/usr/bin/i686-w64-mingw32-gcc -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT -D_NO_OLDNAMES -D__USE_MINGW_ANSI_STDIO=1 -I.././ -I../charset/ -I../windows/ -I../unix/ -I../crypto/ -I../proxy/ -I../ssh/ -I../terminal/ -I../utils/ -D_WIN32_IE=0x0500 -DWINVER=0x0501 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0501 -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP -DFLJ1 -DMOD_WTS -DMOD_PERSO -DMOD_STARTBUTTON -DMOD_SAVEDUMP -DMOD_DISABLEALTGR -DMOD_KEYMAPPING -DMOD_PUTTYX -DMOD_PORTKNOCKING -DMOD_HYPERLINK -DMOD_PRINTCLIP -DMOD_LAUNCHER -DMOD_RECONNECT -DMOD_RUTTY -DMOD_TUTTY -DMOD_ADB -DMOD_BACKGROUNDIMAGE -DMOD_ZMODEM -DMOD_PROXY -DMOD_FAR2L -I.././ -I../../ -I../charset/ -I../windows/ -I../unix/ -I../mac/ -I../macosx -I../../base64 -I../../bcrypt -I../../md5 -I../../regex -I../../url -I../../rutty -c ../aqsync.c
/usr/bin/i686-w64-mingw32-gcc -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT -D_NO_OLDNAMES -D__USE_MINGW_ANSI_STDIO=1 -I.././ -I../charset/ -I../windows/ -I../unix/ -I../crypto/ -I../proxy/ -I../ssh/ -I../terminal/ -I../utils/ -D_WIN32_IE=0x0500 -DWINVER=0x0501 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0501 -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP -DFLJ1 -DMOD_WTS -DMOD_PERSO -DMOD_STARTBUTTON -DMOD_SAVEDUMP -DMOD_DISABLEALTGR -DMOD_KEYMAPPING -DMOD_PUTTYX -DMOD_PORTKNOCKING -DMOD_HYPERLINK -DMOD_PRINTCLIP -DMOD_LAUNCHER -DMOD_RECONNECT -DMOD_RUTTY -DMOD_TUTTY -DMOD_ADB -DMOD_BACKGROUNDIMAGE -DMOD_ZMODEM -DMOD_PROXY -DMOD_FAR2L -I.././ -I../../ -I../charset/ -I../windows/ -I../unix/ -I../mac/ -I../macosx -I../../base64 -I../../bcrypt -I../../md5 -I../../regex -I../../url -I../../rutty -c ../be_all_s.c
/usr/bin/i686-w64-mingw32-gcc -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT -D_NO_OLDNAMES -D__USE_MINGW_ANSI_STDIO=1 -I.././ -I../charset/ -I../windows/ -I../unix/ -I../crypto/ -I../proxy/ -I../ssh/ -I../terminal/ -I../utils/ -D_WIN32_IE=0x0500 -DWINVER=0x0501 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0501 -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP -DFLJ1 -DMOD_WTS -DMOD_PERSO -DMOD_STARTBUTTON -DMOD_SAVEDUMP -DMOD_DISABLEALTGR -DMOD_KEYMAPPING -DMOD_PUTTYX -DMOD_PORTKNOCKING -DMOD_HYPERLINK -DMOD_PRINTCLIP -DMOD_LAUNCHER -DMOD_RECONNECT -DMOD_RUTTY -DMOD_TUTTY -DMOD_ADB -DMOD_BACKGROUNDIMAGE -DMOD_ZMODEM -DMOD_PROXY -DMOD_FAR2L -I.././ -I../../ -I../charset/ -I../windows/ -I../unix/ -I../mac/ -I../macosx -I../../base64 -I../../bcrypt -I../../md5 -I../../regex -I../../url -I../../rutty -c ../be_misc.c
/usr/bin/i686-w64-mingw32-gcc -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT -D_NO_OLDNAMES -D__USE_MINGW_ANSI_STDIO=1 -I.././ -I../charset/ -I../windows/ -I../unix/ -I../crypto/ -I../proxy/ -I../ssh/ -I../terminal/ -I../utils/ -D_WIN32_IE=0x0500 -DWINVER=0x0501 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0501 -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP -DFLJ1 -DMOD_WTS -DMOD_PERSO -DMOD_STARTBUTTON -DMOD_SAVEDUMP -DMOD_DISABLEALTGR -DMOD_KEYMAPPING -DMOD_PUTTYX -DMOD_PORTKNOCKING -DMOD_HYPERLINK -DMOD_PRINTCLIP -DMOD_LAUNCHER -DMOD_RECONNECT -DMOD_RUTTY -DMOD_TUTTY -DMOD_ADB -DMOD_BACKGROUNDIMAGE -DMOD_ZMODEM -DMOD_PROXY -DMOD_FAR2L -I.././ -I../../ -I../charset/ -I../windows/ -I../unix/ -I../mac/ -I../macosx -I../../base64 -I../../bcrypt -I../../md5 -I../../regex -I../../url -I../../rutty -c ../callback.c
/usr/bin/i686-w64-mingw32-gcc -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT -D_NO_OLDNAMES -D__USE_MINGW_ANSI_STDIO=1 -I.././ -I../charset/ -I../windows/ -I../unix/ -I../crypto/ -I../proxy/ -I../ssh/ -I../terminal/ -I../utils/ -D_WIN32_IE=0x0500 -DWINVER=0x0501 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0501 -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP -DFLJ1 -DMOD_WTS -DMOD_PERSO -DMOD_STARTBUTTON -DMOD_SAVEDUMP -DMOD_DISABLEALTGR -DMOD_KEYMAPPING -DMOD_PUTTYX -DMOD_PORTKNOCKING -DMOD_HYPERLINK -DMOD_PRINTCLIP -DMOD_LAUNCHER -DMOD_RECONNECT -DMOD_RUTTY -DMOD_TUTTY -DMOD_ADB -DMOD_BACKGROUNDIMAGE -DMOD_ZMODEM -DMOD_PROXY -DMOD_FAR2L -I.././ -I../../ -I../charset/ -I../windows/ -I../unix/ -I../mac/ -I../macosx -I../../base64 -I../../bcrypt -I../../md5 -I../../regex -I../../url -I../../rutty -c ../cmdline.c -DMASTER_PASSWORD=`cat ../../masterpassword.txt`
/usr/bin/i686-w64-mingw32-gcc -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT -D_NO_OLDNAMES -D__USE_MINGW_ANSI_STDIO=1 -I.././ -I../charset/ -I../windows/ -I../unix/ -I../crypto/ -I../proxy/ -I../ssh/ -I../terminal/ -I../utils/ -D_WIN32_IE=0x0500 -DWINVER=0x0501 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0501 -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP -DFLJ1 -DMOD_WTS -DMOD_PERSO -DMOD_STARTBUTTON -DMOD_SAVEDUMP -DMOD_DISABLEALTGR -DMOD_KEYMAPPING -DMOD_PUTTYX -DMOD_PORTKNOCKING -DMOD_HYPERLINK -DMOD_PRINTCLIP -DMOD_LAUNCHER -DMOD_RECONNECT -DMOD_RUTTY -DMOD_TUTTY -DMOD_ADB -DMOD_BACKGROUNDIMAGE -DMOD_ZMODEM -DMOD_PROXY -DMOD_FAR2L -I.././ -I../../ -I../charset/ -I../windows/ -I../unix/ -I../mac/ -I../macosx -I../../base64 -I../../bcrypt -I../../md5 -I../../regex -I../../url -I../../rutty -c ../utils/conf.c
/usr/bin/i686-w64-mingw32-gcc -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT -D_NO_OLDNAMES -D__USE_MINGW_ANSI_STDIO=1 -I.././ -I../charset/ -I../windows/ -I../unix/ -I../crypto/ -I../proxy/ -I../ssh/ -I../terminal/ -I../utils/ -D_WIN32_IE=0x0500 -DWINVER=0x0501 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0501 -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP -DFLJ1 -DMOD_WTS -DMOD_PERSO -DMOD_STARTBUTTON -DMOD_SAVEDUMP -DMOD_DISABLEALTGR -DMOD_KEYMAPPING -DMOD_PUTTYX -DMOD_PORTKNOCKING -DMOD_HYPERLINK -DMOD_PRINTCLIP -DMOD_LAUNCHER -DMOD_RECONNECT -DMOD_RUTTY -DMOD_TUTTY -DMOD_ADB -DMOD_BACKGROUNDIMAGE -DMOD_ZMODEM -DMOD_PROXY -DMOD_FAR2L -I.././ -I../../ -I../charset/ -I../windows/ -I../unix/ -I../mac/ -I../macosx -I../../base64 -I../../bcrypt -I../../md5 -I../../regex -I../../url -I../../rutty -c ../config.c
In file included from ../puttyps.h:10,
from ../putty.h:8,
from ../config.c:9:
../windows/platform.h:115:17: warning: '_stricmp' redeclared without dllimport attribute after being referenced with dll linkage
115 | #define stricmp _stricmp
| ^~~~~~~~
../windows/platform.h:115:17: note: in definition of macro 'stricmp'
115 | #define stricmp _stricmp
| ^~~~~~~~
/usr/bin/i686-w64-mingw32-gcc -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT -D_NO_OLDNAMES -D__USE_MINGW_ANSI_STDIO=1 -I.././ -I../charset/ -I../windows/ -I../unix/ -I../crypto/ -I../proxy/ -I../ssh/ -I../terminal/ -I../utils/ -D_WIN32_IE=0x0500 -DWINVER=0x0501 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0501 -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP -DFLJ1 -DMOD_WTS -DMOD_PERSO -DMOD_STARTBUTTON -DMOD_SAVEDUMP -DMOD_DISABLEALTGR -DMOD_KEYMAPPING -DMOD_PUTTYX -DMOD_PORTKNOCKING -DMOD_HYPERLINK -DMOD_PRINTCLIP -DMOD_LAUNCHER -DMOD_RECONNECT -DMOD_RUTTY -DMOD_TUTTY -DMOD_ADB -DMOD_BACKGROUNDIMAGE -DMOD_ZMODEM -DMOD_PROXY -DMOD_FAR2L -I.././ -I../../ -I../charset/ -I../windows/ -I../unix/ -I../mac/ -I../macosx -I../../base64 -I../../bcrypt -I../../md5 -I../../regex -I../../url -I../../rutty -c ../proxy/cproxy.c
/usr/bin/i686-w64-mingw32-gcc -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT -D_NO_OLDNAMES -D__USE_MINGW_ANSI_STDIO=1 -I.././ -I../charset/ -I../windows/ -I../unix/ -I../crypto/ -I../proxy/ -I../ssh/ -I../terminal/ -I../utils/ -D_WIN32_IE=0x0500 -DWINVER=0x0501 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0501 -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP -DFLJ1 -DMOD_WTS -DMOD_PERSO -DMOD_STARTBUTTON -DMOD_SAVEDUMP -DMOD_DISABLEALTGR -DMOD_KEYMAPPING -DMOD_PUTTYX -DMOD_PORTKNOCKING -DMOD_HYPERLINK -DMOD_PRINTCLIP -DMOD_LAUNCHER -DMOD_RECONNECT -DMOD_RUTTY -DMOD_TUTTY -DMOD_ADB -DMOD_BACKGROUNDIMAGE -DMOD_ZMODEM -DMOD_PROXY -DMOD_FAR2L -I.././ -I../../ -I../charset/ -I../windows/ -I../unix/ -I../mac/ -I../macosx -I../../base64 -I../../bcrypt -I../../md5 -I../../regex -I../../url -I../../rutty -c ../dialog.c
/usr/bin/i686-w64-mingw32-gcc -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT -D_NO_OLDNAMES -D__USE_MINGW_ANSI_STDIO=1 -I.././ -I../charset/ -I../windows/ -I../unix/ -I../crypto/ -I../proxy/ -I../ssh/ -I../terminal/ -I../utils/ -D_WIN32_IE=0x0500 -DWINVER=0x0501 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0501 -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP -DFLJ1 -DMOD_WTS -DMOD_PERSO -DMOD_STARTBUTTON -DMOD_SAVEDUMP -DMOD_DISABLEALTGR -DMOD_KEYMAPPING -DMOD_PUTTYX -DMOD_PORTKNOCKING -DMOD_HYPERLINK -DMOD_PRINTCLIP -DMOD_LAUNCHER -DMOD_RECONNECT -DMOD_RUTTY -DMOD_TUTTY -DMOD_ADB -DMOD_BACKGROUNDIMAGE -DMOD_ZMODEM -DMOD_PROXY -DMOD_FAR2L -I.././ -I../../ -I../charset/ -I../windows/ -I../unix/ -I../mac/ -I../macosx -I../../base64 -I../../bcrypt -I../../md5 -I../../regex -I../../url -I../../rutty -c ../crypto/ecc-arithmetic.c
/usr/bin/i686-w64-mingw32-gcc -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT -D_NO_OLDNAMES -D__USE_MINGW_ANSI_STDIO=1 -I.././ -I../charset/ -I../windows/ -I../unix/ -I../crypto/ -I../proxy/ -I../ssh/ -I../terminal/ -I../utils/ -D_WIN32_IE=0x0500 -DWINVER=0x0501 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0501 -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP -DFLJ1 -DMOD_WTS -DMOD_PERSO -DMOD_STARTBUTTON -DMOD_SAVEDUMP -DMOD_DISABLEALTGR -DMOD_KEYMAPPING -DMOD_PUTTYX -DMOD_PORTKNOCKING -DMOD_HYPERLINK -DMOD_PRINTCLIP -DMOD_LAUNCHER -DMOD_RECONNECT -DMOD_RUTTY -DMOD_TUTTY -DMOD_ADB -DMOD_BACKGROUNDIMAGE -DMOD_ZMODEM -DMOD_PROXY -DMOD_FAR2L -I.././ -I../../ -I../charset/ -I../windows/ -I../unix/ -I../mac/ -I../macosx -I../../base64 -I../../bcrypt -I../../md5 -I../../regex -I../../url -I../../rutty -c ../errsock.c
/usr/bin/i686-w64-mingw32-gcc -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT -D_NO_OLDNAMES -D__USE_MINGW_ANSI_STDIO=1 -I.././ -I../charset/ -I../windows/ -I../unix/ -I../crypto/ -I../proxy/ -I../ssh/ -I../terminal/ -I../utils/ -D_WIN32_IE=0x0500 -DWINVER=0x0501 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0501 -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP -DFLJ1 -DMOD_WTS -DMOD_PERSO -DMOD_STARTBUTTON -DMOD_SAVEDUMP -DMOD_DISABLEALTGR -DMOD_KEYMAPPING -DMOD_PUTTYX -DMOD_PORTKNOCKING -DMOD_HYPERLINK -DMOD_PRINTCLIP -DMOD_LAUNCHER -DMOD_RECONNECT -DMOD_RUTTY -DMOD_TUTTY -DMOD_ADB -DMOD_BACKGROUNDIMAGE -DMOD_ZMODEM -DMOD_PROXY -DMOD_FAR2L -I.././ -I../../ -I../charset/ -I../windows/ -I../unix/ -I../mac/ -I../macosx -I../../base64 -I../../bcrypt -I../../md5 -I../../regex -I../../url -I../../rutty -c ../ldisc.c
/usr/bin/i686-w64-mingw32-gcc -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT -D_NO_OLDNAMES -D__USE_MINGW_ANSI_STDIO=1 -I.././ -I../charset/ -I../windows/ -I../unix/ -I../crypto/ -I../proxy/ -I../ssh/ -I../terminal/ -I../utils/ -D_WIN32_IE=0x0500 -DWINVER=0x0501 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0501 -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP -DFLJ1 -DMOD_WTS -DMOD_PERSO -DMOD_STARTBUTTON -DMOD_SAVEDUMP -DMOD_DISABLEALTGR -DMOD_KEYMAPPING -DMOD_PUTTYX -DMOD_PORTKNOCKING -DMOD_HYPERLINK -DMOD_PRINTCLIP -DMOD_LAUNCHER -DMOD_RECONNECT -DMOD_RUTTY -DMOD_TUTTY -DMOD_ADB -DMOD_BACKGROUNDIMAGE -DMOD_ZMODEM -DMOD_PROXY -DMOD_FAR2L -I.././ -I../../ -I../charset/ -I../windows/ -I../unix/ -I../mac/ -I../macosx -I../../base64 -I../../bcrypt -I../../md5 -I../../regex -I../../url -I../../rutty -c ../logging.c
/usr/bin/i686-w64-mingw32-gcc -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT -D_NO_OLDNAMES -D__USE_MINGW_ANSI_STDIO=1 -I.././ -I../charset/ -I../windows/ -I../unix/ -I../crypto/ -I../proxy/ -I../ssh/ -I../terminal/ -I../utils/ -D_WIN32_IE=0x0500 -DWINVER=0x0501 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0501 -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP -DFLJ1 -DMOD_WTS -DMOD_PERSO -DMOD_STARTBUTTON -DMOD_SAVEDUMP -DMOD_DISABLEALTGR -DMOD_KEYMAPPING -DMOD_PUTTYX -DMOD_PORTKNOCKING -DMOD_HYPERLINK -DMOD_PRINTCLIP -DMOD_LAUNCHER -DMOD_RECONNECT -DMOD_RUTTY -DMOD_TUTTY -DMOD_ADB -DMOD_BACKGROUNDIMAGE -DMOD_ZMODEM -DMOD_PROXY -DMOD_FAR2L -I.././ -I../../ -I../charset/ -I../windows/ -I../unix/ -I../mac/ -I../macosx -I../../base64 -I../../bcrypt -I../../md5 -I../../regex -I../../url -I../../rutty -c ../ssh/mainchan.c
/usr/bin/i686-w64-mingw32-gcc -Wall -O2 -std=gnu99 -Wvla -D_WINDOWS -DWIN32S_COMPAT -D_NO_OLDNAMES -D__USE_MINGW_ANSI_STDIO=1 -I.././ -I../charset/ -I../windows/ -I../unix/ -I../crypto/ -I../proxy/ -I../ssh/ -I../terminal/ -I../utils/ -D_WIN32_IE=0x0500 -DWINVER=0x0501 -D_WIN32_WINDOWS=0x0410 -D_WIN32_WINNT=0x0501 -DNO_SECUREZEROMEMORY -DCOVERITY -DNO_HTMLHELP -DFLJ1 -DMOD_WTS -DMOD_PERSO -DMOD_STARTBUTTON -DMOD_SA
.
.
.(truncated)
.
.
void.o fromucs.o slookup.o sbcsdat.o sbcs.o utf8.o \
../../base64/base64.a ../../bcrypt/bcrypt.a ../../blocnote/notepad.a ../../jpeg/libjpeg.a \
../../md5/MD5check.a ../../mini/mini.a ../../regex/libregex.a \
-ladvapi32 -lcomdlg32 -lgdi32 -limm32 -lpsapi -lole32 -lshell32 \
-luser32 -lwsock32 -lwtsapi32
# -lcomctl32 -lwinmm -lwinspool -lole32 -lcrypt32
make[1]: Leaving directory '/sources/KiTTY/0.76b_My_PuTTY/windows'
cp putty.exe putty_nocompress.exe
upx --best --compress-icons=2 --compress-exports=0 putty.exe putty_portable.exe
Ultimate Packer for eXecutables
Copyright (C) 1996 - 2018
UPX 3.95 Markus Oberhumer, Laszlo Molnar & John Reiser Aug 26th 2018
File size Ratio Format Name
-------------------- ------ ----------- -----------
2028032 -> 800256 39.46% win32/pe putty.exe
2028032 -> 800256 39.46% win32/pe putty_portable.exe
-------------------- ------ ----------- -----------
4056064 -> 1600512 39.46% [ 2 files ]
Packed 2 files.
mv putty.exe /builds/kitty.exe
mv putty_portable.exe /builds/kitty_portable.exe
mv putty_nocompress.exe /builds/kitty_nocompress.exe
mv plink.exe /builds/klink.exe
mv pscp.exe /builds/kscp.exe
mv psftp.exe /builds/ksftp.exe
mv pageant.exe /builds/kageant.exe
mv puttygen.exe /builds/kittygen.exe
rm *.o
Gather the binary file
At the completion of compilation, we will have binary files in our build directory
exit
ls -l
Output
total 6992
-rwxr-xr-x 1 wazeem wazeem 450560 Jul 1 13:43 kageant.exe
-rwxr-xr-x 1 wazeem wazeem 800256 Jul 1 13:42 kitty.exe
-rwxr-xr-x 1 wazeem wazeem 2028032 Jul 1 13:43 kitty_nocompress.exe
-rwxr-xr-x 1 wazeem wazeem 800256 Jul 1 13:43 kitty_portable.exe
-rwxr-xr-x 1 wazeem wazeem 539648 Jul 1 13:43 kittygen.exe
-rwxr-xr-x 1 wazeem wazeem 843776 Jul 1 13:43 klink.exe
-rwxr-xr-x 1 wazeem wazeem 839168 Jul 1 13:43 kscp.exe
-rwxr-xr-x 1 wazeem wazeem 845824 Jul 1 13:43 ksftp.exe
Verify the Changes
In the end, we will connect to ssh server using our compiled client and original client from vendor site to verify the modification using tcpdump/wireshark.
Tcpdump Output from Original Client
Tcpdump Output from Compiled Client
Download the Compiled Version
Here is the link to compiled version if you want to use. I highly recommend to use the official versions.