Разлика между версии на „Инсталиране на Dionaea и DionaeaFR“
от БАРЗИКТ Wiki
(→Стартиране на Dionaea) |
(→Инсталиране на DionaeaFR) |
||
(10 intermediate revisions by the same user not shown) | |||
Ред 11: | Ред 11: | ||
==Инсталиране на библиотеки и инструменти== | ==Инсталиране на библиотеки и инструменти== | ||
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
− | sudo apt-get install libudns-dev libglib2.0-dev libssl-dev libcurl4-openssl-dev libreadline-dev libsqlite3-dev python-dev libtool automake autoconf build-essential subversion git-core flex bison pkg-config libnl-3-dev libnl-genl-3-dev libnl-nf-3-dev libnl-route-3-dev sqlite3 cvs python-pip python3 python3-dev python3-yaml check cython3 libemu-dev libev-dev libloudmouth1-dev libnetfilter-queue-dev libpcap-dev | + | sudo apt-get install libudns-dev libglib2.0-dev libssl-dev libcurl4-openssl-dev libreadline-dev libsqlite3-dev python-dev libtool automake autoconf build-essential subversion git-core flex bison pkg-config libnl-3-dev libnl-genl-3-dev libnl-nf-3-dev libnl-route-3-dev sqlite3 cvs python-pip python3 python3-dev python3-yaml check cython3 libemu-dev libev-dev libloudmouth1-dev libnetfilter-queue-dev libpcap-dev python3-bson-ext python3-bson python-bson-ext npm |
</pre> | </pre> | ||
Ред 44: | Ред 44: | ||
=Инсталиране на DionaeaFR= | =Инсталиране на DionaeaFR= | ||
==Инсталиране на библиотеки и инструменти== | ==Инсталиране на библиотеки и инструменти== | ||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
sudo apt-get install python-pip python-netaddr python-dev git unzip | sudo apt-get install python-pip python-netaddr python-dev git unzip | ||
</pre> | </pre> | ||
Ред 73: | Ред 74: | ||
cd /opt/ | cd /opt/ | ||
− | sudo wget http://nodejs.org/dist/ | + | sudo wget http://nodejs.org/dist/v8.1.2/node-v8.1.2.tar.gz |
− | sudo tar xzvf node- | + | sudo tar xzvf node-v8.1.2.tar.gz |
− | cd node- | + | cd node-v8.1.2 |
sudo ./configure | sudo ./configure | ||
sudo make | sudo make | ||
Ред 97: | Ред 98: | ||
sudo cp /opt/DionaeaFR/DionaeaFR/settings.py.dist /opt/DionaeaFR/DionaeaFR/settings.py | sudo cp /opt/DionaeaFR/DionaeaFR/settings.py.dist /opt/DionaeaFR/DionaeaFR/settings.py | ||
+ | |||
+ | sudo mkdir /var/run/dionaeafr | ||
+ | |||
+ | sudo ln -s /usr/bin/nodejs /usr/bin/node | ||
</pre> | </pre> | ||
==Редактиране на файл ''manage.php''== | ==Редактиране на файл ''manage.php''== | ||
− | Изтриват се редовете след '''from.django.import''' до '''execute_from_command_line''': | + | Изтриват се редовете след '''from.django.import''' до '''execute_from_command_line'''. Файлът трябва да има следния вид: |
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | #!/usr/bin/env python | ||
+ | import os | ||
+ | import sys | ||
+ | |||
+ | if __name__ == "__main__": | ||
+ | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "DionaeaFR.settings") | ||
+ | |||
+ | from django.core.management import execute_from_command_line | ||
+ | |||
+ | execute_from_command_line(sys.argv) | ||
+ | </pre> | ||
+ | |||
+ | ==Редактира се кинфигурационния файл ''/opt/DionaeaFR/DionaeaFR/settings.py''== | ||
+ | Променя пътя към базата данни на Dionea: | ||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | DATABASES = { | ||
+ | 'default': { | ||
+ | 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. | ||
+ | 'NAME': '/opt/dionaea/var/dionaea/dionaea.sqlite', | ||
+ | 'USER': '', # Not used with sqlite3. | ||
+ | 'PASSWORD': '', # Not used with sqlite3. | ||
+ | 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. | ||
+ | 'PORT': '', # Set to empty string for default. Not used with sqlite3. | ||
+ | }, | ||
+ | 'OPTIONS': { | ||
+ | 'timeout': 60, | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | ==Стартиране на сървъра на DionaeaFR== | ||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | cd /opt/DionaeaFR/ | ||
+ | sudo python manage.py collectstatic | ||
+ | sudo python manage.py runserver 0.0.0.0:8000 | ||
+ | </pre> | ||
+ | |||
+ | ==(опционално) Редактиране на файл /opt/DionaeaFR/DionaeaFR/Templates/table.html== | ||
+ | Поради бъг се налага редактиране на файла table.html: | ||
+ | <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap;white-space: -pre-wrap;white-space: -o-pre-wrap; word-wrap: break-word"> | ||
+ | {% spaceless %} | ||
+ | {% load django_tables2 %} | ||
+ | {% load i18n %} | ||
+ | {% block table %} | ||
+ | <table {% if table.attrs %} {{ table.attrs.as_html }}{% endif %}> | ||
+ | {% block table.thead %} | ||
+ | <thead> | ||
+ | <tr> | ||
+ | {% for column in table.columns %} | ||
+ | {% if column.orderable %} | ||
+ | <th {{ column.attrs.th.as_html }}><a | ||
+ | href="{% querystring table.prefixed_order_by_field=column.order_by_alias.next %}">{{ column.header }}</a> | ||
+ | </th> | ||
+ | {% else %} | ||
+ | <th {{ column.attrs.th.as_html }}>{{ column.header }}</th> | ||
+ | {% endif %} | ||
+ | {% endfor %} | ||
+ | </tr> | ||
+ | </thead> | ||
+ | {% endblock table.thead %} | ||
+ | {% block table.tbody %} | ||
+ | <tbody> | ||
+ | {% for row in table.page.object_list|default:table.rows %} | ||
+ | {% block table.tbody.row %} | ||
+ | <tr class="{% cycle "odd" "even" %}"> | ||
+ | {% for column, cell in row.items %} | ||
+ | <td {{ column.attrs.td.as_html }}>{{ cell }}</td> | ||
+ | {% endfor %} | ||
+ | </tr> | ||
+ | {% endblock table.tbody.row %} | ||
+ | {% empty %} | ||
+ | {% if table.empty_text %} | ||
+ | {% block table.tbody.empty_text %} | ||
+ | <tr> | ||
+ | <td colspan="{{ table.columns|length }}">{{ table.empty_text }}</td> | ||
+ | </tr> | ||
+ | {% endblock table.tbody.empty_text %} | ||
+ | {% endif %} | ||
+ | {% endfor %} | ||
+ | </tbody> | ||
+ | {% endblock table.tbody %} | ||
+ | {% block table.tfoot %} | ||
+ | <tfoot></tfoot> | ||
+ | {% endblock table.tfoot %} | ||
+ | </table> | ||
+ | {% endblock table %} | ||
+ | |||
+ | {% if table.page %} | ||
+ | {% with table.page.paginator.count as total %} | ||
+ | {% with table.page.object_list|length as count %} | ||
+ | {% block pagination %} | ||
+ | <div class="pagination pagination-centered"> | ||
+ | <ul> | ||
+ | {% if table.page.has_previous %} | ||
+ | {% block pagination.previous %} | ||
+ | <li class="previous"> | ||
+ | <a href="{% querystring table.prefixed_page_field=table.page.previous_page_number %}">{% trans "Previous" %}</a> | ||
+ | </li>{% endblock pagination.previous %} | ||
+ | {% else %} | ||
+ | <li class="previous disabled"><a href="">Previous</a></li> | ||
+ | {% endif %} | ||
+ | {% if table.page.has_next %} | ||
+ | {% block pagination.next %} | ||
+ | <li class="next"> | ||
+ | <a href="{% querystring table.prefixed_page_field=table.page.next_page_number %}">{% trans "Next" %}</a> | ||
+ | </li>{% endblock pagination.next %} | ||
+ | {% else %} | ||
+ | <li class="next disabled"><a href="">Previous</a></li> | ||
+ | {% endif %} | ||
+ | </ul> | ||
+ | </div> | ||
+ | {% endblock pagination %} | ||
+ | {% endwith %} | ||
+ | {% endwith %} | ||
+ | {% endif %} | ||
+ | {% endspaceless %} | ||
</pre> | </pre> |
Текуща версия към 00:09, 28 юни 2017
Процедурата е описана за Ubuntu Server 16.04
Съдържание
- 1 Инсталиране на Dionaea
- 2 Инсталиране на DionaeaFR
- 2.1 Инсталиране на библиотеки и инструменти
- 2.2 Инсталиране на DionaeaFR
- 2.3 Редактиране на файл manage.php
- 2.4 Редактира се кинфигурационния файл /opt/DionaeaFR/DionaeaFR/settings.py
- 2.5 Стартиране на сървъра на DionaeaFR
- 2.6 (опционално) Редактиране на файл /opt/DionaeaFR/DionaeaFR/Templates/table.html
Инсталиране на Dionaea
Обновяване на Ubuntu
sudo apt-get update sudo apt-get upgrade
Инсталиране на библиотеки и инструменти
sudo apt-get install libudns-dev libglib2.0-dev libssl-dev libcurl4-openssl-dev libreadline-dev libsqlite3-dev python-dev libtool automake autoconf build-essential subversion git-core flex bison pkg-config libnl-3-dev libnl-genl-3-dev libnl-nf-3-dev libnl-route-3-dev sqlite3 cvs python-pip python3 python3-dev python3-yaml check cython3 libemu-dev libev-dev libloudmouth1-dev libnetfilter-queue-dev libpcap-dev python3-bson-ext python3-bson python-bson-ext npm
Изтегляне на Dionaea
cd /opt/ sudo git clone https://github.com/DinoTools/dionaea.git
Компилиране на Dionaea
cd /opt/dionaea sudo autoreconf -vi sudo ./configure --prefix=/opt/dionaea --with-python=/usr/bin/python3 --with-cython-dir=/usr/bin --with-ev-include=/opt/dionaea/include --with-ev-lib=/opt/dionaea/lib --with-emu-lib=/opt/dionaea/lib/ --with-emu-include=/opt/dionaea/include/ --with-nl-include=/opt/dionaea/include --with-nl-lib=/opt/dionaea/lib/ sudo make sudo make install
Копиране на конфигурационния файл
sudo cp /opt/dionaea/etc/dionaea/dionaea.cfg /opt/dionaea/etc/dionaea/dionaea.conf
Стартиране на Dionaea
cd /opt/dionaea/bin sudo ./dionaea
Инсталиране на DionaeaFR
Инсталиране на библиотеки и инструменти
sudo apt-get install python-pip python-netaddr python-dev git unzip
Инсталиране на DionaeaFR
sudo pip install Django==1.8 sudo pip install pygeoip sudo pip install django-pagination sudo pip install django-filter==0.11.0 sudo pip install django-tables2 sudo pip install django-compressor sudo pip install django-htmlmin sudo pip install django-appconf sudo pip install htmlmin sudo pip install netaddr cd /opt/ sudo wget https://github.com/benjiec/django-tables2-simplefilter/archive/master.zip -O django-tables2-simplefilter.zip sudo unzip django-tables2-simplefilter.zip sudo mv django-tables2-simplefilter-master/ django-tables2-simplefilter/ cd django-tables2-simplefilter/ sudo python setup.py install cd /opt/ sudo git clone https://github.com/bro/pysubnettree.git cd pysubnettree/ sudo python setup.py install cd /opt/ sudo wget http://nodejs.org/dist/v8.1.2/node-v8.1.2.tar.gz sudo tar xzvf node-v8.1.2.tar.gz cd node-v8.1.2 sudo ./configure sudo make sudo make install sudo npm install -g less sudo npm install -g promise cd /opt/ sudo wget https://github.com/RootingPuntoEs/DionaeaFR/archive/master.zip -O DionaeaFR.zip sudo unzip DionaeaFR.zip sudo mv DionaeaFR-master/ DionaeaFR cd /opt/ sudo wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz sudo wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz sudo gunzip GeoLiteCity.dat.gz sudo gunzip GeoIP.dat.gz sudo mv GeoIP.dat DionaeaFR/DionaeaFR/static sudo mv GeoLiteCity.dat DionaeaFR/DionaeaFR/static sudo cp /opt/DionaeaFR/DionaeaFR/settings.py.dist /opt/DionaeaFR/DionaeaFR/settings.py sudo mkdir /var/run/dionaeafr sudo ln -s /usr/bin/nodejs /usr/bin/node
Редактиране на файл manage.php
Изтриват се редовете след from.django.import до execute_from_command_line. Файлът трябва да има следния вид:
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "DionaeaFR.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
Редактира се кинфигурационния файл /opt/DionaeaFR/DionaeaFR/settings.py
Променя пътя към базата данни на Dionea:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'NAME': '/opt/dionaea/var/dionaea/dionaea.sqlite', 'USER': '', # Not used with sqlite3. 'PASSWORD': '', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. }, 'OPTIONS': { 'timeout': 60, } }
Стартиране на сървъра на DionaeaFR
cd /opt/DionaeaFR/ sudo python manage.py collectstatic sudo python manage.py runserver 0.0.0.0:8000
(опционално) Редактиране на файл /opt/DionaeaFR/DionaeaFR/Templates/table.html
Поради бъг се налага редактиране на файла table.html:
{% spaceless %} {% load django_tables2 %} {% load i18n %} {% block table %} <table {% if table.attrs %} {{ table.attrs.as_html }}{% endif %}> {% block table.thead %} <thead> <tr> {% for column in table.columns %} {% if column.orderable %} <th {{ column.attrs.th.as_html }}><a href="{% querystring table.prefixed_order_by_field=column.order_by_alias.next %}">{{ column.header }}</a> </th> {% else %} <th {{ column.attrs.th.as_html }}>{{ column.header }}</th> {% endif %} {% endfor %} </tr> </thead> {% endblock table.thead %} {% block table.tbody %} <tbody> {% for row in table.page.object_list|default:table.rows %} {% block table.tbody.row %} <tr class="{% cycle "odd" "even" %}"> {% for column, cell in row.items %} <td {{ column.attrs.td.as_html }}>{{ cell }}</td> {% endfor %} </tr> {% endblock table.tbody.row %} {% empty %} {% if table.empty_text %} {% block table.tbody.empty_text %} <tr> <td colspan="{{ table.columns|length }}">{{ table.empty_text }}</td> </tr> {% endblock table.tbody.empty_text %} {% endif %} {% endfor %} </tbody> {% endblock table.tbody %} {% block table.tfoot %} <tfoot></tfoot> {% endblock table.tfoot %} </table> {% endblock table %} {% if table.page %} {% with table.page.paginator.count as total %} {% with table.page.object_list|length as count %} {% block pagination %} <div class="pagination pagination-centered"> <ul> {% if table.page.has_previous %} {% block pagination.previous %} <li class="previous"> <a href="{% querystring table.prefixed_page_field=table.page.previous_page_number %}">{% trans "Previous" %}</a> </li>{% endblock pagination.previous %} {% else %} <li class="previous disabled"><a href="">Previous</a></li> {% endif %} {% if table.page.has_next %} {% block pagination.next %} <li class="next"> <a href="{% querystring table.prefixed_page_field=table.page.next_page_number %}">{% trans "Next" %}</a> </li>{% endblock pagination.next %} {% else %} <li class="next disabled"><a href="">Previous</a></li> {% endif %} </ul> </div> {% endblock pagination %} {% endwith %} {% endwith %} {% endif %} {% endspaceless %}