Skip to content

Instantly share code, notes, and snippets.

@Eterna1
Created August 8, 2019 06:49
Show Gist options
  • Save Eterna1/48a91da882b6305bef4f5f63e3994759 to your computer and use it in GitHub Desktop.
Save Eterna1/48a91da882b6305bef4f5f63e3994759 to your computer and use it in GitHub Desktop.
service.py
#! /usr/bin/python
import subprocess
import sys
import time
from threading import Timer
def kill(proc):
proc.kill()
def main():
server = sys.stdin.readline()
server = server.strip()
server_len = 0
while server_len < min(128,len(server)) and (server[server_len] == '/' or server[server_len] == '.' or server[server_len] == ':' or server[server_len].isalnum()):
server_len += 1
server = server[:server_len]
if not server.startswith("http://") and not server.startswith("https://"):
print "incorrect url"
exit(0)
args = [
'./binary/chrome',
'--enable-blink-features=MojoJS',
'--disable-gpu',
'--headless',
'--repl', #this flag makes chrome not to exit right after the webpage is loaded, this flag is not a part of the CTF challenge
server
]
proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
time.sleep(10)
proc.kill()
stdout = proc.stdout.read()
print 'STDOUT:{}'.format(stdout)
stderr = proc.stderr.read()
print 'STDERR:{}'.format(stderr)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment