Dot Files

Published Nov 19, 2021

Contents

Introduction

The configs are intentionally simple. I usually try to use the default configurations as much as possible, so I can easily switch between different computers without spending time configuring each of them. Also, I'm not too fond of code or configuration that I don't understand. It might do magical things, but when things go awry, which they do, I need to be able to fix it.

install

#!/bin/bash

install_brew() {
  # xcode-select --install
  if ( ! command -v brew &> /dev/null ); then
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    echo 'export PATH=/opt/homebrew/bin:/opt/homebrew/sbin:~/go/bin:$PATH' > ~/.zshrc
    source ~/.zshrc
    brew analytics off && brew analytics state
    echo 'set tabstop=2 shiftwidth=2 expandtab list number autoindent wrap linebreak > ~/.vimrc'
  fi
  brew update
  brew upgrade
  brew install jq
  brew install go
  brew install git
  brew install php
  brew install nvm
  brew install deno
  brew install llvm
  brew install rust
  brew install ruby
  brew install grep
  brew install curl
  brew install wget
  brew install tmux
  brew install nmap
  brew install whois
  brew install netcat
  brew install awscli
  brew install openssl
  brew install --cask lulu
  brew install --cask google-chrome
  brew install --cask firefox
  brew install --cask tor-browser
  brew install --cask spotify
  brew install --cask telegram
  brew install --cask iterm2
  brew install --cask visual-studio-code
  brew install --cask postman
  brew install --cask docker
  brew install --cask mysqlworkbench
  brew install --cask pgadmin4
  brew install --cask mongodb-compass
  brew install --cask wireshark
  brew install --cask burp-suite
  brew install --cask ledger-live
  brew install --cask the-unarchiver
  brew install --cask vlc
  brew install --cask folx
}

install_apt() {
  # update
  sudo apt update && sudo apt upgrade -y

  # ufw
  sudo ufw disable

  # sshd
  sudo echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
  sudo systemctl restart sshd

  # fail2ban
  sudo apt install fail2ban -y
  sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
  sudo vi /etc/fail2ban/jail.local
  sudo systemctl restart fail2ban

  # unattended-upgrades
  sudo apt install unattended-upgrades -y
  sudo dpkg-reconfigure -plow unattended-upgrades
  sudo vi /etc/apt/apt.conf.d/50unattended-upgrades
  sudo vi /etc/apt/apt.conf.d/20auto-upgrades
  sudo systemctl restart unattended-upgrades
  sudo unattended-upgrades --dry-run

  # install packages
  sudo apt install -y jq
  sudo apt install -y git
  sudo apt install -y g++
  sudo apt install -y gcc
  sudo apt install -y make
  sudo apt install -y htop
  sudo apt install -y tmux
  sudo apt install -y whois
  sudo apt install -y awscli
  sudo apt install -y openvpn
  sudo apt install -y net-tools
  sudo apt install -y ruby-full
  sudo apt install -y python3-pip
  sudo apt install -y build-essential
  sudo apt install -y tor
  sudo apt install -y proxychains
  sudo apt install -y nmap
  sudo apt install -y masscan
  sudo apt install -y john
  sudo apt install -y hydra
  sudo apt install -y exploitdb

  # go
  wget https://go.dev/dl/go1.18.3.linux-amd64.tar.gz
  rm -rf /usr/local/go && tar -C /usr/local -xzf go1.18.3.linux-amd64.tar.gz

  # acme
  sudo apt install socat
  curl https://get.acme.sh | sh
  ~/.acme.sh/acme.sh --set-default-ca --server letsencrypt
  ~/.acme.sh/acme.sh --register-account -m xxxx@xxxx.com
  ~/.acme.sh/acme.sh --issue -d sub.domain.com --standalone

  # docker
  curl https://get.docker.com | sh
  sudo apt install docker-compose -y
  sudo systemctl restart docker

  # node.js
  curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
  nvm install 18
  npm install npm@latest -g
  npm install -g pm2 && pm2 startup

  # bash
  touch ~/.hushlogin
  echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bash_profile
  source ~/.bash_profile
}

