Skip to content

Commit

Permalink
optionally allow to trust insecure certificates
Browse files Browse the repository at this point in the history
  • Loading branch information
gronke committed Feb 17, 2017
1 parent d5ddd91 commit 7304216
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 9 additions & 1 deletion wig/classes/request2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import concurrent.futures
import hashlib
import re
import ssl
import string
import random
import urllib.request
Expand Down Expand Up @@ -217,6 +218,7 @@ def __init__(self, options, data):
self.threads = options['threads']
self.proxy = options['proxy']
self.user_agent = options['user_agent']
self.insecure = options['insecure']

self.data = data
self.cache = data['cache']
Expand All @@ -242,6 +244,12 @@ def _create_fetcher(self, redirect_handler=True):

if redirect_handler:
args.append(RedirectHandler)

if self.insecure == True:
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
args.append(urllib.request.HTTPSHandler(context=ctx))

opener = urllib.request.build_opener(*args)
opener.addheaders = [('User-agent', self.user_agent)]
Expand Down Expand Up @@ -353,4 +361,4 @@ def run(self, run_type=None, fp_lists=[]):
for future in concurrent.futures.as_completed(future_list):
self.requested.put(future.result())

return self.requested
return self.requested
6 changes: 5 additions & 1 deletion wig/wig.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def __init__(self, args):
'user_agent': args.user_agent,
'proxy': args.proxy,
'verbosity': args.verbosity,
'insecure': args.insecure,
'threads': 10,
'batch_size': 20,
'run_all': args.run_all,
Expand All @@ -77,7 +78,7 @@ def __init__(self, args):
'no_cache_load': args.no_cache_load,
'no_cache_save': args.no_cache_save,
'write_file': args.output_file,
'subdomains': args.subdomains
'subdomains': args.subdomains,
}

self.data = {
Expand Down Expand Up @@ -327,6 +328,9 @@ def parse_args(url=None):
parser.add_argument('--verbosity', '-v', action='count', default=0,
help='Increase verbosity. Use multiple times for more info')

parser.add_argument('--insecure', '-i', action='store_true', dest='insecure', default=False,
help='Do not verify encrypted connections')

parser.add_argument('--proxy', dest='proxy', default=None,
help='Tunnel through a proxy (format: localhost:8080)')

Expand Down

0 comments on commit 7304216

Please sign in to comment.