A ruby library to interface with Facebooks ThreatExchange API
Add this line to your application's Gemfile:
gem 'ThreatExchange'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ThreatExchange
The ThreatExchange library has two objects you can instanciate queries and submissions. To initialize either class you pass your access token in a hash into each object.
access_token = 'abc123'
TE = ThreatExchange::Client.new(access_token)
To run a query you would first create a hash with the corespnding flags for example.
query = {
threat_type: 'COMPROMISED_CREDENTIAL',
type: 'EMAIL_ADDRESS',
fields: 'indicator,passwords',
limit: 30
}
Then we call the query
result = TE.threat_indicators(query)
The result will return as an array of hashes and then from there you can manipulate as you like.
Each Query method matches the existing ThreatExchange API and supports the same parameters.
TODO: Document / Test Submission
- Fork it ( https://github.com/maus-/ThreatExchange/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request