Skip to content

Instantly share code, notes, and snippets.

@stevemclaugh
Created September 28, 2018 14:58
Show Gist options
  • Save stevemclaugh/f9d153329b01a8faf1654982859296d2 to your computer and use it in GitHub Desktop.
Save stevemclaugh/f9d153329b01a8faf1654982859296d2 to your computer and use it in GitHub Desktop.
# Save this file as 'Dockerfile' in an empty directory
# and build the image with the following command:
# docker build -t wgettor .
FROM alpine
RUN apk update && \
apk add wget curl tor privoxy supervisor
RUN echo "forward-socks5 / 127.0.0.1:9050 ." >> /etc/privoxy/config
RUN mkdir -p /etc/supervisor/conf.d/ && \
echo '[supervisord]' > /etc/supervisor/conf.d/config && \
echo '' >> /etc/supervisor/conf.d/config && \
echo '[program:tor]' >> /etc/supervisor/conf.d/config && \
echo 'command=/usr/bin/tor -f /etc/tor/torrc' >> /etc/supervisor/conf.d/config
## Tor socks proxy config file
RUN echo 'Log notice stdout' > /etc/tor/torrc && \
echo 'SocksPort 127.0.0.1:9050' > /etc/tor/torrc
WORKDIR /download/
## Single page
CMD /usr/bin/supervisord -c /etc/supervisor/conf.d/config && privoxy /etc/privoxy/config && sleep 1 && curl --socks5-hostname 127.0.0.1:9050 icanhazip.com >> wgettor_ips.txt && wget $URL -e use_proxy=yes -e http_proxy=127.0.0.1:8118 && rm supervisord.log && rm supervisord.pid
## Recursive
#CMD /usr/bin/supervisord -c /etc/supervisor/conf.d/config && privoxy /etc/privoxy/config && sleep 1 && wget -r -np -erobots=off --wait=0.02 --random-wait --page-requisites $URL -e use_proxy=yes -e http_proxy=127.0.0.1:8118 && curl --socks5-hostname 127.0.0.1:9050 icanhazip.com >> wgettor_ips.txt && rm supervisord.log && rm supervisord.pid
## Example use
# docker run --rm -ti --volume /user/whatever/Downloads/:/download/ -e URL=http://google.com wgettor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment