csirtgadgets / massive-octo-spice

DEPRECATED - USE v3 (bearded-avenger)

Home Page:https://github.com/csirtgadgets/bearded-avenger-deploymentkit/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Facing issue in CIF server Output format test

diveshshah opened this issue · comments

Hi ,

We have installed CIF server and its client .
Now we are checking basic out put format except of CSV other format is working.

$ cif --otype ipv4 --limit 5 --format csv
Traceback (most recent call last):
File "/usr/local/bin/cif", line 9, in
load_entry_point('py-cifsdk==2.0.0a2', 'console_scripts', 'cif')()
File "/usr/local/lib/python2.7/dist-packages/cifsdk/client.py", line 415, in main
print(ret)
File "/usr/local/lib/python2.7/dist-packages/cifsdk/format/cifcsv.py", line 27, in repr
y = (y[:self.max_field_size] + '..') if len(y) > self.max_field_size else y
TypeError: object of type 'float' has no len()

kindly please help us to come out.

Thanks
Divesh Shah

commented

what does the default output show?

Hi,

We are getting output like this.

soc@SQDK9:~$ sudo cif --otype ipv4 --limit 5 --format csv
[sudo] password for soc:
Traceback (most recent call last):
File "/usr/local/bin/cif", line 9, in
load_entry_point('py-cifsdk==2.0.0a2', 'console_scripts', 'cif')()
File "/usr/local/lib/python2.7/dist-packages/cifsdk/client.py", line 415, in main
print(ret)
File "/usr/local/lib/python2.7/dist-packages/cifsdk/format/cifcsv.py", line 27, in repr
y = (y[:self.max_field_size] + '..') if len(y) > self.max_field_size else y
TypeError: object of type 'float' has no len()

This is our cifcsv.py file detail, where error is showing:-

from cifsdk.format.plugin import Plugin
import csv

try:
from StringIO import StringIO
except ImportError:
from io import StringIO

class Csv(Plugin):

def init(self, _args, *_kwargs):
super(Csv, self).init(_args, *_kwargs)

def repr(self):
si = StringIO()
cw = csv.writer(si)
for obs in self.data:
r = []
for c in self.cols:
y = obs.get(c) or ''
if type(y) is list:
y = ','.join(y)
if type(y) == int:
y = str(y)

y = (y[:self.max_field_size] + '..') if len(y) > self.max_field_size else y
r.append(y.encode('utf-8'))
cw.writerow(r)
return si.getvalue().strip('\r\n')

Thank & Regards
Divesh Shah

