├── LICENSE ├── README.md ├── lazyshot.py └── requirements.txt /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Mukesh Dhama 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # LazyShot 3 | The simplest way to take an automated screenshot of given URLs. Easy installation! 4 | 5 | ![LAZYSHOT](https://image.ibb.co/iMLdFc/Group_2.png) 6 | 7 | 8 | 9 | ### Requirements: 10 | * Python >= 2.7 11 | * Selenium, urlparse and termcolor Python library. Please install latest by running the following command. 12 | ``` 13 | pip install -r requirements.txt 14 | ``` 15 | 16 | ### Installation: 17 | Follow these steps to install the Lazyshot. 18 | 19 | * Clone the project using `git` command. 20 | ``` 21 | git clone https://github.com/mdhama/lazyshot.git 22 | ``` 23 | * Go to /lazyshot 24 | 25 | ``` 26 | cd lazyshot 27 | ``` 28 | * Download chromedriver (v2.35) from [here](https://chromedriver.storage.googleapis.com/index.html?path=2.35/) 29 | * Extract zip file. Copy and Paste `chromedriver` to `/path/to/lazyshot/` directory 30 | 31 | * Add alias `chromedriver` into .bash_profile 32 | ``` 33 | cd 34 | nano ~/.bash_profile 35 | 36 | or 37 | 38 | vi ~/.bash_profile 39 | ``` 40 | * Append below line into .bash_profile 41 | ``` 42 | alias chromedriver="~/path/to/lazyshot/chromedriver" 43 | ``` 44 | * Save and exit. Now refresh .bash_profile 45 | ``` 46 | source ~/.bash_profile 47 | ``` 48 | 49 | Done! 50 | 51 | 52 | ### How to use: 53 | 54 | To take screenshots simply run this command 55 | ``` 56 | python lazyshot.py wordlist 57 | ``` 58 | 59 | Screenshots will be saved into Default `outputs` folder. You can pass the custom folder name using 60 | ``` 61 | python lazyshot.py wordlist --out folder_name 62 | ``` 63 | 64 | ### Wordlist: 65 | The wordlist is just a simple data file where each line contains one URL. 66 | 67 | ``` 68 | vi wordlist 69 | 70 | list subdomains/domains 71 | 72 | :wq (exit vim) 73 | ``` 74 | 75 | Wordlist file example content 76 | 77 | ``` 78 | www.example.com 79 | https://foo.example.com 80 | http://bar.expample.com 81 | foo-bar.exmaple.com 82 | ``` 83 | 84 | ### Example: 85 | ``` 86 | python lazyshot.py wordlist --out example 87 | 88 | output: 89 | 90 | _ __ __ _ _ 91 | | | / ___| | | | 92 | | | __ _ _____ _\ `--.| |__ ___ | |_ 93 | | | / _` |_ / | | |`--. \ '_ \ / _ \| __| 94 | | |___| (_| |/ /| |_| /\__/ / | | | (_) | |_ 95 | \_____/\__,_/___|\__, \____/|_| |_|\___/ \__| 96 | __/ | 97 | |___/ By: Mukesh Dhama & Sahil Ahamad 98 | ------------------------------------------------------------- 99 | 100 | 101 | www.example.com is ready. 102 | foo.example.com is ready. 103 | bar.expample.com is ready. 104 | foo-bar.exmaple.com is ready. 105 | ``` 106 | Screenshots will be saved into `example` directory in .png format 107 | 108 | ### License: 109 | MIT License 110 | 111 | 112 | > Any Pull request is greatly appreciated 113 | -------------------------------------------------------------------------------- /lazyshot.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import os 3 | from selenium import webdriver 4 | from urlparse import urlparse 5 | from termcolor import colored, cprint 6 | 7 | from selenium.webdriver.common.keys import Keys 8 | from selenium.webdriver.chrome.options import Options 9 | 10 | cprint(""" 11 | _ __ __ _ _ 12 | | | / ___| | | | 13 | | | __ _ _____ _\ `--.| |__ ___ | |_ 14 | | | / _` |_ / | | |`--. \ '_ \ / _ \| __| 15 | | |___| (_| |/ /| |_| /\__/ / | | | (_) | |_ 16 | \_____/\__,_/___|\__, \____/|_| |_|\___/ \__| 17 | __/ | 18 | |___/ By: Mukesh Dhama & Sahil Ahamad 19 | --------------------------------------------------------- 20 | \n\n""", 'green') 21 | 22 | 23 | 24 | OUTPUT = 'outputs' 25 | INPUT_FILE = sys.argv[1] 26 | 27 | try: 28 | file = open(INPUT_FILE, "r") 29 | except IOError: 30 | cprint ("ERROR: There was an error reading file.\n", 'red') 31 | sys.exit() 32 | 33 | if len(sys.argv) > 3: 34 | if len(sys.argv) < 4: 35 | cprint("ERROR: Missing folder name. eg: --out \n", 'red') 36 | sys.exit() 37 | else: 38 | OUTPUT = sys.argv[3] 39 | 40 | 41 | fileData = tuple(file.readlines()) 42 | file.close() 43 | 44 | if len(fileData) <= 0: 45 | cprint ("ERROR: File is empty! Please data into the file\n", 'red') 46 | sys.exit() 47 | 48 | 49 | def urlParser(url): 50 | o = urlparse(url) 51 | if len(o.scheme) == 'http' or len(o.scheme) == 'https': 52 | return url 53 | elif len(o.path) <= 0: 54 | return False 55 | else: 56 | return 'http://' + o.path 57 | 58 | 59 | def takeScreeshot(url): 60 | if len(url) == 0: 61 | return False 62 | else: 63 | u = urlParser(url.strip()) 64 | if u: 65 | if not os.path.exists(OUTPUT): 66 | os.makedirs(OUTPUT) 67 | 68 | chrome_options = Options() 69 | chrome_options.add_argument("--headless") 70 | driver = webdriver.Chrome(executable_path=os.path.abspath("chromedriver"), chrome_options=chrome_options) 71 | driver.set_window_size(1280, 1024) 72 | driver.get(u) 73 | driver.save_screenshot(os.getcwd() + '/' +OUTPUT + '/screenshot-' + urlparse(url).path + '.png') 74 | return True 75 | else: 76 | return False 77 | 78 | if len(fileData) > 0: 79 | for url in fileData: 80 | result = takeScreeshot(url) 81 | if result: 82 | cprint(url.strip() + ' is ready.', 'green') 83 | sys.exit() 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | selenium 2 | urlparse 3 | termcolor 4 | --------------------------------------------------------------------------------