apt clean β cleans the packages and install script in /var/cache/apt/archives/ (removes all stored archives in your cache)
apt autoclean β cleans obsolete deb-packages, less than clean (removes all stored archives in your cache for packages that can not be downloaded anymore (thus packages that are no longer in the repo or that have a newer version in the repo))
apt autoremove β removes orphaned packages which are not longer needed from the system, but not purges them, use the --purge option together with the command for that.
apt --purge autoremove β remove config files and (more important as it cleans dead subdirectories from the documentation tree) entries from /usr/share/doc.
Create Aliases
Ubuntu:
nano ~/.bashrc
# Append the following text with personal commands. O.S. update in this case:
alias updateos='sudo -- sh -c "sudo apt update && sudo apt -y upgrade && sudo apt -y autoremove"'
# Load changes:
source ~/.bashrc
# List all aliases:
alias
Kali Linux:
nano ~/.zshrc
# Append the following text with personal commands. O.S. update in this case:
alias updateos='sudo -- sh -c "sudo apt update && sudo apt -y upgrade && sudo apt -y autoremove"'
# Load changes:
source ~/.zshrc
# List all aliases:
alias
sudo apt install -y chrony
# You can configure which time servers you want to use by editing
# nano /etc/chrony/chrony.conf
sudo systemctl enable --now chrony
sudo systemctl status chrony --no-pager
sudo timedatectl status
# System clock synchronized: yes
# NTP service: active
Set Keyboard layout
sudo dpkg-reconfigure keyboard-configuration
Disable Password prompt for sudo group
sudo sed -i.bak 's/%sudo\s\+ALL=(ALL:ALL) ALL/%sudo ALL=(ALL:ALL) NOPASSWD: ALL/' /etc/sudoers
Install packages (deb, etc)
sudo dpkg -i packname
First settings after O.S. install
passwd root
passwd kali
sudo apt install terminator -y
sudo update-alternatives --config x-terminal-emulator
# gsettings set org.gnome.desktop.default-applications.terminal exec 'terminator'
Set grub boot menu timeout
sudo nano /etc/default/grub
# Set the seconds in the GRUB_TIMEOUT value, save and exit the file
GRUB_TIMEOUT=1
sudo update-grub
# Reboot to test the timeout
# To instantly boot without the grub menu waiting, edit the file adding these lines:
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=0
Boot Partition Clean Up (Ubuntu/Debian)
# Check Current Kernel Version
sudo uname -r
# Example output: 5.4.0-64-generic
# As you see on image in my case β 5.4.0-64-generic is current kernel. Other older kernel versions can be deleted.
# List Old installed Kernel images:
sudo dpkg --list 'linux-image*'|awk '{ if ($1=="ii") print $2}'|grep -v `uname -r`
# Your output will something like:
linux-image-5.4.0-39-generic
linux-image-5.4.0-42-generic
linux-image-5.4.0-54-generic
linux-image-5.4.0-64-generic
# To cleanup boot partition in Ubuntu uninstall old kernels with apt command one by one:
sudo apt-get purge linux-image-5.4.0-39-generic
sudo apt-get purge linux-image-5.4.0-42-generic
sudo apt-get purge linux-image-5.4.0-54-generic
# Remove no longer used dependencies:
sudo apt-get autoremove
# Update GRUB:
sudo update-grub
Change Console setup
# For italian keyboard:
sudo dpkg-reconfigure console-setup
Disable Ubuntu automatic updates
sudo nano /etc/apt/apt.conf.d/20auto-upgrades
# make sure all the directives are set to β0β
sudo systemctl disable apt-daily-upgrade.timer
sudo systemctl mask apt-daily-upgrade.service
sudo systemctl disable apt-daily.timer
sudo systemctl mask apt-daily.service
# For complete package uninstall
sudo apt purge --auto-remove unattended-upgrades
# Start the Pc
# Press E in the grub menu
# Find the "linux /...vmlinuz" kernel line
# Add "init=/bin/bash" at the end of the line
# Press CTRL+X to boot.
# In root prompt, type
mount -o remount,rw /
# Set a new password for a user with
passwd user
# or for the root user with
passwd
# Reboot
reboot -f
# or
wget -qO - https://apt.packages.shiftkey.dev/gpg.key | gpg --dearmor | sudo tee /usr/share/keyrings/shiftkey-packages.gpg > /dev/null
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/shiftkey-packages.gpg] https://apt.packages.shiftkey.dev/ubuntu/ any main" > /etc/apt/sources.list.d/shiftkey-packages.list'
sudo apt update && sudo apt install github-desktop
Install Telegram
# Via apt
sudo apt install telegram-desktop
# Via official Linux binary
wget https://telegram.org/dl/desktop/linux
tar -xvf linux
sudo mv Telegram/ /opt
/opt/Telegram/./Telegram
/opt/Telegram/./Updater
Install Anydesk
# Run the following commands as root user:
# add repository key to Trusted software providers list
wget -qO - https://keys.anydesk.com/repos/DEB-GPG-KEY | apt-key add -
# add the repository:
sudo echo "deb http://deb.anydesk.com/ all main" > /etc/apt/sources.list.d/anydesk-stable.list
# update apt cache:
sudo apt update
# install anydesk:
sudo apt install -y anydesk
Install ForticlientVPN
sudo apt install firefox jq lz4json openfortivpn
cd
mkdir tools
cd ~/tools
git clone https://github.com/nonamed01/fuckForticlient.git
cd ~/tools/fuckForticlient
./fuckForticlient.sh -S <SERVER>:<PORT> -c
# Login via browser and retry the command above after logged in
Install DnsLeakTest
cd /tmp
wget https://raw.githubusercontent.com/macvk/dnsleaktest/master/dnsleaktest.py
chmod +x dnsleaktest.py
./dnsleaktest.py
Install Tor
sudo apt install -y tor
service tor start
service tor status
# Start browser with proxychain:
proxychains firefox www.duckduckgo.com
(do not close terminal)
# search for: check dns leaks
Install Anonsurf
cd /tmp
git clone https://github.com/Und3rf10w/kali-anonsurf
cd kali-anonsurf/
./installer.sh
clear
cd
anonsurf --help
anonsurf start
anonsurf myip
cd /opt/
# Get the latest version link from https://github.com/gophish/gophish/releases/
sudo wget https://github.com/gophish/gophish/releases/download/v0.12.1/gophish-v0.12.1-linux-64bit.zip
sudo unzip -d gophish gophish-v0.12.1-linux-64bit.zip
sudo chmod +x gophish/gophish
cd /opt/gophish && sudo ./gophish
docker run -it --rm --name rustscan rustscan/rustscan:2.1.1
# Create a zsh/bash alias like this
alias rustscan='docker run -it --rm --name rustscan rustscan/rustscan:2.1.1'
sudo apt install -y golang-go
go install github.com/projectdiscovery/cvemap/cmd/cvemap@latest
# Based on your SHELL, add Go bin to system PATH
echo "export PATH=$PATH:$HOME/go/bin" >> $HOME/.bashrc
echo "export PATH=$PATH:$HOME/go/bin" >> $HOME/.zshrc
echo "export PATH=$PATH:$HOME/go/bin" >> $ZSH_CUSTOM/my_paths.zsh
source $HOME/.bashrc
source $HOME/.zshrc
Usage and Configuration
SSH Login
sudo systemctl enable ssh --now
Configure Git for Github
git config --global user.email "YOUR_EMAIL@gmail.com"
git config --global user.name"YOUR_USERNAME"
ssh-keygen -t ed25519 -C "YOUR_EMAIL@gmail.com"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
xclip -selection clipboard < ~/.ssh/id_ed25519.pub
# Add a new key on github.com and paste the one copied with xclip.
# Test it:
ssh -T git@github.com
git clone git@github.com:syselement/REPOSITORY.git
Proxychains
#Edit proxychains:
nano /etc/proxychains.conf
# uncoment dynamic_chain
# coment strict_chain
# uncoment Proxy DNS requests-no leak for DNS data
# add on proxylist: socks5 127.0.0.1 9050
OpenVpn
# TryHackme OpenVpn Cypher(Temporary) error fix
sed -i 's/cipher AES-256-CBC/data-ciphers AES-256-CBC/' yournickname.ovpn
# or
sudo nano yournickname.ovpn
# Substitute line 14 "cipher AES-256-CBC" with:
data-ciphers AES-256-CBC
# Launch openvpn connection in background as a daemon
sudo openvpn --config yournickname.ovpn --daemon
# Stop it
sudo pkill -f openvpn
Global Socket allows two workstations on different private networks to communicate with each other. Through firewalls and through NAT - like there is no firewall.
#!/bin/bash
echo "[i] Updating and upgrading Kali (this will take a while)"
apt-get update
apt-get --yes --force-yes dist-upgrade
echo "[i] Installing Xfce4 & xrdp (this will take a while as well)"
apt-get --yes --force-yes install kali-desktop-xfce xorg xrdp
echo "[i] Configuring xrdp to listen to port 3390 (but not starting the service)"
sed -i 's/port=3389/port=3390/g' /etc/xrdp/xrdp.ini
Fix for Authentication Required to Create Managed Color Device, run
cat <<EOF | sudo tee /etc/polkit-1/localauthority/50-local.d/45-allow-colord.pkla
[Allow Colord all Users]
Identity=unix-user:*
Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile
ResultAny=no
ResultInactive=no
ResultActive=yes
EOF
sudo systemctl restart xrdp
Port to connect to is 3390
### TESTS - DO NOT CONSIDER ###
# sudo nano /etc/xrdp/startwm.sh
# # Add lines before test and execute
# unset DBUS_SESSION_BUS_ADDRESS
# unset XDG_RUNTIME_DIR
# . $HOME/.profile
# Backup VMs
sudo -s
# Now that the terminal is using root, run the virsh tool to create a backup of the VM definitions file.
echo '' > nameofvm.xml
virsh dumpxml nameofvm > /var/lib/libvirt/images/nameofvm.xml
# Use ls to find the name of the Qcow2 virtual hard drive in /var/lib/libvirt/images/. Copy the file name, and use mv to move it into a new sub-directory.
mkdir -p vm-backup
cd vm-backup
mv example.qcow2 vm-backup
mv nameofvm.xml vm-backup
# Using tar, create an archive of the VM disk and XML file.
tar jcvfp my-vm-backup.tar.bz2 vm-backup
mv my-vm-backup.tar.bz2 /home/username/
# Backing up VM disk images takes a long time. Depending on the file size, it could take an hour or more. Best to just let the PC do its thing. When the backup is complete, feel free to move my-vm-backup.tar.bz2 to another server, cloud backup and etc.
# Restoring backups
To restore a backup, youβll first need to extract it.
tar xvfp my-vm-backup.tar.bz2
cd vm-backup
# Use virsh to restore the XML file.
sudo -s
virsh define --file /home/username/location/of/exctracted/archive/vm-backup/nameofvm.xml
# Lastly, move the disk image to the images directory.
mv example.qcow2 /var/lib/libvirt/images/