2021-11-05 23:02:23 +01:00
|
|
|
#include "libc.h"
|
|
|
|
|
2021-11-06 00:13:40 +01:00
|
|
|
int func_yolo()
|
|
|
|
{
|
|
|
|
yolo();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int func_help()
|
|
|
|
{
|
|
|
|
printf("\nAvailable Commands:\n");
|
|
|
|
printf(" yolo\n");
|
|
|
|
printf(" suicide\n");
|
|
|
|
printf(" help\n");
|
2021-11-08 23:22:03 +01:00
|
|
|
printf(" syscall5\n");
|
2021-11-06 00:13:40 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int func_suicide()
|
|
|
|
{
|
|
|
|
printf("User is about to suicide\n");
|
|
|
|
int *yolo = 0;
|
|
|
|
*yolo = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-11-05 23:02:23 +01:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
(void)argc;
|
|
|
|
(void)argv;
|
2021-11-06 00:13:40 +01:00
|
|
|
char buf[64];
|
2021-11-08 22:52:46 +01:00
|
|
|
printf("Shell starting... type \"help\" for help\n");
|
2021-11-06 00:13:40 +01:00
|
|
|
while (1) {
|
|
|
|
printf(">");
|
|
|
|
if (readline(buf, sizeof(buf)))
|
|
|
|
continue;
|
|
|
|
if (strcmp(buf, "yolo") == 0) {
|
|
|
|
func_yolo();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (strcmp(buf, "help") == 0) {
|
|
|
|
func_help();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (strcmp(buf, "suicide") == 0) {
|
|
|
|
func_suicide();
|
|
|
|
continue;
|
|
|
|
}
|
2021-11-08 23:22:03 +01:00
|
|
|
if (strcmp(buf, "syscall5") == 0) {
|
|
|
|
testSycall5(1, 2, 3, 4, 5);
|
|
|
|
continue;
|
|
|
|
}
|
2021-11-06 00:13:40 +01:00
|
|
|
}
|
2021-11-05 23:02:23 +01:00
|
|
|
return 0;
|
|
|
|
}
|