Find ipv4 address when server created
This commit is contained in:
parent
a3cf49de01
commit
75f7dfa9ed
|
@ -8,6 +8,7 @@ import json
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import base64
|
import base64
|
||||||
|
import time
|
||||||
|
|
||||||
nixos_infect_script="""
|
nixos_infect_script="""
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
@ -73,3 +74,11 @@ if input("Confirm? ")[0] != 'y':
|
||||||
|
|
||||||
res = requests.post("https://api.vultr.com/v2/instances", headers=headers, data=json.dumps(data)).json()
|
res = requests.post("https://api.vultr.com/v2/instances", headers=headers, data=json.dumps(data)).json()
|
||||||
print(res)
|
print(res)
|
||||||
|
|
||||||
|
print("Checking for ipv4...", end="", flush=True)
|
||||||
|
while res['instance']['main_ip'] == '0.0.0.0':
|
||||||
|
print('.', end="", flush=True)
|
||||||
|
res = requests.get(f"https://api.vultr.com/v2/instances/{res['instance']['id']}", headers=headers).json()
|
||||||
|
time.sleep(5)
|
||||||
|
|
||||||
|
print(res['instance']['main_ip'])
|
||||||
|
|
Loading…
Reference in a new issue