Created
July 3, 2012 16:52
-
-
Save Alex-Ikanow/3040974 to your computer and use it in GitHub Desktop.
Example of complex scripting in Infinit.e
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"description": "test", | |
"extractType": "File", | |
"file": { | |
"XmlIgnoreValues": [ | |
"DefiningCharacteristicList", | |
"TargetedCharacteristicList", | |
"WeaponTypeList", | |
"PerpetratorList", | |
"VictimList", | |
"EventTypeList", | |
"CityStateProvinceList", | |
"FacilityList" | |
], | |
"XmlPrimaryKey": "icn", | |
"XmlRootLevelValues": ["Incident"], | |
"XmlSourceName": "https://wits.nctc.gov/FederalDiscoverWITS/index.do?N=0&Ntk=ICN&Ntx=mode%20match&Ntt=", | |
"domain": "WORKGROUP", | |
"password": "modus!", | |
"username": "modus" | |
}, | |
"mediaType": "Report", | |
"structuredAnalysis": { | |
"associations": [ | |
{ | |
"creationCriteriaScript": "$FUNC( isOrganizationSpecified(); )", | |
"entity1": "$SCRIPT( return _doc.metadata.perpetrator[0].characteristic + ' from ' + _doc.metadata.perpetrator[0].nationality; )", | |
"entity2": "$FUNC( getOrganizationName(); )", | |
"verb": "member of", | |
"verb_category": "generic relations" | |
}, | |
{ | |
"creationCriteriaScript": "$FUNC( isOrganizationSpecified(); )", | |
"entity1": "Organization", | |
"entity2": "FacilityType", | |
"geo_index": "Location", | |
"iterateOver": "entity1/entity2/geo_index", | |
"time_start": "$SCRIPT( return _doc.metadata.incidentdate[0]; )", | |
"verb": "attacked", | |
"verb_category": "assault/attack" | |
}, | |
{ | |
"creationCriteriaScript": "$FUNC( isOrganizationSpecified(); )", | |
"entity1": "Organization", | |
"entity2": "VictimType", | |
"geo_index": "Location", | |
"iterateOver": "entity1/entity2/geo_index", | |
"time_start": "$SCRIPT( return _doc.metadata.incidentdate[0]; )", | |
"verb": "attacked", | |
"verb_category": "assault/attack" | |
}, | |
{ | |
"creationCriteriaScript": "$FUNC( isOrganizationSpecified(); )", | |
"entity1": "Organization", | |
"entity2": "HostageType", | |
"geo_index": "Location", | |
"iterateOver": "entity1/entity2/geo_index", | |
"time_start": "$SCRIPT( return _doc.metadata.incidentdate[0]; )", | |
"verb": "took hostage", | |
"verb_category": "assault/attack" | |
}, | |
{ | |
"creationCriteriaScript": "$SCRIPT( if (isOrganizationSpecified() == false) return true; )", | |
"entity1": "PersonPerpetrator", | |
"entity2": "FacilityType", | |
"geo_index": "Location", | |
"iterateOver": "entity1/entity2/geo_index", | |
"time_start": "$SCRIPT( return _doc.metadata.incidentdate[0]; )", | |
"verb": "attacked", | |
"verb_category": "assault/attack" | |
}, | |
{ | |
"creationCriteriaScript": "$SCRIPT( if (isOrganizationSpecified() == false) return true; )", | |
"entity1": "PersonPerpetrator", | |
"entity2": "VictimType", | |
"geo_index": "Location", | |
"iterateOver": "entity1/entity2/geo_index", | |
"time_start": "$SCRIPT( return _doc.metadata.incidentdate[0]; )", | |
"verb": "attacked", | |
"verb_category": "assault/attack" | |
}, | |
{ | |
"creationCriteriaScript": "$SCRIPT( if (isOrganizationSpecified() == false) return true; )", | |
"entity1": "PersonPerpetrator", | |
"entity2": "HostageType", | |
"geo_index": "Location", | |
"iterateOver": "entity1/entity2/geo_index", | |
"time_start": "$SCRIPT( return _doc.metadata.incidentdate[0]; )", | |
"verb": "took hostage", | |
"verb_category": "assault/attack" | |
} | |
], | |
"description": "$metadata.summary", | |
"docGeo": { | |
"city": "$SCRIPT( return _doc.metadata.location[0].citystateprovince.city; )", | |
"country": "$SCRIPT( return _doc.metadata.location[0].country; )", | |
"stateProvince": "$SCRIPT( return _doc.metadata.location[0].citystateprovince.stateprovince; )" | |
}, | |
"entities": [ | |
{ | |
"creationCriteriaScript": "$FUNC( isOrganizationSpecified(); )", | |
"dimension": "Who", | |
"disambiguated_name": "$metadata.organization", | |
"type": "Organization", | |
"useDocGeo": false | |
}, | |
{ | |
"dimension": "Where", | |
"disambiguated_name": "$FUNC( getLocationEntity(); )", | |
"iterateOver": "location", | |
"type": "Location", | |
"useDocGeo": true | |
}, | |
{ | |
"entities": [ | |
{ | |
"dimension": "Who", | |
"disambiguated_name": "$FUNC( getVictim(); )", | |
"frequency": "$FUNC( getVictimCount(); )", | |
"type": "VictimType", | |
"useDocGeo": false | |
}, | |
{ | |
"dimension": "Who", | |
"disambiguated_name": "$FUNC( getVictim(); )", | |
"frequency": "$hostagecount", | |
"type": "HostageType", | |
"useDocGeo": false | |
} | |
], | |
"iterateOver": "victim", | |
"useDocGeo": false | |
}, | |
{ | |
"dimension": "Who", | |
"disambiguated_name": "$characteristic from $nationality", | |
"iterateOver": "perpetrator", | |
"type": "PersonPerpetrator", | |
"useDocGeo": false | |
}, | |
{ | |
"dimension": "What", | |
"disambiguated_name": "", | |
"frequency": "1", | |
"iterateOver": "weapontype", | |
"type": "WeaponType", | |
"useDocGeo": false | |
}, | |
{ | |
"dimension": "What", | |
"disambiguated_name": "$FUNC( getEventType(); )", | |
"frequency": "1", | |
"iterateOver": "eventtype", | |
"type": "EventType", | |
"useDocGeo": false | |
}, | |
{ | |
"dimension": "What", | |
"disambiguated_name": "$SCRIPT( var s = (_iterator.indicator == 'Targeted') ? 'Targeted,': ''; s+= _iterator.facilitytype; return s; )", | |
"frequency": "$quantity", | |
"iterateOver": "facility", | |
"type": "FacilityType", | |
"useDocGeo": false | |
} | |
], | |
"publishedDate": "$metadata.incidentdate", | |
"script": "function getLocationEntity() { var s = (_iterator.citystateprovince.city != null) ? _iterator.citystateprovince.city : ''; s+= (s.length > 0) ? ',' : ''; s+= (_iterator.citystateprovince.stateprovince != null) ? _iterator.citystateprovince.stateprovince : ''; s+= (s.length > 0) ? ',' : ''; s+= (_iterator.country != null) ? _iterator.country : ''; return s; } function getVictim() { var indicator = (_iterator.indicator != 'Unknown') ? _iterator.indicator : ''; var victimType = (_iterator.victimtype != 'Unknown') ? _iterator.victimtype : ''; var child = (_iterator.child == 'Yes') ? 'Child' : 'Adult'; var combatant = (_iterator.combatant == 'Yes') ? 'Combatant' : ''; var targeted = (_iterator.targetedcharacteristic != 'None' && _iterator.targetedcharacteristic != 'Unknown') ? _iterator.targetedcharacteristic : ''; var defining = (_iterator.definingcharacteristic != 'None' &&_iterator.definingcharacteristic != 'Unknown') ? _iterator.definingcharacteristic : ''; var s = indicator; if (victimType.length > 0) { if (s.length > 0) { s += ', '; } s += victimType; } if (s.length > 0) { s += ', '; } s += child; if (combatant.length > 0) { if (s.length > 0) { s += ', '; } s += combatant; } if (targeted.length > 0) { if (s.length > 0) { s += ', '; } s += targeted; } if (defining.length > 0) { if (s.length > 0) { s += ', '; } s += defining; } if (s.length > 0) { s += ' from '; } s += _iterator.nationality; return s; } function getVictimCount() { var count = parseInt(_iterator.deadcount, 10) + parseInt(_iterator.woundedcount, 10); return count; } function getEventType() { var s = _value; if (_doc.metadata.assassination[0] == 'Yes') s += ', Assassination'; if (_doc.metadata.suicide[0] == 'Yes') s += ', Suicide'; if (_doc.metadata.ied[0] == 'Yes') s += ', IED'; return s; } function getEventTypeFull() { var s = _doc.metadata.eventtype[0]; if (_doc.metadata.assassination[0] == 'Yes') s += ', Assassination'; if (_doc.metadata.suicide[0] == 'Yes') s += ', Suicide'; if (_doc.metadata.ied[0] == 'Yes') s += ', IED'; return s;} function isOrganizationSpecified() { if (_doc.metadata.organization != null && _doc.metadata.organization[0].toString().toLowerCase() == 'no group') { return false; } else { return true; } }function getOrganizationName() { if (_doc.metadata.organization != null && _doc.metadata.organization[0].toString().toLowerCase() != 'no group') { return _doc.metadata.organization[0]; } }", | |
"scriptEngine": "JavaScript", | |
"title": "$metadata.subject" | |
}, | |
"tags": [ | |
"incidents", | |
"nctc", | |
"terrorism", | |
"wits", | |
"events", | |
"worldwide" | |
], | |
"title": "AAAAAAAAA wits test", | |
"unstructuredAnalysis": {"meta": [ | |
{ | |
"context": "All", | |
"fieldName": "organization", | |
"groupNum": 1, | |
"script": "believed the (.*?)(?: \\([^)]*\\))? (was|were) responsible", | |
"scriptlang": "regex" | |
}, | |
{ | |
"context": "All", | |
"fieldName": "organization", | |
"groupNum": 1, | |
"script": "believed (.*?)(?: \\([^)]*\\))? (was|were) responsible", | |
"scriptlang": "regex" | |
}, | |
{ | |
"context": "All", | |
"fieldName": "organization", | |
"groupNum": 1, | |
"script": ". ([^.]*?)(?: \\([^)]*\\))? claimed responsibility\\.$", | |
"scriptlang": "regex" | |
} | |
]}, | |
"url": "smb://modus:139/wits/sample/", | |
"useExtractor": "none" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment