From d3594007adced738b9e964f78465830394e2503f Mon Sep 17 00:00:00 2001 From: Hacker Date: Fri, 22 May 2026 15:21:21 +0800 Subject: [PATCH] shell script --- alipay | 37 + api | 79 + arch/arch_config.sh | 154 ++ arch/fail2ban.conf | 10 + arch/profile | 56 + arch/vimrc | 3 + arch/zshrc | 22 + arch_cloud | 23 + archboot | 54 + bash | 26 + certbot | 8 + climail | 13 + crypto/bitcoin | 1 + crypto/doge | 1 + crypto/list | 7 + crypto/usdt_eth | 1 + crypto/usdt_trx | 1 + exam | 2 + frp.conf | 16 + frp.sh | 77 + hello | 1 + iarch | 189 ++ index.html | 9 + info | 319 +++ irc | 26 + list | 44 + mailserver/compose.yaml | 33 + mailserver/list | 4 + mailserver/mailserver.env | 660 ++++++ mirrorlist | 20 + mtproxy.sh | 765 +++++++ nginx/authentication | 13 + nginx/http | 10 + nginx/list | 9 + nginx/match | 28 + nginx/onion | 1 + nginx/sslreverse | 30 + nginx/sslsite | 26 + nginx/transfer | 36 + note | 12 + os | 48 + php-login.tar.gz | Bin 0 -> 2931 bytes phplogin | 86 + pub | 13 + qq | 17 + self_cert | 71 + self_ssl | 32 + ssh-luks.tar.gz | Bin 0 -> 15880 bytes su | 2 + systemd | 13 + telegram_bot/list | 4 + telegram_bot/send_docs | 1 + telegram_bot/send_message | 1 + torweb | 21 + transfer | 1 + vpn.sh | 560 +++++ vpn_diy.sh | 4573 +++++++++++++++++++++++++++++++++++++ wechat | 37 + wepay | 37 + wifi | 7 + wireguard.sh | 601 +++++ wordpress | 14 + 62 files changed, 8965 insertions(+) create mode 100644 alipay create mode 100644 api create mode 100644 arch/arch_config.sh create mode 100644 arch/fail2ban.conf create mode 100644 arch/profile create mode 100644 arch/vimrc create mode 100644 arch/zshrc create mode 100644 arch_cloud create mode 100644 archboot create mode 100644 bash create mode 100755 certbot create mode 100644 climail create mode 100644 crypto/bitcoin create mode 100644 crypto/doge create mode 100644 crypto/list create mode 100644 crypto/usdt_eth create mode 100644 crypto/usdt_trx create mode 100644 exam create mode 100644 frp.conf create mode 100755 frp.sh create mode 100644 hello create mode 100755 iarch create mode 100644 index.html create mode 100755 info create mode 100644 irc create mode 100644 list create mode 100644 mailserver/compose.yaml create mode 100644 mailserver/list create mode 100644 mailserver/mailserver.env create mode 100644 mirrorlist create mode 100755 mtproxy.sh create mode 100644 nginx/authentication create mode 100644 nginx/http create mode 100644 nginx/list create mode 100644 nginx/match create mode 100644 nginx/onion create mode 100644 nginx/sslreverse create mode 100644 nginx/sslsite create mode 100644 nginx/transfer create mode 100644 note create mode 100644 os create mode 100644 php-login.tar.gz create mode 100644 phplogin create mode 100644 pub create mode 100644 qq create mode 100755 self_cert create mode 100755 self_ssl create mode 100644 ssh-luks.tar.gz create mode 100644 su create mode 100644 systemd create mode 100644 telegram_bot/list create mode 100644 telegram_bot/send_docs create mode 100644 telegram_bot/send_message create mode 100644 torweb create mode 100644 transfer create mode 100755 vpn.sh create mode 100755 vpn_diy.sh create mode 100644 wechat create mode 100644 wepay create mode 100644 wifi create mode 100755 wireguard.sh create mode 100755 wordpress diff --git a/alipay b/alipay new file mode 100644 index 0000000..191f47f --- /dev/null +++ b/alipay @@ -0,0 +1,37 @@ +  +  +  +  +              +                    +                    +                      +                    +                      +                    +            +                +                      +                  +            +                +            +                    +                +                +                    +                  +              +              +              +                  +            +                  +                  +                    +                  +                +  +  +  +  diff --git a/api b/api new file mode 100644 index 0000000..546f623 --- /dev/null +++ b/api @@ -0,0 +1,79 @@ +#!/usr/bin/env bash +clear +# ====== CONFIG (edit here once) ====== +DOMAIN="domain.com" +API_KEY="YOUR_API_KEY" +SECRET_API_KEY="YOUR_SECRET_API_KEY" +TTL="600" +TYPE="A" + +API_BASE="https://api.porkbun.com/api/json/v3/dns" + +echo "====== Porkbun DNS Manager ======" +echo "Domain: $DOMAIN" +echo "" + +echo "Choose an action:" +echo "1) Update subdomain IP" +echo "2) Create new subdomain" +echo "" + +read -p "Enter choice (1 or 2): " ACTION + +case $ACTION in + +# Update existing record +1) + read -p "Enter subdomain to update: " SUBDOMAIN + read -p "Enter new IP address: " IP + + echo "" + echo "Updating ${SUBDOMAIN}.${DOMAIN} -> ${IP}" + read -p "Proceed? (y/n): " CONFIRM + [[ "$CONFIRM" != "y" ]] && echo "Cancelled." && exit 1 + + RESPONSE=$(curl -s -X POST \ + "$API_BASE/editByNameType/${DOMAIN}/${TYPE}/${SUBDOMAIN}" \ + -H "Content-Type: application/json" \ + -d "{ + \"secretapikey\": \"${SECRET_API_KEY}\", + \"apikey\": \"${API_KEY}\", + \"content\": \"${IP}\", + \"ttl\": \"${TTL}\" + }") + + echo "" + echo "API Response:" + echo "$RESPONSE" + ;; + +# Create new subdomain +2) + read -p "Enter new subdomain name: " SUBDOMAIN + read -p "Enter IP address: " IP + + echo "" + echo "Creating ${SUBDOMAIN}.${DOMAIN} -> ${IP}" + + RESPONSE=$(curl -s -X POST \ + "$API_BASE/create/${DOMAIN}" \ + -H "Content-Type: application/json" \ + -d "{ + \"secretapikey\": \"${SECRET_API_KEY}\", + \"apikey\": \"${API_KEY}\", + \"name\": \"${SUBDOMAIN}\", + \"type\": \"${TYPE}\", + \"content\": \"${IP}\", + \"ttl\": \"${TTL}\" + }") + + echo "" + echo "API Response:" + echo "$RESPONSE" + ;; + +*) + echo "Invalid choice." + exit 1 + ;; +esac diff --git a/arch/arch_config.sh b/arch/arch_config.sh new file mode 100644 index 0000000..d529a91 --- /dev/null +++ b/arch/arch_config.sh @@ -0,0 +1,154 @@ +#/bin/bash +clear +#************************************************************************************Print old information +if [[ -f "/root/info" ]]; then + name1=$(awk 'NR==1 {print $1}' /root/info) + disk1=$(awk 'NR==2 {print $1}' /root/info) + boot1=$(awk 'NR==3 {print $1}' /root/info) + encrypt1=$(awk 'NR==4 {print $1}' /root/info) + euuid=$(sed -n '5p' /root/info) + efistub=$(awk 'NR==6 {print $1}' /root/info) + minisys=$(awk 'NR==7 {print $1}' /root/info) + root1=$(sed -n '8p' /root/info) + + echo '--------------System Information--------------' + if [[ -d "/sys/firmware/efi" ]]; then + echo 'UEFI = ON' + else + echo 'UEFI = OFF' + fi + if [[ $efistub = 1 ]]; then + echo 'EFIstub = ON' + else + echo 'EFIstub = OFF' + fi + if [[ $minisys = 1 ]]; then + echo 'Minisys = ON' + else + echo 'Minisys = OFF' + fi + if [[ $encrypt1 = 1 ]]; then + echo 'Encrypt = ON' + echo "Enc UUID = $(sed -n '5p' /root/info)" + else + echo 'Encrypt = OFF' + fi + echo -e "HOOKs = \e[33m$(sed -n '55p' /etc/mkinitcpio.conf | awk -F= '{print $2}')\e[0m" + echo -e "SSH file = \e[33m$(sed -n '33p' /etc/ssh/sshd_config)\e[0m" + echo -e "Localtime = \e[33m$(date +%H:%M\ \ \ %Y/%m/%d)\e[0m" + echo -e "Sudoers = \e[33m$(sed -n '125p' /etc/sudoers)\e[0m" + echo -e "Shell = \e[33m$(echo $SHELL)\e[0m" + if [[ -f "/etc/default/grub" ]]; then + echo -e "GRUB time = \e[33m$(sed -n '4p' /etc/default/grub)\e[0m" + echo -e "GRUB UUID = \e[33m$(sed -n '7p' /etc/default/grub)\e[0m" + fi + if [[ -f "/etc/vconsole.conf" ]]; then + echo -e "Font size = \e[33m$(cat /etc/vconsole.conf)\e[0m" + fi + echo '----------------------------------------------' +else + echo 'No info file' + exit 1 +fi +read -p 'Continue: (YES/NO) ' ask_continue +if [[ $ask_continue != YES ]]; then + echo -e "\e[31mAborted ...\e[0m" + exit 1 +fi +#************************************************************************************Change information +if [[ -f "/root/info" ]]; then + if [[ $efistub = 1 ]]; then #----------------------------------------------------------EFI Stub + if [[ $encrypt1 = 1 ]]; then #-------------------------------EFI Stub Encrypt + efibootmgr --create --disk $disk1 --part $boot1 --label "Arch Linux LTS" --loader \vmlinuz-linux-lts --unicode "rd.luks.name=${euuid}=system root=/dev/mapper/OS-ROOT rw rd.luks.options=password-echo=no initrd=\initramfs-linux-lts.img" + sed -i '55d' /etc/mkinitcpio.conf + sed -i '55i HOOKS=(base systemd autodetect microcode modconf kms keyboard keymap sd-vconsole block sd-encrypt lvm2 filesystems fsck)' /etc/mkinitcpio.conf + else #-------------------------------------------------------EFI Stub + efibootmgr --create --disk $disk1 --part $boot1 --label "Arch Linux LTS" --loader \vmlinuz-linux-lts --unicode "root=${root1} rw initrd=\initramfs-linux-lts.img" + fi + else #---------------------------------------------------------------------------------GRUB + sed -i '4d' /etc/default/grub + sed -i '4i GRUB_TIMEOUT=0' /etc/default/grub + if [[ $encrypt1 = 1 ]]; then #-------------------------------GEUB Encrypt + sed -i '7d' /etc/default/grub + sed -i "7i GRUB_CMDLINE_LINUX=cryptdevice=UUID=${euuid}:SYSTEM root=/dev/mapper/os-root" /etc/default/grub + sed -i '55d' /etc/mkinitcpio.conf + sed -i '55i HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block encrypt lvm2 filesystems fsck)' /etc/mkinitcpio.conf + fi + if [ -d "/sys/firmware/efi" ]; then #------------------------UEFI + echo -e "\e[32mUEFI\e[0m" + grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=Unix + echo -e "\e[32mgrub installed\e[0m" + grub-mkconfig -o /boot/grub/grub.cfg + echo -e "\e[32mgrub.cfg installed\e[0m" + else #-------------------------------------------------------BIOS + echo -e "\e[32mBIOS\e[0m" + grub-install --target=i386-pc /dev/vda + echo -e "\e[32mgrub installed\e[0m" + grub-mkconfig -o /boot/grub/grub.cfg + echo -e "\e[32mgrub.cfg installed\e[0m" + fi + fi + if [[ $minisys != 1 ]]; then + systemctl enable docker >/dev/null 2>&1 + systemctl enable fail2ban >/dev/null 2>&1 + systemctl enable nginx >/dev/null 2>&1 + mkdir /etc/nginx/conf.d + sed -i '22a \ \ \ \ include /etc/nginx/conf.d/*.conf;' /etc/nginx/nginx.conf + fi +else + echo 'No info file' +fi + +#------------------------------------------------------------------------------Common Services +#Change SSH +sed -i '33d' /etc/ssh/sshd_config +sed -i '33i PermitRootLogin yes' /etc/ssh/sshd_config +#Change issue +echo Welcome back > /etc/issue +#Change hostname +echo $name1 > /etc/hostname +#Change time +ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime +#Change font +echo 'FONT=ter-v28b' > /etc/vconsole.conf +#Change sudoers file +sed -i '125d' /etc/sudoers +sed -i '125i %wheel ALL=(ALL:ALL) ALL' /etc/sudoers +#enable ssh networkmanager +systemctl enable sshd >/dev/null 2>&1 +systemctl enable NetworkManager >/dev/null 2>&1 +#Add my key +bash <(curl -sL sh.lihanzhang.cn/pub) +chsh -s /bin/zsh +ln -s /bin/vim /bin/vi +#Create my folder +mkdir /file +mkdir /www/log -p +mkdir /frp +#arch environment +#Add user +useradd -m olivia -G wheel +mkdir -p ~/.local/bin +curl https://sh.lihanzhang.cn/arch/profile -so ~/.local/bin/.bashrc +curl https://sh.lihanzhang.cn/arch/zshrc -so ~/.zshrc +curl https://sh.lihanzhang.cn/arch/vimrc -so ~/.vimrc +curl https://sh.lihanzhang.cn/arch/fail2ban.conf -so /etc/fail2ban/jail.conf +mkinitcpio -p linux-lts +#************************************************************************************Print Changed information +echo '--------------System Information--------------' +echo -e "HOOKs = \e[33m$(sed -n '55p' /etc/mkinitcpio.conf | awk -F= '{print $2}')\e[0m" +echo -e "SSH file = \e[33m$(sed -n '33p' /etc/ssh/sshd_config)\e[0m" +echo -e "Issue = \e[33m$(cat /etc/issue)\e[0m" +echo -e "Hostname = \e[33m$(cat /etc/hostname)\e[0m" +echo -e "Localtime = \e[33m$(date +%H:%M\ \ \ %Y/%m/%d)\e[0m" +echo -e "Sudoers = \e[33m$(sed -n '125p' /etc/sudoers)\e[0m" +echo -e "Shell = \e[33m$(echo $SHELL)\e[0m" +echo -e "Font size = \e[33m$(cat /etc/vconsole.conf)\e[0m" +if [[ -f "/etc/default/grub" ]]; then + echo -e "GRUB time = \e[33m$(sed -n '4p' /etc/default/grub)\e[0m" + echo -e "GRUB UUID = \e[33m$(sed -n '7p' /etc/default/grub)\e[0m" +fi +echo '----------------------------------------------' +rm -rf /root/info +rm -rf /arch_config.sh +echo -e "\e[32m------Please change password------\e[0m" diff --git a/arch/fail2ban.conf b/arch/fail2ban.conf new file mode 100644 index 0000000..6f1e79b --- /dev/null +++ b/arch/fail2ban.conf @@ -0,0 +1,10 @@ +[sshd] +enabled = true +port = ssh +filter = sshd +backend = systemd +logpath = journal +maxretry = 3 +bantime = 1d +findtime = 10m +action = iptables[name=SSH, port=ssh, protocol=tcp] diff --git a/arch/profile b/arch/profile new file mode 100644 index 0000000..b46b08e --- /dev/null +++ b/arch/profile @@ -0,0 +1,56 @@ +#!/bin/bash +code() { + if [ $# -eq 0 ]; then + echo "Usage: code [-d]