Skip to content

Instantly share code, notes, and snippets.

@JeffreyShran
Forked from si9int/screen.py
Created June 16, 2020 11:04
Show Gist options
  • Save JeffreyShran/40c33b9c15b3c124e4292e4bdefac42e to your computer and use it in GitHub Desktop.
Save JeffreyShran/40c33b9c15b3c124e4292e4bdefac42e to your computer and use it in GitHub Desktop.
Performing screenshots on URLS given via STDIN. Chromium and Chromedriver required! Configuration infile.
#!/usr/bin/env python3
# v.0.1 - by SI9INT (https://si9int.sh)
# Chromium and chromedriver required, be sure to check if both version are the same
# `mkdir screens` to get started, script won't create the folder
import queue, threading, sys
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
CHROME_PATH = '/usr/bin/chromium'
CHROMEDRIVER_PATH = '/home/lin/proto/tools/chromedriver'
WINDOW_SIZE = '1920,1080'
THREADS = 15
chrome_options = Options()
chrome_options.binary_location = CHROME_PATH
chrome_options.add_argument('--headless')
chrome_options.add_argument('--ignore-certificate-errors')
chrome_options.add_argument('--window-size=' + WINDOW_SIZE)
q = queue.Queue(maxsize=0)
threads = []
def screen(name, url):
print('[-] Snapped:', url)
driver = webdriver.Chrome(executable_path=CHROMEDRIVER_PATH, options=chrome_options)
driver.get(url)
driver.save_screenshot('screens/{}.png'.format(name))
driver.close()
def thread_op(q):
while True:
item = q.get()
screen(item[0], item[1])
q.task_done()
for host in sys.stdin:
host = host.strip()
q.put([host.split('://')[1], host])
for t in range(THREADS):
thread = threading.Thread(target=thread_op, args=(q,))
thread.setDaemon(True)
thread.start()
q.join()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment