diff --git a/.github/workflows/build-push-ghcr.yml b/.github/workflows/build-push-ghcr.yml new file mode 100644 index 00000000..13686a0f --- /dev/null +++ b/.github/workflows/build-push-ghcr.yml @@ -0,0 +1,58 @@ +name: Build and Push + +on: + push: + branches: + - main + - development + - feat* + tags: + - "v*" + pull_request: + branches: + - master + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + docker-build: + permissions: + contents: read + packages: write + runs-on: ubuntu-latest + steps: + + - name: Setting environment variables + run: | + echo "repo_name=${{ env.IMAGE_NAME }}" >> $GITHUB_ENV + + - uses: actions/checkout@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY}}/${{ env.repo_name }} + flavor: latest=true + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + + - name: Login to image repository + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + file: Dockerfile + push: ${{ github.ref_type == 'tag' || github.ref_name == 'main' || startsWith(github.ref_name, 'feat-')}} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/install.sh b/install.sh index df99b3e3..6e84640e 100755 --- a/install.sh +++ b/install.sh @@ -1,13 +1,20 @@ #!/bin/bash -# Install script for Sn1per CE +# Cross-platform install script for Sn1per CE +# Supports: Debian/Ubuntu, RHEL/CentOS/Fedora/Amazon Linux, Arch Linux, macOS # Created by @xer0dayz - https://sn1persecurity.com +# Optimized by D4rth R3v4n - https://github.com/gbiagomba +# Optimized for multi-distro support +set -e # Exit on error + +# Color definitions OKBLUE='\033[94m' OKRED='\033[91m' OKGREEN='\033[92m' OKORANGE='\033[93m' RESET='\e[0m' +# Banner echo -e "$OKRED ____ $RESET" echo -e "$OKRED _________ / _/___ ___ _____$RESET" echo -e "$OKRED / ___/ __ \ / // __ \/ _ \/ ___/$RESET" @@ -17,451 +24,909 @@ echo -e "$OKRED /_/ $RESET" echo -e "$RESET" echo -e "$OKORANGE + -- --=[ https://sn1persecurity.com $RESET" echo -e "$OKORANGE + -- --=[ Sn1per CE by @xer0dayz $RESET" +echo -e "$OKORANGE + -- --=[ Multi-distro installer $RESET" echo "" +# Installation directories INSTALL_DIR=/usr/share/sniper LOOT_DIR=/usr/share/sniper/loot PLUGINS_DIR=/usr/share/sniper/plugins GO_DIR=~/go/bin -echo -e "$OKRED[>]$RESET This script will install Sn1per under $INSTALL_DIR. Are you sure you want to continue? (Hit Ctrl+C to exit)$RESET" -if [[ "$1" != "force" ]]; then - read answer -fi - -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root" - exit 1 -fi - -mkdir -p $INSTALL_DIR 2> /dev/null -chmod 755 -Rf $INSTALL_DIR 2> /dev/null -chown root $INSTALL_DIR/sniper 2> /dev/null -mkdir -p $LOOT_DIR 2> /dev/null -mkdir $LOOT_DIR/domains 2> /dev/null -mkdir $LOOT_DIR/screenshots 2> /dev/null -mkdir $LOOT_DIR/nmap 2> /dev/null -mkdir $LOOT_DIR/reports 2> /dev/null -mkdir $LOOT_DIR/output 2> /dev/null -mkdir $LOOT_DIR/osint 2> /dev/null -cp -Rf * $INSTALL_DIR 2> /dev/null -cd $INSTALL_DIR - -sudo cp -a /root/.Xauthority /root/.Xauthority.bak 2> /dev/null -sudo cp -a /home/$USER/.Xauthority /root/.Xauthority 2> /dev/null -sudo cp -a /home/kali/.Xauthority /root/.Xauthority 2> /dev/null -sudo chown root: /root/.Xauthority 2> /dev/null -XAUTHORITY=/root/.Xauthority - -# CHECK FOR UBUNTU... -UBUNTU_CHECK=$(egrep DISTRIB_ID /etc/lsb-release 2> /dev/null) -if [[ $UBUNTU_CHECK == "DISTRIB_ID=Ubuntu" ]]; then - cp /root/.Xauthority /root/.Xauthority.bak 2> /dev/null - cp -a /run/user/1000/gdm/Xauthority /root/.Xauthority 2> /dev/null - cp -a /home/user/.Xauthority /root/.Xauthority 2> /dev/null - chown root /root/.Xauthority 2> /dev/null - XAUTHORITY=/root/.Xauthority 2> /dev/null - snap install chromium 2> /dev/null - ln -s /snap/bin/chromium /usr/bin/chromium 2> /dev/null - xhost + 2> /dev/null - mkdir -p /run/user/0 2> /dev/null - add-apt-repository ppa:longsleep/golang-backports - sudo apt update - apt install golang -fi - -echo -e "$OKBLUE[*]$RESET Installing base dependencies...$RESET" -apt install -y sudo gpg curl - -echo -e "$OKBLUE[*]$RESET Updating repositories... $OKBLUE[$RESET${OKGREEN}OK${RESET}$OKBLUE]$RESET" -curl -fsSL https://archive.kali.org/archive-key.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/kali.gpg --yes - -echo -e "$OKBLUE[*]$RESET Installing package dependencies...$RESET" -apt update -apt install -y nfs-common -apt install -y nodejs -apt install -y wafw00f -apt install -y xdg-utils -apt install -y ruby -apt install -y rubygems -apt install -y python2 -apt install -y python3 -apt install -y python3-paramiko -apt purge -y python3-pip -apt install -y python3-pip -apt install -y dos2unix -apt install -y aha -apt install -y libxml2-utils -apt install -y rpcbind -apt install -y cutycapt -apt install -y host -apt install -y whois -apt install -y dnsrecon -apt install -y curl -apt install -y nmap -apt install -y php8.2 -apt install -y php8.2-curl -apt install -y hydra -apt install -y sqlmap -apt install -y nbtscan -apt install -y nikto -apt install -y whatweb -apt install -y sslscan -apt install -y jq -apt install -y golang -apt install -y adb -apt install -y xsltproc -apt install -y ldapscripts -apt install -y libssl-dev 2> /dev/null -apt install -y xmlstarlet -apt install -y net-tools -apt install -y p7zip-full -apt install -y jsbeautifier -apt install -y theharvester 2> /dev/null -apt install -y phantomjs 2> /dev/null -apt install -y chromium 2> /dev/null -apt install -y xvfb -apt install -y urlcrazy -apt install -y iputils-ping -apt install -y enum4linux -apt install -y dnsutils -apt install -y wtmpdb - -echo -e "$OKBLUE[*]$RESET Installing Metasploit...$RESET" -rm -f /usr/share/keyrings/metasploit-framework.gpg 2> /dev/null -curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > /tmp/msfinstall -chmod 755 /tmp/msfinstall -/tmp/msfinstall - -pip3 install dnspython colorama tldextract urllib3 ipaddress requests --break-system-packages -curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash - -echo -e "$OKBLUE[*]$RESET Installing gem dependencies...$RESET" -gem install rake 2> /dev/null > /dev/null -gem install ruby-nmap 2> /dev/null > /dev/null -gem install net-http-persistent 2> /dev/null > /dev/null -gem install mechanize 2> /dev/null > /dev/null -gem install text-table 2> /dev/null > /dev/null -gem install public_suffix 2> /dev/null > /dev/null - -echo -e "$OKBLUE[*]$RESET Setting up Ruby...$RESET" -dpkg-reconfigure ruby - -echo -e "$OKBLUE[*]$RESET Upgrading Pip...$RESET" -python3 -m pip install --upgrade pip --break-system-packages - -echo -e "$OKBLUE[*]$RESET Cleaning up old extensions...$RESET" -rm -Rf $PLUGINS_DIR 2> /dev/null -mkdir $PLUGINS_DIR 2> /dev/null -cd $PLUGINS_DIR -mkdir -p $GO_DIR 2> /dev/null - -echo -e "$OKBLUE[*]$RESET Downloading extensions...$RESET" - -# SUBLIST3R INSTALLER -echo -e "$OKBLUE[*]$RESET Installing Sublist3r...$RESET" -git clone https://github.com/1N3/Sublist3r.git - -# SHOCKER INSTALLER -echo -e "$OKBLUE[*]$RESET Installing Shocker...$RESET" -git clone https://github.com/nccgroup/shocker.git - -# SSH-AUDIT INSTALLER -echo -e "$OKBLUE[*]$RESET Installing SSH-Audit...$RESET" -git clone https://github.com/arthepsy/ssh-audit - -# JEXBOSS INSTALLER -echo -e "$OKBLUE[*]$RESET Installing Jexboss...$RESET" -git clone https://github.com/1N3/jexboss.git - -# WIG INSTALLER -echo -e "$OKBLUE[*]$RESET Installing Wig...$RESET" -git clone https://github.com/jekyc/wig.git - -# CORSTEST INSTALLER -echo -e "$OKBLUE[*]$RESET Installing CORStest...$RESET" -git clone https://github.com/RUB-NDS/CORStest.git - -# VULSCAN INSTALLER -echo -e "$OKBLUE[*]$RESET Installing Vulscan...$RESET" -git clone https://github.com/scipag/vulscan - -# METAGOOFIL INSTALLER -echo -e "$OKBLUE[*]$RESET Installing Metagoofil...$RESET" -git clone https://github.com/laramies/metagoofil.git - -# SHODAN INSTALLER -echo -e "$OKBLUE[*]$RESET Installing Shodan...$RESET" -git clone https://github.com/achillean/shodan-python - -# CMSMAP INSTALLER -echo -e "$OKBLUE[*]$RESET Installing CMSMap...$RESET" -git clone https://github.com/Dionach/CMSmap.git - -# SMUGGLER INSTALLER -echo -e "$OKBLUE[*]$RESET Installing Smuggler...$RESET" -git clone https://github.com/defparam/smuggler.git - -# DIRSEARCH INSTALLER -echo -e "$OKBLUE[*]$RESET Installing Dirsearch...$RESET" -cd $PLUGINS_DIR -rm -Rf dirsearch/ 2> /dev/null -wget https://github.com/maurosoria/dirsearch/archive/refs/tags/v0.4.2.tar.gz -tar -zxvf v0.4.2.tar.gz -mv dirsearch-0.4.2/ dirsearch/ -cd dirsearch/ -pip3 install -r requirements.txt --break-system-packages -cd $PLUGINS_DIR - -# SECRETFINDER INSTALLER -echo -e "$OKBLUE[*]$RESET Installing SecretFinder...$RESET" -git clone https://github.com/m4ll0k/SecretFinder.git secretfinder -pip install -r $PLUGINS_DIR/secretfinder/requirements.txt --break-system-packages - -# LINKFINDER INSTALLER -echo -e "$OKBLUE[*]$RESET Installing LinkFinder...$RESET" -git clone https://github.com/1N3/LinkFinder -cd LinkFinder -python3 setup.py install -cd .. - -# GITGRABER INSTALLER -echo -e "$OKBLUE[*]$RESET Installing GitGrabber...$RESET" -git clone https://github.com/hisxo/gitGraber.git -pip3 install -r $PLUGINS_DIR/gitGraber/requirements.txt --break-system-packages 2> /dev/null - -# CENSYS-SUBDOMAIN-FINDER INSTALLER -echo -e "$OKBLUE[*]$RESET Installing Censys-Subdomain-Finder...$RESET" -git clone https://github.com/christophetd/censys-subdomain-finder.git -pip3 install -r $PLUGINS_DIR/censys-subdomain-finder/requirements.txt --break-system-packages - -# DNSCAN INSTALLER -echo -e "$OKBLUE[*]$RESET Installing DNScan...$RESET" -git clone https://github.com/rbsec/dnscan.git -pip3 install -r $PLUGINS_DIR/dnscan/requirements.txt --break-system-packages - -# ALTDNS INSTALLER -echo -e "$OKBLUE[*]$RESET Installing AltDNS...$RESET" -git clone https://github.com/infosec-au/altdns.git -cd altdns -pip3 install -r requirements.txt --break-system-packages -python3 setup.py install -pip3 install py-altdns --break-system-packages -cd .. - -# MASSDNS INSTALLER -echo -e "$OKBLUE[*]$RESET Installing MassDNS...$RESET" -git clone https://github.com/blechschmidt/massdns.git -cd massdns -make && make install -cd .. - -# DNSGEN INSTALLER -echo -e "$OKBLUE[*]$RESET Installing DNSGen...$RESET" -git clone https://github.com/ProjectAnte/dnsgen -cd dnsgen -pip3 install -r requirements.txt --break-system-packages -python3 setup.py install -cd .. - -# NUCLEI UPDATES -echo -e "$OKBLUE[*]$RESET Installing Nuclei...$RESET" -GO111MODULE=on go install github.com/projectdiscovery/nuclei/v2/cmd/nuclei@latest -ln -fs /root/go/bin/nuclei /usr/local/bin/nuclei 2> /dev/null -nuclei --update -nuclei - -# INSTALL WEBTECH -echo -e "$OKBLUE[*]$RESET Installing WebTech...$RESET" -pip3 install -U webtech --break-system-packages -mkdir -p /root/.local/share/webtech - -# INSTALL SUBJACK -echo -e "$OKBLUE[*]$RESET Installing SubJack...$RESET" -cd ~/go/bin/;go install github.com/haccer/subjack@latest - -# INSTALL SUBOVER -echo -e "$OKBLUE[*]$RESET Installing SubOver...$RESET" -cd ~/go/bin/;go install github.com/Ice3man543/SubOver@latest; mv /root/go/bin/SubOver /usr/local/bin/subover - -# INSTALL FPROBE -echo -e "$OKBLUE[*]$RESET Installing FProbe...$RESET" -go install github.com/theblackturtle/fprobe@latest; ln -fs ~/go/bin/fprobe /usr/bin/fprobe - -# INSTALL ASNIP -echo -e "$OKBLUE[*]$RESET Installing ASnip...$RESET" -go install github.com/harleo/asnip@latest; ln -fs ~/go/bin/asnip /usr/bin/asnip - -# GAU INSTALLER -echo -e "$OKBLUE[*]$RESET Installing GAU...$RESET" -GO111MODULE=on go install github.com/lc/gau@latest -rm -f /usr/bin/gau 2> /dev/null -ln -fs /root/go/bin/gau /usr/bin/gau 2> /dev/null - -# INSTALL HTTPX -echo -e "$OKBLUE[*]$RESET Installing HTTPX...$RESET" -go install github.com/projectdiscovery/httpx@latest; ln -fs /root/go/bin/httpx /usr/bin/httpx - -# INSTALL FFUF -echo -e "$OKBLUE[*]$RESET Installing FFuF...$RESET" -go install github.com/ffuf/ffuf@latest; ln -fs /root/go/bin/ffuf /usr/bin/ffuf - -# GITHUB-ENDPOINTS INSTALLER -echo -e "$OKBLUE[*]$RESET Installing Github-Endpoints...$RESET" -go install github.com/gwen001/github-endpoints@latest; ln -fs /root/go/bin/github-endpoints /usr/bin/github-endpoints - -# PUREDNS INSTALLER -echo -e "$OKBLUE[*]$RESET Installing PureDNS...$RESET" -go install github.com/d3mondev/puredns/v2@latest; ln -fs /root/go/bin/puredns /usr/bin/puredns - -# AMASS INSTALLER -echo -e "$OKBLUE[*]$RESET Installing AMass...$RESET" -go install -v github.com/OWASP/Amass/v3/...@master -cd /root/go/bin/ - -# SUBFINDER INSTALLER -echo -e "$OKBLUE[*]$RESET Installing SubFinder...$RESET" -go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest; ln -fs /root/go/bin/subfinder /usr/local/bin/subfinder - -# DIRDAR INSTALLER -echo -e "$OKBLUE[*]$RESET Installing DirDar...$RESET" -go install github.com/1N3/dirdar@latest; ln -fs /root/go/bin/dirdar /usr/local/bin/dirdar - -# VULNERS NMAP INSTALLER -echo -e "$OKBLUE[*]$RESET Installing Vulners...$RESET" -cd /usr/share/nmap/scripts/ -rm -f /usr/share/nmap/scripts/vulners.nse -wget https://raw.githubusercontent.com/vulnersCom/nmap-vulners/master/vulners.nse -# ensure readable permissions -sudo chmod 644 /usr/share/nmap/scripts/vulners.nse -# update Nmap's script DB so --script-help and autocompletion see it -sudo nmap --script-updatedb - -# GOBUSTER INSTALLER -echo -e "$OKBLUE[*]$RESET Installing GoBuster...$RESET" -wget https://github.com/OJ/gobuster/releases/download/v3.0.1/gobuster-linux-amd64.7z -O /tmp/gobuster.7z -cd /tmp/ -7z e gobuster.7z -chmod +rx gobuster -mv gobuster /usr/bin/gobuster - -# SHODAN INSTALLER -echo -e "$OKBLUE[*]$RESET Installing Shodan...$RESET" -cd $PLUGINS_DIR -cd shodan-python -python setup.py install -cd .. - -# H8MAIL INSTALLER -echo -e "$OKBLUE[*]$RESET Installing H8Mail...$RESET" -pip3 install h8mail --break-system-packages 2> /dev/null - -# CMSMAP INSTALLER -echo -e "$OKBLUE[*]$RESET Installing CMSMap...$RESET" -cd $PLUGINS_DIR/CMSmap/ && pip3 install . --break-system-packages && python3 setup.py install - -cd $PLUGINS_DIR - -# ARACHNI MANUAL INSTALL -echo -e "$OKBLUE[*]$RESET Installing Arachni...$RESET" -wget https://github.com/Arachni/arachni/releases/download/v1.5.1/arachni-1.5.1-0.5.12-linux-x86_64.tar.gz -O /tmp/arachni.tar.gz -cd /tmp/ -tar -zxf arachni.tar.gz -rm -f /tmp/arachni.tar.gz 2> /dev/null -cd arachni-* -mkdir -p /usr/share/arachni 2> /dev/null -cp -Rf * /usr/share/arachni/ 2> /dev/null -cd /usr/share/arachni/bin/ -for a in `ls`; do ln -fs $PWD/$a /usr/bin/$a; done; - -# REMOVE CVE TEMPLATES (ALL CVEs GOING FORWARD COVERED BY NUCLEI) -rm -f /usr/share/sniper/templates/active/CVE* - -# PHANTOMJS MANUAL INSTALL -echo -e "$OKBLUE[*]$RESET Installing PhantomJS...$RESET" -cd /usr/local/share -wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-x86_64.tar.bz2 2> /dev/null -tar xjf phantomjs-1.9.7-linux-x86_64.tar.bz2 2> /dev/null -ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/share/phantomjs 2> /dev/null -ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs 2> /dev/null -ln -s /usr/local/share/phantomjs-1.9.7-linux-x86_64/bin/phantomjs /usr/bin/phantomjs 2> /dev/null - -# DNS RESOLVERS DOWNLOAD -echo -e "$OKBLUE[*]$RESET Installing DNS Resolvers...$RESET" -wget https://raw.githubusercontent.com/janmasarik/resolvers/master/resolvers.txt -O /usr/share/sniper/wordlists/resolvers.txt - -# THEHARVESTER KALI SETUP -echo -e "$OKBLUE[*]$RESET Installing TheHarvester...$RESET" -cp -f /usr/bin/theHarvester /usr/bin/theharvester 2> /dev/null - -# BLACKWIDOW INSTALLER -echo -e "$OKBLUE[*]$RESET Installing BlackWidow...$RESET" -cd $PLUGINS_DIR -git clone https://github.com/1N3/BlackWidow -cd $PLUGINS_DIR/BlackWidow/ && bash install.sh force 2> /dev/null - -# BRUTEX INSTALLER -echo -e "$OKBLUE[*]$RESET Installing BruteX...$RESET" -cd $PLUGINS_DIR -git clone https://github.com/1N3/BruteX.git -cd $PLUGINS_DIR/BruteX/ && bash install.sh 2> /dev/null - -# FINDSPLOIT INSTALLER -echo -e "$OKBLUE[*]$RESET Installing FindSploit...$RESET" -cd $PLUGINS_DIR -git clone https://github.com/1N3/Findsploit.git -cd $PLUGINS_DIR/Findsploit/ && bash install.sh 2> /dev/null - -# GOOHAK INSTALLER -echo -e "$OKBLUE[*]$RESET Installing GooHak...$RESET" -cd $PLUGINS_DIR -git clone https://github.com/1N3/Goohak.git - -echo -e "$OKBLUE[*]$RESET Setting up environment...$RESET" -cd $INSTALL_DIR -mkdir $LOOT_DIR 2> /dev/null -mkdir $LOOT_DIR/screenshots/ -p 2> /dev/null -mkdir $LOOT_DIR/nmap -p 2> /dev/null -mkdir $LOOT_DIR/domains -p 2> /dev/null -mkdir $LOOT_DIR/output -p 2> /dev/null -mkdir $LOOT_DIR/reports -p 2> /dev/null -chmod +x $INSTALL_DIR/sniper -chmod +x $PLUGINS_DIR/Goohak/goohak -rm -f /usr/bin/dirsearch -ln -s $INSTALL_DIR/sniper /usr/bin/sniper 2> /dev/null -ln -s $PLUGINS_DIR/Goohak/goohak /usr/bin/goohak 2> /dev/null -ln -s $PLUGINS_DIR/dirsearch/dirsearch.py /usr/bin/dirsearch 2> /dev/null -ln -s /usr/share/sniper /sniper 2> /dev/null -ln -s /usr/share/sniper /usr/share/sn1per 2> /dev/null -ln -s /usr/share/sniper/loot/workspace /workspace 2> /dev/null -ln -s /usr/share/sniper/loot/workspace /root/workspace 2> /dev/null -ln -s /usr/share/sniper /root/sniper 2> /dev/null -ln -s /root/.sniper.conf /usr/share/sniper/conf/sniper.conf 2> /dev/null -ln -s /root/.sniper_api_keys.conf /usr/share/sniper/conf/sniper_api_keys.conf 2> /dev/null -mv /root/.sniper.conf /root/.sniper.conf.bak 2> /dev/null -cp -vf /usr/share/sniper/sniper.conf /root/.sniper.conf 2> /dev/null -msfdb init 2> /dev/null - -echo -e "$OKBLUE[*]$RESET Adding start menu and desktop shortcuts... $RESET" -cp -f $INSTALL_DIR/sn1per.desktop /usr/share/applications/ 2> /dev/null -cp -f $INSTALL_DIR/sn1per.desktop /usr/share/applications/sn1per.desktop 2> /dev/null -cp -f $INSTALL_DIR/sn1per.desktop /usr/share/kali-menu/applications/sn1per.desktop 2> /dev/null -cp -f $INSTALL_DIR/sn1per.png /usr/share/pixmaps/ 2> /dev/null -cp -f $PLUGINS_DIR/BruteX/brutex.desktop /usr/share/applications/ 2> /dev/null -cp -f $PLUGINS_DIR/BruteX/brutex.desktop /usr/share/applications/brutex.desktop 2> /dev/null -cp -f $PLUGINS_DIR/BruteX/brutex.desktop /usr/share/kali-menu/applications/brutex.desktop 2> /dev/null -cp -f $PLUGINS_DIR/BlackWidow/blackwidow.desktop /usr/share/applications/ 2> /dev/null -cp -f $PLUGINS_DIR/BlackWidow/blackwidow.desktop /usr/share/applications/blackwidow.desktop 2> /dev/null -cp -f $PLUGINS_DIR/BlackWidow/blackwidow.desktop /usr/share/kali-menu/applications/blackwidow.desktop 2> /dev/null -cp -f $PLUGINS_DIR/Findsploit/findsploit.desktop /usr/share/applications/ 2> /dev/null -cp -f $PLUGINS_DIR/Findsploit/findsploit.desktop /usr/share/applications/findsploit.desktop 2> /dev/null -cp -f $PLUGINS_DIR/Findsploit/findsploit.desktop /usr/share/kali-menu/applications/findsploit.desktop 2> /dev/null -mkdir -p /usr/share/sniper/loot/workspaces/ 2> /dev/null -ln -fs /usr/share/sniper/loot/workspaces/ /home/kali/Desktop/workspaces 2> /dev/null -ln -fs /usr/share/sniper/loot/workspaces/ /root/Desktop/workspaces 2> /dev/null - -echo -e "$OKBLUE[*]$RESET Cleaning up installation files... $RESET" -rm -Rf /tmp/arachni* /tmp/gobuster* /tmp/msfinstall /tmp/openssl.cnf 2> /dev/null - -echo -e "$OKRED[>]$RESET Done! $RESET" -echo -e "$OKRED[>]$RESET To run, type 'sniper'! $RESET" +# Detect OS and distribution +detect_os() { + if [[ "$OSTYPE" == "darwin"* ]]; then + OS="macos" + echo -e "$OKBLUE[*]$RESET Detected macOS" + elif [[ -f /etc/os-release ]]; then + . /etc/os-release + case "$ID" in + ubuntu|debian|kali|parrot) + OS="debian" + PKG_MANAGER="apt" + echo -e "$OKBLUE[*]$RESET Detected Debian-based system: $PRETTY_NAME" + ;; + rhel|centos|fedora|rocky|alma|amzn) + OS="rhel" + if command -v dnf &> /dev/null; then + PKG_MANAGER="dnf" + else + PKG_MANAGER="yum" + fi + echo -e "$OKBLUE[*]$RESET Detected RHEL-based system: $PRETTY_NAME" + ;; + arch|manjaro|endeavouros) + OS="arch" + PKG_MANAGER="pacman" + echo -e "$OKBLUE[*]$RESET Detected Arch-based system: $PRETTY_NAME" + ;; + opensuse*|sles) + OS="opensuse" + PKG_MANAGER="zypper" + echo -e "$OKBLUE[*]$RESET Detected openSUSE-based system: $PRETTY_NAME" + ;; + *) + echo -e "$OKRED[!]$RESET Unsupported distribution: $ID" + echo -e "$OKRED[!]$RESET Supported: Debian/Ubuntu, RHEL/CentOS/Fedora, Arch Linux, macOS" + exit 1 + ;; + esac + else + echo -e "$OKRED[!]$RESET Unable to detect operating system" + exit 1 + fi +} + +# Check if running as root (not needed for macOS with brew) +check_root() { + if [[ "$OS" != "macos" ]] && [[ $EUID -ne 0 ]]; then + echo -e "$OKRED[!]$RESET This script must be run as root on Linux systems" + echo -e "$OKRED[!]$RESET Please run: sudo $0" + exit 1 + fi +} + +# Package manager abstraction +pkg_update() { + echo -e "$OKBLUE[*]$RESET Updating package repositories..." + case "$OS" in + debian) + apt update -y + ;; + rhel) + $PKG_MANAGER makecache -y || $PKG_MANAGER makecache + ;; + arch) + pacman -Sy --noconfirm + ;; + opensuse) + zypper refresh -y + ;; + macos) + brew update + ;; + esac +} + +pkg_install() { + local packages=("$@") + echo -e "$OKBLUE[*]$RESET Installing: ${packages[*]}" + + case "$OS" in + debian) + apt install -y "${packages[@]}" 2>/dev/null || true + ;; + rhel) + $PKG_MANAGER install -y "${packages[@]}" 2>/dev/null || true + ;; + arch) + pacman -S --noconfirm --needed "${packages[@]}" 2>/dev/null || true + ;; + opensuse) + zypper install -y "${packages[@]}" 2>/dev/null || true + ;; + macos) + for pkg in "${packages[@]}"; do + brew install "$pkg" 2>/dev/null || brew upgrade "$pkg" 2>/dev/null || true + done + ;; + esac +} + +# Map package names across distributions +get_package_name() { + local generic_name=$1 + + case "$OS" in + debian) + case "$generic_name" in + python) echo "python3" ;; + pip) echo "python3-pip" ;; + ruby-dev) echo "ruby-dev" ;; + *) echo "$generic_name" ;; + esac + ;; + rhel) + case "$generic_name" in + python) echo "python3" ;; + pip) echo "python3-pip" ;; + ruby-dev) echo "ruby-devel" ;; + libssl-dev) echo "openssl-devel" ;; + build-essential) echo "gcc gcc-c++ make" ;; + *) echo "$generic_name" ;; + esac + ;; + arch) + case "$generic_name" in + python) echo "python" ;; + pip) echo "python-pip" ;; + ruby-dev) echo "ruby" ;; + libssl-dev) echo "openssl" ;; + build-essential) echo "base-devel" ;; + *) echo "$generic_name" ;; + esac + ;; + macos) + case "$generic_name" in + python) echo "python@3" ;; + pip) echo "" ;; # comes with python + ruby-dev) echo "ruby" ;; + libssl-dev) echo "openssl" ;; + build-essential) echo "" ;; # xcode tools + *) echo "$generic_name" ;; + esac + ;; + esac +} + +# Install build tools +install_build_tools() { + echo -e "$OKBLUE[*]$RESET Installing build tools..." + + case "$OS" in + debian) + pkg_install build-essential git curl wget + ;; + rhel) + pkg_install gcc gcc-c++ make git curl wget + if [[ "$PKG_MANAGER" == "dnf" ]]; then + $PKG_MANAGER groupinstall -y "Development Tools" 2>/dev/null || true + else + $PKG_MANAGER groupinstall -y "Development Tools" 2>/dev/null || true + fi + ;; + arch) + pkg_install base-devel git curl wget + ;; + opensuse) + pkg_install -t pattern devel_basis + pkg_install git curl wget + ;; + macos) + # Check for Xcode Command Line Tools + if ! xcode-select -p &>/dev/null; then + echo -e "$OKBLUE[*]$RESET Installing Xcode Command Line Tools..." + xcode-select --install 2>/dev/null || true + fi + pkg_install git curl wget + ;; + esac +} + +# Install base dependencies +install_base_dependencies() { + echo -e "$OKBLUE[*]$RESET Installing base dependencies..." + + local base_pkgs=() + + case "$OS" in + debian) + base_pkgs=( + sudo gpg curl wget git + nmap nikto sqlmap hydra + whois dnsutils dnsrecon + ruby rubygems ruby-dev + python3 python3-pip python3-paramiko + golang + nodejs npm + php php-curl + dos2unix aha jq xmlstarlet + libxml2-utils xsltproc + net-tools iputils-ping + nfs-common rpcbind + nbtscan enum4linux + whatweb wafw00f sslscan + xdg-utils xvfb + p7zip-full + libssl-dev + ) + + # Optional packages + pkg_install theharvester 2>/dev/null || true + pkg_install urlcrazy 2>/dev/null || true + + # Install chromium + if [[ "$ID" == "ubuntu" ]]; then + snap install chromium 2>/dev/null || apt install -y chromium-browser 2>/dev/null || true + else + pkg_install chromium 2>/dev/null || pkg_install chromium-browser 2>/dev/null || true + fi + ;; + + rhel) + # Enable EPEL for RHEL-based systems + if [[ "$ID" == "rhel" ]] || [[ "$ID" == "centos" ]] || [[ "$ID" == "rocky" ]] || [[ "$ID" == "alma" ]]; then + $PKG_MANAGER install -y epel-release 2>/dev/null || true + fi + + base_pkgs=( + sudo git curl wget + nmap + whois bind-utils + ruby ruby-devel rubygems + python3 python3-pip + golang + nodejs npm + php php-curl + jq + libxml2 libxslt + net-tools iputils + rpcbind + openssl openssl-devel + p7zip p7zip-plugins + xorg-x11-server-Xvfb + ) + + # Try to install additional tools (may not be available) + pkg_install nikto sqlmap hydra 2>/dev/null || true + ;; + + arch) + base_pkgs=( + sudo git curl wget + nmap nikto sqlmap hydra + whois dnsutils + ruby rubygems + python python-pip python-paramiko + go + nodejs npm + php + dos2unix jq xmlstarlet + libxml2 libxslt + net-tools iputils + nfs-utils rpcbind + sslscan + xorg-xauth xorg-server-xvfb + p7zip + openssl + ) + ;; + + macos) + base_pkgs=( + git curl wget + nmap + ruby + python@3 + go + node + php + jq + libxml2 libxslt + p7zip + openssl + ) + + # Some tools may need cask + brew install --cask chromium 2>/dev/null || true + ;; + esac + + pkg_install "${base_pkgs[@]}" +} + +# Setup Python environment +setup_python() { + echo -e "$OKBLUE[*]$RESET Setting up Python environment..." + + # Upgrade pip + python3 -m pip install --upgrade pip --break-system-packages 2>/dev/null || \ + python3 -m pip install --upgrade pip 2>/dev/null || true + + # Install Python packages + local py_packages=( + dnspython + colorama + tldextract + urllib3 + ipaddress + requests + h8mail + webtech + ) + + for pkg in "${py_packages[@]}"; do + pip3 install "$pkg" --break-system-packages 2>/dev/null || \ + pip3 install "$pkg" 2>/dev/null || true + done +} + +# Setup Ruby environment +setup_ruby() { + echo -e "$OKBLUE[*]$RESET Setting up Ruby environment..." + + local ruby_gems=( + rake + ruby-nmap + net-http-persistent + mechanize + text-table + public_suffix + ) + + for gem in "${ruby_gems[@]}"; do + gem install "$gem" 2>/dev/null || true + done + + # Reconfigure ruby (Debian-specific) + if [[ "$OS" == "debian" ]]; then + dpkg-reconfigure ruby 2>/dev/null || true + fi +} + +# Setup Go environment +setup_go() { + echo -e "$OKBLUE[*]$RESET Setting up Go environment..." + + # Ensure Go is in PATH + export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin + export GOPATH=$HOME/go + + # Create Go bin directory + mkdir -p "$GO_DIR" 2>/dev/null || true + + # Update Go (if needed) + go version 2>/dev/null || { + echo -e "$OKRED[!]$RESET Go is not properly installed" + return 1 + } +} + +# Install Metasploit +install_metasploit() { + echo -e "$OKBLUE[*]$RESET Installing Metasploit Framework..." + + case "$OS" in + debian|rhel) + # Use official installer + if ! command -v msfconsole &>/dev/null; then + curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > /tmp/msfinstall + chmod 755 /tmp/msfinstall + /tmp/msfinstall 2>/dev/null || echo -e "$OKORANGE[!]$RESET Metasploit installation failed (optional)" + rm -f /tmp/msfinstall + fi + ;; + arch) + pkg_install metasploit 2>/dev/null || true + ;; + macos) + brew install metasploit 2>/dev/null || true + ;; + esac + + # Initialize database + if command -v msfdb &>/dev/null; then + msfdb init 2>/dev/null || true + fi +} + +# Create directory structure +create_directories() { + echo -e "$OKBLUE[*]$RESET Creating directory structure..." + + local dirs=( + "$INSTALL_DIR" + "$LOOT_DIR" + "$LOOT_DIR/domains" + "$LOOT_DIR/screenshots" + "$LOOT_DIR/nmap" + "$LOOT_DIR/reports" + "$LOOT_DIR/output" + "$LOOT_DIR/osint" + "$LOOT_DIR/workspaces" + "$PLUGINS_DIR" + "$GO_DIR" + ) + + for dir in "${dirs[@]}"; do + mkdir -p "$dir" 2>/dev/null || true + done + + # Set permissions + if [[ "$OS" != "macos" ]]; then + chmod 755 -Rf "$INSTALL_DIR" 2>/dev/null || true + chown -R root:root "$INSTALL_DIR" 2>/dev/null || true + fi +} + +# Install Sn1per files +install_sniper_files() { + echo -e "$OKBLUE[*]$RESET Installing Sn1per files..." + + # Copy all files to install directory + cp -Rf ./* "$INSTALL_DIR/" 2>/dev/null || true + + # Make main script executable + chmod +x "$INSTALL_DIR/sniper" 2>/dev/null || true +} + +# Install Go-based tools +install_go_tools() { + echo -e "$OKBLUE[*]$RESET Installing Go-based tools..." + + cd "$GO_DIR" || return + + local go_tools=( + "github.com/projectdiscovery/nuclei/v2/cmd/nuclei@latest:nuclei" + "github.com/haccer/subjack@latest:subjack" + "github.com/Ice3man543/SubOver@latest:subover" + "github.com/theblackturtle/fprobe@latest:fprobe" + "github.com/harleo/asnip@latest:asnip" + "github.com/lc/gau@latest:gau" + "github.com/projectdiscovery/httpx@latest:httpx" + "github.com/ffuf/ffuf@latest:ffuf" + "github.com/gwen001/github-endpoints@latest:github-endpoints" + "github.com/d3mondev/puredns/v2@latest:puredns" + "github.com/OWASP/Amass/v3/...@master:amass" + "github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest:subfinder" + "github.com/1N3/dirdar@latest:dirdar" + ) + + for tool_info in "${go_tools[@]}"; do + IFS=':' read -r tool_path tool_name <<< "$tool_info" + echo -e "$OKBLUE[*]$RESET Installing $tool_name..." + + GO111MODULE=on go install -v "$tool_path" 2>/dev/null || true + + # Create symlink + if [[ -f "$HOME/go/bin/$tool_name" ]]; then + ln -fs "$HOME/go/bin/$tool_name" /usr/local/bin/"$tool_name" 2>/dev/null || \ + ln -fs "$HOME/go/bin/$tool_name" /usr/bin/"$tool_name" 2>/dev/null || true + fi + done + + # Update nuclei templates + if command -v nuclei &>/dev/null; then + nuclei -update-templates 2>/dev/null || nuclei --update 2>/dev/null || true + fi +} + +# Install Python-based tools +install_python_tools() { + echo -e "$OKBLUE[*]$RESET Installing Python-based tools..." + + cd "$PLUGINS_DIR" || return + + # Sublist3r + if [[ ! -d "Sublist3r" ]]; then + echo -e "$OKBLUE[*]$RESET Installing Sublist3r..." + git clone https://github.com/1N3/Sublist3r.git 2>/dev/null || true + fi + + # Shocker + if [[ ! -d "shocker" ]]; then + echo -e "$OKBLUE[*]$RESET Installing Shocker..." + git clone https://github.com/nccgroup/shocker.git 2>/dev/null || true + fi + + # SSH-Audit + if [[ ! -d "ssh-audit" ]]; then + echo -e "$OKBLUE[*]$RESET Installing SSH-Audit..." + git clone https://github.com/arthepsy/ssh-audit 2>/dev/null || true + fi + + # Jexboss + if [[ ! -d "jexboss" ]]; then + echo -e "$OKBLUE[*]$RESET Installing Jexboss..." + git clone https://github.com/1N3/jexboss.git 2>/dev/null || true + fi + + # WIG + if [[ ! -d "wig" ]]; then + echo -e "$OKBLUE[*]$RESET Installing Wig..." + git clone https://github.com/jekyc/wig.git 2>/dev/null || true + fi + + # CORStest + if [[ ! -d "CORStest" ]]; then + echo -e "$OKBLUE[*]$RESET Installing CORStest..." + git clone https://github.com/RUB-NDS/CORStest.git 2>/dev/null || true + fi + + # Vulscan + if [[ ! -d "vulscan" ]]; then + echo -e "$OKBLUE[*]$RESET Installing Vulscan..." + git clone https://github.com/scipag/vulscan 2>/dev/null || true + fi + + # Metagoofil + if [[ ! -d "metagoofil" ]]; then + echo -e "$OKBLUE[*]$RESET Installing Metagoofil..." + git clone https://github.com/laramies/metagoofil.git 2>/dev/null || true + fi + + # Shodan + if [[ ! -d "shodan-python" ]]; then + echo -e "$OKBLUE[*]$RESET Installing Shodan..." + git clone https://github.com/achillean/shodan-python 2>/dev/null || true + cd shodan-python && python3 setup.py install 2>/dev/null || true + cd "$PLUGINS_DIR" + fi + + # CMSMap + if [[ ! -d "CMSmap" ]]; then + echo -e "$OKBLUE[*]$RESET Installing CMSMap..." + git clone https://github.com/Dionach/CMSmap.git 2>/dev/null || true + cd CMSmap && pip3 install . --break-system-packages 2>/dev/null || pip3 install . 2>/dev/null || true + python3 setup.py install 2>/dev/null || true + cd "$PLUGINS_DIR" + fi + + # Smuggler + if [[ ! -d "smuggler" ]]; then + echo -e "$OKBLUE[*]$RESET Installing Smuggler..." + git clone https://github.com/defparam/smuggler.git 2>/dev/null || true + fi + + # Dirsearch + if [[ ! -d "dirsearch" ]]; then + echo -e "$OKBLUE[*]$RESET Installing Dirsearch..." + wget -q https://github.com/maurosoria/dirsearch/archive/refs/tags/v0.4.2.tar.gz -O /tmp/dirsearch.tar.gz + tar -xzf /tmp/dirsearch.tar.gz -C "$PLUGINS_DIR" + mv "$PLUGINS_DIR/dirsearch-0.4.2" "$PLUGINS_DIR/dirsearch" 2>/dev/null || true + cd dirsearch && pip3 install -r requirements.txt --break-system-packages 2>/dev/null || pip3 install -r requirements.txt 2>/dev/null || true + rm -f /tmp/dirsearch.tar.gz + cd "$PLUGINS_DIR" + fi + + # SecretFinder + if [[ ! -d "secretfinder" ]]; then + echo -e "$OKBLUE[*]$RESET Installing SecretFinder..." + git clone https://github.com/m4ll0k/SecretFinder.git secretfinder 2>/dev/null || true + pip3 install -r "$PLUGINS_DIR/secretfinder/requirements.txt" --break-system-packages 2>/dev/null || \ + pip3 install -r "$PLUGINS_DIR/secretfinder/requirements.txt" 2>/dev/null || true + fi + + # LinkFinder + if [[ ! -d "LinkFinder" ]]; then + echo -e "$OKBLUE[*]$RESET Installing LinkFinder..." + git clone https://github.com/1N3/LinkFinder 2>/dev/null || true + cd LinkFinder && python3 setup.py install 2>/dev/null || true + cd "$PLUGINS_DIR" + fi + + # GitGraber + if [[ ! -d "gitGraber" ]]; then + echo -e "$OKBLUE[*]$RESET Installing GitGrabber..." + git clone https://github.com/hisxo/gitGraber.git 2>/dev/null || true + pip3 install -r "$PLUGINS_DIR/gitGraber/requirements.txt" --break-system-packages 2>/dev/null || \ + pip3 install -r "$PLUGINS_DIR/gitGraber/requirements.txt" 2>/dev/null || true + fi + + # Censys-Subdomain-Finder + if [[ ! -d "censys-subdomain-finder" ]]; then + echo -e "$OKBLUE[*]$RESET Installing Censys-Subdomain-Finder..." + git clone https://github.com/christophetd/censys-subdomain-finder.git 2>/dev/null || true + pip3 install -r "$PLUGINS_DIR/censys-subdomain-finder/requirements.txt" --break-system-packages 2>/dev/null || \ + pip3 install -r "$PLUGINS_DIR/censys-subdomain-finder/requirements.txt" 2>/dev/null || true + fi + + # DNScan + if [[ ! -d "dnscan" ]]; then + echo -e "$OKBLUE[*]$RESET Installing DNScan..." + git clone https://github.com/rbsec/dnscan.git 2>/dev/null || true + pip3 install -r "$PLUGINS_DIR/dnscan/requirements.txt" --break-system-packages 2>/dev/null || \ + pip3 install -r "$PLUGINS_DIR/dnscan/requirements.txt" 2>/dev/null || true + fi + + # AltDNS + if [[ ! -d "altdns" ]]; then + echo -e "$OKBLUE[*]$RESET Installing AltDNS..." + git clone https://github.com/infosec-au/altdns.git 2>/dev/null || true + cd altdns + pip3 install -r requirements.txt --break-system-packages 2>/dev/null || pip3 install -r requirements.txt 2>/dev/null || true + python3 setup.py install 2>/dev/null || true + pip3 install py-altdns --break-system-packages 2>/dev/null || pip3 install py-altdns 2>/dev/null || true + cd "$PLUGINS_DIR" + fi + + # MassDNS + if [[ ! -d "massdns" ]]; then + echo -e "$OKBLUE[*]$RESET Installing MassDNS..." + git clone https://github.com/blechschmidt/massdns.git 2>/dev/null || true + cd massdns + make 2>/dev/null && make install 2>/dev/null || true + cd "$PLUGINS_DIR" + fi + + # DNSGen + if [[ ! -d "dnsgen" ]]; then + echo -e "$OKBLUE[*]$RESET Installing DNSGen..." + git clone https://github.com/ProjectAnte/dnsgen 2>/dev/null || true + cd dnsgen + pip3 install -r requirements.txt --break-system-packages 2>/dev/null || pip3 install -r requirements.txt 2>/dev/null || true + python3 setup.py install 2>/dev/null || true + cd "$PLUGINS_DIR" + fi + + # BlackWidow + if [[ ! -d "BlackWidow" ]]; then + echo -e "$OKBLUE[*]$RESET Installing BlackWidow..." + git clone https://github.com/1N3/BlackWidow 2>/dev/null || true + cd BlackWidow && bash install.sh force 2>/dev/null || true + cd "$PLUGINS_DIR" + fi + + # BruteX + if [[ ! -d "BruteX" ]]; then + echo -e "$OKBLUE[*]$RESET Installing BruteX..." + git clone https://github.com/1N3/BruteX.git 2>/dev/null || true + cd BruteX && bash install.sh 2>/dev/null || true + cd "$PLUGINS_DIR" + fi + + # FindSploit + if [[ ! -d "Findsploit" ]]; then + echo -e "$OKBLUE[*]$RESET Installing FindSploit..." + git clone https://github.com/1N3/Findsploit.git 2>/dev/null || true + cd Findsploit && bash install.sh 2>/dev/null || true + cd "$PLUGINS_DIR" + fi + + # GooHak + if [[ ! -d "Goohak" ]]; then + echo -e "$OKBLUE[*]$RESET Installing GooHak..." + git clone https://github.com/1N3/Goohak.git 2>/dev/null || true + chmod +x "$PLUGINS_DIR/Goohak/goohak" 2>/dev/null || true + fi +} + +# Install additional tools +install_additional_tools() { + echo -e "$OKBLUE[*]$RESET Installing additional tools..." + + # GoBuster + if ! command -v gobuster &>/dev/null; then + echo -e "$OKBLUE[*]$RESET Installing GoBuster..." + case "$OS" in + debian) + apt install -y gobuster 2>/dev/null || { + # Manual install if not in repos + wget -q https://github.com/OJ/gobuster/releases/download/v3.0.1/gobuster-linux-amd64.7z -O /tmp/gobuster.7z + cd /tmp && 7z e gobuster.7z && chmod +rx gobuster && mv gobuster /usr/bin/gobuster + } + ;; + rhel) + # Manual install + wget -q https://github.com/OJ/gobuster/releases/download/v3.0.1/gobuster-linux-amd64.7z -O /tmp/gobuster.7z + cd /tmp && 7z e gobuster.7z && chmod +rx gobuster && mv gobuster /usr/bin/gobuster + ;; + macos) + brew install gobuster 2>/dev/null || true + ;; + esac + fi + + # Arachni (Linux only) + if [[ "$OS" != "macos" ]] && [[ ! -d "/usr/share/arachni" ]]; then + echo -e "$OKBLUE[*]$RESET Installing Arachni..." + wget -q https://github.com/Arachni/arachni/releases/download/v1.5.1/arachni-1.5.1-0.5.12-linux-x86_64.tar.gz -O /tmp/arachni.tar.gz + cd /tmp && tar -xzf arachni.tar.gz && rm -f arachni.tar.gz + mkdir -p /usr/share/arachni 2>/dev/null + cp -Rf arachni-*/* /usr/share/arachni/ 2>/dev/null + rm -rf arachni-* + # Create symlinks + cd /usr/share/arachni/bin/ + for binary in *; do + ln -fs "$PWD/$binary" /usr/bin/"$binary" 2>/dev/null || true + done + fi + + # Vulners Nmap Script + echo -e "$OKBLUE[*]$RESET Installing Vulners Nmap script..." + local nmap_scripts_dir + case "$OS" in + debian|rhel|arch) + nmap_scripts_dir="/usr/share/nmap/scripts" + ;; + macos) + nmap_scripts_dir="/usr/local/share/nmap/scripts" + ;; + esac + + if [[ -d "$nmap_scripts_dir" ]]; then + wget -q https://raw.githubusercontent.com/vulnersCom/nmap-vulners/master/vulners.nse -O "$nmap_scripts_dir/vulners.nse" + chmod 644 "$nmap_scripts_dir/vulners.nse" 2>/dev/null || true + nmap --script-updatedb 2>/dev/null || true + fi + + # DNS Resolvers + echo -e "$OKBLUE[*]$RESET Downloading DNS resolvers list..." + mkdir -p "$INSTALL_DIR/wordlists" 2>/dev/null + wget -q https://raw.githubusercontent.com/janmasarik/resolvers/master/resolvers.txt -O "$INSTALL_DIR/wordlists/resolvers.txt" 2>/dev/null || true +} + +# Create symlinks +create_symlinks() { + echo -e "$OKBLUE[*]$RESET Creating symlinks..." + + # Main symlinks + ln -fs "$INSTALL_DIR/sniper" /usr/bin/sniper 2>/dev/null || \ + ln -fs "$INSTALL_DIR/sniper" /usr/local/bin/sniper 2>/dev/null || true + + ln -fs "$PLUGINS_DIR/Goohak/goohak" /usr/bin/goohak 2>/dev/null || \ + ln -fs "$PLUGINS_DIR/Goohak/goohak" /usr/local/bin/goohak 2>/dev/null || true + + ln -fs "$PLUGINS_DIR/dirsearch/dirsearch.py" /usr/bin/dirsearch 2>/dev/null || \ + ln -fs "$PLUGINS_DIR/dirsearch/dirsearch.py" /usr/local/bin/dirsearch 2>/dev/null || true + + # Directory symlinks + ln -fs /usr/share/sniper /sniper 2>/dev/null || true + ln -fs /usr/share/sniper /usr/share/sn1per 2>/dev/null || true + ln -fs /usr/share/sniper/loot/workspaces /workspace 2>/dev/null || true + + # User directory symlinks (Linux only) + if [[ "$OS" != "macos" ]]; then + ln -fs /usr/share/sniper/loot/workspaces /root/workspace 2>/dev/null || true + ln -fs /usr/share/sniper /root/sniper 2>/dev/null || true + ln -fs /root/.sniper.conf /usr/share/sniper/conf/sniper.conf 2>/dev/null || true + ln -fs /root/.sniper_api_keys.conf /usr/share/sniper/conf/sniper_api_keys.conf 2>/dev/null || true + fi +} + +# Setup desktop shortcuts (Linux only) +setup_desktop_shortcuts() { + if [[ "$OS" == "macos" ]]; then + return + fi + + echo -e "$OKBLUE[*]$RESET Setting up desktop shortcuts..." + + # Copy desktop files + cp -f "$INSTALL_DIR/sn1per.desktop" /usr/share/applications/ 2>/dev/null || true + cp -f "$INSTALL_DIR/sn1per.png" /usr/share/pixmaps/ 2>/dev/null || true + + # Kali menu integration + if [[ -d /usr/share/kali-menu/applications ]]; then + cp -f "$INSTALL_DIR/sn1per.desktop" /usr/share/kali-menu/applications/ 2>/dev/null || true + fi + + # Plugin desktop files + if [[ -f "$PLUGINS_DIR/BruteX/brutex.desktop" ]]; then + cp -f "$PLUGINS_DIR/BruteX/brutex.desktop" /usr/share/applications/ 2>/dev/null || true + cp -f "$PLUGINS_DIR/BruteX/brutex.desktop" /usr/share/kali-menu/applications/ 2>/dev/null || true + fi + + if [[ -f "$PLUGINS_DIR/BlackWidow/blackwidow.desktop" ]]; then + cp -f "$PLUGINS_DIR/BlackWidow/blackwidow.desktop" /usr/share/applications/ 2>/dev/null || true + cp -f "$PLUGINS_DIR/BlackWidow/blackwidow.desktop" /usr/share/kali-menu/applications/ 2>/dev/null || true + fi + + if [[ -f "$PLUGINS_DIR/Findsploit/findsploit.desktop" ]]; then + cp -f "$PLUGINS_DIR/Findsploit/findsploit.desktop" /usr/share/applications/ 2>/dev/null || true + cp -f "$PLUGINS_DIR/Findsploit/findsploit.desktop" /usr/share/kali-menu/applications/ 2>/dev/null || true + fi + + # Desktop workspace shortcuts + ln -fs /usr/share/sniper/loot/workspaces/ /home/kali/Desktop/workspaces 2>/dev/null || true + ln -fs /usr/share/sniper/loot/workspaces/ /root/Desktop/workspaces 2>/dev/null || true +} + +# Setup configuration +setup_configuration() { + echo -e "$OKBLUE[*]$RESET Setting up configuration..." + + if [[ "$OS" != "macos" ]]; then + # Backup and copy config + mv /root/.sniper.conf /root/.sniper.conf.bak 2>/dev/null || true + cp -f "$INSTALL_DIR/sniper.conf" /root/.sniper.conf 2>/dev/null || true + + # X11 setup for GUI tools (Linux only) + if [[ -f /root/.Xauthority ]]; then + cp -a /root/.Xauthority /root/.Xauthority.bak 2>/dev/null || true + fi + + if [[ "$USER" != "root" ]] && [[ -f /home/$USER/.Xauthority ]]; then + cp -a /home/$USER/.Xauthority /root/.Xauthority 2>/dev/null || true + chown root:root /root/.Xauthority 2>/dev/null || true + fi + fi +} + +# Cleanup +cleanup() { + echo -e "$OKBLUE[*]$RESET Cleaning up temporary files..." + rm -rf /tmp/arachni* /tmp/gobuster* /tmp/msfinstall /tmp/openssl.cnf /tmp/dirsearch* 2>/dev/null || true +} + +# Main installation flow +main() { + echo -e "$OKRED[>]$RESET This script will install Sn1per under $INSTALL_DIR." + + if [[ "$1" != "force" ]] && [[ "$1" != "-y" ]]; then + echo -e "$OKRED[>]$RESET Do you want to continue? (y/n) $RESET" + read -r answer + if [[ "$answer" != "y" ]] && [[ "$answer" != "Y" ]]; then + echo -e "$OKRED[>]$RESET Installation cancelled." + exit 0 + fi + fi + + # Detect OS + detect_os + + # Check root privileges + check_root + + # Create directories + create_directories + + # Install Sn1per files + install_sniper_files + + # Update package repos + pkg_update + + # Install build tools + install_build_tools + + # Install base dependencies + install_base_dependencies + + # Setup language environments + setup_python + setup_ruby + setup_go + + # Install tools by category + install_metasploit + install_go_tools + install_python_tools + install_additional_tools + + # Create symlinks + create_symlinks + + # Setup desktop shortcuts (Linux only) + setup_desktop_shortcuts + + # Setup configuration + setup_configuration + + # Cleanup + cleanup + + echo "" + echo -e "$OKGREEN[✓]$RESET Installation complete!" + echo -e "$OKGREEN[✓]$RESET To run Sn1per, type: ${OKBLUE}sniper${RESET}" + echo "" + echo -e "$OKORANGE[*]$RESET OS Detected: $OS" + echo -e "$OKORANGE[*]$RESET Install Directory: $INSTALL_DIR" + echo -e "$OKORANGE[*]$RESET Loot Directory: $LOOT_DIR" + echo "" + + # System-specific notes + case "$OS" in + macos) + echo -e "$OKORANGE[!]$RESET Note: Some tools may require additional configuration on macOS" + echo -e "$OKORANGE[!]$RESET Run with sudo if you encounter permission issues" + ;; + rhel) + echo -e "$OKORANGE[!]$RESET Note: Some optional tools may not be available in RHEL repos" + echo -e "$OKORANGE[!]$RESET Consider enabling additional repositories if needed" + ;; + esac +} + +# Run main installation +main "$@" diff --git a/sniper b/sniper index e1d25b13..c1dd8602 100755 --- a/sniper +++ b/sniper @@ -464,7 +464,7 @@ function init { service postgresql start 2> /dev/null > /dev/null msfdb start 2> /dev/null > /dev/null chown root /run/user/1000/gdm/Xauthority 2> /dev/null - LAST_USER=$(last | head -n 1 | awk '{print $1}') + LAST_USER=$(last 2> /dev/null | head -n 1 | awk '{print $1}') sudo cp -a /home/$LAST_USER/.Xauthority /root/.Xauthority 2> /dev/null sudo cp -a /root/.Xauthority /root/.Xauthority.bak 2> /dev/null sudo cp -a /home/$USER/.Xauthority /root/.Xauthority 2> /dev/null