見出し画像

【kali linux】windowsでkali linuxを使う【WSL】

ハッキングテストOSとして知られるkali linuxをWindowsで使ってみましょう


1.WSL環境のインストール

C:\WINDOWS\system32>wsl --install
インストール中: 仮想マシン プラットフォーム
仮想マシン プラットフォーム はインストールされました。
インストール中: Linux 用 Windows サブシステム
Linux 用 Windows サブシステム はインストールされました。
ダウンロード中: WSL カーネル
インストール中: WSL カーネル
WSL カーネル はインストールされました。
ダウンロード中: Ubuntu
要求された操作は正常に終了しました。変更を有効にするには、システムを再起動する必要があ ります。
C:\WINDOWS\system32>


2.kali linuxのインストール

画像1


3.起動失敗

Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80370102
Error: 0x80370102 ??????????????????????????????????????
Press any key to continue...


再起動したら無事に治りました.

画像2

4.SSHの設定

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: masaki
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
┏━(Message from Kali developers)
┃
┃ This is a minimal installation of Kali Linux, you likely
┃ want to install supplementary tools. Learn how:
┃ ⇒ https://www.kali.org/docs/troubleshooting/common-minimum-setup/
┃
┗━(Run: “touch ~/.hushlogin” to hide this message)


▼最初はSSHは入っていないようですね
┌──(masaki㉿DESKTOP-DSDA0NU)-[~]
└─$ ssh
-bash: ssh: command not found

▼APTコマンドは普通に使えそう
┌──(masaki㉿DESKTOP-DSDA0NU)-[~]
└─$ apt
apt 2.3.9 (amd64)
Usage: apt [options] command
apt is a commandline package manager and provides commands for
searching and managing as well as querying information about packages.
It provides the same functionality as the specialized APT tools,
like apt-get and apt-cache, but enables options more suitable for
interactive use by default.
Most used commands:
 list - list packages based on package names
 search - search in package descriptions
 show - show package details
 install - install packages
 reinstall - reinstall packages
 remove - remove packages
 autoremove - Remove automatically all unused packages
 update - update list of available packages
 upgrade - upgrade the system by installing/upgrading packages
 full-upgrade - upgrade the system by removing/installing/upgrading packages
 edit-sources - edit the source information file
 satisfy - satisfy dependency strings
See apt(8) for more information about the available commands.
Configuration options and syntax is detailed in apt.conf(5).
Information about how to configure sources can be found in sources.list(5).
Package and version choices can be expressed via apt_preferences(5).
Security details are available in apt-secure(8).
                                       This APT has Super Cow Powers.
                                       
▼適当にパッケージを指定したんですが失敗                
┌──(masaki㉿DESKTOP-DSDA0NU)-[~]
└─$ apt install openssh
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
┌──(masaki㉿DESKTOP-DSDA0NU)-[~]
└─$ sudo apt install openssh
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
   #1) Respect the privacy of others.
   #2) Think before you type.
   #3) With great power comes great responsibility.
[sudo] password for masaki:
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package openssh

