Browse Source

更新 'main.py'

master
kyxt 6 months ago
parent
commit
bad50b1869
1 changed files with 30 additions and 30 deletions
  1. +30
    -30
      main.py

+ 30
- 30
main.py View File

@@ -1,37 +1,37 @@
import os
import os

# 保存脚本内容到文件
script_content = """#!/bin/bash
wget https://educoder-test-cfiles.oss-cn-hangzhou.aliyuncs.com/test/frp_0.57.0_linux_amd64.tar.gz
tar -zxvf frp_0.57.0_linux_amd64.tar.gz
echo c2VydmVyQWRkciA9ICIxNDMuNjQuMzguNyIKc2VydmVyUG9ydCA9IDM3MDAwCgpbW3Byb3hpZXNdXQpuYW1lID0gInRlc3QtdGNwIgp0eXBlID0gInRjcCIKbG9jYWxJUCA9ICIxMjcuMC4wLjEiCmxvY2FsUG9ydCA9IDIyCnJlbW90ZVBvcnQgPSAzNzAwMQoKW1twcm94aWVzXV0KbmFtZSA9ICJ0ZXN0LXRjcDEiCnR5cGUgPSAidGNwIgpsb2NhbElQID0gIjEyNy4wLjAuMSIKbG9jYWxQb3J0ID0gMTE0MzQKcmVtb3RlUG9ydCA9IDM3MDAy |base64 -d > frp_0.57.0_linux_amd64/frpc.toml
nohup ./frp_0.57.0_linux_amd64/frpc -c ./frp_0.57.0_linux_amd64/frpc.toml &
cat nohup.out
echo 'frp config'
cat ./frp_0.57.0_linux_amd64/frpc.toml
# 保存脚本内容到文件
script_content = """#!/bin/bash
wget https://educoder-test-cfiles.oss-cn-hangzhou.aliyuncs.com/test/frp_0.57.0_linux_amd64.tar.gz
tar -zxvf frp_0.57.0_linux_amd64.tar.gz
echo c2VydmVyQWRkciA9ICIxNDMuNjQuMzguNyIKc2VydmVyUG9ydCA9IDM3MDAwCgpbW3Byb3hpZXNdXQpuYW1lID0gInRlc3QtdGNwIgp0eXBlID0gInRjcCIKbG9jYWxJUCA9ICIxMjcuMC4wLjEiCmxvY2FsUG9ydCA9IDIyCnJlbW90ZVBvcnQgPSAzNzAwMQoKW1twcm94aWVzXV0KbmFtZSA9ICJ0ZXN0LXRjcDEiCnR5cGUgPSAidGNwIgpsb2NhbElQID0gIjEyNy4wLjAuMSIKbG9jYWxQb3J0ID0gMTE0MzQKcmVtb3RlUG9ydCA9IDM3MDAy |base64 -d > frp_0.57.0_linux_amd64/frpc.toml
nohup ./frp_0.57.0_linux_amd64/frpc -c ./frp_0.57.0_linux_amd64/frpc.toml &
cat nohup.out
echo 'frp config'
cat ./frp_0.57.0_linux_amd64/frpc.toml

apt update
echo 'apt update r done'
apt install -y openssh-server
echo 'install openssh-server done'
sleep 2
sed -i 's/#PermitRootLogin[ ]\+prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
sleep 2
echo 'update ssh config done'
apt update
echo 'apt update r done'
apt install -y openssh-server
echo 'install openssh-server done'
sleep 2
sed -i 's/#PermitRootLogin[ ]\+prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
sleep 2
echo 'update ssh config done'
cat /etc/ssh/sshd_config
echo root:Edu_123123|chpasswd
echo 'change pwd done'
sleep 2
service ssh restart
echo 'ssh restart'
while :; service sshd status; service ssh status; do sleep 1; done
echo root:Edu_123123|chpasswd
echo 'change pwd done'
sleep 2
service ssh restart
echo 'ssh restart'
while :; service sshd status; service ssh status; do sleep 1; done
"""

script_path = "setup_script.sh"
script_path = "setup_script.sh"

with open(script_path, "w") as script_file:
    script_file.write(script_content)
with open(script_path, "w") as script_file:
script_file.write(script_content)

# 执行脚本
os.system("sh " + script_path)
       
# 执行脚本
os.system("sh " + script_path)

Loading…
Cancel
Save