feat: save connector to a file
This commit is contained in:
parent
4bbc916282
commit
a493ab7e40
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
.api-key
|
||||
.connector
|
||||
|
6
shell.sh
6
shell.sh
@ -3,6 +3,8 @@
|
||||
API_HOST="https://api.ssh.surf"
|
||||
API_KEY=$(cat .api-key)
|
||||
|
||||
if [ ! -f .connector ]; then
|
||||
echo "SSH Connector not found, getting for the first time"
|
||||
[ -z $API_KEY ] && echo "API key not found" && exit 1
|
||||
|
||||
hello=$(curl -w %{http_code} -sH "x-ssh-auth: $API_KEY" $API_HOST/hello -o /dev/null)
|
||||
@ -14,4 +16,8 @@ fi
|
||||
|
||||
CONNECTOR=$(curl -sH "x-ssh-auth: $API_KEY" -X POST -H "content-type: application/json" $API_HOST/exec --data '{ "cmd": "con --list | grep ssh - Port: 22", "pwd": "/root" }' | grep -o 'Connector: [^"]*' | sed 's/Connector: //' | sed 's/\\n//')
|
||||
|
||||
echo $CONNECTOR > .connector
|
||||
fi
|
||||
|
||||
CONNECTOR=$(cat .connector)
|
||||
npx holesail $CONNECTOR
|
||||
|
Loading…
Reference in New Issue
Block a user