spender-sandbox / cuckoo-modified

Modified edition of cuckoo
395 stars 178 forks source link

Cuckoo Web UI Issue /analysis/* Connection Refused #430

Closed Cuckoo0000 closed 7 years ago

Cuckoo0000 commented 7 years ago

Hi,

I'm able to submit a task using the Web UI, but attempting to view the analysis progress in at /analysis/1 is throwing an exception. Details below:

Request Method:     GET
Request URL:    http://127.0.0.1:8000/analysis/1/
Django Version:     1.10.6
Exception Type:     ConnectionError
Exception Value:    

ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f46968b0910>: Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f46968b0910>: Failed to establish a new connection: [Errno 111] Connection refused)

Exception Location:     /usr/local/lib/python2.7/dist-packages/elasticsearch/connection/http_urllib3.py in perform_request, line 123
Python Executable:  /usr/bin/python
Python Version:     2.7.13
Python Path:    

['/home/cuckoo/cuckoo-modified/web',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/local/lib/python2.7/dist-packages/volatility-2.4-py2.7.egg',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/PILcompat',
 '/usr/lib/python2.7/dist-packages/gtk-2.0',
 '/usr/lib/python2.7/dist-packages/wx-3.0-gtk2',
 '/home/cuckoo/cuckoo-modified/web/..',
 '/home/cuckoo/cuckoo-modified/web/..',
 '/home/cuckoo/cuckoo-modified/web/..',
 '/home/cuckoo/cuckoo-modified/web/..',
 '/home/cuckoo/cuckoo-modified/web/..',
 '/home/cuckoo/cuckoo-modified/web/..',
 '/home/cuckoo/cuckoo-modified',
 '/home/cuckoo/cuckoo-modified/web',
 '/home/cuckoo/cuckoo-modified/web/..']

Server time:    Wed, 29 Mar 2017 12:21:16 +0100

Stacktrace:

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/analysis/1/

Django Version: 1.10.6
Python Version: 2.7.13
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'analysis',
 'compare',
 'api',
 'ratelimit')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'web.headers.CuckooHeaders',
 'ratelimit.middleware.RatelimitMiddleware')

Trace:

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py" in inner
  42.             response = get_response(request)

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _legacy_get_response
  249.             response = self._get_response(request)

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/http.py" in inner
  40.             return func(request, *args, **kwargs)

File "/home/cuckoo/cuckoo-modified/web/analysis/views.py" in report
  726.                     q="info.id : \"%s\"" % task_id

File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/utils.py" in _wrapped
  73.             return func(*args, params=params, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/__init__.py" in search
  569.             doc_type, '_search'), params=params, body=body)

File "/usr/local/lib/python2.7/dist-packages/elasticsearch/transport.py" in perform_request
  318.                 status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)

File "/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/http_urllib3.py" in perform_request
  123.             raise ConnectionError('N/A', str(e), e)

Exception Type: ConnectionError at /analysis/1/
Exception Value: ConnectionError(<urllib3.connection.HTTPConnection object at 0x7f46968b0910>: Failed to establish a new connection: [Errno 111] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x7f46968b0910>: Failed to establish a new connection: [Errno 111] Connection refused)

Thanks.

spender-sandbox commented 7 years ago

It looks like you enabled elasticsearch but didn't configure it properly, or the elastic search engine isn't running?

-Brad

Cuckoo0000 commented 7 years ago

Hi,

Here is the elastic search section of reporting.conf:

# Use ElasticSearch as the "database" which powers Django.
# NOTE: If this is enabled, MongoDB should not be enabled, unless
# search only option is set to yes. Then elastic search is only used for /search web page.
[elasticsearchdb]
enabled = yes
searchonly = no
host = 127.0.0.1
port = 9200
# The report data is indexed in the form of {{index-yyyy.mm.dd}}
# so the below index configuration option is actually an index 'prefix'.
index = cuckoo

Do I need to configure anything else? How can I check if the elastic search engine is running and start it if necessary?

Thanks.

Cuckoo0000 commented 7 years ago

Hi, just to let you know I have resolved this issue. I needed to install and configure elasticsearch.

I used the guide here: https://www.elastic.co/guide/en/elasticsearch/reference/current/deb.html to do so.

Thanks for your help.