Skip to content

TritonDataCenter/ctf2json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ctf2json is a tool designed to gather CTF data embedded in binaries and export
it in a standard JSON format for consumers such as node-ctype.

ctf2json should build on any platform with versions of SunOS libctf and libavl.
It has been tested on illumos, specifically Joyent SmartOS. It has been tested
with GNU make and SUNWmake, Sun's SFW gcc (3.4.3), gcc 4.5.2, and the patched
Sun Studio 12 for OpenSolaris.

ctf2json is licensed under the CDDL. Please check individual files for full
copyright information.

To build with gcc use:

make

To build with Sun Studio use:

make sunwcc

To check style and lint use:

make check

Full documentation is provided in the manual page. To read it from the root of
the repository run:

man -M man/ ctf2json

Installing:

This is a manual process. Put the ctf2json binary wherever you want. Put the
manual page somewhere in section 1 in your MANPATH.

Sample invocation:

./ctf2json -f /lib/libc.so -t psinfo_t

{ "metadata":
	{
		"ctf2json_version": "1.0",
		"created_at": 1316561589,
		"derived_from": "/lib/libc.so",
		"ctf_version": 2,
		"requested_types": [ "psinfo_t" ]
	},
"data":
	[
		{ "name": "int", "integer": { "length": 4, "signed": true } },
		{ "name": "char", "integer": { "length": 1, "signed": true } },
		{ "name": "unsigned short", "integer": { "length": 2, "signed": false } },
		{ "name": "long", "integer": { "length": 4, "signed": true } },
		{ "name": "unsigned", "integer": { "length": 4, "signed": false } },
		{ "name": "size_t", "typedef": "unsigned" },
		{ "name": "unsigned long", "integer": { "length": 4, "signed": false } },
		{ "name": "time_t", "typedef": "long" },
		{ "name": "struct timespec", "struct": [
			{ "name": "tv_sec", "type": "time_t" },
			{ "name": "tv_nsec", "type": "long" }
		] },
		{ "name": "zoneid_t", "typedef": "long" },
		{ "name": "taskid_t", "typedef": "long" },
		{ "name": "dev_t", "typedef": "unsigned long" },
		{ "name": "uid_t", "typedef": "unsigned" },
		{ "name": "gid_t", "typedef": "unsigned" },
		{ "name": "timestruc_t", "typedef": "struct timespec" },
		{ "name": "short", "integer": { "length": 2, "signed": true } },
		{ "name": "projid_t", "typedef": "long" },
		{ "name": "ushort_t", "typedef": "unsigned short" },
		{ "name": "poolid_t", "typedef": "long" },
		{ "name": "uintptr_t", "typedef": "unsigned" },
		{ "name": "id_t", "typedef": "long" },
		{ "name": "pid_t", "typedef": "long" },
		{ "name": "processorid_t", "typedef": "int" },
		{ "name": "psetid_t", "typedef": "int" },
		{ "name": "struct lwpsinfo", "struct": [
			{ "name": "pr_flag", "type": "int" },
			{ "name": "pr_lwpid", "type": "id_t" },
			{ "name": "pr_addr", "type": "uintptr_t" },
			{ "name": "pr_wchan", "type": "uintptr_t" },
			{ "name": "pr_stype", "type": "char" },
			{ "name": "pr_state", "type": "char" },
			{ "name": "pr_sname", "type": "char" },
			{ "name": "pr_nice", "type": "char" },
			{ "name": "pr_syscall", "type": "short" },
			{ "name": "pr_oldpri", "type": "char" },
			{ "name": "pr_cpu", "type": "char" },
			{ "name": "pr_pri", "type": "int" },
			{ "name": "pr_pctcpu", "type": "ushort_t" },
			{ "name": "pr_pad", "type": "ushort_t" },
			{ "name": "pr_start", "type": "timestruc_t" },
			{ "name": "pr_time", "type": "timestruc_t" },
			{ "name": "pr_clname", "type": "char [8]" },
			{ "name": "pr_name", "type": "char [16]" },
			{ "name": "pr_onpro", "type": "processorid_t" },
			{ "name": "pr_bindpro", "type": "processorid_t" },
			{ "name": "pr_bindpset", "type": "psetid_t" },
			{ "name": "pr_lgrp", "type": "int" },
			{ "name": "pr_filler", "type": "int [4]" }
		] },
		{ "name": "lwpsinfo_t", "typedef": "struct lwpsinfo" },
		{ "name": "struct psinfo", "struct": [
			{ "name": "pr_flag", "type": "int" },
			{ "name": "pr_nlwp", "type": "int" },
			{ "name": "pr_pid", "type": "pid_t" },
			{ "name": "pr_ppid", "type": "pid_t" },
			{ "name": "pr_pgid", "type": "pid_t" },
			{ "name": "pr_sid", "type": "pid_t" },
			{ "name": "pr_uid", "type": "uid_t" },
			{ "name": "pr_euid", "type": "uid_t" },
			{ "name": "pr_gid", "type": "gid_t" },
			{ "name": "pr_egid", "type": "gid_t" },
			{ "name": "pr_addr", "type": "uintptr_t" },
			{ "name": "pr_size", "type": "size_t" },
			{ "name": "pr_rssize", "type": "size_t" },
			{ "name": "pr_pad1", "type": "size_t" },
			{ "name": "pr_ttydev", "type": "dev_t" },
			{ "name": "pr_pctcpu", "type": "ushort_t" },
			{ "name": "pr_pctmem", "type": "ushort_t" },
			{ "name": "pr_start", "type": "timestruc_t" },
			{ "name": "pr_time", "type": "timestruc_t" },
			{ "name": "pr_ctime", "type": "timestruc_t" },
			{ "name": "pr_fname", "type": "char [16]" },
			{ "name": "pr_psargs", "type": "char [80]" },
			{ "name": "pr_wstat", "type": "int" },
			{ "name": "pr_argc", "type": "int" },
			{ "name": "pr_argv", "type": "uintptr_t" },
			{ "name": "pr_envp", "type": "uintptr_t" },
			{ "name": "pr_dmodel", "type": "char" },
			{ "name": "pr_pad2", "type": "char [3]" },
			{ "name": "pr_taskid", "type": "taskid_t" },
			{ "name": "pr_projid", "type": "projid_t" },
			{ "name": "pr_nzomb", "type": "int" },
			{ "name": "pr_poolid", "type": "poolid_t" },
			{ "name": "pr_zoneid", "type": "zoneid_t" },
			{ "name": "pr_contract", "type": "id_t" },
			{ "name": "pr_filler", "type": "int [1]" },
			{ "name": "pr_lwp", "type": "lwpsinfo_t" }
		] },
		{ "name": "psinfo_t", "typedef": "struct psinfo" }
	]
}

About

Dump CTF type information to a standard JSON format

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published