Setup script optimized and updated, etc

This commit is contained in:
Dionysus 2024-07-14 00:54:37 -04:00
parent 3004c43626
commit 0d03ad1f72
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE
11 changed files with 94 additions and 196 deletions

View File

@ -34,6 +34,7 @@ alias ..="cd ../"
alias dropkey="dropbearkey -y -f .dropbear/key | head -n 2 | tail -n 1"
alias dump='setterm -dump 1 -file screen.dump'
alias newnym='echo -e "AUTHENTICATE \"CHANGEME\"\r\nSIGNAL NEWNYM\r\nQUIT" | nc 127.0.0.1 9051'
alias mdcat='glow'
alias mkgz='tar -cvzf'
alias myip='curl 4.icanhazip.com && curl 6.icanhazip.com'
alias pubkey='ssh-keygen -y -f ~/.ssh/key'
@ -49,3 +50,4 @@ alias irc2ansi='python3 ~/.scripts/irc2ansi.py'
alias mutag='~/.scripts/mutag'
alias pass='~/.scripts/pass'
alias shotz='~/.scripts/shotz'
alias todo='~/.scripts/todo'

View File

@ -14,29 +14,19 @@ color() {
done
}
ctainr() {
cctain() {
NAME=$1
lxc storage create $NAME-pool dir #Add "source=/path/to/storage" to use a different directory
lxc launch images:debian/12 $NAME-container -s $NAME-pool
incus storage create $NAME-pool dir
incus launch images:debian/12 $NAME-container -s $NAME-pool
incus config set $NAME-container boot.autostart true
sleep 10 # Delay to allow the container to start and get an IP address from the DHCP server
CONTAINER_IP=$(lxc list | grep $NAME-container | awk '{print $6}')
lxc config device override $NAME-container eth0
lxc config device set $NAME-container eth0 ipv4.address $CONTAINER_IP
lxc config set $NAME-container boot.autostart true
lxc exec $NAME-container -- apt update -y
lxc exec $NAME-container -- apt upgrade -y
lxc exec $NAME-container -- apt install unattended-upgrades -y
lxc exec $NAME-container -- useradd -m -s /bin/bash agent
lxc exec $NAME-container -- journalctl --vacuum-time=1d
lxc exec $NAME-container -- sh -c 'printf "[Journal]\nStorage=volatile\nSplitMode=none\nRuntimeMaxUse=500K\n" > /etc/systemd/journald.conf'
lxc exec $NAME-container -- systemctl restart systemd-journald
echo "The $NAME container has been created and is available at $CONTAINER_IP"
echo ""
echo "Forward ports to the container using the following command:"
echo " lxc config device add $NAME-container $NAME-PORT_NAME proxy listen=tcp:[0.0.0.0]:HOST_PORT connect=tcp:[$CONTAINER_IP]:CONTAINER_PORT"
echo ""
echo "Tap in to your container with the following command:"
echo " lxc exec $NAME-container -- bash"
incus exec $NAME-container -- apt update -y
incus exec $NAME-container -- apt upgrade -y
incus exec $NAME-container -- apt install -y git nano unattended-upgrades wget
incus exec $NAME-container -- useradd -m -s /bin/bash agent
incus exec $NAME-container -- journalctl --vacuum-time=1d
incus exec $NAME-container -- sh -c 'printf "[Journal]\nStorage=volatile\nSplitMode=none\nRuntimeMaxUse=500K" > /etc/systemd/journald.conf'
incus exec $NAME-container -- systemctl restart systemd-journald
}
extract() {
@ -65,39 +55,17 @@ extract() {
fi
}
gcp() {
git add .
git commit -S -m "$*"
git push
}
hf() {
curl -F file=@$1 https://hardfiles.org/ # yeah thats right motherfucker, real bay shit, for real bay motherfuckers.
}
iso2usb() {
flash() {
sudo dd bs=4M if=$1 of=$2 status=progress
sudo /bin/sync
}
keys() {
echo "Ctrl + a move to the beginning of line."
echo "Ctrl + d if you've type something, Ctrl + d deletes the character under the cursor, else, it escapes the current shell."
echo "Ctrl + e move to the end of line."
echo "Ctrl + k delete all text from the cursor to the end of line."
echo "Ctrl + l CLEAR"
echo "Ctrl + n DOWN"
echo "Ctrl + p UP"
echo "Ctrl + q to resume output to terminal after Ctrl + s."
echo "Ctrl + r begins a backward search through command history.(keep pressing Ctrl + r to move backward)"
echo "Ctrl + s to stop output to terminal."
echo "Ctrl + t transpose the character before the cursor with the one under the cursor, press Esc + t to transposes the two words before the cursor."
echo "Ctrl + u cut the line before the cursor; then Ctrl + y paste it"
echo "Ctrl + w cut the word before the cursor; then Ctrl + y paste it"
echo "Ctrl + x + backspace delete all text from the beginning of line to the cursor."
echo "Ctrl + x + Ctrl + e launch editor defined by \$EDITOR to input your command. Useful for multi-line commands."
echo "Ctrl + z stop current running process and keep it in background. You can use \`fg\` to continue the process in the foreground, or \`bg\` to continue the process in the background."
echo "Ctrl + _ UNDO"
gcp() {
git add . && git commit -S -m "$*" && git push
}
hf() {
curl -F file=@$1 https://hardfiles.org/ # yeah thats right motherfucker, real bay shit, for real bay motherfuckers.
}
mntusb() {
@ -131,15 +99,7 @@ backup() {
done
}
title() {
echo -ne "\033]0;$1\007"
}
updater() {
xbps-install -Su
xbps-install -u xbps
xbps-install -Su
vkpurge rm all
pdtm -ua
}
# Legacy comand for setting terminal titles in tabbed, might play with this ANSI escape later...
#title() {
# echo -ne "\033]0;$1\007"
#}

View File

@ -54,6 +54,6 @@ crtsh() {
curl -s "https://crt.sh/?q=$1&output=json" | jq -r '.[].name_value' | sort | uniq
}
shidb() {
shodan() {
curl https://internetdb.shodan.io/$1
}

View File

@ -15,7 +15,7 @@ static const int resizehints = 0;
static const int lockfullscreen = 1;
static const Layout layouts[] = { { "", tile } };
static const Rule rules[] = { { NULL, NULL, NULL, 0, False, -1 } };
static const char *tags[] = { "chat", "dev", "irc", "recon", "supernets", "work", "www", "other" };
static const char *tags[] = { "chat", "dev", "irc", "recon", "supernets", "work", "www", "media", "other" };
static const char *fonts[] = { "Misc Ohsnap.Icons:style=Regular:size=11" };
static const char dmenufont[] = "Misc Ohsnap.Icons:style=Regular:size=11";
static const char *colors[][3] = {
@ -59,7 +59,7 @@ static Key keys[] = {
{ 0, XF86AudioPlay, spawn, {.v = music_toggle } },
{ 0, XF86MonBrightnessDown, spawn, {.v = backlight_down } },
{ 0, XF86MonBrightnessUp, spawn, {.v = backlight_up } },
{ 0, XK_Print, spawn, SHCMD("~/.scripts/shot.sh") },
{ 0, XK_Print, spawn, SHCMD("~/.scripts/shotz -u") },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)

View File

@ -75,6 +75,7 @@ setup_chroot() {
passwd
xbps-install -Suy
xbps-install -y void-repo-nonfree
xbps-install -Suy
xbps-install -y intel-ucode

View File

@ -1,5 +1,5 @@
#!/bin/sh
while true; do
xsetroot -name "$(date '+%I:%M @ %m/%')"
xsetroot -name "$(date '+%I:%M @ %m/%d')"
sleep 60
done

View File

@ -1,47 +0,0 @@
#!/bin/sh
# Thin Client Void Linux Setup - Developed by acidvegas (https://git.acid.vegas/void)
GIT_URL="https://raw.githubusercontent.com/acidvegas/void/master"
passwd && sv stop sshd && xbps-remove openssh
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
xbps-install -y dropbear oath-toolkit rsync socklog-void tmux tor tree wget
ln -sfv /etc/sv/nanoklogd /var/service
ln -sfv /etc/sv/socklog-unix /var/service
touch /swapfile && dd if=/dev/zero of=/swapfile bs=1M count=2k status=progress && chmod 0600 /swapfile && mkswap /swapfile && swapon /swapfile
{
echo "/dev/mmcblk0p1 /boot vfat ro,noatime,nodev,noexec,nosuid 0 2"
echo "/dev/mmcblk0p2 / ext4 rw,noatime 0 1"
echo "tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0"
echo "proc /proc proc defaults,hidepid=2 0 0"
echo "/swapfile none swap sw 0 0"
} > /etc/fstab
printf "\nnohook resolv.conf\n" >> /etc/dhcpcd.conf && sv restart dhcpcd
printf "nameserver 9.9.9.9\nnameserver 149.112.112.112\nnameserver 2620:fe::fe\nnameserver 2620:fe::9" > /etc/resolv.conf && chattr +i /etc/resolv.conf
printf "skinny-mon\n" > /etc/hostname
printf "HOSTNAME=\"skinny-mon\"\nHARDWARECLOCK=\"UTC\"\nTIMEZONE=\"America/New_York\"\nKEYMAP=us\n" > /etc/rc.conf
printf "set boldtext\nset minibar\nset nohelp\nset nowrap\nset quickblank\nset tabsize 4\nunbind ^J main\nset selectedcolor black,red\ninclude \"/usr/share/nano/*.nanorc\"\n" > /etc/nanorc
printf "\nexport HISTFILE=/dev/null\nexport LESSHISTFILE=/dev/null\n" >> /etc/profile
printf '#!/bin/sh\nexec 2>&1\n[ -r conf ] && . ./conf\nexec dropbear -p CHANGE:ME -w -s -R -F\n' > /etc/sv/dropbear/run && chattr +i /etc/sv/dropbear/run && ln -sfv /etc/sv/dropbear /var/service
wget -O $HOME/pmf $GIT_URL/scripts/pmf && chmod +x $HOME/pmf
wget -O $HOME/.bashrc $GIT_URL/bash/.bash_thin
useradd -m -s /bin/bash acidvegas && passwd acidvegas
wget -O $HOME/.tmux.conf $GIT_URL/tmux/.tmux.conf
wget -O $HOME/.bashrc $GIT_URL/bash/.bash_thin
mkdir $HOME/.gnupg && wget -O $HOME/.gnupg/gpg.conf $GIT_URL/gpg/gpg.conf && chmod 700 $HOME/.gnupg
printf "pinentry-program /usr/bin/pinentry-curses\ndefault-cache-ttl 3600" > $HOME/.gnupg/gpg-agent.conf
chmod 600 $HOME/.gnupg/*
mkdir $HOME/.scripts
wget -O $HOME/.scripts/dmc $GIT_URL/scripts/dmc && chmod +x $HOME/.scripts/dmc
wget -O $HOME/.scripts/pass https://raw.githubusercontent.com/acidvegas/pass/master/pass && chmod +x $HOME/.scripts/pass

View File

@ -1,46 +0,0 @@
#!/bin/sh
# TMUX Launcher - Developed by acidvegas (https://git.acid.vegas/void)
start_wildwest() {
SESSION="WILDWEST"
tmux new-session -d -s $SESSION -n PI
tmux new-window -t $SESSION -n POWEREDGE
tmux split-window -h -t $SESSION:POWEREDGE
tmux split-window -v -t $SESSION:POWEREDGE.0
tmux split-window -v -t $SESSION:POWEREDGE.2
tmux send-keys -t $SESSION:POWEREDGE.0 "dbc r320-1" C-m
tmux send-keys -t $SESSION:POWEREDGE.1 "dbc r320-2" C-m
tmux send-keys -t $SESSION:POWEREDGE.2 "dbc r430" C-m
tmux send-keys -t $SESSION:POWEREDGE.3 "dbc r620" C-m
tmux select-layout -t $SESSION:POWEREDGE tiled
tmux set-window-option -t $SESSION:POWEREDGE synchronize-panes on
tmux new-window -t $SESSION -n TUNNEL
tmux send-keys -t $SESSION:TUNNEL "dbc tunnel" C-m
tmux attach-session -t $SESSION
}
start_supernets() {
SESSION="SUPERNETS"
tmux new-session -d -s $SESSION -n HUB
tmux new-window -t $SESSION -n WILDWEST
tmux new-window -t $SESSION -n NODES
tmux split-window -h -t $SESSION:NODES
tmux split-window -v -t $SESSION:NODES.0
tmux split-window -v -t $SESSION:NODES.2
tmux send-keys -t $SESSION:NODES.0 "dbc super-lux" C-m
tmux send-keys -t $SESSION:NODES.1 "dbc super-miami" C-m
tmux send-keys -t $SESSION:NODES.2 "dbc super-zooyork" C-m
tmux send-keys -t $SESSION:NODES.3 "dbc super-vegas" C-m
tmux select-layout -t $SESSION:NODES tiled
tmux set-window-option -t $SESSION:NODES synchronize-panes on
}
start_recon() {
SESSION="RECON"
tmux new-session -d -s $SESSION -n scan
tmux new-window -t $SESSION -n box2
tmux new-window -t $SESSION -n box3
tmux new-window -t $SESSION -n box4
tmux new-window -t $SESSION -n box5
tmux attach-session -t $SESSION
}

95
setup
View File

@ -6,10 +6,10 @@
set -xev
# Configuration
CPU=intel # amd or intel
CPU=intel # amd or intel (blank for none)
DISPLAY_SERVER=xorg # xorg or blank for none
GFX_DRIVER=intel # amd or intel (leave blank for none)
REMOTE_PORT=2023 # CHANGE THIS
GFX_DRIVER=intel # amd, intel, or nvidia (blank for none)
ARCH=x86_64 # x86_64 or x86_64-musl
GIT_URL="https://raw.githubusercontent.com/acidvegas/void/master"
@ -17,13 +17,14 @@ setup_root() {
setup_packages
useradd -m -s /bin/bash acidvegas && gpasswd -a acidvegas wheel && passwd acidvegas
gpasswd -a acidvegas _incus && gpasswd -a acidvegas _incus-admin # Typically incus & incus-admin but void uses the underscore prefix
wget -O /usr/share/kbd/consolefonts/ohsnap6x11r.psfu $GIT_URL/font/ohsnap6x11r.psfu
wget -O /usr/share/kbd/consolefonts/ohsnap7x12r.psfu $GIT_URL/font/ohsnap7x12r.psfu
wget -O /usr/share/kbd/consolefonts/ohsnap7x14r.psfu $GIT_URL/font/ohsnap7x14r.psfu
for item in 6x11 7x12 7x14; do
wget -O /usr/share/kbd/consolefonts/ohsnap${item}r.psfu $GIT_URL/font/ohsnap${item}r.psfu
done
printf "\nnohook resolv.conf\n" >> /etc/dhcpcd.conf
printf "\nipv4only\nnodhcp6\n" >> /etc/dhcpcd.conf # For fixing "dhcpcd: ipv6nd_sendadvertisement: Operation not permitted" error
#printf "\nipv4only\nnodhcp6\n" >> /etc/dhcpcd.conf # For fixing "dhcpcd: ipv6nd_sendadvertisement: Operation not permitted" error
printf "nameserver 9.9.9.9\nnameserver149.112.112.112\nnameserver 2620:fe::fe\nnameserver 2620:fe::9" > /etc/resolv.conf
echo "proc /proc proc defaults,hidepid=2 0 0" >> /etc/fstab && mount -o remount /proc
printf "set boldtext\nset minibar\nset nohelp\nset nowrap\nset quickblank\nset tabsize 4\nunbind ^J main\nset selectedcolor black,red\ninclude \"/usr/share/nano/*.nanorc\"\n" > /etc/nanorc
printf "\nexport HISTFILE=/dev/null\nexport LESSHISTFILE=/dev/null\nexport PYTHONHISTFILE=/dev/null\n" >> /etc/profile
@ -33,48 +34,73 @@ setup_root() {
printf "\n\033[1m \033[32m\"Bee\" careful \033[34m__\n \033[32mwith sudo! \033[34m// \ \n \\\\\\_/ \033[33m//\n \033[35m''-.._.-''-.._.. \033[33m-(||)(')\n '''\033[0m\n" > /etc/sudoers.d/sudoers.lecture
printf '#!/bin/sh\nexec 2>&1\n[ -r conf ] && . ./conf\nexec dropbear -p CHANGE:ME -w -s -R -F\n' > /etc/sv/dropbear/run
printf "\nhsts=0\n" >> /etc/wgetrc
ln -sfv /etc/sv/lxd /var/service
ln -sfv /etc/sv/socklog-unix /var/service
ln -sfv /etc/sv/nanoklogd /var/service
ln -sfv /etc/sv/dropbear /var/service
for item in dhcpcd dropbear incus incus-user socklog-unix nanoklogd wpa_supplicant; do
ln -sfv /etc/sv/$item /var/service # Use /etc/runit/runsvdir/default/ instead of /var/service if in a chroot environemnt
done
}
setup_packages() {
setup_nonfree() {
xbps-install -Suy void-repo-nonfree
# Might need to `xbps-recorder -f` after this
if [ $CPU = "intel" ]; then
xbps-install -y intel-ucode
xbps-reconfigure -f $(xbps-query -s linux | grep pkgver | cut -d " " -f 2) # Must regenerate initramfs (This is broken right now)
xbps-install -y intel-ucode linux-firmware-intel
elif [ $CPU = "amd" ]; then
xbps-install -y linux-firmware-amd
fi
if [ $DISPLAY_SERVER = "xorg" ]; then
if [ $GFX_DRIVER = "intel" ]; then
xbps-install -y linux-firmware-intel mesa-dri vulkan-loader mesa-vulkan-intel intel-video-accel
xbps-install -y mesa-dri vulkan-loader mesa-vulkan-intel intel-video-accel
elif [ $GFX_DRIVER = "amd" ]; then
xbps-install -y mesa-dri vulkan-loader mesa-vulkan-radeon radeon-video-accel # Un-tested
elif [ $GFX_DRIVER = "nvidia" ]; then
xbps-install -y nvidia nvidia-libs nvidia-settings nvidia-xconfig # Un-tested
fi
xbps-install -y xorg libX11-devel libX11 libXft-devel libXft libXinerama-devel libXinerama libXrandr-devel libXrandr
xbps-install -y alacritty dmenu dunst firefox pinentry-dmenu redshift scrot Signal-Desktop unclutter xclip
xbps-install -y ohsnap-font font-unifont-bdf freefont-ttf noto-fonts-ttf noto-fonts-ttf-extra noto-fonts-cjk noto-fonts-emoji
xbps-install -y alsa-utils cmus ffmpeg id3v2 eyeD3 youtube-dl # Revamp audio setup at some point
xbps-install -y vscode
fi
xbps-install -y Signal-Desktop vscode # Optional
}
setup_packages() {
# Un-comment to enable non-free proprietary software to be installed
#setup_nonfree
if [ $DISPLAY_SERVER = "xorg" ]; then
xbps-install -y xorg libX11 libX11-devel libXft libXft-devel libXinerama libXinerama-devel libXrandr libXrandr-devel xbacklight xrandr
xbps-install -y alacritty dmenu dunst firefox pinentry-dmenu redshift scrot unclutter xclip
xbps-install -y ohsnap-font font-unifont-bdf freefont-ttf noto-fonts-ttf noto-fonts-ttf-extra noto-fonts-cjk noto-fonts-emoji # These fonts give you the most unicode support coverage
fi
# Development
xbps-install -y checkbashisms gcc go make patch pkg-config python3 python3-pip shellcheck
if [ ! $ARCH = 'x86_64' ]; then
xbps-install -y gcc
fi
xbps-install -y checkbashisms go make patch pkg-config python3 python3-pip
# Essentials
xbps-install -y curl dropbear git lxc lxd socklog-void tmux tor tree unzip zip
xbps-install -y bandwhich glow gnupg2-scdaemon lazygit oath-toolkit progress rsync tmate
xbps-install -y curl dropbear git jq progress rsync socklog-void tmux tor tree unzip zip
xbps-install -y bandwhich bpfmon glow gnupg2-scdaemon lxc incus incus-client incus-tools lazygit oath-toolkit
#xbps-install -y earlyoom && ln -sfv /etc/sv/earlyoom /var/service/
# Alternatives
xbps-install -y bat btop delta duf exa procs
# Fun
xbps-install -y asciiquarium cmatrix no-more-secrets tty-solitaire
# Audio
#xbps-install -y alsa-utils cmus ffmpeg id3v2 eyeD3 youtube-dl # Revamp audio setup at some point
# Recon
xbps-install -y bpfmon masscan termshark
#xbps-install -y aircrack-ng bettercap ettercap masscan tcpdump termshark wireshark
# Radio
#xbps-install -y airspy chirp CubicSDR gnuradio gqrx inspectrum librtlsdr rtl-sdr rx_tools SoapyRTLSDR SDRPlusPlus
}
@ -82,21 +108,20 @@ setup_configs() {
wget -O $HOME/.alacritty.toml $GIT_URL/alacritty/.alacritty.toml
wget -O $HOME/.tmux.conf $GIT_URL/tmux/.tmux.conf
wget -O $HOME/.bashrc $GIT_URL/bash/.bashrc
wget -O $HOME/.bash_aliases $GIT_URL/bash/.bash_aliases
wget -O $HOME/.bash_functions $GIT_URL/bash/.bash_functions
. $HOME/.bashrc # POSIX shell doesn't support source
for item in bashrc bash_aliases bash_functions; do
wget -O $HOME/.$item $GIT_URL/$item
done
#mkdir -p $HOME/.config/cmus && wget -O $HOME/.config/cmus/autosave $GIT_URL/cmus/autosave
#mkdir -p $HOME/.config/dunst && wget -O $HOME/.config/dunst/dunstrc $GIT_URL/dunst/dunstrc
mkdir -p $HOME/.config/cmus && wget -O $HOME/.config/cmus/autosave $GIT_URL/cmus/autosave
mkdir -p $HOME/.config/dunst && wget -O $HOME/.config/dunst/dunstrc $GIT_URL/dunst/dunstrc
wget -O $HOME/.gitconfig $GIT_URL/git/.gitconfig
mkdir $HOME/.gnupg && wget -O $HOME/.gnupg/gpg.conf $GIT_URL/gpg/gpg.conf
mkdir $HOME/.gnupg && wget -O $HOME/.gnupg/gpg.conf $GIT_URL/gpg/gpg.conf
printf "pinentry-program /usr/bin/pinentry-curses\ndefault-cache-ttl 3600" > $HOME/.gnupg/gpg-agent.conf
#printf "pinentry-program /usr/bin/pinentry-dmenu\ndefault-cache-ttl 3600" > $HOME/.gnupg/gpg-agent.conf
chmod 700 $HOME/.gnupg && chmod 600 $HOME/.gnupg/*
mkdir $HOME/.ssh && touch $HOME/.ssh/config && chown -R $USER $HOME/.ssh && chmod 700 $HOME/.ssh && chmod 600 $HOME/.ssh/config
wget -O $HOME/.xinitrc $GIT_URL/xorg/.xinitrc
mkdir $HOME/.scripts
@ -112,8 +137,6 @@ setup_fun() {
BUILD=$HOME/dev/build
mkdir -p $BUILD
sudo xbps-install -y asciiquarium cmatrix no-more-secrets tty-solitaire
wget -O $HOME/.scripts/irc2ansi.py https://github.com/internet-relay-chat/archive/blob/master/art/irc2ansi.py
wget -O $HOME/.scripts/bomber $GIT_URL/scripts/bomber && chmod +x $HOME/.scripts/bomber
wget -O $HOME/.scripts/pipes https://raw.githubusercontent.com/pipeseroni/pipes.sh/master/pipes.sh && chmod +x $HOME/.scripts/pipes

View File

@ -1,4 +1,6 @@
#!/bin/sh
# .xinitrc - developed by acidvegas (https://git.acid.vegas/void)
xset +fp /usr/share/fonts/local
xset fp rehash
@ -9,6 +11,9 @@ $HOME/.scripts/statusbar.sh &
# Example of dual monitor setup
#{ sleep 2; xrandr --output HDMI1 --mode 1920x1080 --output DP1 --mode 1920x1080 --above HDMI1; } &
redshift -P -O 3000 &
# Example rotation
#{ sleep 2; xrandr --output DSI-1 --rotate right; } &
redshift -P -O 4000 &
exec dwm