You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I initially asked decai to decompile a given function. The output was not excellent, so I want to ask it to improve using -Q.
It did not improve because it actually sent to the AI: my new prompt + the initial prompt + the initial decompiled output. This decompiled output is missing stuff, so with what it is given, it can't improve. Rather, it should be sent, as in the initial request, the pdc of the function, with my modified prompt.
[0x00002780]> decai -Q the function calls socket and connect. Please adjust your decompiled output.
curl -s https://api.anthropic.com/v1/messages -H "Content-Type: application/json" -H "anthropic-version: 2023-06-01" -H "x-api-key: CENSORED" -d '{"model":"claude-3-5-sonnet-20241022","max_tokens":5128,"messages":[{"role":"user","content":"Rewrite this function and respond ONLY with code, NO explanations, NO markdown, Change 'goto' into if/else/for/while, Simplify as much as possible, use better variable names, take function arguments and and strings from comments like 'string:', Rewrite this pseudocode into C\nthe function calls socket and connect. Please adjust your decompiled output.:\nint main(int argc, char **argv) {\n void *ptr;\n \n ptr = calloc(argc + 1, 8);\n if (!ptr) {\n exit(-1);\n }\n\n char **saved_args = (char**)ptr;\n char **orig_args = argv;\n char **last_arg = argv + argc;\n\n while (orig_args < last_arg) {\n char *arg = strdup(*orig_args);\n char *orig = *orig_args;\n *saved_args = arg;\n \n size_t len = strlen(orig);\n memset(orig, 0, len);\n *orig_args = NULL;\n \n orig_args++;\n saved_args++;\n }\n\n argv[0] = \"kdevtmpfs\";\n prctl(15, \"kdevtmpfs\", 0, 0, 0);\n\n char *cmd = *((char**)(argv + 1));\n if (!cmd) {\n return -1;\n }\n\n char *at = strchr(cmd, \"@\");\n if (!at) {\n if (strncmp(cmd, \"run\", strlen(\"run\")) != 0) {\n return -1;\n }\n \n // Run mode handling\n int pipes[4];\n pipe2(&pipes[0], 0x800);\n pipe2(&pipes[2], 0x800);\n \n pid_t pid = fork();\n if (pid < 0) {\n exit(-1);\n }\n \n if (pid == 0) {\n // Child process\n char *exec_args[] = {\"/bin/sh\", \"-c\", NULL};\n char *env[] = {\"HOME=/proc\",\n \"PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin\",\n NULL};\n \n close(pipes[0]);\n close(pipes[2]); \n dup2(pipes[1], 1);\n dup2(pipes[3], 2);\n close(pipes[1]);\n close(pipes[3]);\n \n execve(\"/bin/sh\", exec_args, env);\n exit(-1);\n }\n \n close(pipes[1]);\n close(pipes[3]);\n return 0;\n }\n\n return 0;\n}"}]}'
...
The text was updated successfully, but these errors were encountered:
I initially asked decai to decompile a given function. The output was not excellent, so I want to ask it to improve using
-Q
.It did not improve because it actually sent to the AI: my new prompt + the initial prompt + the initial decompiled output. This decompiled output is missing stuff, so with what it is given, it can't improve. Rather, it should be sent, as in the initial request, the
pdc
of the function, with my modified prompt.The text was updated successfully, but these errors were encountered: