Add convenience scripts

This commit is contained in:
Ibrahim Mkusa 2024-11-04 17:23:36 -05:00
parent 5f8bb74c48
commit 7c7bf53a8c
11 changed files with 659 additions and 1 deletions

18
bin/bin/add_swap.sh Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Author Ibrahim Mkusa
# About Creates or installs temporary swap space for machine
set -e
read -rp "Do you want to add or remove swapspace[add/remove]" response
if [[ "$response" == "add" ]]; then
sudo mkdir -p /var/cache/swap
sudo dd if=/dev/zero of=/var/cache/swap/swap0 bs=64M count=64
sudo chmod 0600 /var/cache/swap/swap0
sudo mkswap /var/cache/swap/swap0
sudo swapon /var/cache/swap/swap0
sudo swapon -s
elif [[ "$response" == "remove" ]]; then
sudo swapoff /var/cache/swap/swap0
sudo rm -rf /var/cache/swap/swap0
fi

44
bin/bin/air.sh Executable file
View File

@ -0,0 +1,44 @@
#!/usr/bin/env bash
# Author: Ibrahim Mkusa
# About: Higher interface to aircrack tools
set -e
usage () {
echo "(survey) air.sh [interface] [function]"
echo "(watch) air.sh [interface] [function] [bssid] [channel] [output_file]"
echo "(deauth) air.sh [interface] [function] [count] [bssid] [client]"
echo "(fakeauth) air.sh [interface] [function] [delay] [bmac] [hmac]"
echo "(arpreplay) air.sh [interface] [function] [bmac] [hmac]"
echo "(chopchop) air.sh [interface] [function] [bmac] [hmac] "
echo "(crack) air.sh [capfile] [wordlist]"
}
if [[ "$2" == "survey" ]];then
# Listen to everything
sudo airodump-ng "$1" --band abg
elif [[ "$2" == "watch" ]];then
# channel might be redundant if card locked to channel
echo "Watching $3 on channel $4 writing to $5"
sudo airodump-ng "$1" --bssid "$3" -c "$4" -w "$5"
elif [[ "$2" == "deauth" ]];then
if [[ $# -eq 4 ]];then
sudo aireplay-ng "$1" --deauth "$3" -a "$4"
else
sudo aireplay-ng "$1" --deauth "$3" -a "$4" -c "$5"
fi
elif [[ "$2" == "fakeauth" ]];then
echo "Don't proceed until authentication is successful"
sudo aireplay-ng "$1" -1 "$3" -b "$4" -h "$5"
elif [[ "$2" == "arpreplay" ]]; then
echo "Capturing arp replays and reinjecting"
sudo aireplay-ng "$1" -3 -b "$3" -h "$4"
elif [[ "$2" == "chopchop" ]];then
sudo aireplay-ng "$1" -4 -b "$3" -h"$4"
echo "Done .. use xor file to make arp replay"
echo "Follow directions here https://www.aircrack-ng.org/doku.php?id=korek_chopchop"
elif [[ "$2" == "crack" ]];then
sudo aircrack-ng "$1" -w "$2"
else
usage
fi

170
bin/bin/install_debian.sh Executable file
View File

@ -0,0 +1,170 @@
#!/usr/bin/env bash
#
# Author: Ibrahim Mkusa
# About: uhhhhh installs a bunch of stuff i use(used) on a desktop
set -e
cd ~ && echo "Changed directory $(whoami)'s home"
# Asks whether user is on an ubuntu or fedora distribution
read -rp "Are you on [ubuntu/fedora]" distro
if [[ "$distro" == "ubuntu" ]]; then
manager="apt"
vim="vim-nox"
# install build essential libs
sudo apt install -y build-essential cmake python3-dev
elif [[ "$distro" == "fedora" ]]; then
manager="dnf"
vim="vim-enhanced"
sudo dnf install -y make automake gcc gcc-c++ kernel-devel \
cmake python3-devel
else
echo "No distro-specified. Exiting.. "
exit 1
fi
# install core programs for use in both gnome or i3
sudo $manager install -y gparted git $vim keepassxc curl \
default-jdk default-jre maven perl \
emacs stterm vlc qbittorrent udiskie \
cmake xchm python3 \
doxygen gnome-tweaks ack zsh\
lxappearance i3-wm i3lock feh \
unclutter redshift-gtk shellcheck stow ranger \
scrot alsa-utils automake bash-completion bc bzip2 cppcheck pylint \
dconf-editor mplayer smplayer cmus weechat-curses \
mpd mpc ncmpcpp\
mutt notmuch-mutt arandr neomutt\
pavucontrol atool \
virt-manager lynx ufw x2goclient mosh \
htop conky-all compton \
silversearcher-ag golang \
zathura zathura-cb zathura-djvu zathura-ps \
ncdu \
caca-utils highlight w3m poppler-utils mediainfo \
xbacklight tmux \
volumeicon-alsa tree blueman \
direnv gimp clang clang-tidy \
glances uuid neofetch \
nodejs npm \
octave gedit-plugins calibre \
ruby-full ruby-dev zlib1g-dev multitail cowsay \
texstudio brightnessctl plocate postgresql texlive-latex-extra git-all\
asciinema texlive-fonts-extra latexmk\
texlive-lang-german znc \
ecryptfs-utils rbenv python3-pip fd-find \
vagrant rofi \
libcdk5-dev libcdk5nc6 libcdk5-doc ripgrep \
gnome-terminal polybar yacc \
powertop gnome-browser-connector
#haskell-platform
# snap stuff
# sudo snap install --beta nvim --classic
# better served by a case statement
if [[ "$distro" == "ubuntu" ]]; then
sudo $manager install -y python3-dev exuberant-ctags \
libclang-dev libboost-dev python3-venv libboost-all-dev \
libnode-dev texlive-fonts-recommended
elif [[ "$distro" == "fedora" ]]; then
sudo $manager install -y texlive-collection-fontsrecommended.noarch
fi
system="$(sudo dmidecode --string chassis-type)"
case $system in
Notebook | Laptop)
sudo $manager install -y tlp tlp-rdw
;;
esac
pia_url="https://installers.privateinternetaccess.com/download/pia-linux-3.3.1-06924.run"
read -rp "Install private internet access[yes/no]" response
if [[ "$response" == "yes" ]]; then
wget --show-progress $pia_url
chmod u+x "pia-linux-3.3.1-06924.run"
./pia-linux-3.3.1-06924.run
rm -f pia-linux-3.3.1-06924.run
fi
read -rp "Install openssh server?[yes/no]" response
if [[ "$response" == "yes" ]]; then
sudo $manager install -y openssh-server mosh ddclient
sudo ufw allow 22 # allow ssh port 22
sudo ufw allow 60000:61000/udp # allow mosh ports
sudo ufw allow 60000/udp # allow only 60000
# enable ufw
sudo systemctl start ufw && sudo systemctl enable ufw
sudo ufw enable
fi
read -p "Install Kernel dev tools?[yes/no]" response
if [[ "$response" == "yes" ]]; then
sudo $manager install -y vim libncurses5-dev gcc make git exuberant-ctags \
libssl-dev bison flex libelf-dev bc dwarves zstd git-email
fi
read -p "Install GTK+ tools?[yes/no]" response
if [[ "$response" == "yes" ]]; then
sudo $manager install -y libgtk-4-1 libgtk-4-dev gtk-4-examples
fi
cd ~
git clone https://github.com/jimeh/tmuxifier.git ~/.tmuxifier || true
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm || true
# prefix + capital I to install tmux plugins
# change shell
chsh -s /usr/bin/zsh
#sudo npm install -g typescript
#sudo snap install core; sudo snap refresh core
#read -p "Do you want to install certbot[yes/no]" response
#[[ "$response" == yes ]] && sudo snap install certbot
#sudo certbot renew --dry-run
# stow files
#rm -rf ~/.bashrc ~/.bash_profile
cd ~/dotfiles
stow bash bin docs git i3 ranger shellenv ssh tmux vim\
zsh || true
# install fonts
cd fonts/powerline
chmod u+x install.sh # if not already
./install.sh
cd ~
#setup node version manager to track|install uptodate versions of node
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
# setup poetry python version manager
curl -sSL https://install.python-poetry.org | python3 -
# vim "best darn editor in the world""
vim +PlugInstall +qall
read -rp "Install steam[yes/no]" response
if [[ "$response" == "yes" ]]; then
sudo $manager install -y steam
fi
# install pentest tools
read -rp "Install pentest tools[yes/no]" response
if [[ "$response" == "yes" ]]; then
sudo $manager install -y nmap arp-scan steghide binwalk hcxtools \
hashcat
fi
#source "$HOME/.bashrc"
echo -n "Install anaconda version 2.7, and a 3.5 env"
echo -n "packages rasterio tqdm opencv keras tensorflow fiona"
echo -n "Continue?[yes]"
echo -n "gem install jekyll bundler"

11
bin/bin/install_rhel.sh Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -e
sudo dnf install -y syncthing git-core vim-enhanced keepassxc stow container-tools
sudo dnf group install "Virtualization Host"
# setup syncthing
sudo systemctl start syncthing@$USER
sudo systemctl enable syncthing@$USER

18
bin/bin/install_terraform.sh Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
# instructions taken from terraform.io
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common
wget -O- https://apt.releases.hashicorp.com/gpg | \
gpg --dearmor | \
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null
gpg --no-default-keyring \
--keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg \
--fingerprint
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \
https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \
sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update
sudo apt-get install terraform
terraform -install-autocomplete

13
bin/bin/install_yaourt.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
#
set -e #subshell, so it doesn't mess with my current shell
cd ~
git clone https://aur.archlinux.org/package-query.git
cd package-query
makepkg -si
cd ..
git clone https://aur.archlinux.org/yaourt.git
cd yaourt
makepkg -si
cd ..

10
bin/bin/jumpbox.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
# add the following to a lingering users crontab
# Creates reverse ssh connection on public server
# Makes services running on server available locally (TheLounge)
# Kinda redundant nowadays due to tails, openvpn. You never know tho
# PS: the usernames and hosts don't actually exist :)
ssh -fN -R "3022:localhost:22" kijana@kwendasalama.org
ssh -fN -R "4022:localhost:22" mzee@kwendasalama.org
ssh -L "127.0.0.1:9000:127.0.0.1:9000" kijana@kwendasalama.org
echo "reverse ports created $(date)" >> error.log

33
bin/bin/monitor.sh Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
# Author: Ibrahim Mkusa
# About: Places card into monitor mode and changes mac addresses
set -e
usage () {
echo "monitor.sh [card] [up/down] [channel]"
}
if [[ "$2" == "up" ]];then
# kill all interfering processes
sudo airmon-ng check kill
# start card in monitor mode optionally locked to channel
sudo airmon-ng start "$1" "$3"
# change mac address
sudo ifconfig "$1mon" down
sudo macchanger -A "$1mon"
sudo ifconfig "$1mon" up
iwconfig
sudo macchanger --show "$1mon"
elif [[ "$2" == "down" ]];then
sudo airmon-ng stop "$1"
sudo systemctl restart NetworkManager.service || true
sudo systemctl restart wpa_supplicant.service || true
nmcli networking on || true
iwconfig
else
usage
fi

204
bin/bin/setup_archlinux.sh Executable file
View File

@ -0,0 +1,204 @@
#!/usr/bin/env bash
#
# Author: Ibrahim Mkusa
# About: setup archlinux
set -e
chmod u+x ~/dotfiles/bin/bin/install_yaourt.sh
~/dotfiles/bin/bin/install_yaourt.sh
sudo yaourt -S --needed --noconfirm gvim emacs geany atom\
libreoffice-fresh\
the_silver_searcher ripgrep \
mpv mpd cmus ncmpcpp vlc pianobar rhythmbox audacity mplayer smplayer\
zsh fish\
ranger tree rsync lftp udiskie ncdu os-prober veracrypt\
zathura zathura-cb zathura-djvu zathura-pdf-poppler zathura-ps\
calibre vimpager freemind labyrinth xournal\
firefox youtube-dl wireshark-gtk wget curl nmap httpie thefuck\
elinks links lynx w3m\
gcc go go-tools lua ruby ruby-docs valgrind gdb make cmake\
htop glances polkit unclutter conky conky-manager cronie\
pavucontrol\
screenfetch dmidecode hwdetect hwinfo\
python python2 python2-requests python-pip python2-pip\
git tig\
weechat irssi hexchat bitlbee pidgin newsbeuter\
asciidoc markdown pandoc python-sphinx\
tmux
qbittorrent rtorrent transmission-gtk transmission-cli\
aria2\
zip unzip\
tlp tlp-rdw\
xchm \
keepassx2\
ack\
imagemagick gimp inkscape\
autocutsel\
ctags \
shellcheck\
rxvt-unicode\
mutt notmuch notmuch-vim notmuch-mutt thunderbird\
xclip\
hamster-time-tracker task units arduino\
scrot\
alsa-utils\
bash-completion\
racket\
xorg-server xorg-apps xorg-xinit xorg-xclock\
xorg-xbacklight arandr\
xf86-video-intel\
rofi feh sxiv dmenu compton dunst volumeicon ntfs-3g redshift xautolock\
xmonad xmonad-contrib xmobar xterm stalonetray xcompmgr\
recordmydesktop gtk-recordmydesktop\
docker\
networkmanager network-manager-applet networkmanager-openvpn\
gnome gnome-extra gthumb nautilus-open-terminal gedit-plugins\
gparted lxappearance numix-gtk-theme arc-gtk-theme arc-icon-theme\
ghc cabal-install haskell-haddock-api haskell-haddock-library happy alex\
alsa-utils pulseaudio xf86-input-synaptics\
texlive-core texlive-fontsextra texlive-latexextra texstudio steam\
adobe-source-code-pro-fonts adobe-source-sans-pro-fonts\
adobe-source-serif-pro-fonts\
virtualbox linux-lts-headers virtualbox-guest-iso\
lxde virt-manager direnv boost rust octave doxygen x2goclient
# setup ssh
echo -n "Install openssh server?[yes/no]"
read response
if [[ "$response" == "yes" ]]; then
yaourt -S openssh ddclient sshfs mosh fail2ban ufw x2goserver
# server setup
sudo systemctl enable sshd.service
sudo systemctl enable ddclient.service
# server stuff
sudo ufw allow 22 # allow ssh port 22
sudo ufw allow 60000:61000/udp # allow mosh ports
sudo ufw allow 60000/udp # allow only 60000
# start x2go
x2godbadmin --createdb
sudo systemctl enable x2goserver.service
fi
# virtualbox virtualbox-ext-pack
cd ~
git clone https://github.com/jimeh/tmuxifier.git ~/.tmuxifier || true
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm || true
# stow files
rm -rf ~/.bashrc
cd ~/dotfiles
stow bash bin docs git i3 newsbeuter ranger shellenv ssh tmux vim\
zsh
cd -
vim
echo -n "Install i3-gaps[yes/no]?"
read -r response
if [[ "$response" == "yes" ]]; then
yaourt -S i3-gaps polybar
fi
echo -n "Install xfce stuff[yes/no]?"
read -r response
if [[ "$response" == "yes" ]]; then
yaourt -S xfce4 xfce4-goodies
fi
echo -n "Install nodejs[yes/no]?"
read -r response
if [[ "$response" == "yes" ]]; then
yaourt -S nodejs npm
yaourt -S nvm
fi
echo -n "Install cuda[yes/no]?"
read -r response
if [[ "$response" == "yes" ]]; then
# /opt/cuda/{bin, samples, doc}
yaourt -S --noconfirm nvidia-lts nvidia-settings cuda cudnn freeglut
fi
echo -n "Install Google chrome[yes/no]?"
read -r response
if [[ "$response" == "yes" ]]; then
yaourt -S --noconfirm google-chrome
fi
yaourt -S --needed dropbox
## install the stable lts kernel
yaourt -S linux-lts
# remove the standard linux kernel
yaourt -R linux
# should be populated with the -lts kernel
ls -lsha /boot
# back up old grub.cfg
sudo os-prober
sudo cp /boot/grub/grub.cfg /boot/grub/grub.cfg.bak
# generate new grub.cfg
sudo grub-mkconfig -o /boot/grub/grub.cfg
sudo systemctl enable gdm.service
sudo systemctl enable cronie.service
chmod u+x ~/dotfiles/bin/bin/setup_networkmanager.sh
~/dotfiles/bin/bin/setup_networkmanager.sh
#./pia-nm.sh
echo -n "Setup tlp /etc/default/tlp"
echo -n "continue?[yes]"
read response
echo -n "Change gterminal's [1]menubar [2]fonts [3]colorscheme [4]settings"
echo -n "Continue?[yes]"
read response
source ~/.bashrc
echo -n "Setup gtk-chtheme, gnome-tweak-tool, lxapperance, and qtconfig"
echo -n "Continue?[yes]"
read response
echo -n "Install shell extensions from box/internet/gnomeshellextensions list"
echo -n "Continue?[yes]"
read response
echo -n "Setup ddclient only if on server"
echo -n "Continue?[yes]"
read response
echo -n "Log into dropbox, firefox sync, chrome sync, reddit, steam"
echo -n "Continue?[yes]"
read response
echo -n "Set desktop background"
echo -n "Continue?[yes]"
read response
echo -n "Portforward ssh 22, and for mosh udp 60000-60001"
echo -n "Continue?[yes]"
read response
echo -n "Install anaconda version 2.7, and a 3.5 env"
echo -n "packages rasterio tqdm opencv keras tensorflow fiona"
echo -n "Continue?[yes]"
read response
chsh -s /usr/bin/zsh
# pip stuff
# after enabling multilib
sudo vim /etc/pacman.conf
yaourt -Syu
echo -n "Install steam[yes/no]?"
read -r response
if [[ "$response" == "yes" ]]; then
yaourt -S steam
fi
# Nvidia drivers are pain. I only buy amdgpus
#yaourt -Syu && yaourt -S steam lib32-nvidia-utils
#yaourt -S --needed wine winetricks mono lib32-alsa-lib lib32-alsa-plugins lib32-libxml2\
#lib32-mpg123 lib32-lcms2 lib32-giflib lib32-libpng lib32-gnutls\
#lib32-libpulse

138
bin/bin/setup_fedora_28.sh Executable file
View File

@ -0,0 +1,138 @@
#!/usr/bin/env bash
#
# Author: Ibrahim Mkusa
# About: setup fedora 28
set -e
read -p 'Rpmfusion installed?[y/n]' response
if [[ "$response" == "n" ]]; then
exit
fi
sudo dnf upgrade -y
# install core programs
# python python3 zip unzip
sudo dnf install -y gcc gcc-c++ gparted git vim-enhanced keepassx \
haskell-platform java-1.8.0-openjdk-devel maven perl-core\
rust cargo rustfmt kernel-devel\
emacs rxvt-unicode-256color vlc qbittorrent udiskie \
cmake xchm python-devel python3-devel\
doxygen gnome-tweaks ack ctags zsh\
lxappearance i3 i3lock feh \
unclutter redshift-gtk polkit curl ShellCheck stow xclip ranger \
scrot alsa-utils automake bash-completion bc bzip2 cppcheck pylint\
dconf-editor mplayer smplayer cmus cava weechat \
mpd mpc ncmpcpp\
mutt notmuch-mutt arandr \
pavucontrol atool\
virt-manager lynx ufw ddclient x2goclient mosh\
htop conky compton \
golang the_silver_searcher\
zathura zathura-plugins-all \
ncdu gnome-shell-extension-pomodoro chrome-gnome-shell\
caca-utils highlight atool w3m poppler-utils mediainfo\
xbacklight tmux task\
volumeicon tree blueman\
direnv gimp clang clang-devel boost-devel\
glances uuid screenfetch \
nodejs npm nautilus-dropbox haskell-platform\
texstudio octave gedit-plugins calibre\
ruby ruby-devel multitail cowsay kodi fzf
echo -n "Install i3-gaps[yes/no]?"
read -r response
if [[ "$response" == "yes" ]]; then
sudo dnf copr enable gregw/i3desktop -y
sudo dnf install -y i3-gaps rofi polybar
fi
echo -n "Install tlp stuff[yes/no]?"
read -r response
if [[ "$response" == "yes" ]]; then
sudo dnf install -y tlp tlp-rdw
fi
echo -n "Install pia[yes/no]?"
read -r response
if [[ "$response" == "yes" ]]; then
chmod u+x ~/dotfiles/bin/bin/pia-nm.sh
~/dotfiles/bin/bin/pia-nm.sh
fi
echo -n "Install openssh server?[yes/no]"
read response
if [[ "$response" == "yes" ]]; then
sudo dnf install -y openssh-server mosh
sudo ufw allow 22 # allow ssh port 22
sudo ufw allow 60000:61000/udp # allow mosh ports
sudo ufw allow 60000/udp # allow only 60000
fi
cd ~
git clone https://github.com/jimeh/tmuxifier.git ~/.tmuxifier || true
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm || true
# change shell
chsh -s /usr/bin/zsh
#sudo npm install -g typescript
# stow files
rm -rf ~/.bashrc ~/.bash_profile
cd ~/dotfiles
stow bash bin docs git i3 ranger shellenv ssh tmux vim\
zsh
cd -
vim +PlugInstall +qall
echo -n "Install steam[yes/no]?"
read -r response
if [[ "$response" == "yes" ]]; then
sudo dnf install -y steam
fi
echo -n "Setup tlp /etc/default/tlp"
echo -n "continue?[yes]"
read response
echo -n "Change gterminal's [1]menubar [2]fonts [3]colorscheme [4]settings scrollbar"
echo -n "Continue?[yes]"
read response
source ~/.bashrc
echo -n "Setup gtk-chtheme, gnome-tweak-tool, lxapperance, and qtconfig"
echo -n "Continue?[yes]"
read response
echo -n "Install shell extensions caffeine, dashtodock, pomodoro "
echo -n "openweather, refreshwificonns, removDrivMenu, soundinoutchoo "
echo -n "Continue?[yes]"
read response
echo -n "Setup ddclient only if on server"
echo -n "Continue?[yes]"
read response
echo -n "Log into dropbox, firefox sync, chrome sync, reddit, steam"
echo -n "Continue?[yes]"
read response
echo -n "Set desktop background"
echo -n "Continue?[yes]"
read response
echo -n "Portforward ssh 22, and for mosh udp 60000-60001"
echo -n "Continue?[yes]"
read response
echo -n "Install anaconda version 2.7, and a 3.5 env"
echo -n "packages rasterio tqdm opencv keras tensorflow fiona"
echo -n "Continue?[yes]"
read response

View File

@ -50,7 +50,6 @@ elif [[ wipe = "$1" ]]; then
elif [[ "$1" = "help" ]]; then
usage
fi