Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Dockerfile
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
# docker pull andmyhacks/httpscreenshot
# docker pull jesseosiecki/httpscreenshot

FROM ubuntu:20.04

Expand All@@ -19,3 +19,5 @@ RUN ln -s /etc/httpscreenshot/httpscreenshot.py /usr/bin/httpscreenshot

RUN mkdir -p /etc/httpscreenshot/images
WORKDIR /etc/httpscreenshot/images

ENTRYPOINT ["httpscreenshot"]
7 changes: 6 additions & 1 deletion README.md
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
# httpscreenshot

### Installation via Docker

`docker pull jesseosiecki/httpscreenshot`
`docker run jesseosiecki/httpscreenshot`

### Installation on Ubuntu

#### Via Script

Run `install-dependencies.sh` script as root.

This script has been tested on Ubuntu 14.04.
This script has been tested on Ubuntu 20.04 as *root* (sudo).

### Manually

Expand Down
47 changes: 32 additions & 15 deletions httpscreenshot.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -164,7 +164,7 @@ def parseGnmap(inFile, autodetect):
return targets


def setupBrowserProfile(headless, proxy):
def setupBrowserProfile(headless, proxy, browserType):
browser = None
if (proxy is not None):
service_args = ['--ignore-ssl-errors=true', '--ssl-protocol=any', '--proxy=' + proxy, '--proxy-type=socks5']
Expand All@@ -173,7 +173,18 @@ def setupBrowserProfile(headless, proxy):

while (browser is None):
try:
if (not headless):
if (browserType == 'Chrome' or browserType == 'Chromium'):
service = Service(ChromeDriverManager(log_level=0).install())
coptions = Options()
if headless:
coptions.add_argument("--headless")
coptions.add_argument("--no-sandbox")
coptions.add_argument("--window-size=1024x768")
coptions.add_argument("--ignore-certificate-errors")
coptions.add_argument("--ssl-version-min=tls1")

browser = webdriver.Chrome(service=service, options=coptions)
else:
capabilities = DesiredCapabilities.FIREFOX
capabilities['acceptSslCerts'] = True
fp = webdriver.FirefoxProfile()
Expand All@@ -185,17 +196,15 @@ def setupBrowserProfile(headless, proxy):
fp.set_preference("network.proxy.socks", proxyItems[0])
fp.set_preference("network.proxy.socks_port", int(proxyItems[1]))
fp.set_preference("network.proxy.type", 1)
browser = webdriver.Firefox(firefox_profile=fp, capabilities=capabilities)
else:
service = Service(ChromeDriverManager(log_level=0).install())
coptions = Options()
coptions.add_argument("--headless")
coptions.add_argument("--no-sandbox")
coptions.add_argument("--window-size=1024x768")
coptions.add_argument("--ignore-certificate-errors")
coptions.add_argument("--ssl-version-min=tls1")

browser = webdriver.Chrome(service=service, options=coptions)
fireFoxOptions = webdriver.FirefoxOptions()
if headless:
fireFoxOptions.headless = True

browser = webdriver.Firefox(firefox_profile=fp,
capabilities=capabilities,
options=fireFoxOptions)
browser.set_window_size(1024, 768)

except Exception as e:
print(e)
Expand DownExpand Up@@ -230,6 +239,7 @@ def worker(
tryGUIOnFail,
smartFetch,
proxy,
browserType
):
if debug:
print("[*] Starting worker")
Expand All@@ -241,7 +251,7 @@ def worker(
display = Display(visible=0, size=(800, 600))
display.start()

browser = setupBrowserProfile(headless, proxy)
browser = setupBrowserProfile(headless, proxy, browserType)

except Exception:
print("[-] Oh no! Couldn't create the browser, Selenium blew up")
Expand DownExpand Up@@ -341,7 +351,7 @@ def worker(
display.start()
print("[+] Attempting to fetch with FireFox: " +
curUrl)
browser2 = setupBrowserProfile(False, proxy)
browser2 = setupBrowserProfile(False, proxy, "Firefox")
old_url = browser2.current_url
try:
browser2.get(curUrl.strip())
Expand DownExpand Up@@ -385,7 +395,7 @@ def worker(
exc_traceback)
print("".join("!! " + line for line in lines))
browser.quit()
browser = setupBrowserProfile(headless, proxy)
browser = setupBrowserProfile(headless, proxy, "Firefox")
continue
browser.quit()
display.stop()
Expand DownExpand Up@@ -513,6 +523,12 @@ def signal_handler(signal, frame):
default=False,
help="Run in headless mode (using phantomjs)",
)
parser.add_argument(
"-b",
"--browsertype",
default="Firefox",
help="Choose webdriver{Firefox, Chrome}"
)
parser.add_argument("-w",
"--workers",
default=1,
Expand DownExpand Up@@ -653,6 +669,7 @@ def signal_handler(signal, frame):
args.trygui,
args.smartfetch,
args.proxy,
args.browsertype
),
)
workers.append(p)
Expand Down
8 changes: 4 additions & 4 deletions install-dependencies.sh
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
# Installation Script - tested on a fresh install of Ubuntu 20.04.3 LTS
# Installation Script - tested on a fresh install of Ubuntu 20.04.3 LTS as root (sudo)

# Show all commands being run
#set -x
Expand All@@ -7,11 +7,11 @@
set -e

# Pull packages from apt
sudo apt install -y python3-pip build-essential libssl-dev swig python3-dev
apt install -y python3-pip build-essential libssl-dev swig python3-dev

# Install Google Chrome
wget -O /tmp/google-chrome-stable_current_amd64.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install -y /tmp/google-chrome-stable_current_amd64.deb
apt install -y /tmp/google-chrome-stable_current_amd64.deb

# Install required python packages
pip3 install -r requirements.txt
pip3 install -r requirements.txt