void route(pid_t pid, int print_procs) { pid_read(pid); // print processes int i; for (i = 0; i < max_pids; i++) { if (pids[i].level == 1) { if (print_procs || pid == 0) pid_print_list(i, arg_nowrap); int child = find_child(i); if (child != -1) { char *fname; if (asprintf(&fname, "/proc/%d/net/fib_trie", child) == -1) errExit("asprintf"); extract_if(fname); free(fname); if (asprintf(&fname, "/proc/%d/net/route", child) == -1) errExit("asprintf"); print_route(fname); free(fname); } } } printf("\n"); }
void x11(pid_t pid, int print_procs) { pid_read(pid); // print processes int i; for (i = 0; i < max_pids; i++) { if (pids[i].level == 1) { if (print_procs || pid == 0) pid_print_list(i, arg_nowrap); char *x11file; // todo: use macro from src/firejail/firejail.h for /run/firejail/x11 directory if (asprintf(&x11file, "/run/firejail/x11/%d", i) == -1) errExit("asprintf"); FILE *fp = fopen(x11file, "r"); if (!fp) { free(x11file); continue; } int display; int rv = fscanf(fp, "%d", &display); if (rv == 1) printf(" DISPLAY :%d\n", display); fclose(fp); free(x11file); } } printf("\n"); }
void list(void) { pid_read(0); // include all processes // print processes int i; for (i = 0; i < max_pids; i++) { if (i == skip_process) continue; if (pids[i].level == 1) pid_print_list(i, arg_nowrap); } }
void list(void) { if (getuid() == 0) firemon_drop_privs(); pid_read(0); // include all processes // print processes int i; for (i = 0; i < max_pids; i++) { if (pids[i].level == 1) pid_print_list(i, 0); } }
void cpu(void) { if (getuid() == 0) firemon_drop_privs(); pid_read(0); // include all processes // print processes int i; for (i = 0; i < MAX_PIDS; i++) { if (pids[i].level == 1) { pid_print_list(i, 0); int child = find_child(i); if (child != -1) print_cpu(child); } } }
void cpu(pid_t pid) { if (getuid() == 0) firemon_drop_privs(); pid_read(pid); // print processes int i; for (i = 0; i < max_pids; i++) { if (pids[i].level == 1) { pid_print_list(i, 0); int child = find_child(i); if (child != -1) print_cpu(child); } } }
void seccomp(pid_t pid) { if (getuid() == 0) firemon_drop_privs(); pid_read(pid); // include all processes // print processes int i; for (i = 0; i < max_pids; i++) { if (pids[i].level == 1) { pid_print_list(i, 0); int child = find_child(i); if (child != -1) print_seccomp(child); } } printf("\n"); }
void interface(pid_t pid) { if (getuid() != 0) { fprintf(stderr, "Error: you need to be root to run this command\n"); exit(1); } pid_read(pid); // a pid of 0 will include all processes // print processes int i; for (i = 0; i < MAX_PIDS; i++) { if (pids[i].level == 1) { pid_print_list(i, 0); int child = find_child(i); if (child != -1) { print_sandbox(child); } } } }
void arp(pid_t pid) { if (getuid() == 0) firemon_drop_privs(); pid_read(pid); // print processes int i; for (i = 0; i < MAX_PIDS; i++) { if (pids[i].level == 1) { pid_print_list(i, 0); int child = find_child(i); if (child != -1) { char *fname; if (!asprintf(&fname, "/proc/%d/net/arp", child) == -1) errExit("asprintf"); print_arp(fname); free(fname); printf("\n"); } } } }