Linux LOLBins Applications Available in Windows
Some useful Linux applications that are now part of default installation in Windows 10, Windows Server 2019/2022 (LOLBins - Living Off the Land Binaries).
cURL
The first one is curl which can be very useful for scripting to download or upload files and/or use with a username/password (curl --help) and save the output either to a new filename or the same:
C:\Users\guy\Downloads>curl https://handlers.sans.edu/gbruneau/scripts/Example.csv -o Example.csv
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 230k 100 230k 0 0 1443k 0 --:--:-- --:--:-- --:--:-- 1461k
tar
The next application is tar (tar --help) is used to store, extract and manipulate archive files. Let’s take the previous file Example.csv, archive and compress it and then review the result. Using the same options as Linux will use gzip compression and create the file Example.tgz:
-c Create -r Add/Replace -t List -u Update -x Extract
-f <filename> Location of archive
-v Verbose
-z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma
C:\Users\guy\Downloads>tar zcvf example.tgz Example.csv
C:\Users\guy\Downloads>dir Example.*
Volume in drive C is Starbase
Volume Serial Number is EEB2-C010
Directory of C:\Users\guy\Downloads
12/03/2022 01:39 PM 236,526 Example.csv
12/03/2022 01:46 PM 38,247 example.tgz
To extract the file(s), using the following command:
C:\Users\guy\Downloads>tar xvf example.tgz
x Example.csv
To view the content of the archive:
c:\Users\guy\Downloads>tar ztvf Example.tgz
-rw-rw-rw- 0 0 0 236526 Dec 03 13:39 Example.csv
PktMON
This tool is a Windows original which I think is worth mentionning again. I wrote a diary in May 2020 [1] on how to use PktMON to capture packets using this tool in Windows 10. The resulting packet capture can be converted into a pcapng format to be read later with Wireshark.
OpenSSH
The last one that is always useful is ssh/scp/sftp which is using the OpenSSH. The location of the OpenSSH binaries is: C:\Windows\System32\OpenSSH
ssh
scp
sftp
ssh-add.exe
ssh-agent.exe
ssh-keygen.exe
ssh-keyscan.exe
First lest create some public/private keys using the default user home directory:
C:\Users\guy>ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\guy/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\guy/.ssh/id_rsa.
Your public key has been saved in C:\Users\guy/.ssh/id_rsa.pub.
[...]
C:\Users\guy>cd .ssh
C:\Users\guy\.ssh>dir
Volume in drive C is Starbase
Volume Serial Number is EEB2-C010
Directory of C:\Users\guy\.ssh
12/03/2022 02:10 PM <DIR> .
12/03/2022 02:10 PM <DIR> ..
12/03/2022 02:10 PM 2,655 id_rsa
12/03/2022 02:10 PM 567 id_rsa.pub
11/10/2022 01:49 PM 545 known_hosts
Now ssh/scp/sftp is ready to use with a public key to a remote server. By default OpenSSH doesn't run the SSH listener service but it can be configured using the information posted here in a Microsoft article.
[1] https://isc.sans.edu/diary/Windows+10+Builtin+Packet+Sniffer+PktMon/26186
[2] https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_overview
[3] https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_server_configuration
-----------
Guy Bruneau IPSS Inc.
My Handler Page
Twitter: GuyBruneau
gbruneau at isc dot sans dot edu
Comments