Saturday, March 19, 2022

Installing Kali Linux on WSL2

In the last post I installed Kali Linux on WSL1, but actually it was not recommended as WSL2 is better than WSL1 obviously.

Here is comparison between WSL1 and WSL2.

And also I realized docker was not able to run on WSL1 linux. So I am re-installed Kali Linux on WSL2.



First WSL default version should be changed to version 2. Just type this command is fine.

wsl --set-default-version 2

PS C:\Users\tmlocal> wsl --set-default-version 2
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
The operation completed successfully.

To confirm the WSL version just typing this below command is OK.

wsl --status

PS C:\Users\tmlocal> wsl --status
Default Version: 2

Windows Subsystem for Linux was last updated on 11/15/2021
WSL automatic updates are on.

Kernel version: 5.10.60.1



Now Kali Linux can be installed on WSL2. Here is the command to install.

wsl --install -d kali-linux

PS C:\Users\tmlocal> wsl --install -d kali-linux
Downloading: Kali Linux Rolling
Installing: Kali Linux Rolling
Kali Linux Rolling has been installed.
Launching Kali Linux Rolling...


In the new window Kali Linux starts running like this.

Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: tmlocal
New password:
Retype new password:
passwd: password updated successfully
Installation successful!



Next step is to install the latest versions of all the installed packages. Following 2 commands need to be executed.

Sunday, March 13, 2022

Installing Kali Linux on WSL1 (not recommended)

I found Kali linux is ready for WSL and it's easy to install. Following list is distribution list that can be installed from Microsoft Store.

PS C:\> wsl --status
Default Version: 1

Windows Subsystem for Linux was last updated on 11/15/2021
WSL automatic updates are on.

Kernel version: 5.10.60.1


PS C:\> wsl -l -o
The following is a list of valid distributions that can be installed.
Install using 'wsl --install -d '.

NAME            FRIENDLY NAME
Ubuntu          Ubuntu
Debian          Debian GNU/Linux
kali-linux      Kali Linux Rolling
openSUSE-42     openSUSE Leap 42
SLES-12         SUSE Linux Enterprise Server v12
Ubuntu-16.04    Ubuntu 16.04 LTS
Ubuntu-18.04    Ubuntu 18.04 LTS
Ubuntu-20.04    Ubuntu 20.04 LTS



If WSL has been installed already, just execute following command is fine.

wsl --install -d kali-linux
 

PS C:\> wsl --install -d kali-linux
Downloading: Kali Linux Rolling
Installing: Kali Linux Rolling
Kali Linux Rolling has been installed.
Launching Kali Linux Rolling...



Once it is installed new window is popping up and username and password would be required to input.



Next step is to install the latest versions of all the installed packages. Following 2 commands need to be executed.

sudo apt-get update
sudo apt-get upgrade

This time I got strange error like this.

tmlocal@local:/$ sudo apt-get update
[sudo] password for tmlocal:
Get:1 http://linux3.yz.yamagata-u.ac.jp/pub/linux/kali kali-rolling InRelease [30.6 kB]
Err:1 http://linux3.yz.yamagata-u.ac.jp/pub/linux/kali kali-rolling InRelease
  The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository 
Fetched 30.6 kB in 1s (21.3 kB/s)
Reading package lists... Done
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://linux3.yz.yamagata-u.ac.jp/pub/linux/kali kali-rolling InRelease: The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository 
W: Failed to fetch http://http.kali.org/kali/dists/kali-rolling/InRelease  The following signatures were invalid: EXPKEYSIG ED444FF07D8D0BF6 Kali Linux Repository 
W: Some index files failed to download. They have been ignored, or old ones used instead.


Saturday, February 22, 2020

Syntax highlighting on Blogger

In the last post I used syntax highlight technique.

https://highlightjs.org/

Here is demo page where we can see various languages and styles are covered.
https://highlightjs.org/static/demo/

I'm using "VS 2015" style in my blog pages and following is how to configure it.

Step - 1:
Check CDN URL from here.
https://cdnjs.com/libraries/highlight.js/

Copy js and css link.

<link href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/vs2015.min.css" rel="stylesheet"></link>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>


Step -2:
Go to Blogger Theme setting and click "Edit HTML".

Step-3:
Paste js and css link along with "<script>hljs.initHighlightingOnLoad();</script>" between <head> and </head>.

Step-4:
In order to use Syntax highlighting, HTML needs to be used.

Then write source code between these <pre><code> and </code></pre>. In code class, a supported language can be specified.

example-1:
<pre><code class="java">
public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World!!");
    }

}
</code></pre>

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello World!!");
    }

}

example-2:
* In this case html tags are escaped.
<pre><code class="html">
&lt;link href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/vs2015.min.css" rel="stylesheet"&gt;&lt;/link&gt;
&lt;script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/highlight.min.js"&gt;&lt;/script&gt;
&lt;script&gt;hljs.initHighlightingOnLoad();&lt;/script&gt;
</code></pre>


<link href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/styles/vs2015.min.css" rel="stylesheet"></link>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.18.1/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>



Hello world!

Hi there,

This is my first post of "Days Of Engineer".

I'm very excited to start this blog this year to connect me to huge community of software engineers.

I'm not sure how Blogger can help me thus I start from "hello world!".

Here what hello world is.

main( ) {
        printf("hello, world\n");
}

Installing Kali Linux on WSL2

In the last post I installed Kali Linux on WSL1, but actually it was not recommended as WSL2 is better than WSL1 obviously. Here is compari...