Merge pull request #101 from netantho/averez-esworker-fix

esworker: cast to int/float values for fields ending with _int/_float
This commit is contained in:
Anthony VEREZ 2014-05-06 17:11:02 -07:00
Родитель 6d9620bcbd a2d48c31e0
Коммит bc3a28594f
2 изменённых файлов: 11 добавлений и 5 удалений

Просмотреть файл

@ -48,10 +48,10 @@ ADD conf/nginx.conf /etc/nginx/
#Mozdef
RUN (apt-get install -q -y python2.7-dev python-pip curl supervisor wget\
# && curl -L https://github.com/jeffbryner/MozDef/archive/master.tar.gz |tar -C /opt -xz \
# && /bin/ln -s /opt/MozDef-master /opt/MozDef \
&& curl -L https://github.com/netantho/MozDef/archive/averez-docker.tar.gz |tar -C /opt -xz \
&& /bin/ln -s /opt/MozDef-averez-docker /opt/MozDef \
&& curl -L https://github.com/jeffbryner/MozDef/archive/master.tar.gz |tar -C /opt -xz \
&& /bin/ln -s /opt/MozDef-master /opt/MozDef \
# && curl -L https://github.com/netantho/MozDef/archive/averez-esworker-fix.tar.gz |tar -C /opt -xz \
# && /bin/ln -s /opt/MozDef-averez-esworker-fix /opt/MozDef \
&& cd /opt/MozDef && /usr/bin/pip install --verbose --use-mirrors --timeout 30 -r requirements.txt \
&& /usr/bin/pip install --verbose --use-mirrors --timeout 30 uwsgi gevent \
&& mkdir /var/log/mozdef \

Просмотреть файл

@ -219,7 +219,13 @@ def keyMapping(aDict):
if 'details' not in returndict.keys():
returndict[u'details'] = dict()
# add field
returndict[u'details'][unicode(newName)] = toUnicode(v)
if newName.endswith('_int'):
returndict[u'details'][unicode(newName)] = int(v)
elif newName.endswith('_float'):
returndict[u'details'][unicode(newName)] = float(v)
else:
returndict[u'details'][unicode(newName)] = toUnicode(v)
except Exception as e:
sys.stderr.write('esworker exception normalizing the message %r\n' % e)
return None