Merge pull request #366 from facebook/site_tables

[site] Add tables API page
This commit is contained in:
Teddy Reed 2014-11-05 10:57:28 -08:00
commit 51f434f6b9
12 changed files with 880 additions and 4 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
*.lo
*.o
*.obj
*.pyc
# Compiled Dynamic libraries
*.so

View File

@ -20,6 +20,16 @@ body {
color: #fafafa;
}
.tableName {
color: #A595FF;
}
.tagLink a {
color: #fff !important;
font-weight: normal !important;
text-decoration: none !important;
}
@media (min-width: 768px) {
.bs-docs-nav .navbar-nav>li>a {
@ -61,7 +71,6 @@ body {
color: #cc7a6f;
}
.CodeMirror {
height: auto;
}

View File

@ -6,10 +6,11 @@ var Root = require('./src/Root');
Root.getPages()
.forEach(function (fileName) {
var RootHTML = Root.renderToString({initialPath: fileName});
process.stdout.write("Writing: " + fileName + '\n');
var target = path.join(__dirname, fileName);
var dirname = target.replace(/\\/g, '/').replace(/\/[^\/]*\/?$/, '');
fs.exists(target, function(exists) {
fs.exists(dirname, function(exists) {
if (!exists) {
fs.mkdirSync(dirname, 0755);
}

View File

@ -7,8 +7,11 @@ var Router = require('react-router-component');
var HomePage = require('./pages/HomePage');
var OverviewPage = require('./pages/OverviewPage');
var TablesPage = require('./pages/TablesPage');
var NotFoundPage = require('./pages/NotFoundPage');
var Tags = require('./api/Tags');
var Locations = Router.Locations;
var Location = Router.Location;
var NotFound = Router.NotFound;
@ -21,6 +24,9 @@ var PagesHolder = React.createClass({
<Location path="/index.html" handler={HomePage} />
<Location path="/overview/" handler={OverviewPage} />
<Location path="/overview/index.html" handler={OverviewPage} />
<Location path="/tables/" handler={TablesPage} />
<Location path="/tables/index.html" handler={TablesPage} />
<Location path="/tables/:tag" handler={TablesPage} />
<NotFound handler={NotFoundPage} />
</Locations>
);
@ -54,10 +60,15 @@ var Root = React.createClass({
* @returns {Array}
*/
getPages: function () {
return [
var pages = [
'/index.html',
'/overview/index.html'
'/overview/index.html',
'/tables/index.html',
];
for (var i = 0; i < Tags.length; i++) {
pages[pages.length] = "/tables/" + Tags[i] + ".html";
}
return pages;
}
},
@ -104,6 +115,7 @@ var Root = React.createClass({
<script dangerouslySetInnerHTML={browserInitScriptObj} />
<script src="/vendor/codemirror/codemirror.js" />
<script src="/vendor/codemirror/javascript.js" />
<script src="/vendor/bootstrap/bootstrap.js" />
<script src="/vendor/JSXTransformer.js" />
<script src="/assets/bundle.js" />
</body>

338
site/src/api/Master.js Normal file
View File

@ -0,0 +1,338 @@
/** @jsx React.DOM */
'use strict';
var API = [
{name: "All Platforms", tables: [
{name: "bash_history", columns: [
{name: "username", type: "std::string", description: "", tables: ""},
{name: "command", type: "std::string", description: "", tables: ""},
{name: "history_file", type: "std::string", description: "", tables: ""}
]},
{name: "cpuid", columns: [
{name: "feature", type: "std::string", description: "", tables: ""},
{name: "value", type: "std::string", description: "", tables: ""},
{name: "output_register", type: "std::string", description: "", tables: ""},
{name: "output_bit", type: "std::string", description: "", tables: ""},
{name: "input_eax", type: "std::string", description: "", tables: ""}
]},
{name: "crontab", columns: [
{name: "event", type: "std::string", description: "", tables: ""},
{name: "minute", type: "std::string", description: "", tables: ""},
{name: "hour", type: "std::string", description: "", tables: ""},
{name: "day_of_month", type: "std::string", description: "", tables: ""},
{name: "month", type: "std::string", description: "", tables: ""},
{name: "day_of_week", type: "std::string", description: "", tables: ""},
{name: "command", type: "std::string", description: "", tables: ""},
{name: "path", type: "std::string", description: "", tables: ""}
]},
{name: "etc_hosts", columns: [
{name: "address", type: "std::string", description: "", tables: ""},
{name: "hostnames", type: "std::string", description: "", tables: ""}
]},
{name: "groups", columns: [
{name: "gid", type: "long long int", description: "", tables: ""},
{name: "name", type: "std::string", description: "", tables: ""}
]},
{name: "last", columns: [
{name: "login", type: "std::string", description: "", tables: ""},
{name: "tty", type: "std::string", description: "", tables: ""},
{name: "pid", type: "int", description: "", tables: ""},
{name: "type", type: "int", description: "", tables: ""},
{name: "time", type: "int", description: "", tables: ""},
{name: "host", type: "std::string", description: "", tables: ""}
]},
{name: "passwd_changes", columns: [
{name: "target_path", type: "std::string", description: "", tables: ""},
{name: "time", type: "std::string", description: "", tables: ""},
{name: "action", type: "std::string", description: "", tables: ""},
{name: "transaction_id", type: "std::string", description: "", tables: ""}
]},
{name: "process_envs", columns: [
{name: "pid", type: "int", description: "", tables: ""},
{name: "name", type: "std::string", description: "", tables: ""},
{name: "path", type: "std::string", description: "", tables: ""},
{name: "key", type: "std::string", description: "", tables: ""},
{name: "value", type: "std::string", description: "", tables: ""}
]},
{name: "process_open_files", columns: [
{name: "pid", type: "int", description: "", tables: ""},
{name: "name", type: "std::string", description: "", tables: ""},
{name: "path", type: "std::string", description: "", tables: ""},
{name: "file_type", type: "std::string", description: "", tables: ""},
{name: "local_path", type: "std::string", description: "", tables: ""},
{name: "local_host", type: "std::string", description: "", tables: ""},
{name: "local_port", type: "std::string", description: "", tables: ""},
{name: "remote_host", type: "std::string", description: "", tables: ""},
{name: "remote_port", type: "std::string", description: "", tables: ""}
]},
{name: "processes", columns: [
{name: "name", type: "std::string", description: "", tables: ""},
{name: "path", type: "std::string", description: "", tables: ""},
{name: "cmdline", type: "std::string", description: "", tables: ""},
{name: "pid", type: "int", description: "", tables: ""},
{name: "on_disk", type: "std::string", description: "", tables: ""},
{name: "wired_size", type: "std::string", description: "", tables: ""},
{name: "resident_size", type: "std::string", description: "", tables: ""},
{name: "phys_footprint", type: "std::string", description: "", tables: ""},
{name: "user_time", type: "std::string", description: "", tables: ""},
{name: "system_time", type: "std::string", description: "", tables: ""},
{name: "start_time", type: "std::string", description: "", tables: ""},
{name: "parent", type: "int", description: "", tables: ""}
]},
{name: "routes", columns: [
{name: "destination", type: "std::string", description: "", tables: ""},
{name: "netmask", type: "std::string", description: "", tables: ""},
{name: "gateway", type: "std::string", description: "", tables: ""},
{name: "source", type: "std::string", description: "", tables: ""},
{name: "flags", type: "int", description: "", tables: ""},
{name: "interface", type: "std::string", description: "", tables: ""},
{name: "mtu", type: "int", description: "", tables: ""},
{name: "metric", type: "int", description: "", tables: ""},
{name: "type", type: "std::string", description: "", tables: ""}
]},
{name: "suid_bin", columns: [
{name: "path", type: "std::string", description: "", tables: ""},
{name: "unix_user", type: "std::string", description: "", tables: ""},
{name: "unix_group", type: "std::string", description: "", tables: ""},
{name: "permissions", type: "std::string", description: "", tables: ""}
]},
{name: "time", columns: [
{name: "hour", type: "int", description: "", tables: ""},
{name: "minutes", type: "int", description: "", tables: ""},
{name: "seconds", type: "int", description: "", tables: ""}
]},
{name: "users", columns: [
{name: "uid", type: "long long int", description: "", tables: ""},
{name: "gid", type: "long long int", description: "", tables: ""},
{name: "username", type: "std::string", description: "", tables: ""},
{name: "description", type: "std::string", description: "", tables: ""},
{name: "directory", type: "std::string", description: "", tables: ""},
{name: "shell", type: "std::string", description: "", tables: ""}
]}
]},
{name: "Darwin (Apple OS X)", tables: [
{name: "alf", columns: [
{name: "allow_signed_enabled", type: "int", description: "", tables: ""},
{name: "firewall_unload", type: "int", description: "", tables: ""},
{name: "global_state", type: "int", description: "", tables: ""},
{name: "logging_enabled", type: "int", description: "", tables: ""},
{name: "logging_option", type: "int", description: "", tables: ""},
{name: "stealth_enabled", type: "int", description: "", tables: ""},
{name: "version", type: "std::string", description: "", tables: ""}
]},
{name: "alf_exceptions", columns: [
{name: "path", type: "std::string", description: "", tables: ""},
{name: "state", type: "int", description: "", tables: ""}
]},
{name: "alf_explicit_auths", columns: [
{name: "process", type: "std::string", description: "", tables: ""}
]},
{name: "alf_services", columns: [
{name: "service", type: "std::string", description: "", tables: ""},
{name: "process", type: "std::string", description: "", tables: ""},
{name: "state", type: "int", description: "", tables: ""}
]},
{name: "apps", columns: [
{name: "name", type: "std::string", description: "", tables: ""},
{name: "path", type: "std::string", description: "", tables: ""},
{name: "bundle_executable", type: "std::string", description: "", tables: ""},
{name: "bundle_identifier", type: "std::string", description: "", tables: ""},
{name: "bundle_name", type: "std::string", description: "", tables: ""},
{name: "bundle_short_version", type: "std::string", description: "", tables: ""},
{name: "bundle_version", type: "std::string", description: "", tables: ""},
{name: "bundle_package_type", type: "std::string", description: "", tables: ""},
{name: "compiler", type: "std::string", description: "", tables: ""},
{name: "development_region", type: "std::string", description: "", tables: ""},
{name: "display_name", type: "std::string", description: "", tables: ""},
{name: "info_string", type: "std::string", description: "", tables: ""},
{name: "minimum_system_version", type: "std::string", description: "", tables: ""},
{name: "category", type: "std::string", description: "", tables: ""},
{name: "applescript_enabled", type: "std::string", description: "", tables: ""},
{name: "copyright", type: "std::string", description: "", tables: ""}
]},
{name: "ca_certs", columns: [
{name: "common_name", type: "std::string", description: "", tables: ""},
{name: "not_valid_before", type: "std::string", description: "", tables: ""},
{name: "not_valid_after", type: "std::string", description: "", tables: ""},
{name: "key_algorithm", type: "std::string", description: "", tables: ""},
{name: "key_usage", type: "std::string", description: "", tables: ""},
{name: "subject_key_id", type: "std::string", description: "", tables: ""},
{name: "authority_key_id", type: "std::string", description: "", tables: ""},
{name: "sha1", type: "std::string", description: "", tables: ""}
]},
{name: "homebrew_packages", columns: [
{name: "name", type: "std::string", description: "", tables: ""},
{name: "path", type: "std::string", description: "", tables: ""},
{name: "version", type: "std::string", description: "", tables: ""}
]},
{name: "interface_addresses", columns: [
{name: "interface", type: "std::string", description: "", tables: ""},
{name: "address", type: "std::string", description: "", tables: ""},
{name: "mask", type: "std::string", description: "", tables: ""},
{name: "broadcast", type: "std::string", description: "", tables: ""},
{name: "point_to_point", type: "std::string", description: "", tables: ""}
]},
{name: "interface_details", columns: [
{name: "interface", type: "std::string", description: "", tables: ""},
{name: "mac", type: "std::string", description: "", tables: ""},
{name: "type", type: "int", description: "", tables: ""},
{name: "mtu", type: "std::string", description: "", tables: ""},
{name: "metric", type: "std::string", description: "", tables: ""},
{name: "ipackets", type: "std::string", description: "", tables: ""},
{name: "opackets", type: "std::string", description: "", tables: ""},
{name: "ibytes", type: "std::string", description: "", tables: ""},
{name: "obytes", type: "std::string", description: "", tables: ""},
{name: "ierrors", type: "std::string", description: "", tables: ""},
{name: "oerrors", type: "std::string", description: "", tables: ""},
{name: "last_change", type: "std::string", description: "", tables: ""}
]},
{name: "kextstat", columns: [
{name: "idx", type: "int", description: "", tables: ""},
{name: "refs", type: "int", description: "", tables: ""},
{name: "size", type: "std::string", description: "", tables: ""},
{name: "wired", type: "std::string", description: "", tables: ""},
{name: "name", type: "std::string", description: "", tables: ""},
{name: "version", type: "std::string", description: "", tables: ""},
{name: "linked_against", type: "std::string", description: "", tables: ""}
]},
{name: "launchd", columns: [
{name: "path", type: "std::string", description: "", tables: ""},
{name: "name", type: "std::string", description: "", tables: ""},
{name: "label", type: "std::string", description: "", tables: ""},
{name: "run_at_load", type: "std::string", description: "", tables: ""},
{name: "keep_alive", type: "std::string", description: "", tables: ""},
{name: "on_demand", type: "std::string", description: "", tables: ""},
{name: "disabled", type: "std::string", description: "", tables: ""},
{name: "user_name", type: "std::string", description: "", tables: ""},
{name: "group_name", type: "std::string", description: "", tables: ""},
{name: "stdout_path", type: "std::string", description: "", tables: ""},
{name: "stderr_path", type: "std::string", description: "", tables: ""},
{name: "start_interval", type: "std::string", description: "", tables: ""},
{name: "program_arguments", type: "std::string", description: "", tables: ""},
{name: "program", type: "std::string", description: "", tables: ""},
{name: "watch_paths", type: "std::string", description: "", tables: ""},
{name: "queue_directories", type: "std::string", description: "", tables: ""},
{name: "inetd_compatibility", type: "std::string", description: "", tables: ""},
{name: "start_on_mount", type: "std::string", description: "", tables: ""},
{name: "root_directory", type: "std::string", description: "", tables: ""},
{name: "working_directory", type: "std::string", description: "", tables: ""},
{name: "process_type", type: "std::string", description: "", tables: ""}
]},
{name: "listening_ports", columns: [
{name: "pid", type: "int", description: "", tables: ""},
{name: "port", type: "int", description: "", tables: ""},
{name: "protocol", type: "int", description: "", tables: ""},
{name: "family", type: "int", description: "", tables: ""},
{name: "address", type: "std::string", description: "", tables: ""}
]},
{name: "nvram", columns: [
{name: "name", type: "std::string", description: "", tables: ""},
{name: "type", type: "std::string", description: "", tables: ""},
{name: "value", type: "std::string", description: "", tables: ""}
]},
{name: "osx_version", columns: [
{name: "major", type: "int", description: "", tables: ""},
{name: "minor", type: "int", description: "", tables: ""},
{name: "patch", type: "int", description: "", tables: ""}
]},
{name: "quarantine", columns: [
{name: "path", type: "std::string", description: "", tables: ""},
{name: "creator", type: "std::string", description: "", tables: ""}
]}
]},
{name: "Ubuntu, CentOS", tables: [
{name: "block_devices", columns: [
{name: "name", type: "std::string", description: "", tables: ""},
{name: "parent", type: "std::string", description: "", tables: ""},
{name: "vendor", type: "std::string", description: "", tables: ""},
{name: "model", type: "std::string", description: "", tables: ""},
{name: "size", type: "long long int", description: "", tables: ""},
{name: "uuid", type: "std::string", description: "", tables: ""},
{name: "type", type: "std::string", description: "", tables: ""},
{name: "label", type: "std::string", description: "", tables: ""}
]},
{name: "kernel_modules", columns: [
{name: "name", type: "std::string", description: "", tables: ""},
{name: "size", type: "std::string", description: "", tables: ""},
{name: "used_by", type: "std::string", description: "", tables: ""},
{name: "status", type: "std::string", description: "", tables: ""},
{name: "address", type: "std::string", description: "", tables: ""}
]},
{name: "mounts", columns: [
{name: "fsname", type: "std::string", description: "", tables: ""},
{name: "fsname_real", type: "std::string", description: "", tables: ""},
{name: "path", type: "std::string", description: "", tables: ""},
{name: "type", type: "std::string", description: "", tables: ""},
{name: "opts", type: "std::string", description: "", tables: ""},
{name: "freq", type: "int", description: "", tables: ""},
{name: "passno", type: "int", description: "", tables: ""},
{name: "block_size", type: "long long int", description: "", tables: ""},
{name: "blocks", type: "long long int", description: "", tables: ""},
{name: "blocks_free", type: "long long int", description: "", tables: ""},
{name: "blocks_avail", type: "long long int", description: "", tables: ""},
{name: "inodes", type: "long long int", description: "", tables: ""},
{name: "inodes_free", type: "long long int", description: "", tables: ""}
]},
{name: "pci_devices", columns: [
{name: "slot", type: "std::string", description: "", tables: ""},
{name: "device_class", type: "std::string", description: "", tables: ""},
{name: "vendor", type: "std::string", description: "", tables: ""},
{name: "model", type: "std::string", description: "", tables: ""}
]},
{name: "rpm_packages", columns: [
{name: "name", type: "std::string", description: "", tables: ""},
{name: "version", type: "std::string", description: "", tables: ""},
{name: "release", type: "std::string", description: "", tables: ""},
{name: "source", type: "std::string", description: "", tables: ""},
{name: "size", type: "std::string", description: "", tables: ""},
{name: "dsaheader", type: "std::string", description: "", tables: ""},
{name: "rsaheader", type: "std::string", description: "", tables: ""},
{name: "sha1header", type: "std::string", description: "", tables: ""},
{name: "arch", type: "std::string", description: "", tables: ""}
]}
]}
];
module.exports = API;

10
site/src/api/Tags.js Normal file
View File

@ -0,0 +1,10 @@
/** @jsx React.DOM */
'use strict';
var Tags = [
'master',
'v1.0.3'
];
module.exports = Tags;

232
site/src/api/v1.0.3.js Normal file
View File

@ -0,0 +1,232 @@
/** @jsx React.DOM */
'use strict';
var API = [
{name: "All Platforms", tables: [
{name: "etc_hosts", columns: [
{name: "address", type: "std::string", description: "", tables: ""},
{name: "hostnames", type: "std::string", description: "", tables: ""}
]},
{name: "groups", columns: [
{name: "gid", type: "std::string", description: "", tables: ""},
{name: "name", type: "std::string", description: "", tables: ""}
]},
{name: "last", columns: [
{name: "login", type: "std::string", description: "", tables: ""},
{name: "tty", type: "std::string", description: "", tables: ""},
{name: "pid", type: "int", description: "", tables: ""},
{name: "type", type: "int", description: "", tables: ""},
{name: "time", type: "int", description: "", tables: ""},
{name: "host", type: "std::string", description: "", tables: ""}
]},
{name: "passwd_changes", columns: [
{name: "target_path", type: "std::string", description: "", tables: ""},
{name: "time", type: "std::string", description: "", tables: ""},
{name: "action", type: "std::string", description: "", tables: ""},
{name: "transaction_id", type: "std::string", description: "", tables: ""}
]},
{name: "processes", columns: [
{name: "name", type: "std::string", description: "", tables: ""},
{name: "path", type: "std::string", description: "", tables: ""},
{name: "cmdline", type: "std::string", description: "", tables: ""},
{name: "pid", type: "int", description: "", tables: ""},
{name: "on_disk", type: "std::string", description: "", tables: ""},
{name: "wired_size", type: "std::string", description: "", tables: ""},
{name: "resident_size", type: "std::string", description: "", tables: ""},
{name: "phys_footprint", type: "std::string", description: "", tables: ""},
{name: "user_time", type: "std::string", description: "", tables: ""},
{name: "system_time", type: "std::string", description: "", tables: ""},
{name: "start_time", type: "std::string", description: "", tables: ""},
{name: "parent", type: "int", description: "", tables: ""}
]},
{name: "routes", columns: [
{name: "destination", type: "std::string", description: "", tables: ""},
{name: "netmask", type: "std::string", description: "", tables: ""},
{name: "gateway", type: "std::string", description: "", tables: ""},
{name: "source", type: "std::string", description: "", tables: ""},
{name: "flags", type: "int", description: "", tables: ""},
{name: "interface", type: "std::string", description: "", tables: ""},
{name: "mtu", type: "int", description: "", tables: ""},
{name: "metric", type: "int", description: "", tables: ""},
{name: "type", type: "std::string", description: "", tables: ""}
]},
{name: "time", columns: [
{name: "hour", type: "int", description: "", tables: ""},
{name: "minutes", type: "int", description: "", tables: ""},
{name: "seconds", type: "int", description: "", tables: ""}
]},
{name: "users", columns: [
{name: "uid", type: "std::string", description: "", tables: ""},
{name: "gid", type: "std::string", description: "", tables: ""},
{name: "username", type: "std::string", description: "", tables: ""},
{name: "description", type: "std::string", description: "", tables: ""},
{name: "directory", type: "std::string", description: "", tables: ""},
{name: "shell", type: "std::string", description: "", tables: ""}
]}
]},
{name: "Darwin (Apple OS X)", tables: [
{name: "alf", columns: [
{name: "allow_signed_enabled", type: "int", description: "", tables: ""},
{name: "firewall_unload", type: "int", description: "", tables: ""},
{name: "global_state", type: "int", description: "", tables: ""},
{name: "logging_enabled", type: "int", description: "", tables: ""},
{name: "logging_option", type: "int", description: "", tables: ""},
{name: "stealth_enabled", type: "int", description: "", tables: ""},
{name: "version", type: "std::string", description: "", tables: ""}
]},
{name: "alf_exceptions", columns: [
{name: "path", type: "std::string", description: "", tables: ""},
{name: "state", type: "int", description: "", tables: ""}
]},
{name: "alf_explicit_auths", columns: [
{name: "process", type: "std::string", description: "", tables: ""}
]},
{name: "alf_services", columns: [
{name: "service", type: "std::string", description: "", tables: ""},
{name: "process", type: "std::string", description: "", tables: ""},
{name: "state", type: "int", description: "", tables: ""}
]},
{name: "apps", columns: [
{name: "name", type: "std::string", description: "", tables: ""},
{name: "path", type: "std::string", description: "", tables: ""},
{name: "bundle_executable", type: "std::string", description: "", tables: ""},
{name: "bundle_identifier", type: "std::string", description: "", tables: ""},
{name: "bundle_name", type: "std::string", description: "", tables: ""},
{name: "bundle_short_version", type: "std::string", description: "", tables: ""},
{name: "bundle_version", type: "std::string", description: "", tables: ""},
{name: "bundle_package_type", type: "std::string", description: "", tables: ""},
{name: "compiler", type: "std::string", description: "", tables: ""},
{name: "development_region", type: "std::string", description: "", tables: ""},
{name: "display_name", type: "std::string", description: "", tables: ""},
{name: "info_string", type: "std::string", description: "", tables: ""},
{name: "minimum_system_version", type: "std::string", description: "", tables: ""},
{name: "category", type: "std::string", description: "", tables: ""},
{name: "applescript_enabled", type: "std::string", description: "", tables: ""},
{name: "copyright", type: "std::string", description: "", tables: ""}
]},
{name: "ca_certs", columns: [
{name: "common_name", type: "std::string", description: "", tables: ""},
{name: "not_valid_before", type: "std::string", description: "", tables: ""},
{name: "not_valid_after", type: "std::string", description: "", tables: ""},
{name: "key_algorithm", type: "std::string", description: "", tables: ""},
{name: "key_usage", type: "std::string", description: "", tables: ""},
{name: "subject_key_id", type: "std::string", description: "", tables: ""},
{name: "authority_key_id", type: "std::string", description: "", tables: ""},
{name: "sha1", type: "std::string", description: "", tables: ""}
]},
{name: "interface_addresses", columns: [
{name: "interface", type: "std::string", description: "", tables: ""},
{name: "address", type: "std::string", description: "", tables: ""},
{name: "mask", type: "std::string", description: "", tables: ""},
{name: "broadcast", type: "std::string", description: "", tables: ""},
{name: "point_to_point", type: "std::string", description: "", tables: ""}
]},
{name: "interface_details", columns: [
{name: "interface", type: "std::string", description: "", tables: ""},
{name: "mac", type: "std::string", description: "", tables: ""},
{name: "type", type: "int", description: "", tables: ""},
{name: "mtu", type: "std::string", description: "", tables: ""},
{name: "metric", type: "std::string", description: "", tables: ""},
{name: "ipackets", type: "std::string", description: "", tables: ""},
{name: "opackets", type: "std::string", description: "", tables: ""},
{name: "ibytes", type: "std::string", description: "", tables: ""},
{name: "obytes", type: "std::string", description: "", tables: ""},
{name: "ierrors", type: "std::string", description: "", tables: ""},
{name: "oerrors", type: "std::string", description: "", tables: ""},
{name: "last_change", type: "std::string", description: "", tables: ""}
]},
{name: "kextstat", columns: [
{name: "idx", type: "int", description: "", tables: ""},
{name: "refs", type: "int", description: "", tables: ""},
{name: "size", type: "std::string", description: "", tables: ""},
{name: "wired", type: "std::string", description: "", tables: ""},
{name: "name", type: "std::string", description: "", tables: ""},
{name: "version", type: "std::string", description: "", tables: ""},
{name: "linked_against", type: "std::string", description: "", tables: ""}
]},
{name: "launchd", columns: [
{name: "path", type: "std::string", description: "", tables: ""},
{name: "name", type: "std::string", description: "", tables: ""},
{name: "label", type: "std::string", description: "", tables: ""},
{name: "run_at_load", type: "std::string", description: "", tables: ""},
{name: "keep_alive", type: "std::string", description: "", tables: ""},
{name: "on_demand", type: "std::string", description: "", tables: ""},
{name: "disabled", type: "std::string", description: "", tables: ""},
{name: "user_name", type: "std::string", description: "", tables: ""},
{name: "group_name", type: "std::string", description: "", tables: ""},
{name: "stdout_path", type: "std::string", description: "", tables: ""},
{name: "stderr_path", type: "std::string", description: "", tables: ""},
{name: "start_interval", type: "std::string", description: "", tables: ""},
{name: "program_arguments", type: "std::string", description: "", tables: ""},
{name: "program", type: "std::string", description: "", tables: ""},
{name: "watch_paths", type: "std::string", description: "", tables: ""},
{name: "queue_directories", type: "std::string", description: "", tables: ""},
{name: "inetd_compatibility", type: "std::string", description: "", tables: ""},
{name: "start_on_mount", type: "std::string", description: "", tables: ""},
{name: "root_directory", type: "std::string", description: "", tables: ""},
{name: "working_directory", type: "std::string", description: "", tables: ""},
{name: "process_type", type: "std::string", description: "", tables: ""}
]},
{name: "listening_ports", columns: [
{name: "pid", type: "int", description: "", tables: ""},
{name: "port", type: "int", description: "", tables: ""},
{name: "protocol", type: "int", description: "", tables: ""},
{name: "family", type: "int", description: "", tables: ""},
{name: "address", type: "std::string", description: "", tables: ""}
]},
{name: "nvram", columns: [
{name: "name", type: "std::string", description: "", tables: ""},
{name: "type", type: "std::string", description: "", tables: ""},
{name: "value", type: "std::string", description: "", tables: ""}
]},
{name: "osx_version", columns: [
{name: "major", type: "int", description: "", tables: ""},
{name: "minor", type: "int", description: "", tables: ""},
{name: "patch", type: "int", description: "", tables: ""}
]}
]},
{name: "Ubuntu, CentOS", tables: [
{name: "kernel_modules", columns: [
{name: "name", type: "std::string", description: "", tables: ""},
{name: "size", type: "std::string", description: "", tables: ""},
{name: "used_by", type: "std::string", description: "", tables: ""},
{name: "filename", type: "std::string", description: "", tables: ""},
{name: "description", type: "std::string", description: "", tables: ""},
{name: "sig_key", type: "std::string", description: "", tables: ""},
{name: "version", type: "std::string", description: "", tables: ""},
{name: "signer", type: "std::string", description: "", tables: ""}
]}
]}
];
module.exports = API;

View File

@ -14,6 +14,10 @@ var NAV_LINKS = {
'overview': {
link: '/overview/',
title: 'Overview'
},
'tables': {
link: '/tables/',
title: 'Tables'
}
}

View File

@ -19,6 +19,7 @@ var PageContainer = React.createClass({
<h3 className="page-header">Quick Links</h3>
<ul>
<li><h4><InternalLink href="/overview/">Overview</InternalLink></h4></li>
<li><h4><InternalLink href="/tables/">Tables</InternalLink></h4></li>
<li><h4><a href="//github.com/facebook/osquery/wiki" target="_blank">Wiki</a></h4></li>
<li><h4><a href="//github.com/facebook/osquery/" target="_blank">GitHub</a></h4></li>
</ul>

View File

@ -0,0 +1,162 @@
/** @jsx React.DOM */
'use strict';
var React = require('react');
var Router = require('react-router-component');
var InternalLink = Router.Link;
var BasePage = require('./BasePage');
var PageHeader = require('../components/PageHeader');
var PageFooter = require('../components/PageFooter');
var PageContainer = require('../components/PageContainer');
var NotFoundPage = require('./NotFoundPage');
var Tags = require('../api/Tags');
var Column = React.createClass({
render: function() {
var column = this.props.data;
return (
<tr>
<td><code><span className="text-info">{column.name}</span></code></td>
<td><code>{column.type}</code></td>
<td>{column.description}</td>
</tr>
);
}
});
var Table = React.createClass({
render: function() {
return (
<div>
<h4 className="tableName">{this.props.data.name}</h4>
<table className="table table-bordered table-striped">
<thead>
<tr>
<th width="25%">Column Name</th>
<th>SQLite Type</th>
<th width="50%">Description</th>
</tr>
</thead>
<tbody>
{this.props.data.columns.map(function (column) {
return <Column key={column.name} data={column} />
})}
</tbody>
</table>
</div>
);
}
});
var Category = React.createClass({
render: function() {
return (
<div>
<h3>{this.props.data.name}</h3>
{this.props.data.tables.map(function (table) {
return <Table key={table.name} data={table} />
})}
</div>
);
}
});
var TagName = React.createClass({
render: function() {
var link = "/tables/" + this.props.tag + ".html";
return (
<span className="tagLink">
<span className={this.props.className}>
<InternalLink href={link}>{this.props.tag}</InternalLink>
</span>
<span> </span>
</span>
)
}
})
var Page = React.createClass({
render: function () {
var tag = this.props.tag || 'master.html';
var is_valid = false;
// Make sure requested tag is valid.
tag = tag.substring(0, tag.length - 5);
for (var i = 0; i < Tags.length; i++) {
if (tag == Tags[i]) {
is_valid = true;
}
}
if (!is_valid) {
return (
<NotFoundPage />
);
}
var Master = require('../api/' + tag + '.js');
return (
<BasePage pageName="tables">
<PageHeader
title="Tables"
subTitle="The osquery SQL tables and columns API." />
<PageContainer>
<p className="lead">
<span><strong>Release Tags:</strong> </span>
{Tags.map(function (tag_name) {
var className = "label label-default";
if (tag == tag_name) {
className = "label label-primary";
}
return <TagName
key={tag_name}
className={className}
tag={tag_name}/>
})}
</p>
<p className="lead">
osquery exports the following set of tables organized by platform.
Treat them like SQLite tables:
</p>
<div className="highlight">
<code>
<span>SELECT </span>
<span className="text-success">address</span>
<span>, </span>
<span className="text-success">mac</span>
<span>, id.</span>
<span className="text-success">interface</span>
<br />
<span>FROM </span>
<span className="tableName">interface_details</span>
<span> AS id, </span>
<span className="tableName">interface_addresses</span>
<span> AS ia WHERE id.</span>
<span className="text-success">interface</span>
<span> = ia.</span>
<span className="text-success">interface</span>
<span>;</span>
</code>
</div>
<p className="lead">
There are some operating-specific tables that apply to OS X, Ubuntu,
or CentOS only. osquery stresses feature parity, minimizing
tables that are not available to all platforms is a priority.
</p>
{Master.map(function (category) {
return <Category key={category.name} data={category} />
})}
</PageContainer>
</BasePage>
);
}
});
module.exports = Page;

7
site/vendor/bootstrap/bootstrap.js vendored Normal file

File diff suppressed because one or more lines are too long

99
tools/genapi.py Normal file
View File

@ -0,0 +1,99 @@
#!/usr/bin/env python
# Copyright 2004-present Facebook. All Rights Reserved.
from __future__ import absolute_import
from __future__ import division
#from __future__ import print_function
from __future__ import unicode_literals
import argparse
import ast
import logging
import os
import sys
from gentable import Column, table_name, schema, implementation, table
# the log format for the logging module
LOG_FORMAT = "%(levelname)s [Line %(lineno)d]: %(message)s"
CANONICAL_PLATFORMS = {
"x": "All Platforms",
"darwin": "Darwin (Apple OS X)",
"linux": "Ubuntu, CentOS",
}
TEMPLATE_API_DEFINITION = """
/** @jsx React.DOM */
'use strict';
var API = [
%s
];
module.exports = API;
"""
TEMPLATE_CATEGORY = """
{name: "%s", tables: [%s
]}"""
TEMPLATE_TABLE = """
{name: "%s", columns: [%s
]}"""
TEMPLATE_COLUMN = """
{name: "%s", type: "%s", description: "%s", tables: "%s"}"""
def gen_api(api):
categories = []
for category, tables in api.iteritems():
tables_output = []
for table in tables:
columns_output = []
for column in table[1]:
columns_output.append(TEMPLATE_COLUMN % (
column[0], column[1], "", ""))
tables_output.append(TEMPLATE_TABLE % (
table[0], ", ".join(columns_output)))
categories.append(TEMPLATE_CATEGORY % (
category, ", ".join(tables_output)))
return TEMPLATE_API_DEFINITION % (", ".join(categories))
def gen_spec(tree):
exec(compile(tree, "<string>", "exec"))
schema = [(column.name, column.type) for column in table.schema]
return (table.table_name, schema, table.function)
def main(argc, argv):
parser = argparse.ArgumentParser("Generate API documentation.")
parser.add_argument("--tables", default="osquery/tables/specs",
help="Path to osquery table specs")
args = parser.parse_args()
logging.basicConfig(format=LOG_FORMAT, level=logging.INFO)
if not os.path.exists(args.tables):
logging.error("Cannot find path: %s" % args.table)
exit(1)
categories = {}
for base, folders, files in os.walk(args.tables):
for spec in files:
platform = CANONICAL_PLATFORMS[os.path.basename(base)]
name = spec.split(".table", 1)[0]
if platform not in categories.keys():
categories[platform] = []
with open(os.path.join(base, spec), "rU") as fh:
tree = ast.parse(fh.read())
categories[platform].append(gen_spec(tree))
print gen_api(categories)
if __name__ == "__main__":
main(len(sys.argv), sys.argv)