forked from demisto/content
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintegration-Ipinfo.yml
105 lines (104 loc) · 5.35 KB
/
integration-Ipinfo.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
commonfields:
id: ipinfo
version: -1
name: ipinfo
system: true
display: ipinfo
category: Data Enrichment & Threat Intelligence
image: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAFf0lEQVR42u1Za2wUVRRe7CLCluIDEsHt7jy22PpAUPERrK3FSAzSqGmCP9BEGxMNqPgIUQwB/6HS1p3HLgZUGoOhu3vvne3y1DSpwWioMSptAg0VqGhrrC+oFtBq/aYU2A47j12atiRzkpOZzdx7zvnOPY9773pccskll1xyabyRoFAfr9C5vMyeElW2HlwrqGwFH04sECJs+iUBQozQGwWFrQOY3Xj+CBCnwf3gHkGme8UIk/Dt3nELgN+QKubfSTYAyH+iQgdsWWWfAVD5uAIBw1aKKu1zAsDICEElKJO8sQeBHLA21p6xMimE4dQxXAm2BkByBGBktmNMQEx/9c0KGPDviAEB8yp9cVRBzKiJXx6KNH4dsjeuG0B3wttJvHc4APMHr8QLR7NPPGYTJj3gZegd+eeqmkK8SOz7eZm2hCRiMZfUjGaV2mEB5HdBIbeazb2mofmq4Icf77cA0wlHTR4RQ+G9ibxMQjwaFy9r5ZySLIbwKwZXIxybCW8ft6hAr9vJL9z6yXwA6Td1hkwXDq28F3aIQSlWKqjafeASNNUptgAwKB/hsBpx3S4qxsbGOgGwEsLnWKxGF8pogRNnQU+ThTOqOZXegt50UC8oBjt+CKqkrlBNXGcW90UY9I1NvV8hymSRR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6p8UPlmR5wUCKIeQABPyGvFic1VxZP7OwP40gisAzVW1lljc2swWV7sf8wyFp27xcr33yES7X5ji3DMpPGMA8k4usQJRMhjzf2N3Qq9rtWJm2M+drVuW5lAkglg7+yaOwCR6XXHLJJZdcGqf0P6DbX+u9JytbAAAAAElFTkSuQmCC
description: Use the ipinfo.io API to get data about an IP address
defaultEnabled: true
configuration:
- display: Use system proxy settings
name: proxy
defaultvalue: "false"
type: 8
required: false
- display: API Token (optional)
name: token
defaultvalue: ""
type: 4
required: false
script:
script: |-
var sendRequest = function(url, json) {
var res = http(
url,
{
Method: 'GET',
},
false,
params.proxy
);
if (res.StatusCode < 200 || res.StatusCode >= 300) {
throw 'Failed to query ipinfo, request status code: ' + res.StatusCode + ' and Body: ' + res.Body + '.';
}
return json && res.Body ? JSON.parse(res.Body) : res.Body;
}
var base = 'http://ipinfo.io/';
var token = params.token ? '?token=' + params.token : '';
var jsonSuffix = '/json' + token;
switch (command) {
case 'test-module':
if (sendRequest(base+'8.8.8.8'+jsonSuffix, true)) {
return 'ok';
}
return 'not cool';
case 'ip':
var o = sendRequest(base + args.ip + jsonSuffix, true);
var ec = {IP: {Address: o.ip, Hostname: o.hostname, ASN: o.org, Geo: {
Location: o.loc, Country: o.country, Description: o.city + ', ' + o.region + ', ' + o.postal + ', ' + o.country}}};
ec.DBotScore = {Indicator: args.ip, Type: 'ip', Vendor: 'ipinfo', Score: 0};
var reply = [{Type: entryTypes.note, Contents: o, ContentsFormat: formats.json, HumanReadable: objToMd(o), EntryContext: ec}];
if (o.loc) {
var parts = o.loc.split(',');
reply.push({Type: entryTypes.map, Contents: {lat: parseFloat(parts[0]), lng: parseFloat(parts[1])}, ContentsFormat: formats.json});
}
return reply;
case 'ipinfo_field':
return sendRequest(base + args.ip + '/' + args.field + token, false);
}
type: javascript
commands:
- name: ip
arguments:
- name: ip
required: true
default: true
description: IP address to query. E.g. !ip 1.1.1.1
outputs:
- contextPath: IP.Address
description: The IP address
- contextPath: IP.Hostname
description: The IP hostname
- contextPath: IP.ASN
description: The IP ASN
- contextPath: IP.Geo.Location
description: The IP geographic location in coordinates
- contextPath: IP.Geo.Country
description: The IP country
- contextPath: IP.Geo.Description
description: The IP location as <City, Region, Postal Code, Country>
description: Check IP reputation (when information is available, returns a JSON
with details). Uses all configured Threat Intelligence feeds
- name: ipinfo_field
arguments:
- name: ip
required: true
default: true
description: IP address to query. E.g. !ip 1.1.1.1
- name: field
required: true
auto: PREDEFINED
predefined:
- geo
- loc
- city
- region
- country
- org
- hostname
- phone
description: Name of the field to retrieve. Can be org, city, geo, etc.
description: Retrieve value for a specific field from the IP address information
runonce: false