▼とりあえずアップデート
┌──(masaki㉿DESKTOP-DSDA0NU)-[~]
└─$ sudo apt update
Get:1 http://ftp.riken.jp/Linux/kali kali-rolling InRelease [30.6 kB]
Get:2 http://ftp.riken.jp/Linux/kali kali-rolling/main amd64 Packages [17.9 MB]
Get:3 http://ftp.riken.jp/Linux/kali kali-rolling/non-free amd64 Packages [210 kB]
Get:4 http://ftp.riken.jp/Linux/kali kali-rolling/contrib amd64 Packages [111 kB]
Fetched 18.2 MB in 2s (8,375 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
71 packages can be upgraded. Run 'apt list --upgradable' to see them.

▼アップグレード
┌──(masaki㉿DESKTOP-DSDA0NU)-[~]
└─$ apt list --upgradable
Listing... Done
apt-utils/kali-rolling 2.3.11 amd64 [upgradable from: 2.3.9]
apt/kali-rolling 2.3.11 amd64 [upgradable from: 2.3.9]
base-passwd/kali-rolling 3.5.52 amd64 [upgradable from: 3.5.51]
bash/kali-rolling 5.1-3+b2 amd64 [upgradable from: 5.1-3+b1]
bind9-dnsutils/kali-rolling 1:9.17.19-1 amd64 [upgradable from: 1:9.16.15-1]
bind9-host/kali-rolling 1:9.17.19-1 amd64 [upgradable from: 1:9.16.15-1]
bind9-libs/kali-rolling 1:9.17.19-1 amd64 [upgradable from: 1:9.16.15-1]
bsdutils/kali-rolling 1:2.37.2-4 amd64 [upgradable from: 1:2.37.2-1]
coreutils/kali-rolling 8.32-4.1 amd64 [upgradable from: 8.32-4+b1]

.........
....省略.....
.........

dpkg-statoverride: warning: no override present
Setting up libbpf0:amd64 (1:0.5.0-1) ...
Setting up libxml2:amd64 (2.9.12+dfsg-5) ...
Setting up bind9-libs:amd64 (1:9.17.19-1) ...
Setting up vim-tiny (2:8.2.3565-1+b1) ...
Setting up fdisk (2.37.2-4) ...
Setting up bind9-host (1:9.17.19-1) ...
Setting up bind9-dnsutils (1:9.17.19-1) ...
Setting up dnsutils (1:9.17.19-1) ...
Processing triggers for libc-bin (2.32-4) ...

▼SSHパッケージをインストール
┌──(masaki㉿DESKTOP-DSDA0NU)-[~]
└─$ sudo apt install openssh-server
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
 dbus dbus-bin dbus-daemon dbus-session-bus-common dbus-system-bus-common libcbor0 libdbus-1-3 libexpat1 libfido2-1
 libpam-systemd libwrap0 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxmuu1 ncurses-term openssh-client
 openssh-sftp-server runit-helper ucf xauth
Suggested packages:
 default-dbus-session-bus | dbus-session-bus keychain libpam-ssh monkeysphere ssh-askpass molly-guard ufw
The following NEW packages will be installed:
 dbus dbus-bin dbus-daemon dbus-session-bus-common dbus-system-bus-common libcbor0 libdbus-1-3 libexpat1 libfido2-1
 libpam-systemd libwrap0 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxmuu1 ncurses-term openssh-client
 openssh-server openssh-sftp-server runit-helper ucf xauth
0 upgraded, 25 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,903 kB of archives.
After this operation, 18.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ftp.riken.jp/Linux/kali kali-rolling/main amd64 libdbus-1-3 amd64 1.12.20-3 [219 kB]
Get:2 http://ftp.riken.jp/Linux/kali kali-rolling/main amd64 dbus-bin amd64 1.12.20-3 [124 kB]
Get:3 http://ftp.riken.jp/Linux/kali kali-rolling/main amd64 dbus-session-bus-common all 1.12.20-3 [97.3 kB]
Get:4 http://ftp.riken.jp/Linux/kali kali-rolling/main amd64 libexpat1 amd64 2.4.1-3 [104 kB]
Get:5 http://ftp.riken.jp/Linux/kali kali-rolling/main amd64 dbus-daemon amd64 1.12.20-3 [201 kB]

.........
....省略.....
.........

3072 SHA256:6GmurGRc2uAbeOoZ9545l2K/6XLwrZTSXB4aKn1QeNU root@DESKTOP-DSDA0NU (RSA)
Creating SSH2 ECDSA key; this may take some time ...
256 SHA256:vFfhEfjSheaCCGX2dJJPIBj2g+uDHApyJEfD/SZeTr8 root@DESKTOP-DSDA0NU (ECDSA)
Creating SSH2 ED25519 key; this may take some time ...
256 SHA256:qniWsZdmvkEvF9v6YMqssVeJjh8bT5OCaQsOJVSUmu8 root@DESKTOP-DSDA0NU (ED25519)
update-rc.d: As per Kali policy, ssh init script is left disabled.
invoke-rc.d: could not determine current runlevel
Processing triggers for libc-bin (2.32-4) ...

▼SSHコマンド確認
┌──(masaki㉿DESKTOP-DSDA0NU)-[~]
└─$ ssh
usage: ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface]
          [-b bind_address] [-c cipher_spec] [-D [bind_address:]port]
          [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11]
          [-i identity_file] [-J [user@]host[:port]] [-L address]
          [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
          [-Q query_option] [-R address] [-S ctl_path] [-W host:port]
          [-w local_tun[:remote_tun]] destination [command]
┌──(masaki㉿DESKTOP-DSDA0NU)-[~]
└─$


無事にSSHが使えるようになりました!


#SSH

#kalilinux

#ハッキング

#ハッキングOS







この記事が気に入ったらサポートをしてみませんか?