diff --git a/README.md b/README.md index 859ed8a..536bc7c 100644 --- a/README.md +++ b/README.md @@ -22,27 +22,29 @@ For more information on the PHP implementation please see the [readme](../master keep reading... -ElasticSearch -============== +ElasticSearch Support +===================== + +Important pyDat 3.0 ElasticSearch Notes: -The ElasticSearch backend code is still under testing, please consider the following before using ES as a backend: +Note this is the only release (and overdue) for 3.0 as work is under way for pyDat 4.0. +pyDat 4.0 will remove support for MongoDB and requires a minimum of ElasticSearch 5.2 but +should be easier to work with and considerably faster due to significant improvements in +ElasticSearch 5.x. It will also, more than likely, require a full re-ingestion of source +data. -- Some things might be broken - - I.e., some error handling might be non-existent -- There might be random debug output printed out -- The search language might not be complete -- The data template used with ElasticSearch might change - - Which means you might have ot re-ingest all of your data at some point! +This release supports only ElasticSearch 2.x !! PreReqs to run with ElasticSearch: - ElasticSearch installed somewhere -- python elasticsearch library (pip install elasticsearch) +- python elasticsearch library (pip install elasticsearch>=2.0.0,<3.0.0) - python lex yacc library (pip install ply) - below specified prereqs too ElasticSearch Scripting + ElasticSearch comes with dynamic Groovy scripting disabled due to potential sandbox breakout issues with the Groovy container. Unfortunately, the only way to do certain things in ElasticSearch is via this scripting language. Because the default installation of ES does not have a work-around, there is a setting called ES_SCRIPTING_ENABLED in the pyDat settings file which is set to False by default. When set to True, the pyDat advanced search capability will expose an extra feature called 'Unique Domains' which given search results that will return multiple results for a given domain (e.g., due to multiple versions of a domain matching) will return only the latest entry instead of all entries. Before setting this option to True, you must install a script server-side on every ES node -- to do this, please copy the file called \_score.groovy from the es_scripts directory to your scripts directory located in the elasticsearch configuration directory. On package-based installs of ES on RedHat/CentOS or Ubuntu this should be /etc/elasticsearch/scripts. If the scripts directory does not exist, please create it. Note you have to restart the Node for it to pick up the script. ElasticSearch Plugins @@ -76,48 +78,74 @@ all data is ingested properly. Anyone setting up their database, should read the script before running it to ensure they've tweaked it for their setup. The following is the output from elasticsearch_populate -h -
-Usage: elasticsearch_populate.py [options]
+Version 3.0 introduces ElasticSearch 2.x as a backend for whois data
 
-Options:
+
+usage: elasticsearch_populate.py [-h] (-f FILE | -d DIRECTORY) [-e EXTENSION]
+                                 [-r] [-v] [--vverbose] [-s]
+                                 [-x EXCLUDE | -n INCLUDE] [-o COMMENT]
+                                 [-u [ES_URI [ES_URI ...]]] [-p INDEX_PREFIX]
+                                 [-i IDENTIFIER] [-B BULK_SIZE]
+                                 [--optimize-import] [-t THREADS]
+                                 [--bulk-serializers BULK_SERIALIZERS]
+                                 [--bulk-threads BULK_THREADS]
+                                 [--enable-delta-indexes]
+
+optional arguments:
   -h, --help            show this help message and exit
-  -f FILE, --file=FILE  Input CSV file
-  -d DIRECTORY, --directory=DIRECTORY
-                        Directory to recursively search for CSV files -
-                        prioritized over 'file'
-  -e EXTENSION, --extension=EXTENSION
+  -f FILE, --file FILE  Input CSV file
+  -d DIRECTORY, --directory DIRECTORY
+                        Directory to recursively search for CSV files --
+                        mutually exclusive to '-f' option
+  -e EXTENSION, --extension EXTENSION
                         When scanning for CSV files only parse files with
                         given extension (default: 'csv')
-  -i IDENTIFIER, --identifier=IDENTIFIER
-                        Numerical identifier to use in update to signify
-                        version (e.g., '8' or '20140120')
-  -t THREADS, --threads=THREADS
-                        Number of workers, defaults to 2. Note that each
-                        worker will increase the load on your ES cluster
-  -B BULK_SIZE, --bulk-size=BULK_SIZE
-                        Size of Bulk Insert Requests
+  -r, --redo            Attempt to re-import a failed import or import more
+                        data, uses stored metatdata from previous import (-o,
+                        -n, and -x not required and will be ignored!!)
   -v, --verbose         Be verbose
   --vverbose            Be very verbose (Prints status of every domain parsed,
                         very noisy)
   -s, --stats           Print out Stats after running
-  -x EXCLUDE, --exclude=EXCLUDE
+  -x EXCLUDE, --exclude EXCLUDE
                         Comma separated list of keys to exclude if updating
                         entry
-  -n INCLUDE, --include=INCLUDE
+  -n INCLUDE, --include INCLUDE
                         Comma separated list of keys to include if updating
                         entry (mutually exclusive to -x)
-  -o COMMENT, --comment=COMMENT
+  -o COMMENT, --comment COMMENT
                         Comment to store with metadata
-  -r, --redo            Attempt to re-import a failed import or import more
-                        data, uses stored metatdata from previous import (-o
-                        and -x not required and will be ignored!!)
-  -u ES_URI, --es-uri=ES_URI
-                        Location of ElasticSearch Server (e.g.,
-                        foo.server.com:9200)
-  -p INDEX_PREFIX, --index-prefix=INDEX_PREFIX
+  -u [ES_URI [ES_URI ...]], --es-uri [ES_URI [ES_URI ...]]
+                        Location(s) of ElasticSearch Server (e.g.,
+                        foo.server.com:9200) Can take multiple endpoints
+  -p INDEX_PREFIX, --index-prefix INDEX_PREFIX
                         Index prefix to use in ElasticSearch (default: whois)
-  --bulk-threads=BULK_THREADS
-                        How many threads to use for making bulk requests to ES
+  -i IDENTIFIER, --identifier IDENTIFIER
+                        Numerical identifier to use in update to signify
+                        version (e.g., '8' or '20140120')
+  -B BULK_SIZE, --bulk-size BULK_SIZE
+                        Size of Bulk Elasticsearch Requests
+  --optimize-import     If enabled, will change ES index settings to speed up
+                        bulk imports, but if the cluster has a failure, data
+                        might be lost permanently!
+  -t THREADS, --threads THREADS
+                        Number of workers, defaults to 2. Note that each
+                        worker will increase the load on your ES cluster since
+                        it will try to lookup whatever record it is working on
+                        in ES
+  --bulk-serializers BULK_SERIALIZERS
+                        How many threads to spawn to combine messages from
+                        workers. Only increase this if you're are running a
+                        lot of workers and one cpu is unable to keep up with
+                        the load
+  --bulk-threads BULK_THREADS
+                        How many threads to spawn to send bulk ES messages.
+                        The larger your cluster, the more you can increase
+                        this
+  --enable-delta-indexes
+                        If enabled, will put changed entries in a separate
+                        index. These indexes can be safely deleted if space is
+                        an issue, also provides some other improvements
 
diff --git a/docker/apache.config b/docker/apache.config index 9d5b667..85746fd 100644 --- a/docker/apache.config +++ b/docker/apache.config @@ -197,7 +197,7 @@ WSGIScriptAlias "/" "/opt/WhoDat/pydat/pydat/wsgi.py" process-group=pydat applic # Static content - CSS, Javascript, images, etc. Alias /static/ /opt/WhoDat/pydat/pydat/static/ - + Order allow,deny Allow from all diff --git a/docker/requirements.txt b/docker/requirements.txt index a5b20a1..6f31a30 100644 --- a/docker/requirements.txt +++ b/docker/requirements.txt @@ -2,6 +2,6 @@ pymongo requests unicodecsv markdown -django -elasticsearch +django<=1.11.12 +elasticsearch>=2.0.0,<3.0.0 ply diff --git a/pydat/pydat/ajax.py b/pydat/pydat/ajax.py index 6969f5b..398b8c2 100644 --- a/pydat/pydat/ajax.py +++ b/pydat/pydat/ajax.py @@ -3,7 +3,7 @@ from django.conf import settings from django.template import RequestContext -from django.core.urlresolvers import reverse +from django.urls import reverse from django.shortcuts import render_to_response, HttpResponse import urllib diff --git a/pydat/pydat/settings.py b/pydat/pydat/settings.py index 5dfc355..e03569a 100644 --- a/pydat/pydat/settings.py +++ b/pydat/pydat/settings.py @@ -10,8 +10,6 @@ DEBUG = False -TEMPLATE_DEBUG = DEBUG - SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) HANDLER = 'mongo' @@ -135,56 +133,63 @@ STATIC_URL = '/static/' # Additional locations of static files -STATICFILES_DIRS = ( +STATICFILES_DIRS = [ # Put strings here, like "/home/html/static" or "C:/www/django/static". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. - os.path.join(SITE_ROOT, 'static'), -) +] # List of finder classes that know how to find static files in # various locations. -STATICFILES_FINDERS = ( +STATICFILES_FINDERS = [ 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', -# 'django.contrib.staticfiles.finders.DefaultStorageFinder', -) +] # Make this unique, and don't share it with anybody. SECRET_KEY = 'o=skwv+igf2%#6n&p!nd##w(a*wqugkcq4-2=wugz0(715*!l#' -# List of callables that know how to import templates from various sources. -TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', -# 'django.template.loaders.eggs.Loader', -) - TEST_RUNNER = 'django.test.runner.DiscoverRunner' -MIDDLEWARE_CLASSES = ( +MIDDLEWARE = [ 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', + #'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', # Uncomment the next line for simple clickjacking protection: # 'django.middleware.clickjacking.XFrameOptionsMiddleware', -) +] ROOT_URLCONF = 'pydat.urls' # Python dotted path to the WSGI application used by Django's runserver. WSGI_APPLICATION = 'pydat.wsgi.application' -TEMPLATE_DIRS = ( - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. - os.path.join(SITE_ROOT, 'templates'), -) -INSTALLED_APPS = ( +_TEMPLATE_DIRS_ =[os.path.join(SITE_ROOT, 'templates')] +TEMPLATES = [ + { + "BACKEND": "django.template.backends.django.DjangoTemplates", + "DIRS": _TEMPLATE_DIRS_, + "OPTIONS":{ + "context_processors":[ + 'django.contrib.auth.context_processors.auth', + 'django.template.context_processors.debug', + 'django.template.context_processors.i18n', + 'django.template.context_processors.media', + 'django.template.context_processors.static', + 'django.template.context_processors.tz', + 'django.contrib.messages.context_processors.messages', + 'django.template.context_processors.csrf' + ], + 'debug': DEBUG, + }, + + }, +] + +INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', @@ -196,7 +201,7 @@ # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', 'pydat', -) +] # A sample logging configuration. The only tangible logging # performed by this configuration is to send an email to diff --git a/pydat/pydat/templates/base.html b/pydat/pydat/templates/base.html index 00ff23f..89e7cf4 100644 --- a/pydat/pydat/templates/base.html +++ b/pydat/pydat/templates/base.html @@ -1,15 +1,16 @@ +{% load static %} pyDat: {% block title %}WHOIS exploration{% endblock %} - - - + + + {% block css %} {% endblock %} - - - + + + {% block js_constants %} {% endblock %} - + {% block js %} {% endblock %} diff --git a/pydat/pydat/templates/domain_results.html b/pydat/pydat/templates/domain_results.html index a8f3408..38c08f6 100644 --- a/pydat/pydat/templates/domain_results.html +++ b/pydat/pydat/templates/domain_results.html @@ -1,4 +1,5 @@ {% extends 'base.html' %} +{% load static %} {% block title %}Domain Search{% endblock %} @@ -24,9 +25,9 @@ {% block js %} {% if legacy_search %} - + {% else %} - + {% endif %} {%endblock %} diff --git a/pydat/pydat/templates/nosearchbase.html b/pydat/pydat/templates/nosearchbase.html index 3f1338f..2f4f954 100644 --- a/pydat/pydat/templates/nosearchbase.html +++ b/pydat/pydat/templates/nosearchbase.html @@ -1,15 +1,16 @@ +{% load static %} pyDat: {% block title %}WHOIS exploration{% endblock %} - - - + + + {% block css %} {% endblock %} - - - + + + {% block js_constants %} {% endblock %} - + {% block js %} {% endblock %} diff --git a/pydat/pydat/templates/pdns_results.html b/pydat/pydat/templates/pdns_results.html index eb8b407..3699f51 100644 --- a/pydat/pydat/templates/pdns_results.html +++ b/pydat/pydat/templates/pdns_results.html @@ -1,4 +1,5 @@ {% extends 'base.html' %} +{% load static %} {% block title %}pDNS{% endblock %} @@ -10,7 +11,7 @@ {% endblock %} {% block js %} - + {% endblock %} {% block searchBar %} diff --git a/pydat/pydat/templates/rpdns_results.html b/pydat/pydat/templates/rpdns_results.html index c2aeb98..17e54d0 100644 --- a/pydat/pydat/templates/rpdns_results.html +++ b/pydat/pydat/templates/rpdns_results.html @@ -1,4 +1,5 @@ {% extends 'base.html' %} +{% load static %} {% block title %}pDNS{% endblock %} @@ -10,7 +11,7 @@ {% endblock %} {% block js %} - + {% endblock %} {% block searchBar %} diff --git a/pydat/pydat/templates/stats.html b/pydat/pydat/templates/stats.html index 40f008c..c87c31f 100644 --- a/pydat/pydat/templates/stats.html +++ b/pydat/pydat/templates/stats.html @@ -1,7 +1,8 @@ {% extends 'nosearchbase.html' %} +{% load static %} {% block css %} - + {% endblock %} {% block js_constants %} @@ -62,8 +63,8 @@ {% endblock %} {% block js %} - - + + {% endblock %} {% block page %} diff --git a/pydat/pydat/urls.py b/pydat/pydat/urls.py index c4f2fa1..fce809c 100644 --- a/pydat/pydat/urls.py +++ b/pydat/pydat/urls.py @@ -1,50 +1,51 @@ -from django.conf.urls import patterns, url +from django.conf.urls import url from django.conf import settings +from pydat import ajax, views -urlpatterns = patterns('', - url(r'^$', 'pydat.views.index', name='index'), +urlpatterns = [ + url(r'^$', views.index, name='index'), - url(r'^domains/(?P.*)/(?P.*)/$', 'pydat.views.domains'), - url(r'^domains/$', 'pydat.views.domains', name='domains'), + url(r'^domains/(?P.*)/(?P.*)/$', views.domains), + url(r'^domains/$', views.domains, name='domains'), - url(r'^pdns_results/(?P.*)/$', 'pydat.views.pdns', name='pdns_rest'), - url(r'^pdns_results/$', 'pydat.views.pdns', name='pdns_results'), - url(r'^pdns_search/$', 'pydat.views.pdns_index', name='pdns'), + url(r'^pdns_results/(?P.*)/$', views.pdns, name='pdns_rest'), + url(r'^pdns_results/$', views.pdns, name='pdns_results'), + url(r'^pdns_search/$', views.pdns_index, name='pdns'), - url(r'^pdnsr_results/(?P.*)/(?P.*)/$', 'pydat.views.pdns_r', name='pdns_r_rest'), - url(r'^pdnsr_results/$', 'pydat.views.pdns_r', name='pdns_r_results'), - url(r'^pdnsr_search/$', 'pydat.views.rpdns_index', name='pdns_r'), + url(r'^pdnsr_results/(?P.*)/(?P.*)/$', views.pdns_r, name='pdns_r_rest'), + url(r'^pdnsr_results/$', views.pdns_r, name='pdns_r_results'), + url(r'^pdnsr_search/$', views.rpdns_index, name='pdns_r'), - url(r'^ajax/metadata/$', 'pydat.ajax.metadata'), - url(r'^ajax/metadata/(?P.*)/$', 'pydat.ajax.metadata'), + url(r'^ajax/metadata/$', ajax.metadata), + url(r'^ajax/metadata/(?P.*)/$', ajax.metadata), - url(r'^ajax/domain/(?P.*)/diff/(?P.*)/(?P.*)/$', 'pydat.ajax.domain_diff'), - url(r'^ajax/domain/(?P.*)/(?P.*)/(?P.*)/$', 'pydat.ajax.domain'), - url(r'^ajax/domain/(?P.*)/latest/$', 'pydat.ajax.domain_latest'), - url(r'^ajax/domain/(?P.*)/(?P.*)/$', 'pydat.ajax.domain'), - url(r'^ajax/domain/(?P.*)/$', 'pydat.ajax.domain'), - url(r'^ajax/domain/$', 'pydat.ajax.domain', name='ajax_domain'), + url(r'^ajax/domain/(?P.*)/diff/(?P.*)/(?P.*)/$', ajax.domain_diff), + url(r'^ajax/domain/(?P.*)/(?P.*)/(?P.*)/$', ajax.domain), + url(r'^ajax/domain/(?P.*)/latest/$', ajax.domain_latest), + url(r'^ajax/domain/(?P.*)/(?P.*)/$', ajax.domain), + url(r'^ajax/domain/(?P.*)/$', ajax.domain), + url(r'^ajax/domain/$', ajax.domain, name='ajax_domain'), - url(r'^ajax/domains/(?P.*)/(?P.*)/(?P.*)/(?P.*)/$', 'pydat.ajax.domains' ), - url(r'^ajax/domains/(?P.*)/(?P.*)/latest/$', 'pydat.ajax.domains_latest' ), - url(r'^ajax/domains/(?P.*)/(?P.*)/(?P.*)/$', 'pydat.ajax.domains' ), - url(r'^ajax/domains/(?P.*)/(?P.*)/$', 'pydat.ajax.domains' ), - url(r'^ajax/domains/$', 'pydat.ajax.domains', name='ajax_domains'), + url(r'^ajax/domains/(?P.*)/(?P.*)/(?P.*)/(?P.*)/$', ajax.domains ), + url(r'^ajax/domains/(?P.*)/(?P.*)/latest/$', ajax.domains_latest ), + url(r'^ajax/domains/(?P.*)/(?P.*)/(?P.*)/$', ajax.domains ), + url(r'^ajax/domains/(?P.*)/(?P.*)/$', ajax.domains ), + url(r'^ajax/domains/$', ajax.domains, name='ajax_domains'), - url(r'^ajax/dataTable/(?P.*)/(?P.*)/(?P.*)/(?P.*)/$', 'pydat.ajax.dataTable' ), - url(r'^ajax/dataTable/$', 'pydat.ajax.dataTable', name='ajax_dataTable'), + url(r'^ajax/dataTable/(?P.*)/(?P.*)/(?P.*)/(?P.*)/$', ajax.dataTable ), + url(r'^ajax/dataTable/$', ajax.dataTable, name='ajax_dataTable'), - url(r'^ajax/resolve/(?P.*)/$', 'pydat.ajax.resolve'), - url(r'^ajax/resolve/$', 'pydat.ajax.resolve', name='ajax_resolve'), -) + url(r'^ajax/resolve/(?P.*)/$', ajax.resolve), + url(r'^ajax/resolve/$', ajax.resolve, name='ajax_resolve'), +] if settings.HANDLER == 'es': #Enable ES specific urls - urlpatterns += patterns('', - url(r'^advdomains/$', 'pydat.views.advdomains', name='advdomains'), - url(r'^ajax/query/$', 'pydat.ajax.advanced_search', name='ajax_advanced'), - url(r'^ajax/advDataTable/$', 'pydat.ajax.advDataTable', name='ajax_advDataTable'), - url(r'^stats/$', 'pydat.views.stats', name='stats'), - url(r'^help/$', 'pydat.views.help', name='help'), - ) + urlpatterns.extend([ + url(r'^advdomains/$', views.advdomains, name='advdomains'), + url(r'^ajax/query/$', ajax.advanced_search, name='ajax_advanced'), + url(r'^ajax/advDataTable/$', ajax.advDataTable, name='ajax_advDataTable'), + url(r'^stats/$', views.stats, name='stats'), + url(r'^help/$', views.help, name='help'), + ]) diff --git a/pydat/pydat/views.py b/pydat/pydat/views.py index c4acb8a..dd1c34a 100644 --- a/pydat/pydat/views.py +++ b/pydat/pydat/views.py @@ -2,8 +2,7 @@ import socket from django.conf import settings -from django.template import RequestContext -from django.shortcuts import render_to_response, HttpResponse +from django.shortcuts import render, HttpResponse from django.http import QueryDict import urllib @@ -11,13 +10,13 @@ from pydat.handlers import handler from pydat.handlers import passive -def __renderErrorResponse__(request, view, message, data = None): +def __renderErrorResponse__(request, view, message, data=None): d = {'error': message} if data is not None: d.update(data) - context = __createRequestContext__(request, d) - return render_to_response(view, context) + context = __createRequestContext__(d) + return render(request, view, context=context) def __renderErrorPage__(request, message, data = None): @@ -25,10 +24,10 @@ def __renderErrorPage__(request, message, data = None): if data is not None: d.update(data) - context = __createRequestContext__(request, d) - return render_to_response('error.html', context) + context = __createRequestContext__(d) + return render(request, 'error.html', context=context) -def __createRequestContext__(request, data = None): +def __createRequestContext__(data=None): #Default to adding search forms to every context search_f = domain_form() pdns_f = pdns_form() @@ -59,23 +58,23 @@ def __createRequestContext__(request, data = None): else: ctx_var['active'] = 0 - return RequestContext(request, ctx_var) + return ctx_var def index(request): if settings.HANDLER == 'es': legacy = False else: legacy = True - context = __createRequestContext__(request, data = { 'legacy_search': legacy}) - return render_to_response('domain.html', context) + context = __createRequestContext__(data = { 'legacy_search': legacy}) + return render(request, 'domain.html', context=context) def pdns_index(request): - context = __createRequestContext__(request) - return render_to_response('pdns.html', context) + context = __createRequestContext__() + return render(request, 'pdns.html', context=context) def rpdns_index(request): - context = __createRequestContext__(request) - return render_to_response('rpdns.html', context) + context = __createRequestContext__() + return render(request, 'rpdns.html', context=context) def stats(request): stats = handler.cluster_stats() @@ -90,11 +89,11 @@ def stats(request): if lastten[0]['metadata'] == 0: lastten = lastten[1:] - context = __createRequestContext__(request, data = {'domainStats': stats['domainStats'], + context = __createRequestContext__(data = {'domainStats': stats['domainStats'], 'histogram': stats['histogram'], 'lastten': lastten, 'lastimport': lastimport}) - return render_to_response('stats.html', context) + return render(request, 'stats.html', context=context) def help(request): try: @@ -104,12 +103,12 @@ def help(request): except: helptxt = "Unable to render help text." - context = __createRequestContext__(request, data = {'help': helptxt}) - return render_to_response('help.html', context) + context = __createRequestContext__(data = {'help': helptxt}) + return render(request, 'help.html', context=context) def about(request): - context = __createRequestContext__(request) - return render_to_response('about.html', context) + context = __createRequestContext__() + return render(request, 'about.html', context=context) def advdomains(request): @@ -130,8 +129,8 @@ def advdomains(request): if not search_f.is_valid(): return __renderErrorResponse__(request, 'domain.html', '', {'advdomain_form': search_f, 'legacy_search': False}) #return __renderErrorPage__(request, '', {'advdomain_form': search_f}) - #context = __createRequestContext__(request, data = { 'advdomain_form': search_f } ) - #return render_to_response('domain.html', context) + #context = __createRequestContext__(data = { 'advdomain_form': search_f } ) + #return render(request, 'domain.html', context=context) fmt = search_f.cleaned_data['fmt'] or 'normal' search_string = search_f.cleaned_data['query'] @@ -142,13 +141,13 @@ def advdomains(request): if fmt == 'normal': - context = __createRequestContext__(request, data = { 'search_string': urllib.quote(search_string) or '', + context = __createRequestContext__(data = { 'search_string': urllib.quote(search_string) or '', 'query_unique': query_unique, 'advdomain_form': search_f, 'legacy_search': False, }) - return render_to_response('domain_results.html', context) + return render(request, 'domain_results.html', context=context) else: filt_key = search_f.cleaned_data['filt'] try: @@ -223,14 +222,14 @@ def domains(request, key=None, value=None): low_version_js = 'null' if high_version == None: high_version_js = 'null' - context = __createRequestContext__(request, data = { 'key': urllib.quote(key), + context = __createRequestContext__(data = { 'key': urllib.quote(key), 'value': urllib.quote(value), 'low_version': low_version_js, 'high_version': high_version_js, 'domain_form': search_f, 'legacy_search': True, }) - return render_to_response('domain_results.html', context) + return render(request, 'domain_results.html', context=context) else: results = handler.search(key, value, filt=filt, limit=limit, low = low_version) @@ -280,11 +279,11 @@ def pdns(request, domain = None): results = passive.request_pdns(domain, absolute, rrtypes, limit, pretty) if fmt == 'normal': if results['success']: - context = __createRequestContext__(request, {'results': results, + context = __createRequestContext__({'results': results, 'inverse': False, 'pdns_form': pdns_f, }) - return render_to_response('pdns_results.html', context) + return render(request, 'pdns_results.html', context=context) else: return __renderErrorPage__(request, results['error'], {'pdns_form': pdns_f}) elif fmt == 'json': @@ -340,8 +339,8 @@ def pdns_r(request, key = None, value = None): results = passive.request_pdns_reverse(key, value, rrtypes, limit, pretty) if fmt == 'normal': if results['success']: - context = __createRequestContext__(request, {'results': results, 'inverse': True, 'pdns_r_form': pdns_r_f}) - return render_to_response('pdns_results.html', context) + context = __createRequestContext__({'results': results, 'inverse': True, 'pdns_r_form': pdns_r_f}) + return render(request, 'pdns_results.html', context=context) else: return __renderErrorPage__(request, results['error'], {'pdns_r_form':pdns_r_f}) elif fmt == 'json':