# 2. Kali Linux/Ubuntu VM and tools

Xin chào phần này là phần mà tui viết lại một phần để lưu lại sau muốn cài đặt thì có thể vào làm theo các bước là được, 1 phần ai mà có nhu cầu thì sẽ vào.

## Bước 1: Tải file hệ điều hành

* Hệ điều hành được sử dụng trên nhiều nền tảng tạo máy ảo. Nhưng tôi vẫn thích là VMware.
* Link được sử dụng: <https://www.kali.org/get-kali/#kali-virtual-machines>

## Bước 2: Giải nén và thiết lập vùng lưu trữ

* File vừa tải về sẽ được giải nén ra ta sẽ nhận được thư mục trong đó có nhiều file nhưng ta cần quan tâm nhất là file có đuôi `.vmx` .
* Tiếp theo click chuột phải vào file đuôi `.vmx` rồi chọn `open` bằng wmware.
* Tiếp đến là upgrade tên mới và thư mục nhé.
* Rồi bật lên vào chạy với `username` và `password` đều là `kali`.

## Bước 3: Thiết lập lại hệ điều hành

* Sử dụng một số câu lệnh sau:

```shell
sudo apt-get update
sudo apt-get upgrade
sudo apt autoremove
```

## Bước 4: Cài tools

{% code overflow="wrap" lineNumbers="true" %}

```shell
sudo apt install gdb
sudo apt install z3
sudo apt install jd-gui
sudo apt install apktool
sudo apt install code-oss
sudo apt install rpm
sudo apt install steghide
sudo apt install pngcheck
sudo apt install stegosuite
sudo apt install stegcracker
sudo apt install xxd
sudo apt install ghidra #cái này khi sử dụng lưu ý về quyền user và root
sudo apt install ncat
sudo apt install lldb
```

{% endcode %}

* Cài đặt gdb: <https://github.com/apogiatzis/gdb-peda-pwndbg-gef> (nó gồm tất cả các tools hỗ trợ cho gdb)
* Cài stegseek: <https://github.com/RickdeJager/stegseek>

Cài đặt các gói cho python:

```shell
pip install z3-solver
pip install angr
pip install cpython-lldb
```

Cài pwntools

```shell
apt-get update
apt-get install python3 python3-pip python3-dev git libssl-dev libffi-dev build-essential
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade pwntools
```

Dưới là cài các thư viện bị thiếu: 😂 (có thể sử dụng lệnh `ldd name_file` để kiểm tra xem nó cần những gì thì mình cài)

```shell
sudo apt-get install libxrender1:i386 libxtst6:i386 libxi6:i386
sudo apt-get install libsm6:i386
sudo apt-get install libfontconfig1 fontconfig libfontconfig1-dev
sudo apt-get install libfontconfig1:i386
```

Nếu mà chương trình mà không chạy được filel 32 bit thì ta sẽ chạy các câu lệnh sau:

```sh
sudo dpkg --add-architecture i386
echo "foreign-architecture i386" > /etc/dpkg/dpkg.cfg.d/multiarch
sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
```

Nếu mà cài đặt phần trên mà thấy báo lỗi "foreign-architecture" thì ta sẽ xóa thư mục multiarch đi nhé rồi cài đặt lại là được (như update rồi cài lại các công cụ vì khi nó bị lỗi trên thì dẫn đến không thể cài đặt các phần mềm khác được).

```sh
apt-get install lib32stdc++6
```

## Đối với Ubuntu thì làm tương tự

> Nếu OS không thể tải và cài được vmware tools thì ta sẽ làm như sau:
>
> Sử dụng câu lệnh: <mark style="color:red;">`sudo apt-get install open-vm-tools-desktop -y`</mark> &#x20;
>
> Hoặc làm theo hướng dẫn của vmware là sẽ tải về file <mark style="color:red;">`linux.iso`</mark> -> ta sẽ nhận được thư mục mount -> hãy copy file <mark style="color:red;">`vm...tar.gz`</mark> rồi giải nén nó bằng câu lệnh <mark style="color:red;">`tar -xzvf vm....tar.gz`</mark> -> sau đó đi đến thư mục đã được giải nén và chạy file <mark style="color:red;">`sudo ./vmware-install.pl`</mark> -> trả lời các yêu cầu của nó là xong (tôi đã thử và chưa hiệu quả bằng cách 1 nhé.)

## Bật tính năng auto-login

<figure><img src="/files/FdlVwJSJH3J6tC8qgPSw" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://viettaliii.gitbook.io/home/education/install-tools/2.-kali-linux-vm-and-tools.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
