mirror of https://github.com/MISP/MISP
227 lines
15 KiB
PHP
227 lines
15 KiB
PHP
<?php
|
|
class AppSchema extends CakeSchema {
|
|
|
|
public function before($event = array()) {
|
|
return true;
|
|
}
|
|
|
|
public function after($event = array()) {
|
|
}
|
|
|
|
public $attributes = array(
|
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
|
'event_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'index'),
|
|
'category' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'type' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 100, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'),
|
|
'value1' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'),
|
|
'value2' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'),
|
|
'to_ids' => array('type' => 'boolean', 'null' => false, 'default' => '1'),
|
|
'uuid' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 40, 'key' => 'index', 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'timestamp' => array('type' => 'integer', 'null' => true, 'default' => '0'),
|
|
'distribution' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 4),
|
|
'comment' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'indexes' => array(
|
|
'PRIMARY' => array('column' => 'id', 'unique' => 1),
|
|
'event_id' => array('column' => 'event_id', 'unique' => 0),
|
|
'uuid' => array('column' => 'uuid', 'unique' => 0)
|
|
),
|
|
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
|
);
|
|
|
|
public $bruteforces = array(
|
|
'ip' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'username' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'expire' => array('type' => 'datetime', 'null' => false, 'default' => null),
|
|
'indexes' => array(
|
|
|
|
),
|
|
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
|
);
|
|
|
|
public $events = array(
|
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
|
'threat_level_id' => array('type' => 'integer', 'null' => true, 'default' => null),
|
|
'org' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'date' => array('type' => 'date', 'null' => false, 'default' => null),
|
|
'info' => array('type' => 'text', 'null' => false, 'default' => null, 'key' => 'index', 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'),
|
|
'user_id' => array('type' => 'integer', 'null' => false, 'default' => null),
|
|
'published' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
|
|
'uuid' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 40, 'key' => 'index', 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'attribute_count' => array('type' => 'integer', 'null' => false, 'default' => null),
|
|
'analysis' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 4),
|
|
'orgc' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'timestamp' => array('type' => 'integer', 'null' => false, 'default' => '0'),
|
|
'distribution' => array('type' => 'integer', 'null' => false, 'default' => '0', 'length' => 4),
|
|
'proposal_email_lock' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
|
|
'locked' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
|
|
'indexes' => array(
|
|
'PRIMARY' => array('column' => 'id', 'unique' => 1),
|
|
'uuid' => array('column' => 'uuid', 'unique' => 0),
|
|
'info' => array('column' => 'info', 'type' => 'fulltext')
|
|
),
|
|
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
|
);
|
|
|
|
public $logs = array(
|
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
|
'title' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'created' => array('type' => 'datetime', 'null' => true, 'default' => null),
|
|
'model' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 20, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'model_id' => array('type' => 'integer', 'null' => true, 'default' => null),
|
|
'action' => array('type' => 'string', 'null' => true, 'default' => null, 'length' => 20, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'user_id' => array('type' => 'integer', 'null' => true, 'default' => null),
|
|
'change' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'email' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'org' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'description' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'indexes' => array(
|
|
'PRIMARY' => array('column' => 'id', 'unique' => 1)
|
|
),
|
|
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
|
);
|
|
|
|
public $posts = array(
|
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
|
'date_created' => array('type' => 'datetime', 'null' => false, 'default' => null),
|
|
'date_modified' => array('type' => 'datetime', 'null' => false, 'default' => null),
|
|
'user_id' => array('type' => 'integer', 'null' => false, 'default' => null),
|
|
'contents' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'),
|
|
'post_id' => array('type' => 'integer', 'null' => false, 'default' => '0'),
|
|
'thread_id' => array('type' => 'integer', 'null' => false, 'default' => '0'),
|
|
'indexes' => array(
|
|
'PRIMARY' => array('column' => 'id', 'unique' => 1)
|
|
),
|
|
'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'InnoDB')
|
|
);
|
|
|
|
public $regexp = array(
|
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
|
'regexp' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'replacement' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'type' => array('type' => 'string', 'null' => false, 'default' => 'ALL', 'length' => 100, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'indexes' => array(
|
|
'PRIMARY' => array('column' => 'id', 'unique' => 1)
|
|
),
|
|
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
|
);
|
|
|
|
public $roles = array(
|
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
|
'name' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 100, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'created' => array('type' => 'datetime', 'null' => true, 'default' => null),
|
|
'modified' => array('type' => 'datetime', 'null' => true, 'default' => null),
|
|
'perm_add' => array('type' => 'boolean', 'null' => true, 'default' => null),
|
|
'perm_modify' => array('type' => 'boolean', 'null' => true, 'default' => null),
|
|
'perm_modify_org' => array('type' => 'boolean', 'null' => true, 'default' => null),
|
|
'perm_publish' => array('type' => 'boolean', 'null' => true, 'default' => null),
|
|
'perm_sync' => array('type' => 'boolean', 'null' => true, 'default' => null),
|
|
'perm_admin' => array('type' => 'boolean', 'null' => true, 'default' => null),
|
|
'perm_audit' => array('type' => 'boolean', 'null' => true, 'default' => null),
|
|
'perm_full' => array('type' => 'boolean', 'null' => true, 'default' => null),
|
|
'perm_auth' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
|
|
'perm_regexp_access' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
|
|
'perm_site_admin' => array('type' => 'boolean', 'null' => false, 'default' => '0'),
|
|
'indexes' => array(
|
|
'PRIMARY' => array('column' => 'id', 'unique' => 1)
|
|
),
|
|
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
|
);
|
|
|
|
public $servers = array(
|
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
|
'url' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'authkey' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 40, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'org' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'organization' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 10, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'push' => array('type' => 'boolean', 'null' => false, 'default' => null),
|
|
'pull' => array('type' => 'boolean', 'null' => false, 'default' => null),
|
|
'lastpulledid' => array('type' => 'integer', 'null' => false, 'default' => null),
|
|
'lastpushedid' => array('type' => 'integer', 'null' => false, 'default' => null),
|
|
'indexes' => array(
|
|
'PRIMARY' => array('column' => 'id', 'unique' => 1)
|
|
),
|
|
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
|
);
|
|
|
|
public $shadow_attributes = array(
|
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
|
'old_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'index'),
|
|
'event_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'index'),
|
|
'type' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 100, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'),
|
|
'category' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'value1' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'to_ids' => array('type' => 'boolean', 'null' => false, 'default' => '1'),
|
|
'uuid' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 40, 'key' => 'index', 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'value2' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'org' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'email' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'),
|
|
'indexes' => array(
|
|
'PRIMARY' => array('column' => 'id', 'unique' => 1),
|
|
'event_id' => array('column' => 'event_id', 'unique' => 0),
|
|
'uuid' => array('column' => 'uuid', 'unique' => 0),
|
|
'old_id' => array('column' => 'old_id', 'unique' => 0)
|
|
),
|
|
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
|
);
|
|
|
|
public $threads = array(
|
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
|
'date_created' => array('type' => 'datetime', 'null' => false, 'default' => null),
|
|
'date_modified' => array('type' => 'datetime', 'null' => false, 'default' => null),
|
|
'distribution' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 4),
|
|
'user_id' => array('type' => 'integer', 'null' => false, 'default' => null),
|
|
'post_count' => array('type' => 'integer', 'null' => false, 'default' => null),
|
|
'event_id' => array('type' => 'integer', 'null' => false, 'default' => null),
|
|
'title' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'),
|
|
'org' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'indexes' => array(
|
|
'PRIMARY' => array('column' => 'id', 'unique' => 1)
|
|
),
|
|
'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'InnoDB')
|
|
);
|
|
|
|
public $threat_levels = array(
|
|
'id' => array('type' => 'boolean', 'null' => false, 'default' => null, 'key' => 'primary'),
|
|
'name' => array('type' => 'string', 'null' => false, 'length' => 50, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'description' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'form_description' => array('type' => 'string', 'null' => false, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'indexes' => array(
|
|
'PRIMARY' => array('column' => 'id', 'unique' => 1)
|
|
),
|
|
'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'InnoDB')
|
|
);
|
|
|
|
public $users = array(
|
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
|
'password' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 40, 'key' => 'index', 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'org' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'email' => array('type' => 'string', 'null' => false, 'default' => null, 'key' => 'index', 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'),
|
|
'autoalert' => array('type' => 'boolean', 'null' => false, 'default' => null),
|
|
'authkey' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 40, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'invited_by' => array('type' => 'integer', 'null' => false, 'default' => null),
|
|
'gpgkey' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_bin', 'charset' => 'utf8'),
|
|
'nids_sid' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 15),
|
|
'termsaccepted' => array('type' => 'boolean', 'null' => false, 'default' => null),
|
|
'newsread' => array('type' => 'date', 'null' => false, 'default' => null),
|
|
'role_id' => array('type' => 'integer', 'null' => false, 'default' => null),
|
|
'change_pw' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 4),
|
|
'contactalert' => array('type' => 'boolean', 'null' => false, 'default' => null),
|
|
'indexes' => array(
|
|
'PRIMARY' => array('column' => 'id', 'unique' => 1),
|
|
'email' => array('column' => 'email', 'unique' => 0),
|
|
'password' => array('column' => 'password', 'unique' => 0)
|
|
),
|
|
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
|
);
|
|
|
|
public $whitelist = array(
|
|
'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'primary'),
|
|
'name' => array('type' => 'text', 'null' => false, 'default' => null, 'collate' => 'utf8_unicode_ci', 'charset' => 'utf8'),
|
|
'indexes' => array(
|
|
'PRIMARY' => array('column' => 'id', 'unique' => 1)
|
|
),
|
|
'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_bin', 'engine' => 'MyISAM')
|
|
);
|
|
|
|
}
|