Closed cristobalrosa closed 7 years ago
Fix date serialization issue.
Since we were not specifying the date serializer the deserialization made by jackson was wrong: Using the java sdk I was retrieving a couple of pulses like this:
Pulse{name='test2', description='aa', tags=[], indicators=[]} Created Wed Jul 12 16:39:47 CDT 2017 Modified Wed Jul 12 16:39:47 CDT 2017 Pulse{name='test1', description='', tags=[], indicators=[Indicator{indicator='domain.com', type='DOMAIN', description='lll', created=Wed Jul 12 16:08:32 CDT 2017}]} Created Wed Jul 12 16:21:49 CDT 2017 Modified Wed Jul 12 16:21:20 CDT 2017
And using the python sdk:
{ "adversary": "", "author_name": "cristobal", "created": "2017-07-12T21:08:31.798000", "description": "", "extract_source": [], "id": "xxxx", "indicators": [ { "content": "", "created": "2017-07-12T21:08:32", "description": "lll", "id": 27276, "indicator": "domain.com", "title": "kk", "type": "domain" } ], "industries": [], "modified": "2017-07-12T21:08:48.752000", "name": "test1", "public": 0, "references": [], "revision": 2, "tags": [], "targeted_countries": [], "tlp": "white" }, { "adversary": "", "author_name": "cristobal", "created": "2017-07-12T21:25:07.880000", "description": "aa", "extract_source": [], "id": "yyyy", "indicators": [], "industries": [], "modified": "2017-07-12T21:25:07.880000", "name": "test2", "public": 0, "references": [], "revision": 1, "tags": [], "targeted_countries": [], "tlp": "white" }
The code I've used to test this is like the following:
package com.alienvault.otx; import com.alienvault.otx.connect.OTXConnection; import com.alienvault.otx.model.pulse.Pulse; import java.net.MalformedURLException; import java.net.URISyntaxException; import java.util.List; public class testOtx { public static void main(String[] args) throws MalformedURLException, URISyntaxException { OTXConnection connection = new OTXConnection("yourapikeyhere"); List<Pulse> pulseList = connection.getAllPulses(); for (Pulse pulse : pulseList) { System.out.println(pulse.toString()); System.out.println("Created " + pulse.getCreated().toString()); System.out.println("Modified "+ pulse.getModified().toString()); System.out.println("===================================================="); } } }
Fix date serialization issue.
Since we were not specifying the date serializer the deserialization made by jackson was wrong: Using the java sdk I was retrieving a couple of pulses like this:
And using the python sdk:
The code I've used to test this is like the following: