redis-rogue-server
redis-rogue-server copied to clipboard
Console message on make process on ubuntu 18.04
Hi, I have the next message when I do make, do you know if it is ok or is there any issue?
xxxxxx@xxxxxxx:~/redis-rogue-server/RedisModulesSDK/exp$ make
make -C ../rmutil
make[1]: Entering directory '/redis-rogue-server/RedisModulesSDK/rmutil'
ar rcs librmutil.a util.o strings.o sds.o vector.o alloc.o periodic.o
make[1]: Leaving directory '/redis-rogue-server/RedisModulesSDK/rmutil'
gcc -I../ -Wall -g -fPIC -lc -lm -std=gnu99 -c -o exp.o exp.c
exp.c: In function ‘DoCommand’:
exp.c:16:15: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
char *cmd = RedisModule_StringPtrLen(argv[1], &cmd_len);
^~~~~~~~~~~~~~~~~~~~~~~~
exp.c:23:8: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration]
if (strlen(buf) + strlen(output) >= size) {
^~~~~~
exp.c:23:8: warning: incompatible implicit declaration of built-in function ‘strlen’
exp.c:23:8: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
exp.c:27:4: warning: implicit declaration of function ‘strcat’ [-Wimplicit-function-declaration]
strcat(output, buf);
^~~~~~
exp.c:27:4: warning: incompatible implicit declaration of built-in function ‘strcat’
exp.c:27:4: note: include ‘<string.h>’ or provide a declaration of ‘strcat’
exp.c:29:66: warning: incompatible implicit declaration of built-in function ‘strlen’
RedisModuleString *ret = RedisModule_CreateString(ctx, output, strlen(output));
^~~~~~
exp.c:29:66: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
exp.c: In function ‘RevShellCommand’:
exp.c:41:14: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
char *ip = RedisModule_StringPtrLen(argv[1], &cmd_len);
^~~~~~~~~~~~~~~~~~~~~~~~
exp.c:42:18: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
char *port_s = RedisModule_StringPtrLen(argv[2], &cmd_len);
^~~~~~~~~~~~~~~~~~~~~~~~
exp.c:48:24: warning: implicit declaration of function ‘inet_addr’; did you mean ‘si_addr’? [-Wimplicit-function-declaration]
sa.sin_addr.s_addr = inet_addr(ip);
^~~~~~~~~
si_addr
exp.c:57:3: warning: null argument where non-null required (argument 2) [-Wnonnull]
execve("/bin/sh", 0, 0);
^~~~~~
exp.c: In function ‘RedisModule_OnLoad’:
exp.c:68:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
if (RedisModule_CreateCommand(ctx, "system.exec",
^~
exp.c:71:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
if (RedisModule_CreateCommand(ctx, "system.rev",
^~
ld -o exp.so exp.o -shared -Bsymbolic -L../rmutil -lrmutil -lc
Thanks in advance.
Hi, do you solve this problem now? I encountered the same problem today. T_T
Hi, do you solve this problem now? I encountered the same problem today. T_T
No yet.
same issue here
run with sudo, i don't know why but it seems to work here.
2,6c2,5
<
< #include <stdio.h>
< #include <unistd.h>
< #include <stdlib.h>
< #include <errno.h>
---
> #include <stdio.h>
> #include <unistd.h>
> #include <stdlib.h>
> #include <errno.h>
8c7
< #include <sys/types.h>
---
> #include <sys/types.h>
11a11,14
> #include <string.h>
> #include <arpa/inet.h>
>
>
16c19
< char *cmd = RedisModule_StringPtrLen(argv[1], &cmd_len);
---
> const char *cmd = RedisModule_StringPtrLen(argv[1], &cmd_len);
41,42c44,45
< char *ip = RedisModule_StringPtrLen(argv[1], &cmd_len);
< char *port_s = RedisModule_StringPtrLen(argv[2], &cmd_len);
---
> const char *ip = RedisModule_StringPtrLen(argv[1], &cmd_len);
> const char *port_s = RedisModule_StringPtrLen(argv[2], &cmd_len);
50c53
<
---
>
57c60,61
< execve("/bin/sh", 0, 0);
---
> char *argv[] = { NULL };
> execve("/bin/sh", argv, NULL);