Esempio n. 1
0
 *
 */
if (!defined('__ROOT__')) {
    define('__ROOT__', realpath(dirname(__FILE__)));
}
require_once __ROOT__ . '/ThreatExchangeConfig.php';
ThreatExchangeConfig::init();
// Get the command line options
$options = getopt('b:f:hmq:s:u:t:');
if (!isset($options['t'])) {
    echo print_usage();
    exit(1);
}
// Load user details
$app_id = ThreatExchangeConfig::getAppID();
$app_secret = ThreatExchangeConfig::getAppSecret();
$searcher = BaseSearch::getSearcher($options['t']);
if (!$searcher->hasValidOptions($options)) {
    echo print_usage() . $searcher->getUsage();
    exit(1);
}
// Build query sets
$requests = array();
if (isset($options['q']) || isset($options['s']) && isset($options['u'])) {
    $requests[] = $searcher->buildAPIRequest($options);
} else {
    if (isset($options['f'])) {
        $queries = ThreatExchangeUtils::parseQueryFile($options['f']);
        foreach ($queries as $query) {
            $options['q'] = $query;
            $requests[] = $searcher->buildAPIRequest($options);