Kali Linux構築

IPUSIRONさんの書いてるハッキングラボの構築をMac環境で手軽に構築できるスクリプトです。
環境構築をある程度自動化してるため、再構築をすることができるようになります。
nat network経由でインターネットできること。
※Kali Linux 2020.1.0対応

目次
・VirtualBoxセットアップ
・Kali linuxセットアップ(自動)
・キーボード設定(自動)
・日本語環境構築(自動)
・タイムゾーンの設定(自動)
・networkの追加(nic1 nat,nic2 hostonly)
・ssh起動(自動)
・pythonインストール

github zephel01 kali linux setup

Homebrew install(Mac)

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

ソフトウェア・アップデート(Mac)
・Command Line Tools for Xcode をインストールします。

スクリーンショット 2020-01-27 23.21.51

$ brew install wget

VirtualBoxのセットアップ(Mac)
※各パッケージをインストールします。

$ wget https://download.virtualbox.org/virtualbox/6.1.2/VirtualBox-6.1.2-135662-OSX.dmg

ダウンロードしたファイルをインストールします。
VirtualBox-6.1.2-135662-OSX.dmgをクリックしてください。

スクリーンショット 2020-01-27 23.30.37

スクリーンショット 2020-01-27 23.30.46

機能拡張がブロックされた場合はセキュリティ環境設定を開く

スクリーンショット 2020-01-27 23.31.57

変更するにはカギをクリックします。

スクリーンショット 2020-01-27 23.32.16

スクリーンショット 2020-01-27 23.32.43

先に進めるとインストールできます。失敗した場合は再インストールをしてください。

スクリーンショット 2020-01-27 23.33.11

Oracle_VM_VirtualBox_Extension_Pack-6.1.2.vbox-extpackをダウンロードします。(VirtualBoxのバージョンが合ってないとインストールできません)

$ wget https://download.virtualbox.org/virtualbox/6.1.2/Oracle_VM_VirtualBox_Extension_Pack-6.1.2.vbox-extpack

Oracle_VM_VirtualBox_Extension_Pack-6.1.2.vbox-extpackをクリックしてインストールします。

Vagrant のインストール(Mac)

$ wget https://releases.hashicorp.com/vagrant/2.2.7/vagrant_2.2.7_x86_64.dmg

vagrant_2.2.7_x86_64.dmgをインストールします。

スクリーンショット 2020-01-27 23.43.31

vagrant.pkgをクリックしてインストールします。

スクリーンショット 2020-01-27 23.44.20

スクリーンショット 2020-01-27 23.45.03

Vagrant plugin update(Mac)

$ vagrant plugin update

コンソールでgit cloneします。(Mac)

# git clone https://github.com/zephel01/kali.git

kali linux の追加(Kali linuxのイメージのダウンロード)(Mac)

$ cd kali
$ vagrant box add kalilinux/rolling
$ vagrant box list

kali linux のセットアップ(Mac)

$ vagrant up

networkの追加(nic1 nat, nic2 hostonly)

$ ./netadd.sh

Kali Linux へssh接続(Mac)

$ vagrant ssh
Linux kali 5.4.0-kali3-amd64 #1 SMP Debian 5.4.13-1kali1 (2020-01-20) x86_64

The programs included with the Kali GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Kali GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
kali@kali:~$​

ssh configに追加(Mac)

$ vagrant ssh-config >> ~/.ssh/config

ssh で接続(Mac)

$ ssh default
Linux kali 5.3.0-kali2-amd64 #1 SMP Debian 5.3.9-3kali1 (2019-11-20) x86_64

The programs included with the Kali GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Kali GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Jan 27 19:17:33 2020 from 10.0.3.2

kali linuxにpython環境構築(Kali)

$ git clone https://github.com/zephel01/kali.git
$ cd kali
$ ./python_install.sh

vagrant コマンド
・作成したイメージの確認

$ vagrant global-status
id       name    provider   state   directory
------------------------------------------------------------------------
22b62d0  default virtualbox running /Users/zephel01/works/kali

※ゴミ残った場合はvagrant global-status --pruneで削除

・作成したイメージの削除

$ cd kali
$ ./destroy.sh
vagrant destroy 22b62d0
   default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...​
$ vagrant destroy e717278 (上の表示したID)

macOS Catalinaぐらいからセキュリティが厳しくなったようで以下の設定が必要になります。vagrant upで止まる場合は設定が必要です。

セキュリティとプライバシーの設定に追加します。

スクリーンショット 2020-01-28 1.11.10

スクリーンショット 2020-01-28 1.11.19


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