From: "Wes" notifications@github.com
To: "csirtgadgets" massive-octo-spice@noreply.github.com
Cc: "diveshshah" divesh.shah@sequretek.com, "Author" author@noreply.github.com
Sent: Monday, August 8, 2016 5:56:48 PM
Subject: Re: [csirtgadgets/massive-octo-spice] Facing issue in CIF server Output format test (#437)

what does the default output show?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub , or mute the thread .

y = (y[:self.max_field_size] + '..') if len(y) > self.max_field_size else y
r.append(y.encode('utf-8'))
cw.writerow(r)
return si.getvalue().strip('\r\n')

Thank & Regards
Divesh Shah

From: "Wes" notifications@github.com
To: "csirtgadgets" massive-octo-spice@noreply.github.com
Cc: "diveshshah" divesh.shah@sequretek.com, "Author" author@noreply.github.com
Sent: Monday, August 8, 2016 5:56:48 PM
Subject: Re: [csirtgadgets/massive-octo-spice] Facing issue in CIF server Output format test (#437)

what does the default output show?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub , or mute the thread .

commented

what does the output look like if you remove the --format csv ?

Hi,

If we remove --format csv
we are getting output like this, is it a correct one??

i think its look like format table.

soc@SQDK9:~$ sudo cif --otype ipv4 --limit 5
+-------+----------+----------------------+----------------------+----------------+-------+----+--------+----------------------------------+------------+-------------+-----------------+-----------------------+-----------+
| tlp | group | lasttime | reporttime | observable | otype | cc | asn | asn_desc | confidence | description | tags | rdata | provider |
+-------+----------+----------------------+----------------------+----------------+-------+----+--------+----------------------------------+------------+-------------+-----------------+-----------------------+-----------+
| green | everyone | 2016-08-08T18:36:28Z | 2016-08-08T18:36:28Z | 213.92.11.253 | ipv4 | IT | 3313 | INET-AS , IT | 12.949 | | whitelist,rdata | corrieredellosport.it | alexa.com |
| green | everyone | 2016-08-08T18:36:28Z | 2016-08-08T18:36:28Z | 104.25.239.18 | ipv4 | US | 13335 | CLOUDFLARENET CloudFlare, Inc... | 12.949 | | whitelist,rdata | moviescounter.com | alexa.com |
| green | everyone | 2016-08-08T18:36:28Z | 2016-08-08T18:36:28Z | 125.77.194.203 | ipv4 | CN | 133775 | CHINATELECOM-FUJIAN-XIAMEN-IDC.. | 12.949 | | whitelist,rdata | sonhoo.com | alexa.com |
| green | everyone | 2016-08-08T18:36:28Z | 2016-08-08T18:36:28Z | 169.198.1.251 | ipv4 | US | 16677 | AZO AutoZone Inc, US | 12.949 | | whitelist,rdata | autozone.com | alexa.com |
| green | everyone | 2016-08-08T18:36:32Z | 2016-08-08T18:36:32Z | 104.25.99.102 | ipv4 | US | 13335 | CLOUDFLARENET CloudFlare, Inc... | 12.949 | | whitelist,rdata | wallpaperscraft.com | alexa.com |
+-------+----------+----------------------+----------------------+----------------+-------+----+--------+----------------------------------+------------+-------------+-----------------+-----------------------+-----------+

Thnaks
Divesh Shah

From: "Wes" notifications@github.com
To: "csirtgadgets" massive-octo-spice@noreply.github.com
Cc: "diveshshah" divesh.shah@sequretek.com, "Author" author@noreply.github.com
Sent: Monday, August 8, 2016 6:23:59 PM
Subject: Re: [csirtgadgets/massive-octo-spice] Facing issue in CIF server Output format test (#437)

what does the output look like if you remove the --format csv ?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub , or mute the thread .

commented

yes. are you using the latest version of the python client?

Hi,

i have installed client by link provided in document .
is it latest one?
sudo pip install https://github.com/csirtgadgets/cif-sdk-py/archive/2.0.0a2.tar.gz

Thanks & regards
Divesh Shah

From: "Wes" notifications@github.com
To: "csirtgadgets" massive-octo-spice@noreply.github.com
Cc: "diveshshah" divesh.shah@sequretek.com, "Author" author@noreply.github.com
Sent: Tuesday, August 9, 2016 4:58:56 PM
Subject: Re: [csirtgadgets/massive-octo-spice] Facing issue in CIF server Output format test (#437)

yes. are you using the latest version of the python client?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub , or mute the thread .

commented

the latest is 2.0.0a5 as per:

https://github.com/csirtgadgets/cif-sdk-py/releases

where are you seeing a reference to 2.0.0a2.tar.gz ? we should get that fixed..

Hi,

https://github.com/csirtgadgets/massive-octo-spice/wiki/where-do-i-start

In Overview section.

Thanks
Divesh Shah

From: "Wes" notifications@github.com
To: "csirtgadgets" massive-octo-spice@noreply.github.com
Cc: "diveshshah" divesh.shah@sequretek.com, "Author" author@noreply.github.com
Sent: Tuesday, August 9, 2016 6:05:05 PM
Subject: Re: [csirtgadgets/massive-octo-spice] Facing issue in CIF server Output format test (#437)

the latest is 2.0.0a5 as per:

https://github.com/csirtgadgets/cif-sdk-py/releases

where are you seeing a reference to 2.0.0a2.tar.gz ? we should get that fixed..


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub , or mute the thread .

commented

ahh, ok. missed that reference. fixed, try again with 2.0.0a5 and let us know if it's still an issue. we've fixed a few --format csv issues since 2.0.0a2.

Hi,

Thanks a lot..
Its working.

Please share a exact document link for creating feed.

Divesh Shah

From: "Wes" notifications@github.com
To: "csirtgadgets" massive-octo-spice@noreply.github.com
Cc: "diveshshah" divesh.shah@sequretek.com, "Author" author@noreply.github.com
Sent: Tuesday, August 9, 2016 6:12:22 PM
Subject: Re: [csirtgadgets/massive-octo-spice] Facing issue in CIF server Output format test (#437)

ahh, ok. missed that reference. fixed, try again with 2.0.0a5 and let us know if it's still an issue. we've fixed a few --format csv issues since 2.0.0a2.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub , or mute the thread .