# Havoc C2

## 1. Script run auto Havoc

Đối với phần này, khi tôi chạy nhiều lần Havoc teamserver và client nên nó mất của mình nhiều thời gian khiến mình viết đoạn này giúp mình chỉ cần click là có thể run luôn:))

Đầu tiên chúng ta sẽ tạo 1 script bash có tên `Havoc_start.sh` như sau:

{% code overflow="wrap" %}

```bash
#!/bin/bash

PASSWORD="kali"

# === Thư mục chứa Havoc ===
HAVOC_DIR="/home/$USER/Havoc"

# === Mở terminal khởi chạy teamserver ===
echo "$PASSWORD" | sudo -S gnome-terminal --title="Havoc" -- bash -c "cd '$HAVOC_DIR'; sudo ./havoc server --profile ./profiles/havoc.yaotl -v --debug; exec bash" 

gnome-terminal --title="Havoc Client" -- bash -c "cd '$HAVOC_DIR'; ./havoc client; exec bash"

```

{% endcode %}

Trong đây là nó sẽ mở 2 cửa sổ 1 cửa sổ liên của teamserver cần quyền root nên sẽ có password.

Sau đó nhớ thêm quyền thực thi vô cái file này nhá.

```bash
chmod +x Havoc_start.sh
```

Tùy thuộc vào vị trí lưu Havoc nhá, nhưng thực tế thường lưu trực tiếp vào thư mục `/home/kali`.

<figure><img src="/files/16024mlUrj0DySJ4P7c2" alt=""><figcaption></figcaption></figure>

Tiếp theo là tôi muốn là có icon trông giống 1 application và nhìn nó chuyên nghiệp hơn nhá.

Thế là ta sẽ tạo thêm 1 file có tên `HavocLauncher.desktop` ở Desktop nhé:

```
[Desktop Entry]
Name=Havoc C2
Comment=Run Havoc Teamserver and Client
Exec=/home/kali/Desktop/Havoc_start.sh
Icon=/home/kali/Havoc/assets/Havoc.png
Terminal=false
Type=Application
Categories=Utility;
StartupNotify=false
```

Path của file .sh vừa tạo trước sẽ tùy chỉnh tùy nơi bạn lưu nhé, và icon tùy chọn do mình nhé, có thể chọn bất kỳ icon nào. Một điểm lưu ý tôi không muốn hiển thị cửa sổ terminal thì tôi tắt đi và cảnh báo cũng tắt đi nhá cho đơn giản.

Sau đó cũng tương tự thêm quyền thực thi cho nó nhá.

```bash
chmod +x HavocLauncher.desktop
```

Và kết quả:

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

Cảm ơn các bạn đã đọc đến đây, nó đơn giản nhưng tôi sẽ lưu lại vì sau có muốn nhớ lại kiếm lại thì vô đây.


---

# 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/mal/havoc-c2.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.
