Skip to content

Instantly share code, notes, and snippets.

@si9int
Created June 15, 2020 22:49
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save si9int/d2176d894c5e9eca17dfa66fc31b7576 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()
@h3xhash
Copy link

h3xhash commented Jun 20, 2020

good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment