Skip to content

Commit

Permalink
Finish 3.1.0-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
sarus committed May 8, 2020
2 parents 1f332d2 + 9ccea24 commit cc66a45
Show file tree
Hide file tree
Showing 11 changed files with 1,085 additions and 426 deletions.
50 changes: 27 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
# Polarity Shodan Integration

Polarity's Shodan integration gives users access to automated IPv4 and IPv6 lookups against the Shodan Host REST API.

Please see [https://www.shodan.io/](https://www.shodan.io/) for more information.

![image](https://user-images.githubusercontent.com/306319/46555899-e36b6400-c8b2-11e8-9d31-5dc3e34559bc.png)

## Shodan Integration Options

### Shodan API Key

Your Shodan API Key.

## Installation Instructions

Installation instructions for integrations are provided on the [PolarityIO GitHub Page](https://polarityio.github.io/).

## Polarity

Polarity is a memory-augmentation platform that improves and accelerates analyst decision making. For more information about the Polarity platform please see:

https://polarity.io/
# Polarity Shodan Integration

![mode:on demand only](https://img.shields.io/badge/mode-on%20demand%20only-blue.svg)

Polarity's Shodan integration gives users access to automated IPv4 and IPv6 lookups against the Shodan Host REST API. The Shodan REST API restricts searches to 1 per second. The integration will automatically throttle lookups to stay below this limit and will queue up to 15 search requests per API key. If the queue is full, you will receive back a response indicating that the queue is full and will have the option to rerun the search from the Overlay Window.

Please see [https://www.shodan.io/](https://www.shodan.io/) for more information.

| ![image](assets/overlay.png) |
|---|
|*Shodan Example* |

## Shodan Integration Options

### Shodan API Key

Your Shodan API Key.

## Installation Instructions

Installation instructions for integrations are provided on the [PolarityIO GitHub Page](https://polarityio.github.io/).

## Polarity

Polarity is a memory-augmentation platform that improves and accelerates analyst decision making. For more information about the Polarity platform please see:

https://polarity.io/
Binary file added assets/overlay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 37 additions & 4 deletions components/shodan-block.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,37 @@
polarity.export = PolarityComponent.extend({
details: Ember.computed.alias('block.data.details'),

});
polarity.export = PolarityComponent.extend({
data: Ember.computed.alias('block.data'),
details: Ember.computed.alias('block.data.details'),
showDetails: false,
entity: Ember.computed.alias('block.entity'),
message: '',
errorMessage: null,
isRunning: false,
actions: {
toggleDetails: function () {
this.toggleProperty('showDetails');
},
tryAgain: function () {
const outerThis = this;

this.set('message', '');
this.set('errorMessage', '');
this.set('isRunning', true);

this.sendIntegrationMessage({ data: { entity: this.entity } })
.then((newDetails) => {
outerThis.set('message', 'Success!');
outerThis.set('details', newDetails);
})
.catch((err) => {
outerThis.set(
'errorMessage',
`Failed on Retry: ${err.message || err.title || err.description || 'Unknown Reason'}`
);
})
.finally(() => {
this.set('isRunning', false);
outerThis.get('block').notifyPropertyChange('data');
});
}
}
});
103 changes: 68 additions & 35 deletions components/shodan-summary.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,68 @@
'use strict';

polarity.export = PolarityComponent.extend({
details: Ember.computed.alias('block.data.details'),
summaryTags: Ember.computed('details.tags', function(){
let summaryTags = [];

if(this.get('details.city')){
summaryTags.push(this.get('details.city'));
}

if(this.get('details.isp')){
summaryTags.push(this.get('details.isp'));
}

if(this.get('details.country_name')){
summaryTags.push(this.get('details.country_name'));
}

if(this.get('details.org')){
summaryTags.push(this.get('details.org'));
}

let tags = this.get('details.tags');
if(Array.isArray(tags)){
summaryTags = summaryTags.concat(tags);
}

if(summaryTags.length === 0){
summaryTags.push('No Tags');
}
return summaryTags;
})
});

'use strict';

polarity.export = PolarityComponent.extend({
details: Ember.computed.alias('block.data.details'),
entity: Ember.computed.alias('block.entity'),
summaryTags: Ember.computed('details.tags', function() {
let summaryTags = [];

let location = '';
const country = this.get('details.country_name');
const city = this.get('details.city');

if (city && country) {
location = `${city}, ${country}`;
} else if (city) {
location = city;
} else if (country) {
location = country;
}

if (location) {
summaryTags.push(location);
}

if (this.get('details.isp')) {
summaryTags.push(`ISP: ${this.get('details.isp')}`);
}

if (this.get('details.org')) {
summaryTags.push(`Org: ${this.get('details.org')}`);
}

let tags = this.get('details.tags');
if (Array.isArray(tags)) {
summaryTags = summaryTags.concat(tags);
}

if (summaryTags.length === 0) {
summaryTags.push('No Tags');
}
return summaryTags;
}),
actions: {
tryAgain: function() {
const outerThis = this;

this.set('message', '');
this.set('errorMessage', '');
this.set('isRunning', true);

this.sendIntegrationMessage({ data: { entity: this.entity } })
.then((newDetails) => {
outerThis.set('message', 'Success!');
outerThis.set('details', newDetails);
})
.catch((err) => {
outerThis.set(
'errorMessage',
`Failed on Retry: ${err.message || err.title || err.description || 'Unknown Reason'}`
);
})
.finally(() => {
this.set('isRunning', false);
outerThis.get('block').notifyPropertyChange('data');
});
}
}
});
190 changes: 95 additions & 95 deletions config/config.js
Original file line number Diff line number Diff line change
@@ -1,99 +1,99 @@
module.exports = {
/**
* Name of the integration which is displayed in the Polarity integrations user interface
*
* @type String
* @required
*/
name: "Shodan",
/**
* The acronym that appears in the notification window when information from this integration
* is displayed. Note that the acronym is included as part of each "tag" in the summary information
* for the integration. As a result, it is best to keep it to 4 or less characters. The casing used
* here will be carried forward into the notification window.
*
* @type String
* @required
*/
acronym: "SHO",
/**
* Description for this integration which is displayed in the Polarity integrations user interface
*
* @type String
* @optional
*/
description: "IP Lookup Integration for Shodan",
entityTypes: ['IPv4', 'IPv6'],
/**
* An array of style files (css or less) that will be included for your integration. Any styles specified in
* the below files can be used in your custom template.
*
* @type Array
* @optional
*/
"styles": [
"./styles/shodan.less"
],
/**
* Provide custom component logic and template for rendering the integration details block. If you do not
* provide a custom template and/or component then the integration will display data as a table of key value
* pairs.
*
* @type Object
* @optional
*/
block: {
component: {
file: "./components/shodan-block.js"
},
template: {
file: "./templates/shodan-block.hbs"
}
/**
* Name of the integration which is displayed in the Polarity integrations user interface
*
* @type String
* @required
*/
name: "Shodan",
/**
* The acronym that appears in the notification window when information from this integration
* is displayed. Note that the acronym is included as part of each "tag" in the summary information
* for the integration. As a result, it is best to keep it to 4 or less characters. The casing used
* here will be carried forward into the notification window.
*
* @type String
* @required
*/
acronym: "SHO",
/**
* Description for this integration which is displayed in the Polarity integrations user interface
*
* @type String
* @optional
*/
description: "IP Lookup Integration for Shodan",
entityTypes: ["IPv4", "IPv6"],
/**
* An array of style files (css or less) that will be included for your integration. Any styles specified in
* the below files can be used in your custom template.
*
* @type Array
* @optional
*/
styles: ["./styles/shodan.less"],
/**
* Provide custom component logic and template for rendering the integration details block. If you do not
* provide a custom template and/or component then the integration will display data as a table of key value
* pairs.
*
* @type Object
* @optional
*/
block: {
component: {
file: "./components/shodan-block.js"
},
summary: {
component: {
file: './components/shodan-summary.js'
},
template: {
file: './templates/shodan-summary.hbs'
}
template: {
file: "./templates/shodan-block.hbs"
}
},
summary: {
component: {
file: "./components/shodan-summary.js"
},
request: {
// Provide the path to your certFile. Leave an empty string to ignore this option.
// Relative paths are relative to the VT integration's root directory
cert: '',
// Provide the path to your private key. Leave an empty string to ignore this option.
// Relative paths are relative to the VT integration's root directory
key: '',
// Provide the key passphrase if required. Leave an empty string to ignore this option.
// Relative paths are relative to the VT integration's root directory
passphrase: '',
// Provide the Certificate Authority. Leave an empty string to ignore this option.
// Relative paths are relative to the VT integration's root directory
ca: '',
// An HTTP proxy to be used. Supports proxy Auth with Basic Auth, identical to support for
// the url parameter (by embedding the auth info in the uri)
proxy: ''
},
logging: {
level: 'info', //trace, debug, info, warn, error, fatal
},
/**
* Options that are displayed to the user/admin in the Polarity integration user-interface. Should be structured
* as an array of option objects.
*
* @type Array
* @optional
*/
"options": [
{
"key": "apiKey",
"name": "Shodan API Key",
"description": "Your Shodan API Key.",
"default": "",
"type": "text",
"userCanEdit": true,
"adminOnly": false
}
]
template: {
file: "./templates/shodan-summary.hbs"
}
},
request: {
// Provide the path to your certFile. Leave an empty string to ignore this option.
// Relative paths are relative to the VT integration's root directory
cert: "",
// Provide the path to your private key. Leave an empty string to ignore this option.
// Relative paths are relative to the VT integration's root directory
key: "",
// Provide the key passphrase if required. Leave an empty string to ignore this option.
// Relative paths are relative to the VT integration's root directory
passphrase: "",
// Provide the Certificate Authority. Leave an empty string to ignore this option.
// Relative paths are relative to the VT integration's root directory
ca: "",
// An HTTP proxy to be used. Supports proxy Auth with Basic Auth, identical to support for
// the url parameter (by embedding the auth info in the uri)
proxy: "",
rejectUnauthorized: true
},
logging: {
level: "info" //trace, debug, info, warn, error, fatal
},
onDemandOnly: true,
/**
* Options that are displayed to the user/admin in the Polarity integration user-interface. Should be structured
* as an array of option objects.
*
* @type Array
* @optional
*/
options: [
{
key: "apiKey",
name: "Shodan API Key",
description: "Your Shodan API Key.",
default: "",
type: "password",
userCanEdit: true,
adminOnly: false
}
]
};
Loading

0 comments on commit cc66a45

Please sign in to comment.