install_anywhere() {
  rm -rf ~/tools && mkdir ~/tools && cd ~/tools
  sudo gem install wpscan
  go install github.com/ffuf/ffuf@latest
  go install github.com/tomnomnom/gf@latest
  go install github.com/tomnomnom/fff@latest
  go install github.com/tomnomnom/anew@latest
  go install github.com/lc/gau/v2/cmd/gau@latest
  go install github.com/projectdiscovery/dnsx/cmd/dnsx@latest
  go install github.com/projectdiscovery/httpx/cmd/httpx@latest
  go install github.com/projectdiscovery/nuclei/v2/cmd/nuclei@latest
  go install github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest
  go install github.com/projectdiscovery/interactsh/cmd/interactsh-client@latest
  go install github.com/KathanP19/Gxss@latest
  go install github.com/hahwul/dalfox/v2@latest
  go install github.com/dwisiswant0/crlfuzz/cmd/crlfuzz@latest
  git clone --depth 1 https://github.com/sqlmapproject/sqlmap sqlmap-dev && cd ~/tools
  git clone https://github.com/codingo/NoSQLMap && cd NoSQLMap && python3 setup.py install && cd ~/tools
  git clone https://github.com/Dionach/CMSmap && cd CMSmap && pip3 install . && cd ~/tools
  git clone https://github.com/Tuhinshubhra/CMSeeK && cd CMSeeK && pip3 install -r requirements.txt && cd ~/tools
  git clone https://github.com/obheda12/GitDorker && cd GitDorker && pip3 install -r requirements.txt && cd ~/tools
  git clone https://github.com/EnableSecurity/wafw00f && cd wafw00f && python3 setup.py install && cd ~/tools
  git clone https://github.com/s0md3v/Corsy && cd Corsy && pip3 install requests && cd ~/tools
  git clone https://github.com/s0md3v/Arjun && cd Arjun && python3 setup.py install && cd ~/tools
  git clone https://github.com/devanshbatham/ParamSpider && cd ParamSpider && pip3 install -r requirements.txt && cd ~/tools
  git clone https://github.com/devanshbatham/OpenRedireX
  git clone https://github.com/sullo/nikto
  git clone https://github.com/epinna/tplmap
  git clone https://github.com/defparam/smuggler
  git clone https://github.com/commixproject/commix
  git clone https://github.com/danielmiessler/SecLists
  git clone https://github.com/projectdiscovery/nuclei-templates
  curl "https://gitlab.com/kalilinux/packages/wordlists/-/raw/kali/master/rockyou.txt.gz?inline=false" -o rockyou.txt.gz && gunzip rockyou.txt.gz
}

install_ohmyzsh() {
  sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
}

echo "Installing tools"
if [ "$(uname)" == "Darwin" ]; then install_brew && install_anywhere && install_ohmyzsh;
elif [ -f /etc/debian_version ]; then install_apt && install_anywhere;
fi

echo "Cleaning up"
if [ "$(uname)" == "Darwin" ]; then brew update && brew upgrade && brew cleanup && brew doctor;
elif [ -f /etc/debian_version ]; then sudo apt autoremove -y && sudo apt autoclean -y && sudo apt clean;
fi

echo; echo ".zshrc"; echo '
export PATH=/opt/homebrew/bin:/opt/homebrew/sbin:~/go/bin:$PATH
alias cleanmymac="brew update && brew upgrade && brew cleanup && brew doctor"
alias cleancahce="rm -rf ~/Library/Caches 2> /dev/null"
alias findgit="find . -type f -name config -not -path node_modules -exec grep -H github {} \; 2> /dev/null"
alias deploysite="rsync -avr --exclude={node_modules,dist,build,.next,.git,.DS_Store,package-lock.json} ~/site/ -e \"ssh -i ~/.ssh/id\" user@0.0.0.0:~/site"
alias previewsite="rsync -avrn --exclude={node_modules,dist,build,.next,.git,.DS_Store,package-lock.json} ~/site/ -e \"ssh -i ~/.ssh/id\" user@0.0.0.0:~/site"
'

echo; echo "vscode-settings.json";echo '
{
  "window.restoreFullscreen": true,
  "window.newWindowDimensions": "maximized",
  "editor.tabSize": 2,
  "editor.fontSize": 14,
  "editor.insertSpaces": true,
  "editor.wordWrap": "on",
  "editor.cursorStyle": "block",
  "editor.cursorBlinking": "solid",
  "editor.matchBrackets": "never",
  "editor.renderWhitespace": "trailing",
  "editor.glyphMargin": false,
  "editor.parameterHints.enabled": false,
  "editor.hideCursorInOverviewRuler": true,
  "editor.minimap.enabled": false,
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.guides.bracketPairs": "active",
  "workbench.startupEditor": "none",
  "workbench.settings.editor": "json",
  "workbench.activityBar.visible": false,
  "workbench.editor.enablePreview": false,
  "workbench.editor.untitled.hint": "hidden",
  "workbench.settings.useSplitJSON": true,
  "breadcrumbs.symbolPath": "off",
  "telemetry.telemetryLevel": "off",
  extensions.ignoreRecommendations": true
}
'