代码拉取完成,页面将自动刷新
同步操作将从 chuanjiao10/kasini3000_agent_linux 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#
DL='https://download.fastgit.org/powershell/powershell/releases/v7.1.5/powershell-7.1.5-linux-alpine-x64.tar.gz'
MIRROR='https://github.com.cnpmjs.org/PowerShell/PowerShell/releases/download/v7.1.5/powershell-7.1.5-linux-alpine-x64.tar.gz'
if grep -iEq 'alpine' /etc/issue || grep -iEq 'alpine' /etc/*-release
then
echo 'linux is alpine'
if [ -h /usr/bin/pwsh ]
then
echo 'powershell installed on alpine'
if grep -Eq 'powershell' /etc/ssh/sshd_config
then
echo 'powershell_sshd_good'
exit 0
else
echo '' >> /etc/ssh/sshd_config
echo 'Subsystem powershell /usr/bin/pwsh -sshs -NoLogo -NoProfile' >> /etc/ssh/sshd_config
echo 'UseDNS no' >> /etc/ssh/sshd_config
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
rc-service sshd restart
echo 'powershell_sshd_fixed'
exit 0
fi
else
echo 'installing powershell now'
apk update
apk add --no-cache \
ca-certificates \
less \
ncurses-terminfo-base \
krb5-libs \
libgcc \
libintl \
libssl1.1 \
libstdc++ \
tzdata \
userspace-rcu \
zlib \
icu-libs \
curl \
lttng-ust \
wget
cd /tmp
mkdir -p /opt/microsoft/powershell/7
for i in `seq 1 6`
do
rm -rf /tmp/powershell*.tar.gz
wget $DL
if [ $? -eq 0 ]
then
DOWNLOAD_END=1
break
else
wget $MIRROR
if [ $? -eq 0 ]
then
DOWNLOAD_END=1
break
else
echo '下载pwsh失败!'
sleep 3
fi
fi
done
if ((DOWNLOAD_END=1))
then
echo '下载pwsh成功!'
else
echo '多次下载pwsh失败!脚本退出!'
exit 2
fi
DDDD=`find /tmp -iname 'powershell*.tar.gz'`
echo $DDDD
tar -C /opt/microsoft/powershell/7 -xf ${DDDD}
if [ -x /opt/microsoft/powershell/7/pwsh ]
then
ln -s /opt/microsoft/powershell/7/pwsh /usr/bin/pwsh
else
echo '安装pwsh失败!脚本退出!'
exit 4
fi
if grep -Eq 'powershell' /etc/ssh/sshd_config
then
echo 'powershell_sshd_good'
exit 0
else
echo '' >> /etc/ssh/sshd_config
echo 'Subsystem powershell /usr/bin/pwsh -sshs -NoLogo -NoProfile' >> /etc/ssh/sshd_config
echo 'UseDNS no' >> /etc/ssh/sshd_config
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
rc-service sshd restart
echo 'powershell_sshd_fixed'
exit 0
fi
fi
else
echo 'linux not alpine'
exit 3
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。