33 lines
689 B
Python
Executable File
33 lines
689 B
Python
Executable File
#!/usr/bin/env python3
|
|
import random
|
|
import subprocess
|
|
import sys
|
|
|
|
def start(url):
|
|
debug_port = random.randint(9000, 9999)
|
|
chrome_cmd = [
|
|
'/usr/bin/google-chrome',
|
|
'--headless=new',
|
|
'--no-sandbox',
|
|
'--remote-debugging-port=' + str(debug_port),
|
|
url
|
|
]
|
|
|
|
process = subprocess.Popen(
|
|
chrome_cmd,
|
|
stdout=subprocess.DEVNULL,
|
|
stderr=subprocess.DEVNULL,
|
|
start_new_session=True
|
|
)
|
|
|
|
print({
|
|
"pid": process.pid,
|
|
"debug_port": debug_port
|
|
})
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if len(sys.argv) != 2:
|
|
print("Usage: itb_start <url>")
|
|
sys.exit(1)
|
|
start(sys.argv[1]) |