TheHive-Project / Hippocampe

Threat Feed Aggregation, Made Easy
https://thehive-project.org
GNU Affero General Public License v3.0
166 stars 44 forks source link

Can't set space as delimeter parameter in 'feedname.conf' #78

Open AlvaroSainzBarcena opened 4 years ago

AlvaroSainzBarcena commented 4 years ago

Request Type Bug Work Environment

Question Answer
OS version (server) CentOS 7
Hippocampe version / git hash Last
Package Type From source

Problem Description

I tried to add a new source (http://www.malwaredomainlist.com/hostslist/hosts.txt) whose fields are separated by two space characters.

I tried to set the 'delimeter' parameter of the feed config file as space character without success. I tried the following values (none worked): delimiter : \t delimiter : \s delimiter :
delimiter : ' '

Does anyone know what value must be specified? Im trying to achieve it without having to modify python code.

Steps to Reproduce

  1. step 1 - Install Hippocampe
  2. step 2 - Add the new source: http://www.malwaredomainlist.com/hostslist/hosts.txt
  3. step 3 - Launch shadowbook

Thank you.

AlvaroSainzBarcena commented 4 years ago

Finally I modified code, now works the '\s' delimeter as space character:

    if delimiter == '\\s':
            parsedPage = csv.DictReader(parsedPage, fields, extraFields, delimiter = ' ')
    elif delimiter != '\\t':
            parsedPage = csv.DictReader(parsedPage, fields, extraFields, delimiter = delimiter)
    if delimiter == '\\t':
            parsedPage = csv.DictReader(parsedPage, fields, extraFields, dialect = 'excel-tab')
    return parsedPage

This is the end of 'csvParser' function in '.../hippocampe/core/services/modules/shadowbook/parser.py'.