A ruby library to interface with Facebooks ThreatExchange API. This is still very much in development so feel free to contribute :)
Install required dependencies
bundle install
Install this gem locally
rake install
Add this to your application
require 'ThreatExchange'
The ThreatExchange library provides a base set of abstractions for the ThreatExchange API. You instanciate a new ThreatExchange::Client and provide it with your access token.
TE = ThreatExchange::Client.new(appid, secret)
To query the ThreatExchange API you create a hash with parameters for your query
query = {
threat_type: 'COMPROMISED_CREDENTIAL',
type: 'EMAIL_ADDRESS',
fields: 'indicator,passwords',
limit: 30
}
Then call the query with the respective method.
result = TE.threat_indicators(query)
The result will return either a string, a singular hash or an array of hashes and then from there you can manipulate the data as you like. If you would like to see examples of each type of query take a look at the script in the example directory.
- Fork it ( https://github.com/facebook/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