From 12c77cdbfa4ec48d935af3ae7cf1118e38bec6e1 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 29 May 2011 15:47:21 +0200 Subject: lowered filesystem hierarchy--everything are modules --- Makefile | 10 +- Monitoring/Makefile | 8 + Monitoring/TODO | 5 + Monitoring/conf/hostgroups_nagios2.cfg | 31 ++ Monitoring/conf/krebs_hosts.cfg | 78 +++++ Monitoring/conf/krebsnet.cfg | 20 ++ Monitoring/conf/localhost.cfg | 60 ++++ Monitoring/conf/other_hosts.cfg | 23 ++ Monitoring/conf/shack_infrastructure.cfg | 231 ++++++++++++++ Monitoring/conf/shacknet.cfg | 34 ++ Monitoring/conf/tinc_hosts.cfg | 45 +++ Monitoring/conf/tincnet.cfg | 31 ++ Monitoring/htdocs/images/logos/krebs/favicon.ico | Bin 0 -> 822 bytes Monitoring/htdocs/images/logos/krebs/krebs.gd2 | Bin 0 -> 1047 bytes Monitoring/htdocs/images/logos/krebs/krebs.png | Bin 0 -> 323 bytes Monitoring/htdocs/images/logos/krebs/shack.gd2 | Bin 0 -> 1047 bytes Monitoring/htdocs/images/logos/krebs/shack.png | Bin 0 -> 316 bytes Monitoring/htdocs/images/logos/krebs/tinc.gd2 | Bin 0 -> 1305 bytes Monitoring/htdocs/images/logos/krebs/tinc.png | Bin 0 -> 361 bytes .../images/logos/krebs/wireless_access_point.gd2 | Bin 0 -> 1047 bytes .../images/logos/krebs/wireless_access_point.png | Bin 0 -> 883 bytes .../logos/krebs/wireless_access_point_64.png | Bin 0 -> 5364 bytes Monitoring/plugins/check_sip | 252 +++++++++++++++ bigeye/bigeyed | 70 +++++ infest/Makefile | 18 ++ infest/bin/make-patch | 57 ++++ infest/bootstrap.sh | 23 ++ infest/core/angstrom | 4 + infest/core/debian | 6 + infest/host-patch/beagleboard/Makefile | 9 + infest/host-patch/beagleboard/profile.patch | 42 +++ infest/skel/etc/motd.tail | 10 + infest/skel/etc/profile | 58 ++++ infest/skel/etc/rc.local | 10 + infest/skel/home/.ssh/authorized_keys | 6 + infest/skel/home/.vimrc | 31 ++ modules/Monitoring/Makefile | 8 - modules/Monitoring/TODO | 5 - modules/Monitoring/conf/hostgroups_nagios2.cfg | 31 -- modules/Monitoring/conf/krebs_hosts.cfg | 78 ----- modules/Monitoring/conf/krebsnet.cfg | 20 -- modules/Monitoring/conf/localhost.cfg | 60 ---- modules/Monitoring/conf/other_hosts.cfg | 23 -- modules/Monitoring/conf/shack_infrastructure.cfg | 231 -------------- modules/Monitoring/conf/shacknet.cfg | 34 -- modules/Monitoring/conf/tinc_hosts.cfg | 45 --- modules/Monitoring/conf/tincnet.cfg | 31 -- .../htdocs/images/logos/krebs/favicon.ico | Bin 822 -> 0 bytes .../Monitoring/htdocs/images/logos/krebs/krebs.gd2 | Bin 1047 -> 0 bytes .../Monitoring/htdocs/images/logos/krebs/krebs.png | Bin 323 -> 0 bytes .../Monitoring/htdocs/images/logos/krebs/shack.gd2 | Bin 1047 -> 0 bytes .../Monitoring/htdocs/images/logos/krebs/shack.png | Bin 316 -> 0 bytes .../Monitoring/htdocs/images/logos/krebs/tinc.gd2 | Bin 1305 -> 0 bytes .../Monitoring/htdocs/images/logos/krebs/tinc.png | Bin 361 -> 0 bytes .../images/logos/krebs/wireless_access_point.gd2 | Bin 1047 -> 0 bytes .../images/logos/krebs/wireless_access_point.png | Bin 883 -> 0 bytes .../logos/krebs/wireless_access_point_64.png | Bin 5364 -> 0 bytes modules/Monitoring/plugins/check_sip | 252 --------------- modules/bigeye/bigeyed | 70 ----- modules/infest/Makefile | 18 -- modules/infest/bin/make-patch | 57 ---- modules/infest/bootstrap.sh | 23 -- modules/infest/core/angstrom | 4 - modules/infest/core/debian | 6 - modules/infest/host-patch/beagleboard/Makefile | 9 - .../infest/host-patch/beagleboard/profile.patch | 42 --- modules/infest/skel/etc/motd.tail | 10 - modules/infest/skel/etc/profile | 58 ---- modules/infest/skel/etc/rc.local | 10 - modules/infest/skel/home/.ssh/authorized_keys | 6 - modules/infest/skel/home/.vimrc | 31 -- modules/morse/COPYING | 14 - modules/morse/README | 32 -- modules/morse/morse.sh | 160 ---------- modules/node/Makefile | 8 - modules/noise/Makefile | 16 - modules/noise/TODO | 60 ---- modules/noise/cron/bin/zeit | 18 -- modules/noise/init.d/noise | 48 --- modules/noise/modules/cat | 14 - modules/noise/modules/chat | 33 -- modules/noise/modules/date | 6 - modules/noise/modules/echo | 6 - modules/noise/modules/ein_mal_eins | 37 --- modules/noise/modules/espeak | 34 -- modules/noise/modules/help | 24 -- modules/noise/modules/join | 15 - modules/noise/modules/lang | 22 -- modules/noise/modules/mpc | 14 - modules/noise/modules/names | 22 -- modules/noise/modules/nick | 10 - modules/noise/modules/part | 15 - modules/noise/modules/ping | 24 -- modules/noise/modules/play | 36 --- modules/noise/modules/pong | 26 -- modules/noise/modules/query | 23 -- modules/noise/modules/send_to_channel | 17 - modules/noise/modules/sendmail | 55 ---- modules/noise/modules/shackstatus | 104 ------ modules/noise/modules/sleep | 10 - modules/noise/modules/stream | 64 ---- modules/noise/modules/temp | 56 ---- modules/noise/modules/test | 13 - modules/noise/modules/twitter | 125 -------- modules/noise/modules/vvs | 17 - modules/noise/modules/wall | 8 - modules/noise/modules/zeit | 19 -- modules/noise/noise | 182 ----------- modules/noise/noise-as-user | 4 - modules/noise/noise-server | 4 - modules/people/Makefile | 6 - modules/people/README.md | 13 - modules/people/TODO.md | 3 - modules/people/VERSION | 1 - modules/people/arping.py | 37 --- modules/people/arping_users.py | 54 ---- modules/people/mac_names.lst | 1 - modules/retiolum/Makefile | 15 - modules/retiolum/README | 29 -- modules/retiolum/bin/fillxx | 6 - modules/retiolum/bin/hosts | 11 - modules/retiolum/bin/ipv6 | 35 --- modules/retiolum/bin/tinc | 18 -- modules/retiolum/bin/update_tinc_hosts | 33 -- modules/retiolum/doc/install_dotcloud | 85 ----- modules/retiolum/doc/install_no.de | 4 - modules/retiolum/scripts/README | 16 - modules/retiolum/scripts/adv_graphgen/README | 28 -- modules/retiolum/scripts/adv_graphgen/parse.py | 101 ------ modules/retiolum/scripts/adv_graphgen/sanitize.sh | 13 - modules/retiolum/scripts/autostart/Makefile | 14 - modules/retiolum/scripts/autostart/tinc | 94 ------ modules/retiolum/scripts/tinc_multicast/retiolum | 34 -- .../retiolum/scripts/tinc_multicast/retiolum.py | 349 --------------------- modules/retiolum/scripts/tinc_setup/README | 18 -- .../retiolum/scripts/tinc_setup/autoupdate_cron.sh | 7 - modules/retiolum/scripts/tinc_setup/bootstrap.sh | 11 - modules/retiolum/scripts/tinc_setup/build_arch.sh | 14 - .../retiolum/scripts/tinc_setup/build_debian.sh | 32 -- .../scripts/tinc_setup/build_debian_clean.sh | 31 -- modules/retiolum/scripts/tinc_setup/build_ec2.sh | 16 - modules/retiolum/scripts/tinc_setup/build_no.de.sh | 1 - modules/retiolum/scripts/tinc_setup/install.sh | 72 ----- modules/retiolum/scripts/tinc_setup/tinc-up | 20 -- .../retiolum/scripts/tinc_setup/write_channel.py | 26 -- modules/roboctl/index.js | 18 -- modules/roboctl/lib/irc.js | 67 ---- modules/streams/Makefile | 10 - modules/streams/README | 10 - modules/streams/deepmix | 27 -- modules/streams/groove | 29 -- modules/streams/radiotux | 29 -- modules/temper/.gitignore | 1 - modules/temper/99-tempsensor.rules | 1 - modules/temper/Makefile | 14 - modules/temper/temper.c | 277 ---------------- modules/temper/temper.h | 39 --- modules/webcams/cam1.sh | 2 - modules/zoneminder/Makefile | 14 - modules/zoneminder/zmdc.pl-LD_PRELOAD.patch | 10 - modules/zoneminder/zoneminder.conf | 2 - morse/COPYING | 14 + morse/README | 32 ++ morse/morse.sh | 160 ++++++++++ node/Makefile | 8 + noise/Makefile | 16 + noise/TODO | 60 ++++ noise/cron/bin/zeit | 18 ++ noise/init.d/noise | 48 +++ noise/modules/cat | 14 + noise/modules/chat | 33 ++ noise/modules/date | 6 + noise/modules/echo | 6 + noise/modules/ein_mal_eins | 37 +++ noise/modules/espeak | 34 ++ noise/modules/help | 24 ++ noise/modules/join | 15 + noise/modules/lang | 22 ++ noise/modules/mpc | 14 + noise/modules/names | 22 ++ noise/modules/nick | 10 + noise/modules/part | 15 + noise/modules/ping | 24 ++ noise/modules/play | 36 +++ noise/modules/pong | 26 ++ noise/modules/query | 23 ++ noise/modules/send_to_channel | 17 + noise/modules/sendmail | 55 ++++ noise/modules/shackstatus | 104 ++++++ noise/modules/sleep | 10 + noise/modules/stream | 64 ++++ noise/modules/temp | 56 ++++ noise/modules/test | 13 + noise/modules/twitter | 125 ++++++++ noise/modules/vvs | 17 + noise/modules/wall | 8 + noise/modules/zeit | 19 ++ noise/noise | 182 +++++++++++ noise/noise-as-user | 4 + noise/noise-server | 4 + people/Makefile | 6 + people/README.md | 13 + people/TODO.md | 3 + people/VERSION | 1 + people/arping.py | 37 +++ people/arping_users.py | 54 ++++ people/mac_names.lst | 1 + retiolum/Makefile | 15 + retiolum/README | 29 ++ retiolum/bin/fillxx | 6 + retiolum/bin/hosts | 11 + retiolum/bin/ipv6 | 35 +++ retiolum/bin/tinc | 18 ++ retiolum/bin/update_tinc_hosts | 33 ++ retiolum/doc/install_dotcloud | 85 +++++ retiolum/doc/install_no.de | 4 + retiolum/scripts/README | 16 + retiolum/scripts/adv_graphgen/README | 28 ++ retiolum/scripts/adv_graphgen/parse.py | 101 ++++++ retiolum/scripts/adv_graphgen/sanitize.sh | 13 + retiolum/scripts/autostart/Makefile | 14 + retiolum/scripts/autostart/tinc | 94 ++++++ retiolum/scripts/tinc_multicast/retiolum | 34 ++ retiolum/scripts/tinc_multicast/retiolum.py | 349 +++++++++++++++++++++ retiolum/scripts/tinc_setup/README | 18 ++ retiolum/scripts/tinc_setup/autoupdate_cron.sh | 7 + retiolum/scripts/tinc_setup/bootstrap.sh | 11 + retiolum/scripts/tinc_setup/build_arch.sh | 14 + retiolum/scripts/tinc_setup/build_debian.sh | 32 ++ retiolum/scripts/tinc_setup/build_debian_clean.sh | 31 ++ retiolum/scripts/tinc_setup/build_ec2.sh | 16 + retiolum/scripts/tinc_setup/build_no.de.sh | 1 + retiolum/scripts/tinc_setup/install.sh | 72 +++++ retiolum/scripts/tinc_setup/tinc-up | 20 ++ retiolum/scripts/tinc_setup/write_channel.py | 26 ++ roboctl/index.js | 18 ++ roboctl/lib/irc.js | 67 ++++ streams/Makefile | 10 + streams/README | 10 + streams/deepmix | 27 ++ streams/groove | 29 ++ streams/radiotux | 29 ++ temper/.gitignore | 1 + temper/99-tempsensor.rules | 1 + temper/Makefile | 14 + temper/temper.c | 277 ++++++++++++++++ temper/temper.h | 39 +++ webcams/cam1.sh | 2 + zoneminder/Makefile | 14 + zoneminder/zmdc.pl-LD_PRELOAD.patch | 10 + zoneminder/zoneminder.conf | 2 + 251 files changed, 4360 insertions(+), 4360 deletions(-) create mode 100644 Monitoring/Makefile create mode 100644 Monitoring/TODO create mode 100644 Monitoring/conf/hostgroups_nagios2.cfg create mode 100644 Monitoring/conf/krebs_hosts.cfg create mode 100644 Monitoring/conf/krebsnet.cfg create mode 100644 Monitoring/conf/localhost.cfg create mode 100644 Monitoring/conf/other_hosts.cfg create mode 100644 Monitoring/conf/shack_infrastructure.cfg create mode 100644 Monitoring/conf/shacknet.cfg create mode 100644 Monitoring/conf/tinc_hosts.cfg create mode 100644 Monitoring/conf/tincnet.cfg create mode 100644 Monitoring/htdocs/images/logos/krebs/favicon.ico create mode 100644 Monitoring/htdocs/images/logos/krebs/krebs.gd2 create mode 100644 Monitoring/htdocs/images/logos/krebs/krebs.png create mode 100644 Monitoring/htdocs/images/logos/krebs/shack.gd2 create mode 100644 Monitoring/htdocs/images/logos/krebs/shack.png create mode 100644 Monitoring/htdocs/images/logos/krebs/tinc.gd2 create mode 100644 Monitoring/htdocs/images/logos/krebs/tinc.png create mode 100644 Monitoring/htdocs/images/logos/krebs/wireless_access_point.gd2 create mode 100644 Monitoring/htdocs/images/logos/krebs/wireless_access_point.png create mode 100644 Monitoring/htdocs/images/logos/krebs/wireless_access_point_64.png create mode 100755 Monitoring/plugins/check_sip create mode 100755 bigeye/bigeyed create mode 100644 infest/Makefile create mode 100755 infest/bin/make-patch create mode 100644 infest/bootstrap.sh create mode 100755 infest/core/angstrom create mode 100755 infest/core/debian create mode 100644 infest/host-patch/beagleboard/Makefile create mode 100644 infest/host-patch/beagleboard/profile.patch create mode 100644 infest/skel/etc/motd.tail create mode 100755 infest/skel/etc/profile create mode 100755 infest/skel/etc/rc.local create mode 100644 infest/skel/home/.ssh/authorized_keys create mode 100644 infest/skel/home/.vimrc delete mode 100644 modules/Monitoring/Makefile delete mode 100644 modules/Monitoring/TODO delete mode 100644 modules/Monitoring/conf/hostgroups_nagios2.cfg delete mode 100644 modules/Monitoring/conf/krebs_hosts.cfg delete mode 100644 modules/Monitoring/conf/krebsnet.cfg delete mode 100644 modules/Monitoring/conf/localhost.cfg delete mode 100644 modules/Monitoring/conf/other_hosts.cfg delete mode 100644 modules/Monitoring/conf/shack_infrastructure.cfg delete mode 100644 modules/Monitoring/conf/shacknet.cfg delete mode 100644 modules/Monitoring/conf/tinc_hosts.cfg delete mode 100644 modules/Monitoring/conf/tincnet.cfg delete mode 100644 modules/Monitoring/htdocs/images/logos/krebs/favicon.ico delete mode 100644 modules/Monitoring/htdocs/images/logos/krebs/krebs.gd2 delete mode 100644 modules/Monitoring/htdocs/images/logos/krebs/krebs.png delete mode 100644 modules/Monitoring/htdocs/images/logos/krebs/shack.gd2 delete mode 100644 modules/Monitoring/htdocs/images/logos/krebs/shack.png delete mode 100644 modules/Monitoring/htdocs/images/logos/krebs/tinc.gd2 delete mode 100644 modules/Monitoring/htdocs/images/logos/krebs/tinc.png delete mode 100644 modules/Monitoring/htdocs/images/logos/krebs/wireless_access_point.gd2 delete mode 100644 modules/Monitoring/htdocs/images/logos/krebs/wireless_access_point.png delete mode 100644 modules/Monitoring/htdocs/images/logos/krebs/wireless_access_point_64.png delete mode 100755 modules/Monitoring/plugins/check_sip delete mode 100755 modules/bigeye/bigeyed delete mode 100644 modules/infest/Makefile delete mode 100755 modules/infest/bin/make-patch delete mode 100644 modules/infest/bootstrap.sh delete mode 100755 modules/infest/core/angstrom delete mode 100755 modules/infest/core/debian delete mode 100644 modules/infest/host-patch/beagleboard/Makefile delete mode 100644 modules/infest/host-patch/beagleboard/profile.patch delete mode 100644 modules/infest/skel/etc/motd.tail delete mode 100755 modules/infest/skel/etc/profile delete mode 100755 modules/infest/skel/etc/rc.local delete mode 100644 modules/infest/skel/home/.ssh/authorized_keys delete mode 100644 modules/infest/skel/home/.vimrc delete mode 100644 modules/morse/COPYING delete mode 100644 modules/morse/README delete mode 100755 modules/morse/morse.sh delete mode 100644 modules/node/Makefile delete mode 100644 modules/noise/Makefile delete mode 100644 modules/noise/TODO delete mode 100755 modules/noise/cron/bin/zeit delete mode 100755 modules/noise/init.d/noise delete mode 100755 modules/noise/modules/cat delete mode 100755 modules/noise/modules/chat delete mode 100755 modules/noise/modules/date delete mode 100755 modules/noise/modules/echo delete mode 100755 modules/noise/modules/ein_mal_eins delete mode 100755 modules/noise/modules/espeak delete mode 100755 modules/noise/modules/help delete mode 100755 modules/noise/modules/join delete mode 100755 modules/noise/modules/lang delete mode 100755 modules/noise/modules/mpc delete mode 100755 modules/noise/modules/names delete mode 100755 modules/noise/modules/nick delete mode 100755 modules/noise/modules/part delete mode 100755 modules/noise/modules/ping delete mode 100755 modules/noise/modules/play delete mode 100755 modules/noise/modules/pong delete mode 100755 modules/noise/modules/query delete mode 100755 modules/noise/modules/send_to_channel delete mode 100755 modules/noise/modules/sendmail delete mode 100755 modules/noise/modules/shackstatus delete mode 100755 modules/noise/modules/sleep delete mode 100755 modules/noise/modules/stream delete mode 100755 modules/noise/modules/temp delete mode 100755 modules/noise/modules/test delete mode 100755 modules/noise/modules/twitter delete mode 100755 modules/noise/modules/vvs delete mode 100755 modules/noise/modules/wall delete mode 100755 modules/noise/modules/zeit delete mode 100755 modules/noise/noise delete mode 100755 modules/noise/noise-as-user delete mode 100755 modules/noise/noise-server delete mode 100644 modules/people/Makefile delete mode 100644 modules/people/README.md delete mode 100644 modules/people/TODO.md delete mode 100644 modules/people/VERSION delete mode 100755 modules/people/arping.py delete mode 100755 modules/people/arping_users.py delete mode 100644 modules/people/mac_names.lst delete mode 100644 modules/retiolum/Makefile delete mode 100644 modules/retiolum/README delete mode 100755 modules/retiolum/bin/fillxx delete mode 100755 modules/retiolum/bin/hosts delete mode 100755 modules/retiolum/bin/ipv6 delete mode 100755 modules/retiolum/bin/tinc delete mode 100755 modules/retiolum/bin/update_tinc_hosts delete mode 100644 modules/retiolum/doc/install_dotcloud delete mode 100644 modules/retiolum/doc/install_no.de delete mode 100644 modules/retiolum/scripts/README delete mode 100644 modules/retiolum/scripts/adv_graphgen/README delete mode 100755 modules/retiolum/scripts/adv_graphgen/parse.py delete mode 100755 modules/retiolum/scripts/adv_graphgen/sanitize.sh delete mode 100644 modules/retiolum/scripts/autostart/Makefile delete mode 100755 modules/retiolum/scripts/autostart/tinc delete mode 100755 modules/retiolum/scripts/tinc_multicast/retiolum delete mode 100755 modules/retiolum/scripts/tinc_multicast/retiolum.py delete mode 100644 modules/retiolum/scripts/tinc_setup/README delete mode 100644 modules/retiolum/scripts/tinc_setup/autoupdate_cron.sh delete mode 100644 modules/retiolum/scripts/tinc_setup/bootstrap.sh delete mode 100755 modules/retiolum/scripts/tinc_setup/build_arch.sh delete mode 100755 modules/retiolum/scripts/tinc_setup/build_debian.sh delete mode 100755 modules/retiolum/scripts/tinc_setup/build_debian_clean.sh delete mode 100755 modules/retiolum/scripts/tinc_setup/build_ec2.sh delete mode 100644 modules/retiolum/scripts/tinc_setup/build_no.de.sh delete mode 100755 modules/retiolum/scripts/tinc_setup/install.sh delete mode 100755 modules/retiolum/scripts/tinc_setup/tinc-up delete mode 100644 modules/retiolum/scripts/tinc_setup/write_channel.py delete mode 100644 modules/roboctl/index.js delete mode 100644 modules/roboctl/lib/irc.js delete mode 100644 modules/streams/Makefile delete mode 100644 modules/streams/README delete mode 100755 modules/streams/deepmix delete mode 100755 modules/streams/groove delete mode 100755 modules/streams/radiotux delete mode 100644 modules/temper/.gitignore delete mode 100644 modules/temper/99-tempsensor.rules delete mode 100644 modules/temper/Makefile delete mode 100644 modules/temper/temper.c delete mode 100644 modules/temper/temper.h delete mode 100755 modules/webcams/cam1.sh delete mode 100644 modules/zoneminder/Makefile delete mode 100644 modules/zoneminder/zmdc.pl-LD_PRELOAD.patch delete mode 100644 modules/zoneminder/zoneminder.conf create mode 100644 morse/COPYING create mode 100644 morse/README create mode 100755 morse/morse.sh create mode 100644 node/Makefile create mode 100644 noise/Makefile create mode 100644 noise/TODO create mode 100755 noise/cron/bin/zeit create mode 100755 noise/init.d/noise create mode 100755 noise/modules/cat create mode 100755 noise/modules/chat create mode 100755 noise/modules/date create mode 100755 noise/modules/echo create mode 100755 noise/modules/ein_mal_eins create mode 100755 noise/modules/espeak create mode 100755 noise/modules/help create mode 100755 noise/modules/join create mode 100755 noise/modules/lang create mode 100755 noise/modules/mpc create mode 100755 noise/modules/names create mode 100755 noise/modules/nick create mode 100755 noise/modules/part create mode 100755 noise/modules/ping create mode 100755 noise/modules/play create mode 100755 noise/modules/pong create mode 100755 noise/modules/query create mode 100755 noise/modules/send_to_channel create mode 100755 noise/modules/sendmail create mode 100755 noise/modules/shackstatus create mode 100755 noise/modules/sleep create mode 100755 noise/modules/stream create mode 100755 noise/modules/temp create mode 100755 noise/modules/test create mode 100755 noise/modules/twitter create mode 100755 noise/modules/vvs create mode 100755 noise/modules/wall create mode 100755 noise/modules/zeit create mode 100755 noise/noise create mode 100755 noise/noise-as-user create mode 100755 noise/noise-server create mode 100644 people/Makefile create mode 100644 people/README.md create mode 100644 people/TODO.md create mode 100644 people/VERSION create mode 100755 people/arping.py create mode 100755 people/arping_users.py create mode 100644 people/mac_names.lst create mode 100644 retiolum/Makefile create mode 100644 retiolum/README create mode 100755 retiolum/bin/fillxx create mode 100755 retiolum/bin/hosts create mode 100755 retiolum/bin/ipv6 create mode 100755 retiolum/bin/tinc create mode 100755 retiolum/bin/update_tinc_hosts create mode 100644 retiolum/doc/install_dotcloud create mode 100644 retiolum/doc/install_no.de create mode 100644 retiolum/scripts/README create mode 100644 retiolum/scripts/adv_graphgen/README create mode 100755 retiolum/scripts/adv_graphgen/parse.py create mode 100755 retiolum/scripts/adv_graphgen/sanitize.sh create mode 100644 retiolum/scripts/autostart/Makefile create mode 100755 retiolum/scripts/autostart/tinc create mode 100755 retiolum/scripts/tinc_multicast/retiolum create mode 100755 retiolum/scripts/tinc_multicast/retiolum.py create mode 100644 retiolum/scripts/tinc_setup/README create mode 100644 retiolum/scripts/tinc_setup/autoupdate_cron.sh create mode 100644 retiolum/scripts/tinc_setup/bootstrap.sh create mode 100755 retiolum/scripts/tinc_setup/build_arch.sh create mode 100755 retiolum/scripts/tinc_setup/build_debian.sh create mode 100755 retiolum/scripts/tinc_setup/build_debian_clean.sh create mode 100755 retiolum/scripts/tinc_setup/build_ec2.sh create mode 100644 retiolum/scripts/tinc_setup/build_no.de.sh create mode 100755 retiolum/scripts/tinc_setup/install.sh create mode 100755 retiolum/scripts/tinc_setup/tinc-up create mode 100644 retiolum/scripts/tinc_setup/write_channel.py create mode 100644 roboctl/index.js create mode 100644 roboctl/lib/irc.js create mode 100644 streams/Makefile create mode 100644 streams/README create mode 100755 streams/deepmix create mode 100755 streams/groove create mode 100755 streams/radiotux create mode 100644 temper/.gitignore create mode 100644 temper/99-tempsensor.rules create mode 100644 temper/Makefile create mode 100644 temper/temper.c create mode 100644 temper/temper.h create mode 100755 webcams/cam1.sh create mode 100644 zoneminder/Makefile create mode 100644 zoneminder/zmdc.pl-LD_PRELOAD.patch create mode 100644 zoneminder/zoneminder.conf diff --git a/Makefile b/Makefile index 4e8a8e65..188e6ca2 100644 --- a/Makefile +++ b/Makefile @@ -4,16 +4,16 @@ DIST = debian all: select-target infest: - make -C modules/infest + make -C infest install-core: core/$(DIST) noise: - make -C modules/noise infest + make -C noise infest streams: - make -C modules/streams + make -C streams monitoring: - make -C modules/Monitoring debian + make -C Monitoring debian zoneminder: - make -C modules/zoneminder fix it so hard + make -C zoneminder fix it so hard diff --git a/Monitoring/Makefile b/Monitoring/Makefile new file mode 100644 index 00000000..cc1d8903 --- /dev/null +++ b/Monitoring/Makefile @@ -0,0 +1,8 @@ +.phony: debian +debian: + [ `which nagios3` ] || apt-get install nagios3 + rm /etc/nagios3/conf.d/localhost_nagios2.cfg || true + cp -r conf/* /etc/nagios3/conf.d/ + cp -R htdocs/* /usr/share/nagios3/htdocs/ + cp -r plugins /usr/lib/nagios + /etc/init.d/nagios3 reload diff --git a/Monitoring/TODO b/Monitoring/TODO new file mode 100644 index 00000000..6d74fdcd --- /dev/null +++ b/Monitoring/TODO @@ -0,0 +1,5 @@ +add guest user +add guest user to +> * authorized_for_all_services=usernagios,guest +> * authorized_for_all_hosts=usernagios,guest +in /etc/nagios3/somewhere diff --git a/Monitoring/conf/hostgroups_nagios2.cfg b/Monitoring/conf/hostgroups_nagios2.cfg new file mode 100644 index 00000000..63acbf50 --- /dev/null +++ b/Monitoring/conf/hostgroups_nagios2.cfg @@ -0,0 +1,31 @@ +# Some generic hostgroup definitions + +# A simple wildcard hostgroup +define hostgroup { + hostgroup_name all + alias All Servers + members * + } + +# A list of your Debian GNU/Linux servers +define hostgroup { + hostgroup_name debian-servers + alias Debian GNU/Linux Servers + members localhost + } + +# A list of your web servers +define hostgroup { + hostgroup_name http-servers + alias HTTP servers + members localhost + } + +# A list of your ssh-accessible servers +define hostgroup { + hostgroup_name ssh-servers + alias SSH servers + members localhost + } + + diff --git a/Monitoring/conf/krebs_hosts.cfg b/Monitoring/conf/krebs_hosts.cfg new file mode 100644 index 00000000..a929fa19 --- /dev/null +++ b/Monitoring/conf/krebs_hosts.cfg @@ -0,0 +1,78 @@ + +# +# Ur-Krebs +# +define host{ + use generic-host + host_name krebs.shack + alias krebs + _tinc_address 10.7.7.156 + address 10.42.23.5 + parents shack-coreswitch + hostgroups krebs-machines,tinc-nodes,ssh-servers + } +# +# UTART +# +define host{ + use generic-host + host_name utart + alias UTART + _tinc_address 10.7.7.66 + address 10.42.23.23 + parents shack-coreswitch + hostgroups krebs-machines,tinc-nodes,ssh-servers + } +# +# ytart +# will use tinc ip as long as no static ip is supplied +# +define host{ + use generic-host + host_name ytart + alias ytart + _tinc_address 10.7.7.201 + parents shack-wlan-ap5 + address 10.7.7.201 + hostgroups krebs-machines,tinc-nodes,ssh-servers + } +# +# uPM +# +define host{ + use generic-host + host_name upm + alias uPM Virtual Machine + _tinc_address 10.7.7.99 + address upm.shack + parents shack-node1 + hostgroups krebs-machines,ssh-servers,shack-rz + #,tinc-nodes + } + +# TODO add upm and genericore as tinc-nodes +# TODO check MONGODB on uPM + + + +#TODO verkrebse genericore/get password +define host{ + use generic-host + host_name genericore + alias genericore Virtual Machine + #_tinc_address 10.7.7.XX + address genericore.shack + parents shack-node1 + hostgroups ssh-servers,shack-rz + #,tinc-nodes,krebs-machines + } + +define host{ + use generic-host + host_name shepherd + alias Shepherd Krebs + _tinc_address 10.7.7.29 + address 10.42.23.42 + parents shack-coreswitch + hostgroups krebs-machines,tinc-nodes,ssh-servers + } diff --git a/Monitoring/conf/krebsnet.cfg b/Monitoring/conf/krebsnet.cfg new file mode 100644 index 00000000..ae5b898e --- /dev/null +++ b/Monitoring/conf/krebsnet.cfg @@ -0,0 +1,20 @@ +## extended infos for krebsnet +define hostgroup { + hostgroup_name krebs-machines + alias Krebs Machines + } +define hostextinfo{ + hostgroup_name krebs-machines + notes Deployed Krebse +# notes_url http://webserver.localhost.localdomain/hostinfo.pl?host=netware1 + icon_image krebs/krebs.png + icon_image_alt Krebs + vrml_image krebs.png + statusmap_image krebs/krebs.gd2 + } +#define host{ +# use generic-host +# register 0 +# name tinc-only-host +# check_command check_internal_tinc_up!100.0,20%!500.0,60% +# } diff --git a/Monitoring/conf/localhost.cfg b/Monitoring/conf/localhost.cfg new file mode 100644 index 00000000..3b098195 --- /dev/null +++ b/Monitoring/conf/localhost.cfg @@ -0,0 +1,60 @@ +# A simple configuration file for monitoring the local host +# This can serve as an example for configuring other servers; +# Custom services specific to this host are added here, but services +# defined in nagios2-common_services.cfg may also apply. +# + +define host{ + use generic-host ; Name of host template to use + host_name localhost + alias localhost + address 127.0.0.1 + hostgroups krebs-machines + } + +# Define a service to check the disk space of the root partition +# on the local machine. Warning if < 20% free, critical if +# < 10% free space on partition. + +define service{ + use generic-service ; Name of service template to use + host_name localhost + service_description Disk Space + check_command check_all_disks!20%!10% + } + + + +# Define a service to check the number of currently logged in +# users on the local machine. Warning if > 20 users, critical +# if > 50 users. + +define service{ + use generic-service ; Name of service template to use + host_name localhost + service_description Current Users + check_command check_users!20!50 + } + + +# Define a service to check the number of currently running procs +# on the local machine. Warning if > 250 processes, critical if +# > 400 processes. + +define service{ + use generic-service ; Name of service template to use + host_name localhost + service_description Total Processes + check_command check_procs!250!400 + } + + + +# Define a service to check the load on the local machine. + +define service{ + use generic-service ; Name of service template to use + host_name localhost + service_description Current Load + check_command check_load!5.0!4.0!3.0!10.0!6.0!4.0 + } diff --git a/Monitoring/conf/other_hosts.cfg b/Monitoring/conf/other_hosts.cfg new file mode 100644 index 00000000..bfc36154 --- /dev/null +++ b/Monitoring/conf/other_hosts.cfg @@ -0,0 +1,23 @@ +define host{ + use generic-host + host_name google.de + alias Google Website + address google.de + parents shack-modem + hostgroups http-servers + } + +define host{ + use generic-host + host_name google-dns + parents shack-gw + parents shack-modem + alias Google DNS Service (always reachable) + address 8.8.8.8 + } +define service { + host_name google-dns + service_description DNS Service + use generic-service + check_command check_dns + } diff --git a/Monitoring/conf/shack_infrastructure.cfg b/Monitoring/conf/shack_infrastructure.cfg new file mode 100644 index 00000000..dd123dc3 --- /dev/null +++ b/Monitoring/conf/shack_infrastructure.cfg @@ -0,0 +1,231 @@ +# + +# +# Shack Virtual Machine Hoster Platform +# + +# +# Virtualization and storage +# +define host{ + use generic-host + host_name shack-node1 + alias Shack Virtualization Server + address 10.42.0.10 + parents shack-serverswitch + hostgroups shack-rz,ssh-servers + } +define host{ + use generic-host + host_name shack-zetbox + alias Shack Virtualization Server + address 10.42.0.10 + parents shack-serverswitch + hostgroups shack-rz,ssh-servers + } +define host{ + use generic-host + host_name shack-plattenschwein + parents shack-serverswitch + alias Shack Plattenschwein + address 10.42.0.12 + hostgroups shack-rz,ssh-servers + } +define host{ + use generic-host + host_name shack-gauda0 + parents shack-serverswitch + alias Shack gauda0 Mining Server + address gauda0.shack + hostgroups shack-rz + } +# +# Network Infrastructure +# + +# +## Shack gateway (no gateway-no internet) +# +define host{ + use generic-host + host_name shack-gw + parents shack-coreswitch + alias Watchguard Shack Gateway + address 10.42.0.1 + hostgroups shack-rz,ssh-servers + } +define host{ + use generic-host + host_name shack-modem + parents shack-gw + alias Shack Telecom VDSL Router + address 192.168.2.1 + hostgroups shack-rz + } +define host{ + use generic-host + host_name shack-externswitch + parents shack-gw + alias Shack External Switch (2.OG) + address 10.0.10.2 + hostgroups shack-rz + } + +define service { + host_name shack-gw + service_description DNS Service + use generic-service + check_command check_dns + } +define host{ + use generic-host + host_name shack-coreswitch + alias Shack Cisco Router Coreswitch + address 10.42.0.3 + hostgroups shack-rz,ssh-servers + } +define host{ + use generic-host + host_name shack-serverswitch + parents shack-coreswitch + alias Shack Cisco Router Serverswitch + address 10.42.0.4 + hostgroups shack-rz + } + +define host{ + use generic-host + host_name shack-wlan-ap1 + parents shack-coreswitch + alias Shack Wlan Access Point 1 + address 10.42.0.5 + hostgroups wlan-ap + } +define host{ + use generic-host + host_name shack-wlan-ap2 + parents shack-coreswitch + alias Shack Wlan Access Point 2 + address 10.42.0.6 + hostgroups wlan-ap + } +define host{ + use generic-host + host_name shack-wlan-ap3 + parents shack-coreswitch + alias Shack Wlan Access Point 3 + address 10.42.0.7 + hostgroups wlan-ap + } +define host{ + use generic-host + host_name shack-wlan-ap4 + parents shack-coreswitch + alias Shack Wlan Access Point 4 + address 10.42.0.8 + hostgroups wlan-ap + } +define host{ + use generic-host + host_name shack-wlan-ap5 + parents shack-coreswitch + alias Shack Wlan Access Point 5 + address 10.42.0.9 + hostgroups wlan-ap + } +# +# Voip Infrastructure +# +define host{ + use generic-host + host_name shack-voip + alias Shack Cisco VOIP Gateway + address 10.42.0.2 + parents shack-coreswitch + hostgroups shack-rz,http-servers + } + +define service{ + host_name shack-voip + service_description SIP Service + use generic-service + check_command check_sip + } + + + + + +# +# Shack DNS Server +# + +define host{ + use generic-host + host_name shack-dns + parents shack-zetbox + alias Shack DNS Virtual Host + address 10.42.0.100 + hostgroups shack-rz + } +define service { + host_name shack-dns + service_description DNS Service + use generic-service + check_command check_dns_shack + } + +define host{ + use generic-host + host_name shack-pxe + parents shack-zetbox + alias Shack PXEBoot Vhost + address pxeboot.shack + hostgroups shack-rz + } + +define host{ + use generic-host + host_name shack-printsrv + parents shack-node1 + alias Shack Print Server + address printer.shack + hostgroups shack-rz + } + +define host{ + use generic-host + host_name shack-aptproxy + parents shack-zetbox + alias Shack Apt-proxy + address aptproxy.shack + hostgroups shack-rz + } + +define host{ + use generic-host + host_name shack-shack + parents shack-node1 + alias Shack Data Exchange + address shack.shack + hostgroups shack-rz,ssh-servers + } + +# +# shack ldap server +# +define host{ + use generic-host + host_name shack-ldap + parents shack-zetbox + alias Shack LDAP Server + address ldap.shack + hostgroups shack-rz + } +define service { + host_name shack-ldap + service_description LDAP Service + use generic-service + check_command check_ldap!shammunity + } + diff --git a/Monitoring/conf/shacknet.cfg b/Monitoring/conf/shacknet.cfg new file mode 100644 index 00000000..7658ab80 --- /dev/null +++ b/Monitoring/conf/shacknet.cfg @@ -0,0 +1,34 @@ +define hostgroup { + hostgroup_name shack-rz + alias Shack RZ Infrastructure + } +define hostgroup { + hostgroup_name wlan-ap + alias Shack Wlan Access Points + } +define hostextinfo{ + hostgroup_name wlan-ap + notes Access Points for Shack + icon_image krebs/wireless_access_point.png + icon_image_alt wireless_access_point + vrml_image wireless_access_point.png + statusmap_image krebs/wireless_access_point.gd2 + } +define hostextinfo{ + hostgroup_name shack-rz + notes Shack RZ Infrastructure + icon_image krebs/shack.png + icon_image_alt shack-RZ + vrml_image shack.png + statusmap_image krebs/shack.gd2 + } + +define command { + command_name check_sip + command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p 5060 + } + +define command { + command_name check_dns_shack + command_line $USER1$/check_dns -H shack.shack -s '$HOSTADDRESS$' + } diff --git a/Monitoring/conf/tinc_hosts.cfg b/Monitoring/conf/tinc_hosts.cfg new file mode 100644 index 00000000..23c2b75e --- /dev/null +++ b/Monitoring/conf/tinc_hosts.cfg @@ -0,0 +1,45 @@ +#connection will not work if no internet is available (e.g. no shack-gateway) + +# +# Miefda Supernode +# +define host{ + use generic-host + host_name supernode + alias Supernode External + _TINC_ADDRESS 10.7.7.1 + address miefda.org + parents shack-modem + hostgroups tinc-nodes,ssh-servers,http-servers + } + +define service { + host_name supernode + service_description IRC + use generic-service + check_command check_ircd + } +# +# Sharepoint (dhbw-stuttgart) +# +define host{ + use generic-host + host_name sharepoint + alias PA Sharepoint + address 141.31.8.11 + _TINC_ADDRESS 10.7.7.5 + parents shack-modem + hostgroups tinc-nodes,ssh-servers + } +# +# Leechi +# +define host{ + use generic-host + host_name leechi + alias no_omo + address leechi.kicks-ass.org + _TINC_ADDRESS 10.7.7.111 + parents shack-modem + hostgroups tinc-nodes,ssh-servers,http-servers + } diff --git a/Monitoring/conf/tincnet.cfg b/Monitoring/conf/tincnet.cfg new file mode 100644 index 00000000..f0b35b4e --- /dev/null +++ b/Monitoring/conf/tincnet.cfg @@ -0,0 +1,31 @@ +define hostgroup { + hostgroup_name tinc-nodes + alias Tinc Nodes + } + +define hostextinfo{ + hostgroup_name tinc-nodes + notes Tinc Nodes + icon_image krebs/tinc.png + icon_image_alt tinc + vrml_image tinc.png + statusmap_image krebs/tinc.gd2 + } + +define command { + command_name check_internal_tinc_up + command_line $USER1$/check_ping -H $_HOSTTINC_ADDRESS$ -w $ARG1$ -c $ARG2$ + } +define command { + command_name check_ircd + command_line $USER1$/check_ircd $_HOSTTINC_ADDRESS$ + } + +define service { + hostgroup_name tinc-nodes + service_description tinc internal + check_command check_internal_tinc_up!100.0,20%!500.0,60% + use generic-service + notification_interval 0 +} + diff --git a/Monitoring/htdocs/images/logos/krebs/favicon.ico b/Monitoring/htdocs/images/logos/krebs/favicon.ico new file mode 100644 index 00000000..fa18384c Binary files /dev/null and b/Monitoring/htdocs/images/logos/krebs/favicon.ico differ diff --git a/Monitoring/htdocs/images/logos/krebs/krebs.gd2 b/Monitoring/htdocs/images/logos/krebs/krebs.gd2 new file mode 100644 index 00000000..1113f03e Binary files /dev/null and b/Monitoring/htdocs/images/logos/krebs/krebs.gd2 differ diff --git a/Monitoring/htdocs/images/logos/krebs/krebs.png b/Monitoring/htdocs/images/logos/krebs/krebs.png new file mode 100644 index 00000000..3d8a8ab8 Binary files /dev/null and b/Monitoring/htdocs/images/logos/krebs/krebs.png differ diff --git a/Monitoring/htdocs/images/logos/krebs/shack.gd2 b/Monitoring/htdocs/images/logos/krebs/shack.gd2 new file mode 100644 index 00000000..8b0d98e5 Binary files /dev/null and b/Monitoring/htdocs/images/logos/krebs/shack.gd2 differ diff --git a/Monitoring/htdocs/images/logos/krebs/shack.png b/Monitoring/htdocs/images/logos/krebs/shack.png new file mode 100644 index 00000000..53f1275b Binary files /dev/null and b/Monitoring/htdocs/images/logos/krebs/shack.png differ diff --git a/Monitoring/htdocs/images/logos/krebs/tinc.gd2 b/Monitoring/htdocs/images/logos/krebs/tinc.gd2 new file mode 100644 index 00000000..36572d4a Binary files /dev/null and b/Monitoring/htdocs/images/logos/krebs/tinc.gd2 differ diff --git a/Monitoring/htdocs/images/logos/krebs/tinc.png b/Monitoring/htdocs/images/logos/krebs/tinc.png new file mode 100644 index 00000000..daa1fdeb Binary files /dev/null and b/Monitoring/htdocs/images/logos/krebs/tinc.png differ diff --git a/Monitoring/htdocs/images/logos/krebs/wireless_access_point.gd2 b/Monitoring/htdocs/images/logos/krebs/wireless_access_point.gd2 new file mode 100644 index 00000000..6e740ec4 Binary files /dev/null and b/Monitoring/htdocs/images/logos/krebs/wireless_access_point.gd2 differ diff --git a/Monitoring/htdocs/images/logos/krebs/wireless_access_point.png b/Monitoring/htdocs/images/logos/krebs/wireless_access_point.png new file mode 100644 index 00000000..9febe45e Binary files /dev/null and b/Monitoring/htdocs/images/logos/krebs/wireless_access_point.png differ diff --git a/Monitoring/htdocs/images/logos/krebs/wireless_access_point_64.png b/Monitoring/htdocs/images/logos/krebs/wireless_access_point_64.png new file mode 100644 index 00000000..fe9788af Binary files /dev/null and b/Monitoring/htdocs/images/logos/krebs/wireless_access_point_64.png differ diff --git a/Monitoring/plugins/check_sip b/Monitoring/plugins/check_sip new file mode 100755 index 00000000..24374727 --- /dev/null +++ b/Monitoring/plugins/check_sip @@ -0,0 +1,252 @@ +#!/usr/bin/perl -w +# +# check_sip plugin for nagios +# $Revision: 1.2 $ +# +# Nagios plugin to check SIP servers +# +# By Sam Bashton, Bashton Ltd +# bashton.com/content/nagiosplugins +# Michael Hirschbichler, Institute of Broadband Communications, +# Vienna University of Technology +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +use strict; +use lib "/usr/lib/nagios/plugins"; +use utils qw($TIMEOUT %ERRORS &print_revision &support); +use vars qw($PROGNAME); +use IO::Socket::INET; +#use Sys::Hostname; +use Time::HiRes qw(gettimeofday); +use Net::Domain qw (hostname hostfqdn hostdomain); + +$PROGNAME = "check_sip"; +my $VERSION = "1.2"; + +$ENV{'BASH_ENV'}=''; +$ENV{'ENV'}=''; +$ENV{'PATH'}=''; +$ENV{'LC_ALL'}='C'; + +my ($opt_V,$opt_h,$opt_u,$opt_p,$opt_H, $opt_w, $opt_s, $opt_f); +$opt_V = $opt_h = $opt_u = $opt_p = $opt_H = $opt_w = $opt_s = $opt_f = ''; + +my $state = 'UNKNOWN'; + +use Getopt::Long; +Getopt::Long::Configure('bundling'); +GetOptions( + "V" => \$opt_V, "version" => \$opt_V, + "h" => \$opt_h, "help" => \$opt_h, + "s" => \$opt_s, + "f=s" => \$opt_f, "fromuri=s" => \$opt_f, + "u=s" => \$opt_u, "uri=s" => \$opt_u, + "p=s" => \$opt_p, "port=s" => \$opt_p, + "H=s" => \$opt_H, "host=s" => \$opt_H, + "w=s" => \$opt_w, "warn=s" => \$opt_w +); + +# -h displays help +if ($opt_h) { printHelp(); exit $ERRORS{'OK'}; } + +# -V display version number +if ($opt_V) { + print_revision($PROGNAME, $VERSION); + exit $ERRORS{'OK'}; +}; + +# Check the sip URI is OK +unless ($opt_u) { printHelp(); exit $ERRORS{'UNKNOWN'} } + +# Port is 5060 unless otherwise specified +unless ($opt_p) { $opt_p = 5060 } + +# Determine the host from the sip URI if it wasn't specified with -H +unless ($opt_H) { $opt_H = hostFromURI($opt_u) } + +# Check the host is valid +unless (utils::is_hostname($opt_H)) +{ + print "$opt_H is not a valid hostname\n"; + printHelp(); + exit $ERRORS{"UNKNOWN"}; +} + +unless ($opt_w) { $opt_w = 5 } # Warn if response takes longer than 5 seconds + +### Main code ############################################################### + +# Timeout if we don't recieve a response within a suitable timeframe.. +$SIG{'ALRM'} = sub { + print ("SIP timeout: No response from SIP server after $TIMEOUT seconds\n"); + exit $ERRORS{"CRITICAL"}; +}; +alarm($TIMEOUT); + +my $localhost = hostfqdn(); +$opt_f = getFromURI($opt_f,$localhost,$opt_p); +my $user=getUserPart($opt_f); +my $socket = uconnect($opt_H, $opt_p); +my @localinfo = unpack_sockaddr_in($socket->sockname); +my $req = buildReq($localinfo[0], $opt_u, $opt_f,$user,$localhost); +my (undef, $starttime) = gettimeofday; +$socket->send($req); +my $response; +$socket->recv($response, 1024) or $state = 'CRITICAL'; + +#get rid of the 100 Trying - provisional response ... +if (getResponseCode($response) eq "100"){ + $socket->recv($response, 1024) or $state = 'CRITICAL'; +} + +my (undef, $finishtime) = gettimeofday; +my $rtime = ($finishtime - $starttime) / 1000000; # Time taken in seconds +if(checkResponse($response,$rtime,$opt_s)) +{ + if ($rtime > $opt_w) { $state = 'WARNING' } + else { $state = 'OK' } +} +else { $state = 'CRITICAL' } + +exit $ERRORS{$state}; + +### Subroutines ############################################################## + + +sub uconnect +{ + my ($host, $port) = @_; + my $socket = new IO::Socket::INET->new(PeerPort=>$port, Proto=>'udp', PeerAddr=>$host); + unless ($socket) { print "Unable to connect to $host\n"; exit $ERRORS{'UNKNOWN'} } + return $socket; +} + +sub getFromURI{ + my ($from, $localhost,$localport) = @_; + if (!("$from" eq "")){ + return "$from:$localport"; + }else + { + return "sip:checksip\@$localhost:$localport"; + } +} + +sub getUserPart{ + my ($uri) = @_; + my @uris=split(/\@/,$uri); + my $user=$uris[0]; + return $user; +} + +sub hostFromURI +{ + my ($uri) = @_; + $uri =~ s/sip:[^\@]+@//; + return $uri; +} + +sub getResponseCode +{ + my ($message) = @_; + my @messageparts=split(/\ /,$message); + return $messageparts[1]; +} + +sub buildReq +{ + my ($localport, $dsturi, $fromuri,$user,$localhost) = @_; + + my $req; + my $tag = genTag(); + my $idtag = genTag(); + $req.= "OPTIONS $dsturi SIP/2.0\r\n"; + $req.= "Via: SIP/2.0/UDP $localhost:$localport;branch=z9hG4bKhjhs8ass877\r\n"; + $req.= "Max-Forwards: 70\r\n"; + $req.= "To: $dsturi\r\n"; + $req.= "From: $fromuri;tag=$tag\r\n"; + $req.= "Call-ID: $idtag\@$localhost\r\n"; + $req.= "CSeq: 1 OPTIONS\r\n"; + $req.= "Contact: <$user\@$localhost:$localport>\r\n"; + $req.= "Accept: application/sdp\r\n"; + $req.= "Content-Length: 0\r\n\r\n"; + return $req; +} + +sub genTag +{ + my $tag; + my @chars = ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p', + 'q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8', + '9'); + + for (my $i = 0; $i < 6; $i++) + { + $tag .= $chars[rand(scalar @chars)]; + } + return $tag; +} + +sub printHelp +{ + print "This plugin tests the sip service on the specified host.\n\n"; + print "Usage: $PROGNAME -u sip:uri\@example.com [-H host -p PORT -f sip:fromuri\@example.com -w WARNTIME -s]\n"; + print " $PROGNAME [-h | --help]\n"; + print " $PROGNAME [-V | --version]\n\n"; + print "Options:\n"; + print " -u sip:uri\@example.com\n"; + print " Full SIP uri, eg sip:uri\@example.com\n"; + print " -h, --help\n"; + print " Print this help\n"; + print " -V, --version\n"; + print " Print version information\n"; + print " -H host\n"; + print " Host name or IP Address to connect to\n"; + print " -p port\n"; + print " Port to connect to\n"; + print " -f sip:fromuri\@example.com\n"; + print " Full SIP uri, will be used for the \"From:\"-Header\n"; + print " -s\n"; + print " Changes default behavior: all SIP-responses will result in an \"OK\"\n\n"; + + +} + +sub checkResponse +{ + my ($response, $rtime, $sp_behavior) = @_; + my @header=split(/\r/,$response); + my $tstring=$header[0]; + my $rcode=getResponseCode($response); + if (!$sp_behavior){ + #in this case, we want to see if the SIP-server is respoding positively to our request + # Some SUT respond with 100 Trying - assume everything is OK if we get this + if ($response =~ /^SIP.+[12]00/){ + print "$tstring, $rtime seconds response time|rtt=".$rtime."s;0.5s;1s;0:10; code=".$rcode."\n"; + return 1; + } + elsif ($response =~ /^SIP.+404 Not Found/) { + print "$tstring, $rtime seconds response time|rtt=".$rtime."s;0.5s;1s;0:10; code=".$rcode."\n"; + return 0 } + else { print "Unknown error: $tstring, $rtime seconds response time|rtt=".$rtime."s;0.5s;1s;0:10; code=".$rcode."\n"; return 0; } + }else{ + #in this case, we accept every response from the server, as long it is SIP + if ($response =~ /^SIP./){ + print "$tstring, $rtime seconds response time|rtt=".$rtime."s;0.5s;1s;0:10; code=".$rcode."\n"; + return 1; + } + else { print "Unknown error: $tstring, $rtime seconds response time|rtt=".$rtime."s;0.5s;1s;0:10; code=".$rcode."\n"; return 0; } + } +} diff --git a/bigeye/bigeyed b/bigeye/bigeyed new file mode 100755 index 00000000..5aa36210 --- /dev/null +++ b/bigeye/bigeyed @@ -0,0 +1,70 @@ +#! /bin/sh +# +# usage: bigeyed +# + +set -euf + +mkdir -vp /tmp/bigeye +cd /tmp/bigeye + +cleanup() { + test -n "$spid" && kill -9 $spid && spid= +} + +port=`touch /dev/bigeye 2>/dev/null && rm /dev/bigeye && echo 3 || echo 3333` + +#python -m http.server $port & server=$! +python -m SimpleHTTPServer $port & spid=$? +trap cleanup EXIT HUP INT QUIT TERM + +base64 -d>favicon.ico</dev/null 2>/dev/null + mv 0000000$frame.jpg index.jpg + cat>00000001.html< + + + $hostname's bigeye +

$date

+

ZOMBIECANCER

+EOF + mv 00000001.html index.html +} + +while blink; do + sleep 1 +done + diff --git a/infest/Makefile b/infest/Makefile new file mode 100644 index 00000000..ec5836a3 --- /dev/null +++ b/infest/Makefile @@ -0,0 +1,18 @@ + +ifndef patch_file +patch_file := /etc/Verkrebsung.patch +endif + +ifndef patch_flags +patch_flags := +endif + +.PHONY: infest dry-run +infest: $(patch_file) + unset POSIXLY_CORRECT; patch $(patch_flags) -fNp0 < $< + +$(patch_file): bin/make-patch + $< >$@ + +dry-run: + make patch_file=/tmp/krebs-infest-dry-run.patch patch_flags=--dry-run diff --git a/infest/bin/make-patch b/infest/bin/make-patch new file mode 100755 index 00000000..6f26e745 --- /dev/null +++ b/infest/bin/make-patch @@ -0,0 +1,57 @@ +#! /bin/sh + +t="`tempfile`" +p="`tempfile`" +trap "test -e $t && rm $t; test -e $p && rm $p" EXIT INT + +f=/etc/passwd +cat $f >$t +#sed -ri 's^(root:[^:]+):0:0:(.*)$\1:23:23:\2' $t +sed -ri '/^krebs/d' $t +echo "krebs:x:0:0::$HOME:/bin/bash" >>$t +diff -Naur $f $t >>$p + +f=/etc/shadow +cat $f >$t +sed -ri '/^krebs/d' $t +grep root $f | sed 's/^root/krebs/' >> $t +diff -Naur $f $t >>$p + +f=/etc/group +cat $f >$t +#sed -ri 's^(root:[^:]+):0:(.*)$\1:23:\2' $t +sed -ri '/^krebs/d' $t +echo 'krebs:x:0:' >>$t +diff -Naur $f $t >>$p + +f=/etc/fstab +cat $f >$t +if ! grep -q 'none[ \t]*/tmp' $t; then + echo 'none /tmp tmpfs defaults,size=50M 0 0' >>$t +fi +if ! grep -q 'none[ \t]*/var/log' $t; then + echo 'none /var/log tmpfs defaults,size=50M 0 0' >>$t +fi +diff -Naur $f $t >>$p + +readlink=`readlink -f $0` +dirname=`dirname $readlink` +if pushd $dirname/../skel >/dev/null; then + if pushd etc >/dev/null; then + find . -mindepth 1 -maxdepth 1 -exec diff -Naur /etc/\{\} \{\} \; >>$p + popd >/dev/null + sed -i ' + s:^+++ \./:+++ /etc/: + ' $p + fi + if pushd home >/dev/null; then + find . -type f -exec diff -Naur $HOME/\{\} \{\} \; >>$p + popd >/dev/null + sed -i ' + s:^+++ \./:+++ '$HOME'/: + ' $p + fi + popd >/dev/null +fi + +cat $p diff --git a/infest/bootstrap.sh b/infest/bootstrap.sh new file mode 100644 index 00000000..c434a4fe --- /dev/null +++ b/infest/bootstrap.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -x +[ "`id -u`" -eq "0" ] || { echo "you need to be root!"; exit 1;} || exit 1 + +[ -e '/usr/bin/git' ] || \ +apt-get install -y git-core || \ +yum install git || \ +opkg install git || \ +pacman -Sy git || \ +{ echo "please install git!"; exit 1;} || exit 1 + +[ -e '/krebs' ] || git clone git://github.com/krebscode/painload.git /krebs \ +|| { echo "cloning failed :(" ; exit 1; } || exit 1 + +cd /krebs || { echo "cannot change into /krebs folder:(" ; exit 1; } || exit 1 + +#read -n1 -p "infest now? [yN]" + +#[[ $REPLY = [yY] ]] && make infest +#echo $REPLY +echo "do 'make infest' in /krebs" +echo "have a nice day" + diff --git a/infest/core/angstrom b/infest/core/angstrom new file mode 100755 index 00000000..dafb840f --- /dev/null +++ b/infest/core/angstrom @@ -0,0 +1,4 @@ +#!/bin/sh + +opkg install vim vim-syntax +opkg install git diff --git a/infest/core/debian b/infest/core/debian new file mode 100755 index 00000000..fedd1ede --- /dev/null +++ b/infest/core/debian @@ -0,0 +1,6 @@ +#!/bin/sh +set -x +[ `which git` ] || apt-get install --yes git-core +[ `which tmux` ] || apt-get install --yes tmux +[ `which screen` ] && apt-get remote --yes screen +[ `which vim` ] || apt-get install --yes vim diff --git a/infest/host-patch/beagleboard/Makefile b/infest/host-patch/beagleboard/Makefile new file mode 100644 index 00000000..55952104 --- /dev/null +++ b/infest/host-patch/beagleboard/Makefile @@ -0,0 +1,9 @@ +.PHONY: all +all: select-target + +patchfile: + diff /krebs/etc/profile /etc/profile > profile.patch || true + +patch: + cd /;\ + patch -p0 < /krebs/host-patch/beagleboard/profile.patch diff --git a/infest/host-patch/beagleboard/profile.patch b/infest/host-patch/beagleboard/profile.patch new file mode 100644 index 00000000..d96173d7 --- /dev/null +++ b/infest/host-patch/beagleboard/profile.patch @@ -0,0 +1,42 @@ +--- /krebs/etc/profile Tue May 24 19:31:39 2011 ++++ /etc/profile Tue May 24 20:15:17 2011 +@@ -11,26 +11,13 @@ + alias la='ls -lA' + alias lAtr='ls -lAtr' + alias ll='ls -l' +-alias ls='ls -h --color=auto --group-directories-first' ++alias ls='ls -h --color=auto' + alias vi='vim' + alias vim='vim -p' + alias view='vim -R' + + set -o notify + +-if test -n "${BASH_VERSION-}" ; then +- shopt -s checkhash +- shopt -s histappend histreedit histverify +- shopt -s no_empty_cmd_completion +- complete -d cd +- +- function comp_sch() { +- local cword="${COMP_WORDS[$COMP_CWORD]}" +- COMPREPLY=( $(sch -l "$cword.*" ) ) +- } +- complete -F comp_sch sch +-fi +- + export HISTSIZE='65536' + export HISTFILESIZE="$HISTSIZE" + export HISTCONTROL='ignoredups' +@@ -43,10 +30,7 @@ + PS1='\[\033[${PS1_COLOR}m\]$(PS1)\[\033[32m\]\w\[\033[39m\]${PSx-} ' # green \w + PS1='\[\033[32m\]\w\[\033[m\] ' # green \w + +-if test -n "${SSH_CLIENT-}" ; then +- PS1='\[\033[35m\]\h'" $PS1" # prefix with magenta hostname +- #TERM=xterm-256color xtermcontrol --bg \#292d29 --fg \#d0d0d0 +-fi ++PS1='\[\033[35m\]\h'" $PS1" # prefix with magenta hostname + + export PATH="/krebs/bin:$PATH" + diff --git a/infest/skel/etc/motd.tail b/infest/skel/etc/motd.tail new file mode 100644 index 00000000..0e685c01 --- /dev/null +++ b/infest/skel/etc/motd.tail @@ -0,0 +1,10 @@ +KREBS PAINLOAD (MORE COBRA) + x x x x + xx xx xx xx xx xx + xx xx xx xx xx xx + xxx x x xxx + x xxxxxxxxxxxx x + xxxxxxxxxxxxxxxx + x xxxxxxxxxxxx x + x x x x x x + x x x x x x diff --git a/infest/skel/etc/profile b/infest/skel/etc/profile new file mode 100755 index 00000000..2812c86c --- /dev/null +++ b/infest/skel/etc/profile @@ -0,0 +1,58 @@ +#! /bin/sh + +export EDITOR=vi + +set -u +alias bc='bc -q' +alias df='df -h' +alias du='du -h' +alias grep='grep --color=auto' +alias ps?="ps ax | head -n 1;ps ax | fgrep -v ' grep --color=auto ' | grep" +alias la='ls -lA' +alias lAtr='ls -lAtr' +alias ll='ls -l' +alias ls='ls -h --color=auto --group-directories-first' +alias vi='vim' +alias vim='vim -p' +alias view='vim -R' + +set -o notify + +if test -n "${BASH_VERSION-}" ; then + shopt -s checkhash + shopt -s histappend histreedit histverify + shopt -s no_empty_cmd_completion + complete -d cd + + function comp_sch() { + local cword="${COMP_WORDS[$COMP_CWORD]}" + COMPREPLY=( $(sch -l "$cword.*" ) ) + } + complete -F comp_sch sch +fi + +export HISTSIZE='65536' +export HISTFILESIZE="$HISTSIZE" +export HISTCONTROL='ignoredups' + +case "${TERM-dumb}" in + linux) PS1_COLOR=34 ;; + rxvt-unicode) PS1_COLOR=30 ;; + *) PS1_COLOR=39 ;; +esac +PS1='\[\033[${PS1_COLOR}m\]$(PS1)\[\033[32m\]\w\[\033[39m\]${PSx-} ' # green \w +PS1='\[\033[32m\]\w\[\033[m\] ' # green \w + +#if test -n "${SSH_CLIENT-}" ; then + PS1='\[\033[35m\]\h'" $PS1" # prefix with magenta hostname + #TERM=xterm-256color xtermcontrol --bg \#292d29 --fg \#d0d0d0 +#fi + +export PATH="/krebs/bin:$PATH" + +echo '--' >&2 +test -e ~/TODO && cat ~/TODO >&2 + +set +u + +cd /krebs diff --git a/infest/skel/etc/rc.local b/infest/skel/etc/rc.local new file mode 100755 index 00000000..f224f9e4 --- /dev/null +++ b/infest/skel/etc/rc.local @@ -0,0 +1,10 @@ +#! /bin/sh -e + +morse() { + /krebs/morse/morse.sh "$@" +} + +morse -l 42 -f 4000 `hostname` +morse -l 42 -f 2000 BEREIT + +exit 0 diff --git a/infest/skel/home/.ssh/authorized_keys b/infest/skel/home/.ssh/authorized_keys new file mode 100644 index 00000000..ab09bfe5 --- /dev/null +++ b/infest/skel/home/.ssh/authorized_keys @@ -0,0 +1,6 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCl3RTOHd5DLiVeUbUr/GSiKoRWknXQnbkIf+uNiFO+XxiqZVojPlumQUVhasY8UzDzj9tSDruUKXpjut50FhIO5UFAgsBeMJyoZbgY/+R+QKU00Q19+IiUtxeFol/9dCO+F4o937MC0OpAC10LbOXN/9SYIXueYk3pJxIycXwUqhYmyEqtDdVh9Rx32LBVqlBoXRHpNGPLiswV2qNe0b5p919IGcslzf1XoUzfE3a3yjk/XbWh/59xnl4V7Oe7+iQheFxOT6rFA30WYwEygs5As//ZYtxvnn0gA02gOnXJsNjOW9irlxOUeP7IOU6Ye3WRKFRR0+7PS+w8IJLag2xb makefu@servarch +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3SFNYGRiH0oz44G51MWx+o4cC3Fj+ez5DKO5jjtEFZ0ik8XQ5CrVj7a87WbwABA/XRdIt+3WHoInsRmuDfgcIMYgWC567v2GdOxXg2danEIAhhsOY7KiCBLCfZz7lrFO7F6eJH1RCkwrXY+59hkA+i3LNtLmZazJIb2AGwFF8Xf+b/eWmLhqjCYON+OpvqftbCm9CwhLYOUcVoR94gFAzlMYSCHR7RuBBdLV6zrkmEwFEsKghBI7fcdhwfQxuV5UGVCD58KkTQTgK/Mf2tmAg/muBM+P8s2O6wVbtixmIiiDxfc99C3QD1MYVNHqWgV1Rz9JKfmyuVvFqn7TRuuT1 tv@also +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtDhAxjiCH0SmTGNDqmlKPug9qTf+IFOVjdXfk01lAV2KMVW00CgNo2d5kl5+6pM99K7zZO7Uo7pmSFLSCAg8J6cMRI3v5OxFsnQfcJ9TeGLZt/ua7F8YsyIIr5wtqKtFbujqve31q9xJMypEpiX4np3nLiHfYwcWu7AFAUY8UHcCNl4JXm6hsmPe+9f6Mg2jICOdkfMMn0LtW+iq1KZpw1Nka2YUSiE2YuUtV+V+YaVMzdcjknkVkZNqcVk6tbJ1ZyZKM+bFEnE4VkHJYDABZfELpcgBAszfWrVG0QpEFjVCUq5atpIVHJcWWDx072r0zgdTPcBuzsHHC5PRfVBLEw== makefu@arch +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAp83zynhIueJJsWlSEykVSBrrgBFKq38+vT8bRfa+csqyjZBl2SQFuCPo+Qbh49mwchpZRshBa9jQEIGqmXxv/PYdfBFQuOFgyUq9ZcTZUXqeynicg/SyOYFW86iiqYralIAkuGPfQ4howLPVyjTZtWeEeeEttom6p6LMY5Aumjz2em0FG0n9rRFY2fBzrdYAgk9C0N6ojCs/Gzknk9SGntA96MDqHJ1HXWFMfmwOLCnxtE5TY30MqSmkrJb7Fsejwjoqoe9Y/mCaR0LpG2cStC1+37GbHJNH0caCMaQCX8qdfgMVbWTVeFWtV6aWOaRgwLrPDYn4cHWQJqTfhtPrNQ== death@Uriel +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvZvfMwszjeUcmrs5Tpd4XJDVNDNUu3Qn3ZxgJzwuoys5LXxPcMikTO++dyrXl2kyexxgSMk6SZtuh34Xg0f9JDb5pN+DJwoeYv96lqTZ5QY4dn+1F0CoP+cK692GH14Kh1wBQyiL50Wj/iWR5/QHpRzrOLsepcZim1nL9FjsW6S2l+uDnUwC4x1EhsRezqJESJlqEsiS+kbhtiPybs7KcY0U4SkpYjfNjlpFE9eLrvSouoyQOUcIVjplcGIma/SVOVYWng4wQA0d5TkCAWAU0OZb0377KynDa7F8K/wN0hRGLGZGFbs3kNDJHqR1lt+sals8M6JO7qk1VVJJj1OsUw== pfleidi@pfleidimobile +ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQB2G4SpJ/UYxmTidUl8ytT6bdNGTdYvv2nmhQyaFBroNit3xdDOVxKvaMEGDuR6ncRugw5BBvrv6iPMTCFluHJxjuh6lk3JrrsJ8CT22ZOGsA593hRoXZOCrs5SxcFkw9EBiCuaHHlWiS9+Dffr6/zpkhH3djTz05uGnDrvtKuV/Zmu5XHAurNn+X3C5S/zk/y0n8o62iSQHVKeNBGO2WYhVce9d65Ucek5dOvXZYVKSe1LeAOKyeHWv+VWP8QlObmfVrQ5l1Pou6WV6Wpo85KBa/mmBJIygC9rrG+gx/1LX7JxStbCu/WoUlUwkSaP2qxWaET9KaSO8+2Wrg5i34ax== samuel@localhost diff --git a/infest/skel/home/.vimrc b/infest/skel/home/.vimrc new file mode 100644 index 00000000..22bbf99d --- /dev/null +++ b/infest/skel/home/.vimrc @@ -0,0 +1,31 @@ +" do the right thing all the time +" +" Colors and stuff +syntax on +set background=dark + + + + +" searching +set hlsearch +set showmatch +set ignorecase +set incsearch +set wildignore=*.o,*.obj,*.bak,*.pyc + +" tabbing +set tabstop=2 +set et +set sw=2 +set smarttab +set autoindent + +" vim magic +filetype plugin indent on + + +" fuck you, help command +inoremap +nnoremap +vnoremap diff --git a/modules/Monitoring/Makefile b/modules/Monitoring/Makefile deleted file mode 100644 index cc1d8903..00000000 --- a/modules/Monitoring/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -.phony: debian -debian: - [ `which nagios3` ] || apt-get install nagios3 - rm /etc/nagios3/conf.d/localhost_nagios2.cfg || true - cp -r conf/* /etc/nagios3/conf.d/ - cp -R htdocs/* /usr/share/nagios3/htdocs/ - cp -r plugins /usr/lib/nagios - /etc/init.d/nagios3 reload diff --git a/modules/Monitoring/TODO b/modules/Monitoring/TODO deleted file mode 100644 index 6d74fdcd..00000000 --- a/modules/Monitoring/TODO +++ /dev/null @@ -1,5 +0,0 @@ -add guest user -add guest user to -> * authorized_for_all_services=usernagios,guest -> * authorized_for_all_hosts=usernagios,guest -in /etc/nagios3/somewhere diff --git a/modules/Monitoring/conf/hostgroups_nagios2.cfg b/modules/Monitoring/conf/hostgroups_nagios2.cfg deleted file mode 100644 index 63acbf50..00000000 --- a/modules/Monitoring/conf/hostgroups_nagios2.cfg +++ /dev/null @@ -1,31 +0,0 @@ -# Some generic hostgroup definitions - -# A simple wildcard hostgroup -define hostgroup { - hostgroup_name all - alias All Servers - members * - } - -# A list of your Debian GNU/Linux servers -define hostgroup { - hostgroup_name debian-servers - alias Debian GNU/Linux Servers - members localhost - } - -# A list of your web servers -define hostgroup { - hostgroup_name http-servers - alias HTTP servers - members localhost - } - -# A list of your ssh-accessible servers -define hostgroup { - hostgroup_name ssh-servers - alias SSH servers - members localhost - } - - diff --git a/modules/Monitoring/conf/krebs_hosts.cfg b/modules/Monitoring/conf/krebs_hosts.cfg deleted file mode 100644 index a929fa19..00000000 --- a/modules/Monitoring/conf/krebs_hosts.cfg +++ /dev/null @@ -1,78 +0,0 @@ - -# -# Ur-Krebs -# -define host{ - use generic-host - host_name krebs.shack - alias krebs - _tinc_address 10.7.7.156 - address 10.42.23.5 - parents shack-coreswitch - hostgroups krebs-machines,tinc-nodes,ssh-servers - } -# -# UTART -# -define host{ - use generic-host - host_name utart - alias UTART - _tinc_address 10.7.7.66 - address 10.42.23.23 - parents shack-coreswitch - hostgroups krebs-machines,tinc-nodes,ssh-servers - } -# -# ytart -# will use tinc ip as long as no static ip is supplied -# -define host{ - use generic-host - host_name ytart - alias ytart - _tinc_address 10.7.7.201 - parents shack-wlan-ap5 - address 10.7.7.201 - hostgroups krebs-machines,tinc-nodes,ssh-servers - } -# -# uPM -# -define host{ - use generic-host - host_name upm - alias uPM Virtual Machine - _tinc_address 10.7.7.99 - address upm.shack - parents shack-node1 - hostgroups krebs-machines,ssh-servers,shack-rz - #,tinc-nodes - } - -# TODO add upm and genericore as tinc-nodes -# TODO check MONGODB on uPM - - - -#TODO verkrebse genericore/get password -define host{ - use generic-host - host_name genericore - alias genericore Virtual Machine - #_tinc_address 10.7.7.XX - address genericore.shack - parents shack-node1 - hostgroups ssh-servers,shack-rz - #,tinc-nodes,krebs-machines - } - -define host{ - use generic-host - host_name shepherd - alias Shepherd Krebs - _tinc_address 10.7.7.29 - address 10.42.23.42 - parents shack-coreswitch - hostgroups krebs-machines,tinc-nodes,ssh-servers - } diff --git a/modules/Monitoring/conf/krebsnet.cfg b/modules/Monitoring/conf/krebsnet.cfg deleted file mode 100644 index ae5b898e..00000000 --- a/modules/Monitoring/conf/krebsnet.cfg +++ /dev/null @@ -1,20 +0,0 @@ -## extended infos for krebsnet -define hostgroup { - hostgroup_name krebs-machines - alias Krebs Machines - } -define hostextinfo{ - hostgroup_name krebs-machines - notes Deployed Krebse -# notes_url http://webserver.localhost.localdomain/hostinfo.pl?host=netware1 - icon_image krebs/krebs.png - icon_image_alt Krebs - vrml_image krebs.png - statusmap_image krebs/krebs.gd2 - } -#define host{ -# use generic-host -# register 0 -# name tinc-only-host -# check_command check_internal_tinc_up!100.0,20%!500.0,60% -# } diff --git a/modules/Monitoring/conf/localhost.cfg b/modules/Monitoring/conf/localhost.cfg deleted file mode 100644 index 3b098195..00000000 --- a/modules/Monitoring/conf/localhost.cfg +++ /dev/null @@ -1,60 +0,0 @@ -# A simple configuration file for monitoring the local host -# This can serve as an example for configuring other servers; -# Custom services specific to this host are added here, but services -# defined in nagios2-common_services.cfg may also apply. -# - -define host{ - use generic-host ; Name of host template to use - host_name localhost - alias localhost - address 127.0.0.1 - hostgroups krebs-machines - } - -# Define a service to check the disk space of the root partition -# on the local machine. Warning if < 20% free, critical if -# < 10% free space on partition. - -define service{ - use generic-service ; Name of service template to use - host_name localhost - service_description Disk Space - check_command check_all_disks!20%!10% - } - - - -# Define a service to check the number of currently logged in -# users on the local machine. Warning if > 20 users, critical -# if > 50 users. - -define service{ - use generic-service ; Name of service template to use - host_name localhost - service_description Current Users - check_command check_users!20!50 - } - - -# Define a service to check the number of currently running procs -# on the local machine. Warning if > 250 processes, critical if -# > 400 processes. - -define service{ - use generic-service ; Name of service template to use - host_name localhost - service_description Total Processes - check_command check_procs!250!400 - } - - - -# Define a service to check the load on the local machine. - -define service{ - use generic-service ; Name of service template to use - host_name localhost - service_description Current Load - check_command check_load!5.0!4.0!3.0!10.0!6.0!4.0 - } diff --git a/modules/Monitoring/conf/other_hosts.cfg b/modules/Monitoring/conf/other_hosts.cfg deleted file mode 100644 index bfc36154..00000000 --- a/modules/Monitoring/conf/other_hosts.cfg +++ /dev/null @@ -1,23 +0,0 @@ -define host{ - use generic-host - host_name google.de - alias Google Website - address google.de - parents shack-modem - hostgroups http-servers - } - -define host{ - use generic-host - host_name google-dns - parents shack-gw - parents shack-modem - alias Google DNS Service (always reachable) - address 8.8.8.8 - } -define service { - host_name google-dns - service_description DNS Service - use generic-service - check_command check_dns - } diff --git a/modules/Monitoring/conf/shack_infrastructure.cfg b/modules/Monitoring/conf/shack_infrastructure.cfg deleted file mode 100644 index dd123dc3..00000000 --- a/modules/Monitoring/conf/shack_infrastructure.cfg +++ /dev/null @@ -1,231 +0,0 @@ -# - -# -# Shack Virtual Machine Hoster Platform -# - -# -# Virtualization and storage -# -define host{ - use generic-host - host_name shack-node1 - alias Shack Virtualization Server - address 10.42.0.10 - parents shack-serverswitch - hostgroups shack-rz,ssh-servers - } -define host{ - use generic-host - host_name shack-zetbox - alias Shack Virtualization Server - address 10.42.0.10 - parents shack-serverswitch - hostgroups shack-rz,ssh-servers - } -define host{ - use generic-host - host_name shack-plattenschwein - parents shack-serverswitch - alias Shack Plattenschwein - address 10.42.0.12 - hostgroups shack-rz,ssh-servers - } -define host{ - use generic-host - host_name shack-gauda0 - parents shack-serverswitch - alias Shack gauda0 Mining Server - address gauda0.shack - hostgroups shack-rz - } -# -# Network Infrastructure -# - -# -## Shack gateway (no gateway-no internet) -# -define host{ - use generic-host - host_name shack-gw - parents shack-coreswitch - alias Watchguard Shack Gateway - address 10.42.0.1 - hostgroups shack-rz,ssh-servers - } -define host{ - use generic-host - host_name shack-modem - parents shack-gw - alias Shack Telecom VDSL Router - address 192.168.2.1 - hostgroups shack-rz - } -define host{ - use generic-host - host_name shack-externswitch - parents shack-gw - alias Shack External Switch (2.OG) - address 10.0.10.2 - hostgroups shack-rz - } - -define service { - host_name shack-gw - service_description DNS Service - use generic-service - check_command check_dns - } -define host{ - use generic-host - host_name shack-coreswitch - alias Shack Cisco Router Coreswitch - address 10.42.0.3 - hostgroups shack-rz,ssh-servers - } -define host{ - use generic-host - host_name shack-serverswitch - parents shack-coreswitch - alias Shack Cisco Router Serverswitch - address 10.42.0.4 - hostgroups shack-rz - } - -define host{ - use generic-host - host_name shack-wlan-ap1 - parents shack-coreswitch - alias Shack Wlan Access Point 1 - address 10.42.0.5 - hostgroups wlan-ap - } -define host{ - use generic-host - host_name shack-wlan-ap2 - parents shack-coreswitch - alias Shack Wlan Access Point 2 - address 10.42.0.6 - hostgroups wlan-ap - } -define host{ - use generic-host - host_name shack-wlan-ap3 - parents shack-coreswitch - alias Shack Wlan Access Point 3 - address 10.42.0.7 - hostgroups wlan-ap - } -define host{ - use generic-host - host_name shack-wlan-ap4 - parents shack-coreswitch - alias Shack Wlan Access Point 4 - address 10.42.0.8 - hostgroups wlan-ap - } -define host{ - use generic-host - host_name shack-wlan-ap5 - parents shack-coreswitch - alias Shack Wlan Access Point 5 - address 10.42.0.9 - hostgroups wlan-ap - } -# -# Voip Infrastructure -# -define host{ - use generic-host - host_name shack-voip - alias Shack Cisco VOIP Gateway - address 10.42.0.2 - parents shack-coreswitch - hostgroups shack-rz,http-servers - } - -define service{ - host_name shack-voip - service_description SIP Service - use generic-service - check_command check_sip - } - - - - - -# -# Shack DNS Server -# - -define host{ - use generic-host - host_name shack-dns - parents shack-zetbox - alias Shack DNS Virtual Host - address 10.42.0.100 - hostgroups shack-rz - } -define service { - host_name shack-dns - service_description DNS Service - use generic-service - check_command check_dns_shack - } - -define host{ - use generic-host - host_name shack-pxe - parents shack-zetbox - alias Shack PXEBoot Vhost - address pxeboot.shack - hostgroups shack-rz - } - -define host{ - use generic-host - host_name shack-printsrv - parents shack-node1 - alias Shack Print Server - address printer.shack - hostgroups shack-rz - } - -define host{ - use generic-host - host_name shack-aptproxy - parents shack-zetbox - alias Shack Apt-proxy - address aptproxy.shack - hostgroups shack-rz - } - -define host{ - use generic-host - host_name shack-shack - parents shack-node1 - alias Shack Data Exchange - address shack.shack - hostgroups shack-rz,ssh-servers - } - -# -# shack ldap server -# -define host{ - use generic-host - host_name shack-ldap - parents shack-zetbox - alias Shack LDAP Server - address ldap.shack - hostgroups shack-rz - } -define service { - host_name shack-ldap - service_description LDAP Service - use generic-service - check_command check_ldap!shammunity - } - diff --git a/modules/Monitoring/conf/shacknet.cfg b/modules/Monitoring/conf/shacknet.cfg deleted file mode 100644 index 7658ab80..00000000 --- a/modules/Monitoring/conf/shacknet.cfg +++ /dev/null @@ -1,34 +0,0 @@ -define hostgroup { - hostgroup_name shack-rz - alias Shack RZ Infrastructure - } -define hostgroup { - hostgroup_name wlan-ap - alias Shack Wlan Access Points - } -define hostextinfo{ - hostgroup_name wlan-ap - notes Access Points for Shack - icon_image krebs/wireless_access_point.png - icon_image_alt wireless_access_point - vrml_image wireless_access_point.png - statusmap_image krebs/wireless_access_point.gd2 - } -define hostextinfo{ - hostgroup_name shack-rz - notes Shack RZ Infrastructure - icon_image krebs/shack.png - icon_image_alt shack-RZ - vrml_image shack.png - statusmap_image krebs/shack.gd2 - } - -define command { - command_name check_sip - command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p 5060 - } - -define command { - command_name check_dns_shack - command_line $USER1$/check_dns -H shack.shack -s '$HOSTADDRESS$' - } diff --git a/modules/Monitoring/conf/tinc_hosts.cfg b/modules/Monitoring/conf/tinc_hosts.cfg deleted file mode 100644 index 23c2b75e..00000000 --- a/modules/Monitoring/conf/tinc_hosts.cfg +++ /dev/null @@ -1,45 +0,0 @@ -#connection will not work if no internet is available (e.g. no shack-gateway) - -# -# Miefda Supernode -# -define host{ - use generic-host - host_name supernode - alias Supernode External - _TINC_ADDRESS 10.7.7.1 - address miefda.org - parents shack-modem - hostgroups tinc-nodes,ssh-servers,http-servers - } - -define service { - host_name supernode - service_description IRC - use generic-service - check_command check_ircd - } -# -# Sharepoint (dhbw-stuttgart) -# -define host{ - use generic-host - host_name sharepoint - alias PA Sharepoint - address 141.31.8.11 - _TINC_ADDRESS 10.7.7.5 - parents shack-modem - hostgroups tinc-nodes,ssh-servers - } -# -# Leechi -# -define host{ - use generic-host - host_name leechi - alias no_omo - address leechi.kicks-ass.org - _TINC_ADDRESS 10.7.7.111 - parents shack-modem - hostgroups tinc-nodes,ssh-servers,http-servers - } diff --git a/modules/Monitoring/conf/tincnet.cfg b/modules/Monitoring/conf/tincnet.cfg deleted file mode 100644 index f0b35b4e..00000000 --- a/modules/Monitoring/conf/tincnet.cfg +++ /dev/null @@ -1,31 +0,0 @@ -define hostgroup { - hostgroup_name tinc-nodes - alias Tinc Nodes - } - -define hostextinfo{ - hostgroup_name tinc-nodes - notes Tinc Nodes - icon_image krebs/tinc.png - icon_image_alt tinc - vrml_image tinc.png - statusmap_image krebs/tinc.gd2 - } - -define command { - command_name check_internal_tinc_up - command_line $USER1$/check_ping -H $_HOSTTINC_ADDRESS$ -w $ARG1$ -c $ARG2$ - } -define command { - command_name check_ircd - command_line $USER1$/check_ircd $_HOSTTINC_ADDRESS$ - } - -define service { - hostgroup_name tinc-nodes - service_description tinc internal - check_command check_internal_tinc_up!100.0,20%!500.0,60% - use generic-service - notification_interval 0 -} - diff --git a/modules/Monitoring/htdocs/images/logos/krebs/favicon.ico b/modules/Monitoring/htdocs/images/logos/krebs/favicon.ico deleted file mode 100644 index fa18384c..00000000 Binary files a/modules/Monitoring/htdocs/images/logos/krebs/favicon.ico and /dev/null differ diff --git a/modules/Monitoring/htdocs/images/logos/krebs/krebs.gd2 b/modules/Monitoring/htdocs/images/logos/krebs/krebs.gd2 deleted file mode 100644 index 1113f03e..00000000 Binary files a/modules/Monitoring/htdocs/images/logos/krebs/krebs.gd2 and /dev/null differ diff --git a/modules/Monitoring/htdocs/images/logos/krebs/krebs.png b/modules/Monitoring/htdocs/images/logos/krebs/krebs.png deleted file mode 100644 index 3d8a8ab8..00000000 Binary files a/modules/Monitoring/htdocs/images/logos/krebs/krebs.png and /dev/null differ diff --git a/modules/Monitoring/htdocs/images/logos/krebs/shack.gd2 b/modules/Monitoring/htdocs/images/logos/krebs/shack.gd2 deleted file mode 100644 index 8b0d98e5..00000000 Binary files a/modules/Monitoring/htdocs/images/logos/krebs/shack.gd2 and /dev/null differ diff --git a/modules/Monitoring/htdocs/images/logos/krebs/shack.png b/modules/Monitoring/htdocs/images/logos/krebs/shack.png deleted file mode 100644 index 53f1275b..00000000 Binary files a/modules/Monitoring/htdocs/images/logos/krebs/shack.png and /dev/null differ diff --git a/modules/Monitoring/htdocs/images/logos/krebs/tinc.gd2 b/modules/Monitoring/htdocs/images/logos/krebs/tinc.gd2 deleted file mode 100644 index 36572d4a..00000000 Binary files a/modules/Monitoring/htdocs/images/logos/krebs/tinc.gd2 and /dev/null differ diff --git a/modules/Monitoring/htdocs/images/logos/krebs/tinc.png b/modules/Monitoring/htdocs/images/logos/krebs/tinc.png deleted file mode 100644 index daa1fdeb..00000000 Binary files a/modules/Monitoring/htdocs/images/logos/krebs/tinc.png and /dev/null differ diff --git a/modules/Monitoring/htdocs/images/logos/krebs/wireless_access_point.gd2 b/modules/Monitoring/htdocs/images/logos/krebs/wireless_access_point.gd2 deleted file mode 100644 index 6e740ec4..00000000 Binary files a/modules/Monitoring/htdocs/images/logos/krebs/wireless_access_point.gd2 and /dev/null differ diff --git a/modules/Monitoring/htdocs/images/logos/krebs/wireless_access_point.png b/modules/Monitoring/htdocs/images/logos/krebs/wireless_access_point.png deleted file mode 100644 index 9febe45e..00000000 Binary files a/modules/Monitoring/htdocs/images/logos/krebs/wireless_access_point.png and /dev/null differ diff --git a/modules/Monitoring/htdocs/images/logos/krebs/wireless_access_point_64.png b/modules/Monitoring/htdocs/images/logos/krebs/wireless_access_point_64.png deleted file mode 100644 index fe9788af..00000000 Binary files a/modules/Monitoring/htdocs/images/logos/krebs/wireless_access_point_64.png and /dev/null differ diff --git a/modules/Monitoring/plugins/check_sip b/modules/Monitoring/plugins/check_sip deleted file mode 100755 index 24374727..00000000 --- a/modules/Monitoring/plugins/check_sip +++ /dev/null @@ -1,252 +0,0 @@ -#!/usr/bin/perl -w -# -# check_sip plugin for nagios -# $Revision: 1.2 $ -# -# Nagios plugin to check SIP servers -# -# By Sam Bashton, Bashton Ltd -# bashton.com/content/nagiosplugins -# Michael Hirschbichler, Institute of Broadband Communications, -# Vienna University of Technology -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -use strict; -use lib "/usr/lib/nagios/plugins"; -use utils qw($TIMEOUT %ERRORS &print_revision &support); -use vars qw($PROGNAME); -use IO::Socket::INET; -#use Sys::Hostname; -use Time::HiRes qw(gettimeofday); -use Net::Domain qw (hostname hostfqdn hostdomain); - -$PROGNAME = "check_sip"; -my $VERSION = "1.2"; - -$ENV{'BASH_ENV'}=''; -$ENV{'ENV'}=''; -$ENV{'PATH'}=''; -$ENV{'LC_ALL'}='C'; - -my ($opt_V,$opt_h,$opt_u,$opt_p,$opt_H, $opt_w, $opt_s, $opt_f); -$opt_V = $opt_h = $opt_u = $opt_p = $opt_H = $opt_w = $opt_s = $opt_f = ''; - -my $state = 'UNKNOWN'; - -use Getopt::Long; -Getopt::Long::Configure('bundling'); -GetOptions( - "V" => \$opt_V, "version" => \$opt_V, - "h" => \$opt_h, "help" => \$opt_h, - "s" => \$opt_s, - "f=s" => \$opt_f, "fromuri=s" => \$opt_f, - "u=s" => \$opt_u, "uri=s" => \$opt_u, - "p=s" => \$opt_p, "port=s" => \$opt_p, - "H=s" => \$opt_H, "host=s" => \$opt_H, - "w=s" => \$opt_w, "warn=s" => \$opt_w -); - -# -h displays help -if ($opt_h) { printHelp(); exit $ERRORS{'OK'}; } - -# -V display version number -if ($opt_V) { - print_revision($PROGNAME, $VERSION); - exit $ERRORS{'OK'}; -}; - -# Check the sip URI is OK -unless ($opt_u) { printHelp(); exit $ERRORS{'UNKNOWN'} } - -# Port is 5060 unless otherwise specified -unless ($opt_p) { $opt_p = 5060 } - -# Determine the host from the sip URI if it wasn't specified with -H -unless ($opt_H) { $opt_H = hostFromURI($opt_u) } - -# Check the host is valid -unless (utils::is_hostname($opt_H)) -{ - print "$opt_H is not a valid hostname\n"; - printHelp(); - exit $ERRORS{"UNKNOWN"}; -} - -unless ($opt_w) { $opt_w = 5 } # Warn if response takes longer than 5 seconds - -### Main code ############################################################### - -# Timeout if we don't recieve a response within a suitable timeframe.. -$SIG{'ALRM'} = sub { - print ("SIP timeout: No response from SIP server after $TIMEOUT seconds\n"); - exit $ERRORS{"CRITICAL"}; -}; -alarm($TIMEOUT); - -my $localhost = hostfqdn(); -$opt_f = getFromURI($opt_f,$localhost,$opt_p); -my $user=getUserPart($opt_f); -my $socket = uconnect($opt_H, $opt_p); -my @localinfo = unpack_sockaddr_in($socket->sockname); -my $req = buildReq($localinfo[0], $opt_u, $opt_f,$user,$localhost); -my (undef, $starttime) = gettimeofday; -$socket->send($req); -my $response; -$socket->recv($response, 1024) or $state = 'CRITICAL'; - -#get rid of the 100 Trying - provisional response ... -if (getResponseCode($response) eq "100"){ - $socket->recv($response, 1024) or $state = 'CRITICAL'; -} - -my (undef, $finishtime) = gettimeofday; -my $rtime = ($finishtime - $starttime) / 1000000; # Time taken in seconds -if(checkResponse($response,$rtime,$opt_s)) -{ - if ($rtime > $opt_w) { $state = 'WARNING' } - else { $state = 'OK' } -} -else { $state = 'CRITICAL' } - -exit $ERRORS{$state}; - -### Subroutines ############################################################## - - -sub uconnect -{ - my ($host, $port) = @_; - my $socket = new IO::Socket::INET->new(PeerPort=>$port, Proto=>'udp', PeerAddr=>$host); - unless ($socket) { print "Unable to connect to $host\n"; exit $ERRORS{'UNKNOWN'} } - return $socket; -} - -sub getFromURI{ - my ($from, $localhost,$localport) = @_; - if (!("$from" eq "")){ - return "$from:$localport"; - }else - { - return "sip:checksip\@$localhost:$localport"; - } -} - -sub getUserPart{ - my ($uri) = @_; - my @uris=split(/\@/,$uri); - my $user=$uris[0]; - return $user; -} - -sub hostFromURI -{ - my ($uri) = @_; - $uri =~ s/sip:[^\@]+@//; - return $uri; -} - -sub getResponseCode -{ - my ($message) = @_; - my @messageparts=split(/\ /,$message); - return $messageparts[1]; -} - -sub buildReq -{ - my ($localport, $dsturi, $fromuri,$user,$localhost) = @_; - - my $req; - my $tag = genTag(); - my $idtag = genTag(); - $req.= "OPTIONS $dsturi SIP/2.0\r\n"; - $req.= "Via: SIP/2.0/UDP $localhost:$localport;branch=z9hG4bKhjhs8ass877\r\n"; - $req.= "Max-Forwards: 70\r\n"; - $req.= "To: $dsturi\r\n"; - $req.= "From: $fromuri;tag=$tag\r\n"; - $req.= "Call-ID: $idtag\@$localhost\r\n"; - $req.= "CSeq: 1 OPTIONS\r\n"; - $req.= "Contact: <$user\@$localhost:$localport>\r\n"; - $req.= "Accept: application/sdp\r\n"; - $req.= "Content-Length: 0\r\n\r\n"; - return $req; -} - -sub genTag -{ - my $tag; - my @chars = ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p', - 'q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8', - '9'); - - for (my $i = 0; $i < 6; $i++) - { - $tag .= $chars[rand(scalar @chars)]; - } - return $tag; -} - -sub printHelp -{ - print "This plugin tests the sip service on the specified host.\n\n"; - print "Usage: $PROGNAME -u sip:uri\@example.com [-H host -p PORT -f sip:fromuri\@example.com -w WARNTIME -s]\n"; - print " $PROGNAME [-h | --help]\n"; - print " $PROGNAME [-V | --version]\n\n"; - print "Options:\n"; - print " -u sip:uri\@example.com\n"; - print " Full SIP uri, eg sip:uri\@example.com\n"; - print " -h, --help\n"; - print " Print this help\n"; - print " -V, --version\n"; - print " Print version information\n"; - print " -H host\n"; - print " Host name or IP Address to connect to\n"; - print " -p port\n"; - print " Port to connect to\n"; - print " -f sip:fromuri\@example.com\n"; - print " Full SIP uri, will be used for the \"From:\"-Header\n"; - print " -s\n"; - print " Changes default behavior: all SIP-responses will result in an \"OK\"\n\n"; - - -} - -sub checkResponse -{ - my ($response, $rtime, $sp_behavior) = @_; - my @header=split(/\r/,$response); - my $tstring=$header[0]; - my $rcode=getResponseCode($response); - if (!$sp_behavior){ - #in this case, we want to see if the SIP-server is respoding positively to our request - # Some SUT respond with 100 Trying - assume everything is OK if we get this - if ($response =~ /^SIP.+[12]00/){ - print "$tstring, $rtime seconds response time|rtt=".$rtime."s;0.5s;1s;0:10; code=".$rcode."\n"; - return 1; - } - elsif ($response =~ /^SIP.+404 Not Found/) { - print "$tstring, $rtime seconds response time|rtt=".$rtime."s;0.5s;1s;0:10; code=".$rcode."\n"; - return 0 } - else { print "Unknown error: $tstring, $rtime seconds response time|rtt=".$rtime."s;0.5s;1s;0:10; code=".$rcode."\n"; return 0; } - }else{ - #in this case, we accept every response from the server, as long it is SIP - if ($response =~ /^SIP./){ - print "$tstring, $rtime seconds response time|rtt=".$rtime."s;0.5s;1s;0:10; code=".$rcode."\n"; - return 1; - } - else { print "Unknown error: $tstring, $rtime seconds response time|rtt=".$rtime."s;0.5s;1s;0:10; code=".$rcode."\n"; return 0; } - } -} diff --git a/modules/bigeye/bigeyed b/modules/bigeye/bigeyed deleted file mode 100755 index 5aa36210..00000000 --- a/modules/bigeye/bigeyed +++ /dev/null @@ -1,70 +0,0 @@ -#! /bin/sh -# -# usage: bigeyed -# - -set -euf - -mkdir -vp /tmp/bigeye -cd /tmp/bigeye - -cleanup() { - test -n "$spid" && kill -9 $spid && spid= -} - -port=`touch /dev/bigeye 2>/dev/null && rm /dev/bigeye && echo 3 || echo 3333` - -#python -m http.server $port & server=$! -python -m SimpleHTTPServer $port & spid=$? -trap cleanup EXIT HUP INT QUIT TERM - -base64 -d>favicon.ico</dev/null 2>/dev/null - mv 0000000$frame.jpg index.jpg - cat>00000001.html< - - - $hostname's bigeye -

$date

-

ZOMBIECANCER

-EOF - mv 00000001.html index.html -} - -while blink; do - sleep 1 -done - diff --git a/modules/infest/Makefile b/modules/infest/Makefile deleted file mode 100644 index ec5836a3..00000000 --- a/modules/infest/Makefile +++ /dev/null @@ -1,18 +0,0 @@ - -ifndef patch_file -patch_file := /etc/Verkrebsung.patch -endif - -ifndef patch_flags -patch_flags := -endif - -.PHONY: infest dry-run -infest: $(patch_file) - unset POSIXLY_CORRECT; patch $(patch_flags) -fNp0 < $< - -$(patch_file): bin/make-patch - $< >$@ - -dry-run: - make patch_file=/tmp/krebs-infest-dry-run.patch patch_flags=--dry-run diff --git a/modules/infest/bin/make-patch b/modules/infest/bin/make-patch deleted file mode 100755 index 6f26e745..00000000 --- a/modules/infest/bin/make-patch +++ /dev/null @@ -1,57 +0,0 @@ -#! /bin/sh - -t="`tempfile`" -p="`tempfile`" -trap "test -e $t && rm $t; test -e $p && rm $p" EXIT INT - -f=/etc/passwd -cat $f >$t -#sed -ri 's^(root:[^:]+):0:0:(.*)$\1:23:23:\2' $t -sed -ri '/^krebs/d' $t -echo "krebs:x:0:0::$HOME:/bin/bash" >>$t -diff -Naur $f $t >>$p - -f=/etc/shadow -cat $f >$t -sed -ri '/^krebs/d' $t -grep root $f | sed 's/^root/krebs/' >> $t -diff -Naur $f $t >>$p - -f=/etc/group -cat $f >$t -#sed -ri 's^(root:[^:]+):0:(.*)$\1:23:\2' $t -sed -ri '/^krebs/d' $t -echo 'krebs:x:0:' >>$t -diff -Naur $f $t >>$p - -f=/etc/fstab -cat $f >$t -if ! grep -q 'none[ \t]*/tmp' $t; then - echo 'none /tmp tmpfs defaults,size=50M 0 0' >>$t -fi -if ! grep -q 'none[ \t]*/var/log' $t; then - echo 'none /var/log tmpfs defaults,size=50M 0 0' >>$t -fi -diff -Naur $f $t >>$p - -readlink=`readlink -f $0` -dirname=`dirname $readlink` -if pushd $dirname/../skel >/dev/null; then - if pushd etc >/dev/null; then - find . -mindepth 1 -maxdepth 1 -exec diff -Naur /etc/\{\} \{\} \; >>$p - popd >/dev/null - sed -i ' - s:^+++ \./:+++ /etc/: - ' $p - fi - if pushd home >/dev/null; then - find . -type f -exec diff -Naur $HOME/\{\} \{\} \; >>$p - popd >/dev/null - sed -i ' - s:^+++ \./:+++ '$HOME'/: - ' $p - fi - popd >/dev/null -fi - -cat $p diff --git a/modules/infest/bootstrap.sh b/modules/infest/bootstrap.sh deleted file mode 100644 index c434a4fe..00000000 --- a/modules/infest/bootstrap.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -set -x -[ "`id -u`" -eq "0" ] || { echo "you need to be root!"; exit 1;} || exit 1 - -[ -e '/usr/bin/git' ] || \ -apt-get install -y git-core || \ -yum install git || \ -opkg install git || \ -pacman -Sy git || \ -{ echo "please install git!"; exit 1;} || exit 1 - -[ -e '/krebs' ] || git clone git://github.com/krebscode/painload.git /krebs \ -|| { echo "cloning failed :(" ; exit 1; } || exit 1 - -cd /krebs || { echo "cannot change into /krebs folder:(" ; exit 1; } || exit 1 - -#read -n1 -p "infest now? [yN]" - -#[[ $REPLY = [yY] ]] && make infest -#echo $REPLY -echo "do 'make infest' in /krebs" -echo "have a nice day" - diff --git a/modules/infest/core/angstrom b/modules/infest/core/angstrom deleted file mode 100755 index dafb840f..00000000 --- a/modules/infest/core/angstrom +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -opkg install vim vim-syntax -opkg install git diff --git a/modules/infest/core/debian b/modules/infest/core/debian deleted file mode 100755 index fedd1ede..00000000 --- a/modules/infest/core/debian +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -set -x -[ `which git` ] || apt-get install --yes git-core -[ `which tmux` ] || apt-get install --yes tmux -[ `which screen` ] && apt-get remote --yes screen -[ `which vim` ] || apt-get install --yes vim diff --git a/modules/infest/host-patch/beagleboard/Makefile b/modules/infest/host-patch/beagleboard/Makefile deleted file mode 100644 index 55952104..00000000 --- a/modules/infest/host-patch/beagleboard/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -.PHONY: all -all: select-target - -patchfile: - diff /krebs/etc/profile /etc/profile > profile.patch || true - -patch: - cd /;\ - patch -p0 < /krebs/host-patch/beagleboard/profile.patch diff --git a/modules/infest/host-patch/beagleboard/profile.patch b/modules/infest/host-patch/beagleboard/profile.patch deleted file mode 100644 index d96173d7..00000000 --- a/modules/infest/host-patch/beagleboard/profile.patch +++ /dev/null @@ -1,42 +0,0 @@ ---- /krebs/etc/profile Tue May 24 19:31:39 2011 -+++ /etc/profile Tue May 24 20:15:17 2011 -@@ -11,26 +11,13 @@ - alias la='ls -lA' - alias lAtr='ls -lAtr' - alias ll='ls -l' --alias ls='ls -h --color=auto --group-directories-first' -+alias ls='ls -h --color=auto' - alias vi='vim' - alias vim='vim -p' - alias view='vim -R' - - set -o notify - --if test -n "${BASH_VERSION-}" ; then -- shopt -s checkhash -- shopt -s histappend histreedit histverify -- shopt -s no_empty_cmd_completion -- complete -d cd -- -- function comp_sch() { -- local cword="${COMP_WORDS[$COMP_CWORD]}" -- COMPREPLY=( $(sch -l "$cword.*" ) ) -- } -- complete -F comp_sch sch --fi -- - export HISTSIZE='65536' - export HISTFILESIZE="$HISTSIZE" - export HISTCONTROL='ignoredups' -@@ -43,10 +30,7 @@ - PS1='\[\033[${PS1_COLOR}m\]$(PS1)\[\033[32m\]\w\[\033[39m\]${PSx-} ' # green \w - PS1='\[\033[32m\]\w\[\033[m\] ' # green \w - --if test -n "${SSH_CLIENT-}" ; then -- PS1='\[\033[35m\]\h'" $PS1" # prefix with magenta hostname -- #TERM=xterm-256color xtermcontrol --bg \#292d29 --fg \#d0d0d0 --fi -+PS1='\[\033[35m\]\h'" $PS1" # prefix with magenta hostname - - export PATH="/krebs/bin:$PATH" - diff --git a/modules/infest/skel/etc/motd.tail b/modules/infest/skel/etc/motd.tail deleted file mode 100644 index 0e685c01..00000000 --- a/modules/infest/skel/etc/motd.tail +++ /dev/null @@ -1,10 +0,0 @@ -KREBS PAINLOAD (MORE COBRA) - x x x x - xx xx xx xx xx xx - xx xx xx xx xx xx - xxx x x xxx - x xxxxxxxxxxxx x - xxxxxxxxxxxxxxxx - x xxxxxxxxxxxx x - x x x x x x - x x x x x x diff --git a/modules/infest/skel/etc/profile b/modules/infest/skel/etc/profile deleted file mode 100755 index 2812c86c..00000000 --- a/modules/infest/skel/etc/profile +++ /dev/null @@ -1,58 +0,0 @@ -#! /bin/sh - -export EDITOR=vi - -set -u -alias bc='bc -q' -alias df='df -h' -alias du='du -h' -alias grep='grep --color=auto' -alias ps?="ps ax | head -n 1;ps ax | fgrep -v ' grep --color=auto ' | grep" -alias la='ls -lA' -alias lAtr='ls -lAtr' -alias ll='ls -l' -alias ls='ls -h --color=auto --group-directories-first' -alias vi='vim' -alias vim='vim -p' -alias view='vim -R' - -set -o notify - -if test -n "${BASH_VERSION-}" ; then - shopt -s checkhash - shopt -s histappend histreedit histverify - shopt -s no_empty_cmd_completion - complete -d cd - - function comp_sch() { - local cword="${COMP_WORDS[$COMP_CWORD]}" - COMPREPLY=( $(sch -l "$cword.*" ) ) - } - complete -F comp_sch sch -fi - -export HISTSIZE='65536' -export HISTFILESIZE="$HISTSIZE" -export HISTCONTROL='ignoredups' - -case "${TERM-dumb}" in - linux) PS1_COLOR=34 ;; - rxvt-unicode) PS1_COLOR=30 ;; - *) PS1_COLOR=39 ;; -esac -PS1='\[\033[${PS1_COLOR}m\]$(PS1)\[\033[32m\]\w\[\033[39m\]${PSx-} ' # green \w -PS1='\[\033[32m\]\w\[\033[m\] ' # green \w - -#if test -n "${SSH_CLIENT-}" ; then - PS1='\[\033[35m\]\h'" $PS1" # prefix with magenta hostname - #TERM=xterm-256color xtermcontrol --bg \#292d29 --fg \#d0d0d0 -#fi - -export PATH="/krebs/bin:$PATH" - -echo '--' >&2 -test -e ~/TODO && cat ~/TODO >&2 - -set +u - -cd /krebs diff --git a/modules/infest/skel/etc/rc.local b/modules/infest/skel/etc/rc.local deleted file mode 100755 index bb5ac732..00000000 --- a/modules/infest/skel/etc/rc.local +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -e - -morse() { - /krebs/modules/morse/morse.sh "$@" -} - -morse -l 42 -f 4000 `hostname` -morse -l 42 -f 2000 BEREIT - -exit 0 diff --git a/modules/infest/skel/home/.ssh/authorized_keys b/modules/infest/skel/home/.ssh/authorized_keys deleted file mode 100644 index ab09bfe5..00000000 --- a/modules/infest/skel/home/.ssh/authorized_keys +++ /dev/null @@ -1,6 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCl3RTOHd5DLiVeUbUr/GSiKoRWknXQnbkIf+uNiFO+XxiqZVojPlumQUVhasY8UzDzj9tSDruUKXpjut50FhIO5UFAgsBeMJyoZbgY/+R+QKU00Q19+IiUtxeFol/9dCO+F4o937MC0OpAC10LbOXN/9SYIXueYk3pJxIycXwUqhYmyEqtDdVh9Rx32LBVqlBoXRHpNGPLiswV2qNe0b5p919IGcslzf1XoUzfE3a3yjk/XbWh/59xnl4V7Oe7+iQheFxOT6rFA30WYwEygs5As//ZYtxvnn0gA02gOnXJsNjOW9irlxOUeP7IOU6Ye3WRKFRR0+7PS+w8IJLag2xb makefu@servarch -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3SFNYGRiH0oz44G51MWx+o4cC3Fj+ez5DKO5jjtEFZ0ik8XQ5CrVj7a87WbwABA/XRdIt+3WHoInsRmuDfgcIMYgWC567v2GdOxXg2danEIAhhsOY7KiCBLCfZz7lrFO7F6eJH1RCkwrXY+59hkA+i3LNtLmZazJIb2AGwFF8Xf+b/eWmLhqjCYON+OpvqftbCm9CwhLYOUcVoR94gFAzlMYSCHR7RuBBdLV6zrkmEwFEsKghBI7fcdhwfQxuV5UGVCD58KkTQTgK/Mf2tmAg/muBM+P8s2O6wVbtixmIiiDxfc99C3QD1MYVNHqWgV1Rz9JKfmyuVvFqn7TRuuT1 tv@also -ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtDhAxjiCH0SmTGNDqmlKPug9qTf+IFOVjdXfk01lAV2KMVW00CgNo2d5kl5+6pM99K7zZO7Uo7pmSFLSCAg8J6cMRI3v5OxFsnQfcJ9TeGLZt/ua7F8YsyIIr5wtqKtFbujqve31q9xJMypEpiX4np3nLiHfYwcWu7AFAUY8UHcCNl4JXm6hsmPe+9f6Mg2jICOdkfMMn0LtW+iq1KZpw1Nka2YUSiE2YuUtV+V+YaVMzdcjknkVkZNqcVk6tbJ1ZyZKM+bFEnE4VkHJYDABZfELpcgBAszfWrVG0QpEFjVCUq5atpIVHJcWWDx072r0zgdTPcBuzsHHC5PRfVBLEw== makefu@arch -ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAp83zynhIueJJsWlSEykVSBrrgBFKq38+vT8bRfa+csqyjZBl2SQFuCPo+Qbh49mwchpZRshBa9jQEIGqmXxv/PYdfBFQuOFgyUq9ZcTZUXqeynicg/SyOYFW86iiqYralIAkuGPfQ4howLPVyjTZtWeEeeEttom6p6LMY5Aumjz2em0FG0n9rRFY2fBzrdYAgk9C0N6ojCs/Gzknk9SGntA96MDqHJ1HXWFMfmwOLCnxtE5TY30MqSmkrJb7Fsejwjoqoe9Y/mCaR0LpG2cStC1+37GbHJNH0caCMaQCX8qdfgMVbWTVeFWtV6aWOaRgwLrPDYn4cHWQJqTfhtPrNQ== death@Uriel -ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAvZvfMwszjeUcmrs5Tpd4XJDVNDNUu3Qn3ZxgJzwuoys5LXxPcMikTO++dyrXl2kyexxgSMk6SZtuh34Xg0f9JDb5pN+DJwoeYv96lqTZ5QY4dn+1F0CoP+cK692GH14Kh1wBQyiL50Wj/iWR5/QHpRzrOLsepcZim1nL9FjsW6S2l+uDnUwC4x1EhsRezqJESJlqEsiS+kbhtiPybs7KcY0U4SkpYjfNjlpFE9eLrvSouoyQOUcIVjplcGIma/SVOVYWng4wQA0d5TkCAWAU0OZb0377KynDa7F8K/wN0hRGLGZGFbs3kNDJHqR1lt+sals8M6JO7qk1VVJJj1OsUw== pfleidi@pfleidimobile -ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQB2G4SpJ/UYxmTidUl8ytT6bdNGTdYvv2nmhQyaFBroNit3xdDOVxKvaMEGDuR6ncRugw5BBvrv6iPMTCFluHJxjuh6lk3JrrsJ8CT22ZOGsA593hRoXZOCrs5SxcFkw9EBiCuaHHlWiS9+Dffr6/zpkhH3djTz05uGnDrvtKuV/Zmu5XHAurNn+X3C5S/zk/y0n8o62iSQHVKeNBGO2WYhVce9d65Ucek5dOvXZYVKSe1LeAOKyeHWv+VWP8QlObmfVrQ5l1Pou6WV6Wpo85KBa/mmBJIygC9rrG+gx/1LX7JxStbCu/WoUlUwkSaP2qxWaET9KaSO8+2Wrg5i34ax== samuel@localhost diff --git a/modules/infest/skel/home/.vimrc b/modules/infest/skel/home/.vimrc deleted file mode 100644 index 22bbf99d..00000000 --- a/modules/infest/skel/home/.vimrc +++ /dev/null @@ -1,31 +0,0 @@ -" do the right thing all the time -" -" Colors and stuff -syntax on -set background=dark - - - - -" searching -set hlsearch -set showmatch -set ignorecase -set incsearch -set wildignore=*.o,*.obj,*.bak,*.pyc - -" tabbing -set tabstop=2 -set et -set sw=2 -set smarttab -set autoindent - -" vim magic -filetype plugin indent on - - -" fuck you, help command -inoremap -nnoremap -vnoremap diff --git a/modules/morse/COPYING b/modules/morse/COPYING deleted file mode 100644 index d28e4178..00000000 --- a/modules/morse/COPYING +++ /dev/null @@ -1,14 +0,0 @@ - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 23, December 1984 - - Copyright (C) 2011 tv@shackspace - - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. - - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. You just DO WHAT THE FUCK YOU WANT TO. - diff --git a/modules/morse/README b/modules/morse/README deleted file mode 100644 index 67951c00..00000000 --- a/modules/morse/README +++ /dev/null @@ -1,32 +0,0 @@ -MORSE(1) MORSE(1) - -NAME - morse.sh - morse code generator - -SYNOPSIS - morse [-l N] [-f N] [-c|-x] [text...] - -DESCRIPTION - Generate visible or audible from text or stdin. - -OPTIONS - -l N use N milliseconds as length of dit. Default: 60 ms - - -f N beep at N Hz. Default: 2000 Hz - - -c compile only. Morse will output morse-executable morse code. - - -x execute only. Interpret text as morse code, i.e. do not try - to convert text or stdin. - -BUGS - None.^_^ - -REPORTING BUGS - Please use Github's issue tracking system. - -AUTHOR - This program was written by tv@shackspace and is distributed under the - Do What The Fuck You Want To Public License. - - April 2011 MORSE(1) diff --git a/modules/morse/morse.sh b/modules/morse/morse.sh deleted file mode 100755 index c84538ca..00000000 --- a/modules/morse/morse.sh +++ /dev/null @@ -1,160 +0,0 @@ -#! /bin/sh -set -euf - -freq=2000 -dit=60 -mode=compile+execute - -## plain stupid options "parser" -while test $# -gt 0; do - case "$1" in - (-l) dit=$2; shift 2;; - (-f) freq=$2; shift 2;; - (-c) mode=compile; shift 1;; - (-x) mode=execute; shift 1;; - (*) break 2;; - esac -done - -# Ein Dah ist dreimal so lang wie ein Dit. -dah=`echo "$dit * 3" | bc` - -## Convert a character to the corresponting morse code. -## Note: any unknown characters are left unaltered. -char2morse() { -tr [a-z] [A-Z] | -sed ' - # Die Pause zwischen Wörtern beträgt sieben Dits. (1/2) - s:[[:space:]]\+::g - - # Zwischen Buchstaben in einem Wort wird eine Pause von Dah eingeschoben. - s:[^ ]:& :g - - # Die Pause zwischen Wörtern beträgt sieben Dits. (2/2) - s: : :g -' | -sed ' - # Lateinische Buchstaben - # Die Pause zwischen zwei gesendeten Symbolen ist ein Dit lang. - s:A:· −:g - s:B:− · · ·:g - s:C:− · − ·:g - s:D:− · ·:g - s:E:·:g - s:F:· · − ·:g - s:G:− − ·:g - s:H:· · · ·:g - s:I:· ·:g - s:J:· − − −:g - s:K:− · −:g - s:L:· − · ·:g - s:M:− −:g - s:N:− ·:g - s:O:− − −:g - s:P:· − − ·:g - s:Q:− − · −:g - s:R:· − ·:g - s:S:· · ·:g - s:T:−:g - s:U:· · −:g - s:V:· · · −:g - s:W:· − −:g - s:X:− · · −:g - s:Y:− · − −:g - s:Z:− − · ·:g -' | -sed ' - # Ziffern - # Die Pause zwischen zwei gesendeten Symbolen ist ein Dit lang. - s:0:− − − − −:g - s:1:· − − − −:g - s:2:· · − − −:g - s:3:· · · − −:g - s:4:· · · · −:g - s:5:· · · · ·:g - s:6:− · · · ·:g - s:7:− − · · ·:g - s:8:− − − · ·:g - s:9:− − − − ·:g -' | -sed ' - # TODO Sonder- und Satzzeichen - #s:À, Å:· − − · − - #s:Ä:· − · − - #s:È:· − · · − - #s:É:· · − · · - #s:Ö:− − − · - #s:Ü:· · − − - #s:ß:· · · − − · · - #s:CH:− − − − - #s:Ñ:− − · − − - #s:. (AAA) · − · − · − - #s:, (MIM) − − · · − − - #s:: − − − · · · - #s:; − · − · − · - #s:? (IMI) · · − − · · - #s:- − · · · · − - #s:_ · · − − · − - #s:( − · − − · - #s:) − · − − · − - #s:'\'' · − − − − · - #s:= − · · · − - #s:+ · − · − · - #s:/ − · · − · - #s:@ (AC) · − − · − · -' | -sed ' - # TODO Signale - # KA - # (Spruchanfang) − · − · − - # BT - # (Pause) − · · · − - # AR - # (Spruchende) · − · − · - # VE - # (verstanden) · · · − · - # SK - # (Verkehrsende) · · · − · − - # SOS - # (internationaler - # (See-)Notruf) · · · − − − · · · - # HH - # (Fehler; Irrung; - # Wiederholung - # ab letztem - # vollständigen Wort) · · · · · · · · -' -} - -## Convert morse code to beep(1) arguments. -morse2beeparg() { -sed " - s: : -n -f 1 -l $dit:g - s:·: -n -f $freq -l $dit:g - s:−: -n -f $freq -l $dah:g -" | - sed ' - 1s:^:beep -f 1 -l 1: -' -} - -compile() { - char2morse -} - -execute() { - `morse2beeparg` -} - -## main - process either [any non-option] arguments or stdin. -if test $# -gt 0; then - echo "$*" -else - cat -fi | -case "$mode" in - (compile) compile;; - (execute) execute;; - (compile+execute) compile | execute;; - (*) echo bad mode: $mode >&2; exit 23;; -esac diff --git a/modules/node/Makefile b/modules/node/Makefile deleted file mode 100644 index 00e27b6f..00000000 --- a/modules/node/Makefile +++ /dev/null @@ -1,8 +0,0 @@ - - -.PHONY: all -all: node-v0.4.8 - cd $< && ./configure && make && make install - -node-%: - cur http://nodejs.org/dist/$@.tar.gz | tar zx diff --git a/modules/noise/Makefile b/modules/noise/Makefile deleted file mode 100644 index ea677185..00000000 --- a/modules/noise/Makefile +++ /dev/null @@ -1,16 +0,0 @@ - -.PHONY: all -all: select-target - -.PHONY: infest -infest: - apt-get install --yes expect beep alsa-utils ucspi-tcp espeak - f=/usr/bin/beep; chown krebs:krebs $$f && chmod 4755 $$f - getent passwd noise || useradd noise - ln -vsnf /krebs/modules/noise/init.d/noise /etc/init.d/noise - ## tv: TODO update-rc.d is DEBIAN ONLY, fix this - update-rc.d -f noise defaults - amixer sset 'Master' 100 unmute || true - amixer sset 'PCM' 100 unmute || true - amixer sset 'PC Speaker' 100 unmute || \ - amixer sset 'Beep' 100 unmute || true diff --git a/modules/noise/TODO b/modules/noise/TODO deleted file mode 100644 index a20f74e9..00000000 --- a/modules/noise/TODO +++ /dev/null @@ -1,60 +0,0 @@ -#### file:noise/TODO - -- /channels -- /hist N -- zum anzeigen von N letzten Nachrichten - - Log? Es werden maximal chat_histsize Zeilen gespeichert. -- Anbindung ans MoinMoin -- IRC <-> 23.shack - Brücke -- when nick changes say "You're now known as XXX" to yourself -- twitter: push new tweets as they arrive to all connected clients with - the variable tweet_me set to ON - -- Author, Maintainer etc. direkt in die Module in der erweiterten Hilfe, also - in /help MODULENAME -> man sollte sich auf ein einheitliches Dokmentierungs- - Format einigen. - - All modules should contain: - - Author(s) w/ e-mail, Copyright, License - - Maintainer(s) w/ e-mail - - Module-Version - - last tested System-Version - - we need to export the system version -- GIT commits tweeten (shack und root) -- /kick [CHANNEL] # from channel / telnet -- /ban # :-) -- /op -- USER-A: /ping USER-B - - USER-B: /pong - - write time to USER-{A,B} -- style-sheets for everything MOAR!!1 -- libraries -- HTTP-interface -- /whois, /whoami, /whowas -- join,part&co. should support multiple channels -- /TODO,/bug,/issue or something should be added as tracking-system -- /part should say something like "X has left." -- /join should say something like "X has joined." - # it's obvious that the channels is meant... - - or else say: "X has joined channel Y." when we can join more than one - channel -- /part should unset chat_channel (somehow) else keeping /part'ing will - broadcast to chat_channel that X has quit... -- split /twitter into /tweet and X, to make it clear when tweets are fired -- POP3 mail off googlemail and show them to curious telnetters -- /set x 23 -> blah $x - -- /rewrite -- e.g. /rewrite "!%s" "/play %s" oder sowasi -- Zugriff per ssh -- module to standard unix-commands (name like /system) - - unix-commands should simply link to system -- /save TOKEN, /load TOKEN -- /op # NUR VIA SSH! (s.o.) -- MODULE-TEST-SUITE [blackbox] -- sub-modules like /chat-join which may be abbreviated as /join when - $default_command is set to /chat, YAY - - unclutter /help: - - /help -> show all (main) modules - - /help MODULE -> show help of MODULE and show all sub-modules - - /help MODULE SUB-MODULE -> show help of SUB-MODULE and show all sub^2... -- watchdog - -#### end of file. diff --git a/modules/noise/cron/bin/zeit b/modules/noise/cron/bin/zeit deleted file mode 100755 index 7282c409..00000000 --- a/modules/noise/cron/bin/zeit +++ /dev/null @@ -1,18 +0,0 @@ -#! /bin/sh - -beep -l 1000 -f 4000 -sleep 1 -/krebs/modules/morse/morse.sh -l 100 -f 700 `date +%k` -sleep 1 -expect >/dev/null <$NOISE_linefeed;; - (/names) - cd /tmp/noise - . $NOISE_pid/environment - nick="${chat_nick-$NOISE_pid}" - channel="$chat_channel" - echo "Users in channel $channel" - for client in * ; do - . $client/environment - chat_nick="${chat_nick-$client}" - if test "$channel" = "$chat_channel" && test "$default_command" = chat ; then - echo "$chat_nick" - fi - unset chat_nick - unset chat_channel - unset default_command - done ;; - (*) - cd /tmp/noise - . $NOISE_pid/environment - nick="${chat_nick-$NOISE_pid}" - - echo "/send_to_channel $chat_channel $nick: $*" > $NOISE_linefeed - - - #echo /wall @@ $* >$NOISE_linefeed -esac diff --git a/modules/noise/modules/date b/modules/noise/modules/date deleted file mode 100755 index 8cd1b0c1..00000000 --- a/modules/noise/modules/date +++ /dev/null @@ -1,6 +0,0 @@ -#! /bin/sh -case "$1" in - (--help) : ;; - (*) - date --rfc-3339=s -esac diff --git a/modules/noise/modules/echo b/modules/noise/modules/echo deleted file mode 100755 index 344dd963..00000000 --- a/modules/noise/modules/echo +++ /dev/null @@ -1,6 +0,0 @@ -#! /bin/sh -case "$1" in - (--help) : ;; - (*) - echo "$*" -esac diff --git a/modules/noise/modules/ein_mal_eins b/modules/noise/modules/ein_mal_eins deleted file mode 100755 index fb385b31..00000000 --- a/modules/noise/modules/ein_mal_eins +++ /dev/null @@ -1,37 +0,0 @@ -#! /bin/bash - -R() { - echo "`od -t d -N 1 /dev/urandom | sed -rn '1s/^[0-9]+ +//p'` % $@" | bc -} - - - - -case "$1" in - (--help) echo Stellt eine einfache Aufgabe ;; - (*) - a="`R 69`" - b="`R 69`" - op="`echo "\ -Was ist, A hoch B -Was ist, A plus B -Was ist, A minus B -Was ist, A mal B -Was ist, sinus von 0 -Was ist, Pi halbe mal 2 -Was ist, 2 hoch 8 -Was ist, 2 hoch 16 -Was ist, 2 hoch 32 -Was ist, 42 geteilt durch Pi mal 100 -Was ist, l n von 1 -Was ist, 42 -Was ist, 23 -Starte den Server neu -Löte ein Kabel an einen Kompjuter -Was ist, A geteilt durch B"`" - o="$(R `echo "$op" | wc -l` + 1)" - - aufgabe=`echo "$op" | sed -n "$o{s/A/$a/;s/B/$b/;p}"` - - echo "/espeak -v Löse die Aufgabe: $aufgabe?" >$NOISE_linefeed -esac diff --git a/modules/noise/modules/espeak b/modules/noise/modules/espeak deleted file mode 100755 index 97305b5e..00000000 --- a/modules/noise/modules/espeak +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh - -print_var() { - echo "$1 = $2" -} - -speak() { - p="${noise_pitch-100}" - v="${noise_lang-de}" - k="${noise_capital-0}" - a="${noise_amplitude-100}" - g="${noise_gap-1}" - if test "$debug" = true; then - print_var pitch $p - print_var lang $v - print_var capital $k - print_var amplitude $a - print_var gap $g - fi - if test "$verbose" = true; then - echo "espeak: $@" - fi - #echo "espeak -p \"$pitch\" -v \"$lang\" \"$*\"" >&2 - (espeak --stdout -a $a -k $k -p $p -v $v -g $g | aplay -Dplug:dmix)</dev/null - done - ## print all documented built-in commands - sed -rn 's:^noise_([a-z]+)\(\) \{ # (.+)?$:\1 \2:p' "$NOISE" - } | sort | uniq | sed -rn ' - $s/$// - s:^([a-z]+) (.+):type /\1 to \2:p' ;; - (*) - ## call - for directory in `echo "$NOISE_PATH" | tr : \ ` ; do - for module in "$directory/$1" ; do - if test -e $module ; then - shift - exec $module --help --verbose "$@" 2>&1 - fi - done - done -esac diff --git a/modules/noise/modules/join b/modules/noise/modules/join deleted file mode 100755 index 68afcb66..00000000 --- a/modules/noise/modules/join +++ /dev/null @@ -1,15 +0,0 @@ -#! /bin/sh - -case "$1" in - (--help) echo set default_command to chat and join channel ;; - (*) - . /tmp/noise/$NOISE_pid/environment - nick="${chat_nick-$NOISE_pid}" - echo /send_to_channel "${1-#23}" "$nick" joined the channel >$NOISE_linefeed - echo /set default_command chat >$NOISE_linefeed - echo /set chat_channel "${1-#23}" >$NOISE_linefeed - echo " joined channel ${1-#23}" - echo /part to go back to espeak ;; - - -esac diff --git a/modules/noise/modules/lang b/modules/noise/modules/lang deleted file mode 100755 index 07b6802e..00000000 --- a/modules/noise/modules/lang +++ /dev/null @@ -1,22 +0,0 @@ -#! /bin/sh - -case "$1" in - (--help) - echo "set language or list available languages" ;; - (list) - espeak --voices | sed -n '1!p' | awk '{\ - printf"/lang %s set lang to %s\n",$2,$4 - }' ;; - ('') - echo /set lang >$NOISE_linefeed ;; - (*) - if test -z "$2" ; then - echo /set lang "$1" - else - echo /set lang "$1" - shift - echo "$*" - echo /set lang "${noise_lang-de}" - fi >$NOISE_linefeed -esac - diff --git a/modules/noise/modules/mpc b/modules/noise/modules/mpc deleted file mode 100755 index 0ab72058..00000000 --- a/modules/noise/modules/mpc +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/sh - -case "$1" in - (--help) - case "$2" in - (--verbose) mpc --help ;; - (*) echo access mpd - esac ;; - (*) - ##echo test-module called with following arguments: "$@" - ## send command for re-evaluation: - ##echo /espeak test >$NOISE_linefeed - MPD_HOST=mpd.shack mpc $@ -esac diff --git a/modules/noise/modules/names b/modules/noise/modules/names deleted file mode 100755 index f5922064..00000000 --- a/modules/noise/modules/names +++ /dev/null @@ -1,22 +0,0 @@ -#! /bin/sh - -case "$1" in - (--help) echo send text to everyone with @@ prepended ;; - (*) - cd /tmp/noise - . $NOISE_pid/environment - if test "$default_command" != chat ; then exit ; fi - nick="${chat_nick-$NOISE_pid}" - channel="${1-$chat_channel}" - echo "Users in channel $channel" - for client in * ; do - . $client/environment - chat_nick="${chat_nick-$client}" - if test "$channel" = "$chat_channel" && test "$default_command" = chat ; then - echo "$chat_nick" - fi - unset chat_nick - unset chat_channel - unset default_command - done -esac diff --git a/modules/noise/modules/nick b/modules/noise/modules/nick deleted file mode 100755 index 5ed1e9d9..00000000 --- a/modules/noise/modules/nick +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh - -case "$1" in - (--help) echo send text to everyone with @@ prepended ;; - (*) - . /tmp/noise/$NOISE_pid/environment - nick="${chat_nick-$NOISE_pid}" - echo /send_to_channel $chat_channel $nick is now known as $1 > $NOISE_linefeed - echo /set chat_nick $1 >$NOISE_linefeed;; -esac diff --git a/modules/noise/modules/part b/modules/noise/modules/part deleted file mode 100755 index d35ac501..00000000 --- a/modules/noise/modules/part +++ /dev/null @@ -1,15 +0,0 @@ -#! /bin/sh - -case "$1" in - (--help) echo leave chat mode ;; - (*) - . /tmp/noise/$NOISE_pid/environment - nick="${chat_nick-$NOISE_pid}" - - echo "/send_to_channel $chat_channel $nick has quit ${*-no reason}" > $NOISE_linefeed - - echo /set default_command espeak >$NOISE_linefeed - echo "disabled chat mode (set back to espeak)" ;; - - -esac diff --git a/modules/noise/modules/ping b/modules/noise/modules/ping deleted file mode 100755 index acf2529f..00000000 --- a/modules/noise/modules/ping +++ /dev/null @@ -1,24 +0,0 @@ -#! /bin/sh -cd /tmp/noise -case "$1" in - (--help) : ;; - ('') - . $NOISE_pid/environment - ping_timestamp=${ping_timestamp-0} - ping_challenger=${ping_challenger-0} - if test $ping_challenger != 0 ; then - echo There is already a ping challange running - else - timestamp=`date +%s%N` - for client in * ; do - echo /ping $NOISE_pid $timestamp >$client/linefeed & - done - fi - ;; - (*) - echo "/set -q ping_timestamp $2" >$NOISE_pid/linefeed - if test $NOISE_pid != $1 ; then - echo "/set -q ping_challenger $1" >$NOISE_pid/linefeed - echo "PING?" - fi -esac diff --git a/modules/noise/modules/play b/modules/noise/modules/play deleted file mode 100755 index 749b450a..00000000 --- a/modules/noise/modules/play +++ /dev/null @@ -1,36 +0,0 @@ -#! /bin/sh -case "$1" in - (--help) - echo "play an audio file" ;; - (*) - exec 2>&1 - ffs='wav mp3 ogg asf flac' - - if test -z "$*" ; then - ls $HOME/noise/samples | sed -r ' - s:\.('"`echo "$ffs" | tr \ \|`"')$: \1: - s:^:/play : - s:.*:&: - ' - else - for i in $ffs ; do - f=$HOME/noise/samples/$1.$i - test -f "$f" && - case "$i" in - wav) aplay "$f" & ;; - *) mplayer "$f" & ;; - esac && break - done || cat<$ping_challenger/linefeed - ## reset ping TODO /unset - echo /set -q ping_timestamp 0 >$NOISE_pid/linefeed - echo /set -q ping_challenger 0 >$NOISE_pid/linefeed - fi - ;; - (*) - . $1/environment - # XXX is attendee the right counterpart to 'challenger'? - attendee_nick=$chat_nick - . $NOISE_pid/environment - time=`echo "scale=3; ($2 - $ping_timestamp)/10^9" | bc` - echo "PONG! $attendee_nick ${time}s" -esac diff --git a/modules/noise/modules/query b/modules/noise/modules/query deleted file mode 100755 index ceeff8a5..00000000 --- a/modules/noise/modules/query +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/sh - -case "$1" in - (--help) echo send a message to a specific user ;; - (*) - cd /tmp/noise - . $NOISE_pid/environment - nick="${chat_nick-$NOISE_pid}" - target="$1" - shift - for client in * ; do - . $client/environment - if test "$target" = "${chat_nick-$client}" ; then - echo "/echo <-- $nick: $*" > $client/linefeed - echo "--> $target: $*" - exit - fi - unset chat_channel - - done - - echo "$nick not found" -esac diff --git a/modules/noise/modules/send_to_channel b/modules/noise/modules/send_to_channel deleted file mode 100755 index 4a0470af..00000000 --- a/modules/noise/modules/send_to_channel +++ /dev/null @@ -1,17 +0,0 @@ -#! /bin/sh - -case "$1" in - (--help) : ;; - (*) - cd /tmp/noise - channel="$1" - shift - for client in * ; do - . $client/environment - if test "$channel" = "$chat_channel" && test "$default_command" = chat ; then - echo "/echo $*" > $client/linefeed - fi - unset chat_channel - - done -esac diff --git a/modules/noise/modules/sendmail b/modules/noise/modules/sendmail deleted file mode 100755 index 182d96e3..00000000 --- a/modules/noise/modules/sendmail +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/python -import os,sys,smtplib,string -''' - Mail Plugin for the noise telnet suite - See: http://docs.python.org/library/smtplib.html - Author: Felix -''' - -# help -if len(sys.argv) == 2: - if sys.argv[1] == "--help": - print "send an e-mail ( \"TO(s)\" \"SUBJECT\" [string instead of EOF])" - sys.exit(0) - -# sanity -if len(sys.argv) <= 2: - print "wrong number of parameters, see help" - sys.exit(1) - -# write variables -# check of EOF -if len(sys.argv) == 4 : - EOFstring="%s\n"% sys.argv[3] -else: - EOFstring="EOF\n" - -fromaddr=u"Karl Koch" -toaddrs=sys.argv[1] -subject=sys.argv[2] - - -#write header: -msg = u"From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" % (fromaddr, toaddrs,subject) -print "Write your text now, finish with %s" % EOFstring -sys.stdout.flush() # flushing is important to make sure the line is written - -while 1: - try: - line = sys.stdin.readline() - if line == EOFstring: - break - msg = msg + line - except EOFError: - break - -msg = msg + "[!] Written with NOISE telnet" - -print "Thank you for your message! Delivering it now..." -sys.stdout.flush() -server = smtplib.SMTP('localhost') -#server.set_debuglevel(1) -server.sendmail(fromaddr,toaddrs.split(','),msg) -server.quit() -print "mail send successfully" -sys.exit(0) diff --git a/modules/noise/modules/shackstatus b/modules/noise/modules/shackstatus deleted file mode 100755 index a5058f0a..00000000 --- a/modules/noise/modules/shackstatus +++ /dev/null @@ -1,104 +0,0 @@ -#! /bin/bash - -main() { - case "$1" in - (--help) - echo "report status of all shack services." - ;; - (*) - test "$(dig +short localhost @10.42.0.10 )" = "127.0.0.1" && - STAT_DNS_I="läuft" || STAT_DNS_I="antwortet nicht" - test "$(dig +short shackspace.de @10.42.0.10 )" = "141.31.176.214" && - STAT_DNS_E="läuft" || STAT_DNS_E="antwortet nicht" - test "$(dig +short shackspace.de @141.31.176.214 )" = "141.31.176.214" && - STAT_DNS_X="läuft"|| STAT_DNS_X="antwortet nicht" - - STAT_LINE=$(ping -c 5 -i 0.2 -q 141.31.176.214 | - awk '/packet loss/ { print 100-$6}' ) - - cat <<-EOF >$NOISE_linefeed - /set pitch 10 - /espeak -v Hallo - Ich bin Krebs. - /espeak -v Heute ist `wochentag`, der `tag` --- `monat` -- `date +%Y` - /zeit - /espeak -v tcheck der systeme: - /espeak -v Energie versorgung -- aktiv - /espeak -v shackhost -- läuft - /espeak -v telnet -- läuft - /espeak -v interner - D N S -- interne - do-mejn -- $STAT_DNS_I - /espeak -v interner - D N S -- externe - do-mejn -- $STAT_DNS_E - /espeak -v externer - D N S - $STAT_DNS_X - /espeak -v Leitungsqualität - $STAT_LINE prozent. - /temp - /espeak -v krebs kompjuting bereit - EOF - ;; - esac 2>&1 -} - -wochentag() { - case $(date +%a) in - (Mon) echo Montag ;; - (Tue) echo Dienstag ;; - (Wed) echo Mittwoch ;; - (Thu) echo Donnerstag ;; - (Fri) echo Freitag ;; - (Sat) echo Samstag ;; - (Sun) echo Sonntag ;; - esac -} - -tag() { - case $(date +%d) in - (1) echo erste ;; - (2) echo zweite ;; - (3) echo dritte ;; - (4) echo vierte ;; - (5) echo fünfte ;; - (6) echo sechste ;; - (7) echo siebte ;; - (8) echo achte ;; - (9) echo neunte ;; - (10) echo zehnte ;; - (11) echo elfte ;; - (12) echo zwölfte ;; - (13) echo dreizehnte ;; - (14) echo vierzehnte ;; - (15) echo fünfzehnte ;; - (16) echo sechzehnte ;; - (17) echo siebzehnte ;; - (18) echo achtzehnte ;; - (19) echo neunzehnte ;; - (20) echo zwanzigste ;; - (21) echo einundzwanzigste ;; - (22) echo zweiundzwanzigste ;; - (23) echo dreiundzwanzigste ;; - (24) echo vierundzwanzigste ;; - (25) echo füfundzwanzigste ;; - (26) echo sechsundzwanzigste ;; - (27) echo siebenundzwanzigste ;; - (28) echo achtundzwanzigste ;; - (29) echo neunundzwanzigste ;; - (30) echo dreissigste ;; - (31) echo einunddreissigste ;; - esac -} - -monat() { - case $(date +%b) in - (Jan) echo Januar ;; - (Feb) echo Februar ;; - (Mar) echo März ;; - (Apr) echo April ;; - (May) echo Mai ;; - (Jun) echo Juni ;; - (Jul) echo Juli ;; - (Aug) echo August ;; - (Sep) echo September ;; - (Oct) echo Oktober ;; - (Nov) echo November ;; - (Dec) echo Dezember ;; - esac -} - -main "$@" diff --git a/modules/noise/modules/sleep b/modules/noise/modules/sleep deleted file mode 100755 index 89712cac..00000000 --- a/modules/noise/modules/sleep +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -case "$1" in - (--help) echo "pause for NUMBER seconds" ;; - (*) - if echo "$1" | grep -Eq '^([0-9]+(\.[0-9]*)?|[0-9]*\.[0-9]+)$' ; then - sleep "$1" - else - echo 'FAIL: $1 is not a number' - fi -esac diff --git a/modules/noise/modules/stream b/modules/noise/modules/stream deleted file mode 100755 index 1e6fd0c5..00000000 --- a/modules/noise/modules/stream +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -inputdir=$HOME/noise/streams -basename="`basename "$0"`" -case "$1" in - (--help) - if echo "$0 $*" | grep -q '[[:space:]]--verbose\>'; then - echo -e "\x1B[35mtype \x1B[32m/$basename off \x1B[35mto turn stream off\x1B[m" - for i in `ls $inputdir` ; do - filename="$inputdir/$i" - shortcut=`xmlstarlet sel -t -v /station/@shortcut "$inputdir/$i"` - title=`xmlstarlet sel -t -v /station/@title "$inputdir/$i"` - topic=`xmlstarlet sel -t -v /station/@topic "$inputdir/$i"` - stream=`xmlstarlet sel -t -v /station/@stream "$inputdir/$i"` - echo -e "\x1B[35mtype \x1B[32m/$basename $shortcut \x1B[35mfor $topic\x1B[m" - done - else - echo "play an audio stream" - fi - ;; - (*) - exec 2>&1 - ffs='xml' - - if test -z "$*" ; then - echo -e "\x1B[32m/stream off \x1B[33m- turn stream off\x1B[m" - for i in `ls $inputdir` ; do - filename="$inputdir/$i" - shortcut=`xmlstarlet sel -t -v /station/@shortcut "$inputdir/$i"` - title=`xmlstarlet sel -t -v /station/@title "$inputdir/$i"` - topic=`xmlstarlet sel -t -v /station/@topic "$inputdir/$i"` - stream=`xmlstarlet sel -t -v /station/@stream "$inputdir/$i"` - echo -e "\x1B[32m/stream $shortcut \x1B[33m- $title \x1B[35m$topic\x1B[m" - done - else if [ "$1" = "off" ]; then - [ ! -d /tmp/noise ] || ( echo "no directory /tmp/noise; aborting" ; exit 1 ) - [ -f /tmp/noise/stream.pid ] && ( kill ` cat /tmp/noise/stream.pid ` ) - [ -e /tmp/noise/stream.pid ] && rm /tmp/noise/stream.pid || ( echo "can't remove /tmp/noise/stream.pid; aborting" ; exit 1 ) - else - for i in `ls $inputdir` ; do - filename="$inputdir/$i" - shortcut=`xmlstarlet sel -t -v /station/@shortcut "$inputdir/$i"` - stream=`xmlstarlet sel -t -v /station/@stream "$inputdir/$i"` - if [ "$shortcut" == "$1" ]; then - [ ! -d /tmp/noise ] || ( umask 077 ; mkdir /tmp/noise ) || ( echo "can't create /tmp/noise; aborting" ; exit 1 ) - [ -f /tmp/noise/stream.pid ] && ( kill ` cat /tmp/noise/stream.pid ` ) - [ -e /tmp/noise/stream.pid ] && rm /tmp/noise/stream.pid || ( echo "can't remove /tmp/noise/stream.pid; aborting" ; exit 1 ) - mplayer -cache 2048 -quiet "$stream" & - ( umask 077 ; echo $! > /tmp/noise/stream.pid ) - break - fi - done || cat<] -## Echo temperature in K. If formula is given then return that result instead. -inside_temp() { - echo "scale=2; x=`/krebs/modules/temper/temper` + 273.15; ${1-x}" | bc -} - -outside_temp() { - echo "scale=2; x=`dig +short txt outside.elwood.temp.citecs.de | - sed 's/^"DEG \([0-9]\+\.[0-9]\+\)"$/\1/' - ` + 273.15; ${1-x}" | bc -} - -espeak_inside() { - echo Die Krebs-tempera-tur beträgt $@ | to_espeak -} - -espeak_outside() { - echo Die Außen-tempera-tur beträgt $@ | to_espeak -} - -to_espeak() { - sed ' - s/\(\.[0-9]\)0\+/\1/g - s/\(\.[0-9]\)\([0-9]\)[0-9]*/ \1 \2 /; - s/^-/minus /; - s/\./ komma /; - ' | tee $NOISE_linefeed -} - -main "$@" diff --git a/modules/noise/modules/test b/modules/noise/modules/test deleted file mode 100755 index 2c0b8e0d..00000000 --- a/modules/noise/modules/test +++ /dev/null @@ -1,13 +0,0 @@ -#! /bin/sh - -case "$1" in - (--help) echo do some test-module related stuff ;; - (*) - - echo -n ">> " - read TEST - if [ $TEST == 'q' ]; then exit; fi - echo /wall @@ $TEST >$NOISE_linefeed - #sleep 1 - #sleep 1; echo /test >$NOISE_linefeed & -esac diff --git a/modules/noise/modules/twitter b/modules/noise/modules/twitter deleted file mode 100755 index 26982525..00000000 --- a/modules/noise/modules/twitter +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/python -#encode=utf8 - -#print "TODO Bug Robert to implement Twitter-OAuth!" -#exit(1) -import sys - -#sys.path.append("/usr/local/lib/") - -import twitter, os, pwd - -#os.getlogin = lambda: pwd.getpwuid(os.getuid())[0] - -sys.stderr = sys.stdout - -def shorten(text): - - text = text.replace("about ", "~") - text = text.replace("an", "1") - text = text.replace(" minutes", "m") - text = text.replace(" minute", "m") - text = text.replace(" hours", "h") - text = text.replace(" hour", "h") - text = text.replace(" seconds", "s") - text = text.replace(" second", "s") - text = text.replace(" days", "d") - text = text.replace(" day", "d") - text = text.replace(" weeks", "w") - text = text.replace(" week", "w") - text = text.replace(" years", "y") - text = text.replace(" year", "y") - text = text.replace(" ago", "") - text = text.replace("a", "1") - return text - - -def parse(text): - text = text.replace("\n","") - t = text.split(" ") - new = "" - for piece in t: - escape = "" - if piece.startswith("@"): - escape = "" - if piece[1:].lower() == "shackspam" or piece[1:].lower() == "shackspace": - escape = "" - - elif piece.startswith("#"): - escape = "" - elif piece.startswith("http://"): - escape = "" - if escape: - new += escape + piece + " " - else: - new += piece + " " - - return new - -if len(sys.argv) > 1 and sys.argv[1] == "--help": - print "read or post to the shackspam twitter timeline" - if len(sys.argv) == 3 and sys.argv[2] == "--verbose": - print "call without parameters to read" - print "use /twitter [your tweet] to tweet something to the shackspam twitter timeline" - exit() - - - -api = twitter.Api("Z7f9npE5ixvZ0lMCHDZBOg", "8z0gyfOABar1HxKvqL6fYXLqRFUPLQ9OOzDFt7Q4F4", "139766258-94TGPvNsJ8tYVv68eZewfXOIyDvRCWdycNlUgHrs", "NRnDQZPCoLrDizFvakZkSWgoG4vgGuT3OOMChSfiI") - -#api.SetXTwitterHeaders("Shackspace UTTERANCE","","0.00.0.01.42") - -if len(sys.argv) > 1: - - - tweet = u"" - - for t in sys.argv[1:]: - tweet += t.decode("utf8") + u" " - tweet = tweet[:-1] - - print u"Length: " + str(len(tweet)) + u"" - - if len(tweet) > 140: - print u"Your Tweet must be shorter than 140 characters.\n" - exit() - - status = api.PostUpdate(tweet) - - - - -else: - """print "\tshackspace tweets:" - for i in api.GetUserTimeline(): - i.text = parse(i.text) - print ("" + i.user.screen_name + " " + i.GetRelativeCreatedAt() + " " + i.text).encode("utf8").replace("\n"," ") - - print "\n\tfriends tweets" - """ - a = api.GetFriendsTimeline() - a.reverse() - for i in a: - text = i.text - ilen = len(i.user.screen_name) + len(shorten(i.GetRelativeCreatedAt())) + 2 - if i.user.screen_name.lower() == "shackspace" or i.user.screen_name.lower() == "shackspam": - info = "" + i.user.screen_name + " " + shorten(i.GetRelativeCreatedAt()) + "" - else: - info = "" + i.user.screen_name + " " + shorten(i.GetRelativeCreatedAt()) + "" - text = info + " " + parse(text) - - t = text.split(" ") - tmp = "" - for n in t: - if ((len(tmp) + len(n)) >= 80): - print parse(tmp).encode("utf8") - tmp = " " * ilen - - tmp += " " + n - if len(tmp) > ilen: - print parse(tmp).encode("utf8") - - - - - diff --git a/modules/noise/modules/vvs b/modules/noise/modules/vvs deleted file mode 100755 index fc23375f..00000000 --- a/modules/noise/modules/vvs +++ /dev/null @@ -1,17 +0,0 @@ -#! /bin/sh - -wrapper() { - exec 2>&1 - echo date: `date +%H:%M` - "$@" -} - -case "$1" in - (--help) echo query VVS ;; - (*) - case $# in - (2) wrapper vvs.de "$@" ;; - (0) wrapper vvs ;; - (*) echo "Syntax: /vvs [ORIGIN DESTINATION]" ; return ;; - esac -esac diff --git a/modules/noise/modules/wall b/modules/noise/modules/wall deleted file mode 100755 index c73744ea..00000000 --- a/modules/noise/modules/wall +++ /dev/null @@ -1,8 +0,0 @@ -#! /bin/sh -case "$1" in - (--help) : ;; - (?*) - for linefeed in /tmp/noise/*/linefeed ; do - echo /echo "$*" >$linefeed - done -esac diff --git a/modules/noise/modules/zeit b/modules/noise/modules/zeit deleted file mode 100755 index 9fbc33e4..00000000 --- a/modules/noise/modules/zeit +++ /dev/null @@ -1,19 +0,0 @@ -#! /bin/sh - -case "$1" in - (--help) - echo "say current time" ;; - (*) - exec >>$NOISE_linefeed - k=`date +%k|sed 's/^[[:space:]]*1[[:space:]]*$/ein/'` - M=`date +%M|sed 's/0*//'` - echo /set pitch 10 - case "$lang" in - (de|'') echo "/espeak Es ist $k Uhr $M" ;; - (en|*-en) - test -z "$M" || M="and $M minutes" - echo "/espeak It is $k o clock $M" ;; - (*) echo "Error: unsupported lang = $lang" >&2 - esac - echo /set pitch ${noise_pitch-100} -esac 2>&1 diff --git a/modules/noise/noise b/modules/noise/noise deleted file mode 100755 index bd6b17c8..00000000 --- a/modules/noise/noise +++ /dev/null @@ -1,182 +0,0 @@ -#! /bin/sh - -noise_set() { # set a variable - case "$1" in - (-q|--quiet) echo=: ; shift ;; - (*) echo=echo ;; - esac - case $# in - (0) ## print all noise variables - env | sed -rn ' - s/^noise_([[:alnum:]_]+)=(.*)$/\1 = \2/p - ' | sort - ;; - (1) ## print value the specified variable - eval "echo \"$1 = \$noise_$1\"" - ;; - (*) ## set the specified variable - if echo "$1" | grep -q '[^[:alnum:]_]' ; then - fail invalid variable name "$1" - return 23 - fi - eval "old=\"\$noise_$1\"" - if test "x$old" = "x$2" ; then - eval "$echo \"$1 is already $2\"" - elif test -z "$old" ; then - eval "export noise_$1='$2' ; $echo \ -\"$1 set to $2\"" - else - eval "export noise_$1='$2' ; $echo \ -\"$1 changed from $old to $2\"" - fi - ## write variable to $env - if grep -q "^$1=" "$env" ; then - sed -ri "s'^($1)=(.*)\$'\1=\'$2\''" $env - else - echo "$1='$2'" >>$env - fi - ;; - esac -} - -noise_unset() { # unset a variable - case "$1" in - (-q|--quiet) echo=: ; shift ;; - (*) echo=echo ;; - esac - case $# in - (1) ## - unset "noise_$1" - sed -ni "/^$1=/!p" $env - ;; - (*) - fail "broken commandline: $@" - ;; - esac -} - -noise_quit() { # exit - echo "Good bye!" - exit -} - -fail() { - echo "FAIL: $*" - return 23 -} - -cleanup() { - kill $jobs - rm -f $linefeed $env - rmdir /tmp/noise/$$ 2>/dev/null - rmdir /tmp/noise 2>/dev/null -} - -exec 2>&1 -qname="`readlink -f "$0"`" -dirname="`dirname "$qname"`" -export HOME='/home/noise' -if test -d "$dirname/modules" ; then - export NOISE_PATH="${NOISE_PATH+$NOISE_PATH:}$dirname/modules" - export NOISE_PATH="${NOISE_PATH+$NOISE_PATH:}$HOME/noise/modules" -fi -mkdir -p /tmp/noise/$$ -linefeed="/tmp/noise/$$/linefeed" -env="/tmp/noise/$$/environment" -trap cleanup EXIT -mkfifo $linefeed -touch $env -## -## -## -readline() { - { read REPLY && echo "$REPLY" ; } | sed -rn " - s/[']//g - s/~%/\n/g - s/([^\\])([#<>])/\1\\\\\2/g - s:^/([a-z_]+)([[:space:]]+(.*))?$:command=\1; args='\3';:p;t - s@^([[:alnum:]_/+-]+):[[:space:]]*(.*)@command=lang; args='\1 \2';@p;t - s@^\![[:space:]]*(.*)@command=play; args='\1';@p;t - s:.*:command='$noise_default_command'; args='&';:p;t - " -} -## -## -## -while echo -n "$noise_prompt" && eval "`readline`" ; do - ## modcall - for dir in `echo "$NOISE_PATH" | tr : \ ` ; do - module="$dir/$command" - if test -x "$module" ; then -#echo foo $module:$@: - #shift - eval 'NOISE="$0" NOISE_pid="$$" NOISE_linefeed="$linefeed" "$module"' "$args" - continue 2 - fi - done - ## funcall - if type noise_$command | grep -q function ; then - eval 'noise_$command' "$args" - continue - fi - ## - fail unknown command "$command" -done <$linefeed & -jobs="${jobs+$jobs }`jobs -p`" -## -## -## -cat</dev/null -`... - -## Motto Of The Day\ - -Join the 23.shack-dev-team, we've got ` - sloccount $dirname/* | - sed -rn ' - s/.*\(SLOC\)[[:space:]]*=[[:space:]]*([0-9]+)$/\1/p - '` SLOC, ` - { - ls $dirname/modules/ - test -d ~noise/modules && ls ~noise/modules/ - } | sort | uniq | wc -l - ` mods, -`grep ^- $dirname/TODO | wc -l`+ TODOs and drive the irregular Hackathon @shackspace. -Follow http://twitter.com/shackspam FTW! - -## Hints\ - -Start your telnet session with rlwrap for MAXIMUM profit. -Get online-help with /help. - -EOF -# TODO: MOTD-candidates: -#twitter: #shackspam -#mail: shockspasm@googlemail.com -#irc: freenode/#shackspace -#afk: @shackspace -## -## -## -exec >>$linefeed -## -## -## -echo '/set -q default_command espeak' -echo '/set -q prompt "READY.~%"' -## -## -## -while read REPLY; do - case $REPLY in - (/quit) echo /quit ; exit ;; - (*) tr \; \\n | grep . ;; - esac< print all discovered hosts - -SNMPWALK Command -=============== - -snmpwalk -c shammunity 10.42.0.1 1.3.6.1.2.1.3.1.1.2 diff --git a/modules/people/TODO.md b/modules/people/TODO.md deleted file mode 100644 index daacfd58..00000000 --- a/modules/people/TODO.md +++ /dev/null @@ -1,3 +0,0 @@ -BUGS -===== - diff --git a/modules/people/VERSION b/modules/people/VERSION deleted file mode 100644 index 6c50e659..00000000 --- a/modules/people/VERSION +++ /dev/null @@ -1 +0,0 @@ -+++++++[>+++++++>+++++++<<-]>.>---.<-. diff --git a/modules/people/arping.py b/modules/people/arping.py deleted file mode 100755 index 1b51ab1b..00000000 --- a/modules/people/arping.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/python - -import logging -log = logging.getLogger('arpingy') -logging.disable(logging.WARNING) - -import os,sys -try: - if (os.geteuid() != 0): - raise Exception('no root permissions') - from scapy.all import * #might throws "no such module" - - def arpingy(iprange="10.42.1.0/24",iface='eth0'): - log.debug("pinging "+ str(iprange)) - """Arping function takes IP Address or Network, returns nested mac/ip list""" - try: - conf.verb=0 - ans,unans=arping(iprange,iface=iface,timeout=1,retry=3) - - collection = [] - for snd, rcv in ans: - result = rcv.sprintf(r"%ARP.psrc% %Ether.src%").split() - log.debug(result) - return result # take just the first arp reply - except Exception as e: - print ("something went wrong while arpinging " + str(e)) - return [] - -except Exception as e: - log.error("Cannot load arping functions!" + str(e)) - def arpingy(iprange='',iface=''): - raise Exception ('arping not available') - - -if __name__ =='__main__': - logging.basicConfig(level=logging.DEBUG) - arpingy(sys.argv[1],sys.argv[2]) diff --git a/modules/people/arping_users.py b/modules/people/arping_users.py deleted file mode 100755 index c576e4f3..00000000 --- a/modules/people/arping_users.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/python -import subprocess,re,logging,sys - -from arping import arpingy -from multiprocessing import Pool -DEV='eth0' -MAC_NAMES='mac_names.lst' -data = [] -ret = {} -verb = False - -if len(sys.argv) > 1 and sys.argv[1] == 'v': - verb = True -def get_own_addr(): - data = subprocess.Popen(['/sbin/ifconfig',DEV], - stdout=subprocess.PIPE).communicate()[0].replace('\n','') - return re.sub(r'.*HWaddr ([0-9A-Fa-f:]*).*inet addr:([0-9.]*).*' , - r'\1 \2',data).split() - -def load_names(MAC_NAMES): - names = {} - f = open(MAC_NAMES) - for l in f: - mac,name = l.split() - names[mac] = name.replace('\n','') - f.close() - return names - -def arping_helper(dic): - return arpingy(**dic) - -for first in range(4): - for second in range(255): - data.append({'iprange':'10.42.'+str(first)+'.'+str(second),'iface':DEV}) - -names = load_names(MAC_NAMES) -try: - p = Pool(20) - ret = filter(lambda x:x , p.map(arping_helper, data)) - myip,mymac = get_own_addr() - ret.append([mymac,myip]) - p.terminate() -except Exception as e: - print 'you fail '+str(e) - - - -for p in ret: - if verb: - print p[0] + " => " + p[1] - if p[1] in names: - print names[p[1]]+ " is online" - - diff --git a/modules/people/mac_names.lst b/modules/people/mac_names.lst deleted file mode 100644 index dcd3c2b0..00000000 --- a/modules/people/mac_names.lst +++ /dev/null @@ -1 +0,0 @@ -00:40:63:c8:b5:a0 krebs diff --git a/modules/retiolum/Makefile b/modules/retiolum/Makefile deleted file mode 100644 index 0d99ee70..00000000 --- a/modules/retiolum/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -.phony: update it all so install - -all: select-target - -it: so -so: it - -/etc/tinc/retiolum/hosts: - cd $(dir $@) && git clone https://github.com/krebscode/hosts - -update: /etc/tinc/retiolum/hosts - cd $< && git pull - -install: - scripts/tinc_setup/install.sh diff --git a/modules/retiolum/README b/modules/retiolum/README deleted file mode 100644 index 9b9725f2..00000000 --- a/modules/retiolum/README +++ /dev/null @@ -1,29 +0,0 @@ -Retiolum Darknet Module for Krebs -======================== - -Enter the darknet with the help of tinc retiolum - -Getting Started -------------- -to get you started, check out scripts/tinc_setup/README - -1. the first step you will need to do is grab a binary copy of tinc via your -packet manager, build it yourself or place all your hope into the build -script of your distribution. -2. after doing that you might want to run the scripts/tinc_setup/install.sh -script to write all the configuration files and private/public keys. -This installation is somewhat interactive so be sure not to fuck shit up. - -Other cool stuff ---------------- -in bin/ there are some cool scripts which are partly needed and partly -totally unnecessary to work with retiolum. - -As all the scripts are not too horribly long, be sure to use -`cat bin/SCRIPTNAME` to get an understanding of what they do - -besides that in scripts/ there are 3 more scripts which perform pretty -sophisticated tasks like finding instances via multicast or writing graphs -of the current retiolum network. Try them if you dare :) - - diff --git a/modules/retiolum/bin/fillxx b/modules/retiolum/bin/fillxx deleted file mode 100755 index 5e558362..00000000 --- a/modules/retiolum/bin/fillxx +++ /dev/null @@ -1,6 +0,0 @@ -#! /bin/sh -while echo $1 | grep -q xx; do - xx=`od -An -tx1 -N 1 /dev/urandom | tr -d \ ` - set -- `echo $1 | sed s/xx/$xx/` -done -echo $1 diff --git a/modules/retiolum/bin/hosts b/modules/retiolum/bin/hosts deleted file mode 100755 index 6939f52c..00000000 --- a/modules/retiolum/bin/hosts +++ /dev/null @@ -1,11 +0,0 @@ -#! /bin/sh -set -euf - -netname=${1-retiolum} - -cd /etc/tinc/$netname/hosts - -for i in `ls`; do - sed -rn 's|^ *Subnet *= *([^ /]*)(/[0-9]*)? *$|\1\t'$i' '$i'.'$netname'|p' $i -done | sort - diff --git a/modules/retiolum/bin/ipv6 b/modules/retiolum/bin/ipv6 deleted file mode 100755 index 65a1eaa1..00000000 --- a/modules/retiolum/bin/ipv6 +++ /dev/null @@ -1,35 +0,0 @@ -#! /bin/sh -# -# Manage IPv6 of the retiolum interface. -# -# usage: ipv6 {start,stop} -# -set -euf - -if test `id -u` != 0; then - echo "we're going sudo..." >&2 - exec sudo "$0" "$@" - exit 23 # go to hell -fi - -file=/etc/tinc/retiolum/hosts/`hostname` -addr=`sed -rn 's|^Subnet *= *(42:[0-9A-Fa-f:]*/128)|\1|p' $file` -route=42::/16 - -start() { - stop - ip -6 addr add $addr dev retiolum - ip -6 route add $route dev retiolum -} - -stop() { - ip -6 addr del $addr dev retiolum 2>/dev/null || : - ip -6 route del $route dev retiolum 2>/dev/null || : -} - -## dispatch -case "$1" in - (start) start;; - (stop) stop;; - (*) echo "You're made of stupid" 2>/dev/null; exit 23;; -esac diff --git a/modules/retiolum/bin/tinc b/modules/retiolum/bin/tinc deleted file mode 100755 index ffa1dbee..00000000 --- a/modules/retiolum/bin/tinc +++ /dev/null @@ -1,18 +0,0 @@ -#! /bin/sh -# -set -euf - -init() { - f=/tmp/retiolum.GraphDumpFile - if ! test -f $f; then - touch $f && - chown -v tincd: $f - fi - - modprobe -v tun -} - -if init; then - exec tincd --user=tincd --net=retiolum "$@" -fi - diff --git a/modules/retiolum/bin/update_tinc_hosts b/modules/retiolum/bin/update_tinc_hosts deleted file mode 100755 index 2d5cf957..00000000 --- a/modules/retiolum/bin/update_tinc_hosts +++ /dev/null @@ -1,33 +0,0 @@ -#! /bin/sh -set -euf - -if test "${nosudo-false}" != true -a `id -u` != 0; then - echo "we're going sudo..." >&2 - exec sudo "$0" "$@" - exit 23 # go to hell -fi - -DIRNAME=`dirname $0` -export PATH="`readlink -f $DIRNAME`:$PATH" - -hosts="${hosts-/etc/hosts}" - -bs='# BEGIN OF RETIOLUM' -es='# END OF RETIOLUM' - -case "${1-imstupid}" in - (start|restart) - if grep -q "^$bs$" $hosts && grep -q "^$es$" $hosts; then - $0 stop - echo "$bs" >> $hosts - hosts >> $hosts - echo "$es" >> $hosts - fi - ;; - (stop) - sed -ie "/^$bs$/,/^$es$/d" $hosts - ;; - (*) - echo 'Error 1: You are made of stupid!' >&2 - exit 23 -esac diff --git a/modules/retiolum/doc/install_dotcloud b/modules/retiolum/doc/install_dotcloud deleted file mode 100644 index ab7206b1..00000000 --- a/modules/retiolum/doc/install_dotcloud +++ /dev/null @@ -1,85 +0,0 @@ -The Dotcloud provided by duostack.com is a application development platform -for simple deployment of your stuff. - -It also provides an ssh-interface via: - - dotcloud ssh project.module - - -to be able to use it without the hassle of going through the api, you will -need to create an own dsa-key for ssh to use and deploy this public key on -the machine - - ssh-keygen -t dsa -f dotcloud_project.dss - cat dotcloud_project.dss.pub (copy the contents to the dotclouds - ~/.ssh/authorized_keys2) - -find your dotcloud host ip via - - dotcloud info project.module - - -You will gain a user shell with - - ssh dotcloud@module.project -p 5960 - -we will need to build some stuff in order to get a working copy of tinc. -Everything needs to be done in userspace. - - mkdir build - cd build - curl http://www.openssl.org/source/openssl-1.0.0d.tar.gz | tar xz - cd openssl-1.0.0d - ./config --prefix=$HOME/usr -fPIC - make install - cp lib* $HOME/usr/lib - cd .. - - curl http://www.oberhumer.com/opensource/lzo/download/lzo-2.04.tar.gz | tar xz - cd lzo-2.04 - ./configure --prefix=$HOME/usr - - curl http://zlib.net/zlib-1.2.5.tar.gz | tar xz - cd zlib-1.2.5/ - ./configure --prefix=$HOME/usr - make install - -before building we need to patch the tinc daemon to run without the need -for a tun device. - -tutorial is here: -https://hackerspace.be/TincVPN - - - curl http://www.tinc-vpn.org/packages/tinc-1.0.14.tar.gz | tar xz - cd tinc-1.0.14 - #replace the device.c with the patched (empty) one from the webpage - ./configure --prefix=$HOME/usr --sysconfdir=$HOME/etc \ - --localstatedir=$HOME/var --with-openssl=`pwd`/../openssl-1.0.0d/ \ - --with-openssl-lib=`pwd`/../openssl-1.0.0d/ \ - --with-zlib-include=$HOME/usr/include --with-zlib-lib=$HOME/usr/lib - make - make install - mkdir ~/etc - mkdir -p ~/var/run - cd ~/painload/modules/retiolum/scripts/tinc_setup - ./install cloudkrebs 10.7.7.221 - - -be sure to fix the portnumber in the generated host file and add your own -address in hosts/cloudkrebs: - - Address = my.public.address - Port = 1655 - - PUBKEY - - -also write the right in tinc.conf: - - Name = cloudkrebs - - Mode = switch - #device = ... - # no device :) - diff --git a/modules/retiolum/doc/install_no.de b/modules/retiolum/doc/install_no.de deleted file mode 100644 index a8b72a78..00000000 --- a/modules/retiolum/doc/install_no.de +++ /dev/null @@ -1,4 +0,0 @@ -ok, i tried to just do the same step i did in the other cloud service, but -it failed when trying to include tunnel headers.this is what to do: - -# add PATH_MAX to conf.c diff --git a/modules/retiolum/scripts/README b/modules/retiolum/scripts/README deleted file mode 100644 index 4dbb42af..00000000 --- a/modules/retiolum/scripts/README +++ /dev/null @@ -1,16 +0,0 @@ -This Folder contains all the cool scripts created for tinc_retiolum - -currently the following functions are deployed: - -adv_graphgen/ - makefu - this folder contains a script suite which parses the interesting - parameters from the syslog file by sending SIGUSR2 to the tinc process - -tinc_multicast/ - Miefda,Lassulus - A tinc multicast script suite which provides automagic-discovery in a - local network by utilizing multicast - -tinc_setup/ - makefu (i am so sorry...) - A number of scripts which build and configure tinc on a local machine. - Core is the install.sh script which actually writes the configuration - and creates users as well as private/public keys diff --git a/modules/retiolum/scripts/adv_graphgen/README b/modules/retiolum/scripts/adv_graphgen/README deleted file mode 100644 index 082e0f2b..00000000 --- a/modules/retiolum/scripts/adv_graphgen/README +++ /dev/null @@ -1,28 +0,0 @@ -The folder contains a number of scripts which provide a convenient way to -generate advanced graphs from the SIGUSR2 output of tinc. - -it currently contains the following files: - -sanitize.sh: - wrapper arond parse.py which filters the syslog file for all tinc - related lines and removes the status informations: - this means that - - May 19 20:40:44 servarch dnsmasq[5382]: reading /etc/resolv.conf - May 19 20:41:38 servarch tinc.retiolum[4780]: Error looking up pa-sharepoint.informatik.ba-stuttgart.de port 655: Name or service not known - - becomes - - Error looking up pa-sharepoint.informatik.ba-stuttgart.de port 655: Name or service not known - - and so on. - It also provides a wrapper around graphviz which automagically - generates graphs from the produced graph file - -parse.py: - reads from stdin the sanitized syslog file and prints a valid dot file - from the given output. - The parser module may also produce any other output (e.g. for dns - entries and so on) you will need to actually read and modify the source - in order to be able to do this. ~May the source be with you~ - diff --git a/modules/retiolum/scripts/adv_graphgen/parse.py b/modules/retiolum/scripts/adv_graphgen/parse.py deleted file mode 100755 index 639c5316..00000000 --- a/modules/retiolum/scripts/adv_graphgen/parse.py +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/python2 -# -*- coding: utf8 -*- - -import sys -""" TODO: Refactoring needed to pull the edges out of the node structures again, -it should be easier to handle both structures""" - -def write_digraph(nodes): - """ - writes the complete digraph in dot format - """ - print ('digraph retiolum {') - print (' node[shape=box,style=filled,fillcolor=grey]') - generate_stats(nodes) - nodes = delete_unused_nodes(nodes) - merge_edges(nodes) - for k,v in nodes.iteritems(): - write_node(k,v) - print ('}') -def generate_stats(nodes): - """ Generates some statistics of the network and nodes - """ - for k,v in nodes.iteritems(): - v['num_conns'] = len(v.get('to',[])) -def delete_unused_nodes(nodes): - new_nodes = {} - for k,v in nodes.iteritems(): - if v.get('to',[]): - new_nodes[k] = v - return new_nodes -def merge_edges(nodes): - """ merge back and forth edges into one - DESTRUCTS the current structure by deleting "connections" in the nodes - - """ - for k,v in nodes.iteritems(): - for con in v.get('to',[]): - for i,secon in enumerate(nodes[con['name']].get('to',[])): - if k == secon['name']: - del (nodes[con['name']]['to'][i]) - con['bidirectional'] = True - - -def write_node(k,v): - """ writes a single node and its edges - edges are weightet with the informations inside the nodes provided by - tinc - """ - node = " "+k+"[label=\"" - node += k+"\\l" - node += "external:"+v['external-ip']+":"+v['external-port']+"\\l" - if v.has_key('num_conns'): - node += "Num Connects:"+str(v['num_conns'])+"\\l" - for addr in v.get('internal-ip',['¯\\\\(°_o)/¯']): - node += "internal:"+addr+"\\l" - node +="\"" - if v['external-ip'] == "MYSELF": - node += ",fillcolor=steelblue1" - node += "]" - print node - - for con in v.get('to',[]): - edge = " "+k+ " -> " +con['name'] + "[weight="+str(float(con['weight'])) - if con.get('bidirectional',False): - edge += ",dir=both" - edge += "]" - print edge - -def parse_input(): - nodes={} - for line in sys.stdin: - line = line.replace('\n','') - if line == 'Nodes:': - nodes={} - for line in sys.stdin: - if line == 'End of nodes.\n': - break - l = line.replace('\n','').split() #TODO unhack me - nodes[l[0]]= { 'external-ip': l[2], 'external-port' : l[4] } - if line == 'Subnet list:': - for line in sys.stdin: - if line == 'End of subnet list.\n': - break - l = line.replace('\n','').split() - if not nodes[l[2]].get('internal-ip',False): - nodes[l[2]]['internal-ip'] = [] - nodes[l[2]]['internal-ip'].append(l[0].split('#')[0]) - if line == 'Edges:': - edges = {} - for line in sys.stdin: - if line == 'End of edges.\n': - break - l = line.replace('\n','').split() - - if not nodes[l[0]].has_key('to') : - nodes[l[0]]['to'] = [] - nodes[l[0]]['to'].append( - {'name':l[2],'addr':l[4],'port':l[6],'weight' : l[10] }) - return nodes -nodes = parse_input() -write_digraph(nodes) diff --git a/modules/retiolum/scripts/adv_graphgen/sanitize.sh b/modules/retiolum/scripts/adv_graphgen/sanitize.sh deleted file mode 100755 index 0e12d207..00000000 --- a/modules/retiolum/scripts/adv_graphgen/sanitize.sh +++ /dev/null @@ -1,13 +0,0 @@ -GRAPH_SETTER1=dot -GRAPH_SETTER2=circo -LOG_FILE=/var/log/everything.log -OPENER=/bin/true - -sudo pkill -USR2 tincd -sudo sed -n '/tinc.retiolum/{s/.*tinc.retiolum\[[0-9]*\]: //gp}' $LOG_FILE |\ - ./parse.py > retiolum.dot - -$GRAPH_SETTER1 -Tpng -o $1retiolum_1.png retiolum.dot -$GRAPH_SETTER2 -Tpng -o $1retiolum_2.png retiolum.dot -$OPENER retiolum_1.png &>/dev/null -#rm retiolum.dot diff --git a/modules/retiolum/scripts/autostart/Makefile b/modules/retiolum/scripts/autostart/Makefile deleted file mode 100644 index aba6bd33..00000000 --- a/modules/retiolum/scripts/autostart/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -INIT_FOLDER=/etc/init.d -.phony: all -debian: - #TODO change the tinc file before writing - cp tinc /etc/init.d/tinc - chmod +x /etc/init.d - echo "retiolum" > /etc/tinc/nets.boot - update-rc.d tinc defaults -arch: - @cp tinc /etc/rc.d - @chmod +x /etc/rc.d/tinc - @echo "add tinc to DAEMONS in /etc/rc.conf" - - diff --git a/modules/retiolum/scripts/autostart/tinc b/modules/retiolum/scripts/autostart/tinc deleted file mode 100755 index 12e77d6a..00000000 --- a/modules/retiolum/scripts/autostart/tinc +++ /dev/null @@ -1,94 +0,0 @@ -#! /bin/sh -# -### BEGIN INIT INFO -# Provides: tinc -# Required-Start: $remote_fs $network -# Required-Stop: $remote_fs $network -# Should-Start: $syslog $named -# Should-Stop: $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start tinc daemons -# Description: Create a file $NETSFILE (/etc/tinc/nets.boot), -# and put all the names of the networks in there. -# These names must be valid directory names under -# $TCONF (/etc/tinc). Lines starting with a # will be -# ignored in this file. -### END INIT INFO -# -# Based on Lubomir Bulej's Redhat init script. - -DAEMON="/usr/sbin/tincd" -NAME="tinc" -DESC="tinc daemons" -TCONF="/etc/tinc" -NETSFILE="$TCONF/nets.boot" -NETS="" - -modprobe tun - -test -f $DAEMON || exit 0 - -[ -r /etc/default/tinc ] && . /etc/default/tinc - -# foreach_net "what-to-say" action [arguments...] -foreach_net() { - if [ ! -f $NETSFILE ] ; then - echo "Please create $NETSFILE." - exit 0 - fi - echo -n "$1" - shift - egrep '^[ ]*[a-zA-Z0-9_-]+' $NETSFILE | while read net args; do - echo -n " $net" - "$@" $net $args - done - echo "." -} - -start() { - $DAEMON $EXTRA -n "$@" -} -stop() { - $DAEMON -n $1 -k -} -reload() { - $DAEMON -n $1 -kHUP -} -restart() { - stop "$@" - sleep 0.5 - i=0; - while [ -f /var/run/tinc.$1.pid ] ; do - if [ $i = '10' ] ; then - break - else - echo -n "." - sleep 0.5 - i=$(($i+1)) - fi - done - start "$@" -} - -case "$1" in - start) - foreach_net "Starting $DESC:" start - ;; - stop) - foreach_net "Stopping $DESC:" stop - ;; - reload|force-reload) - foreach_net "Reloading $DESC configuration:" reload - ;; - restart) - foreach_net "Restarting $DESC:" restart - ;; - *) - echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload}" - exit 1 - ;; -esac - -exit 0 - diff --git a/modules/retiolum/scripts/tinc_multicast/retiolum b/modules/retiolum/scripts/tinc_multicast/retiolum deleted file mode 100755 index 1d6b775f..00000000 --- a/modules/retiolum/scripts/tinc_multicast/retiolum +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -. /etc/rc.conf -. /etc/rc.d/functions - -TINCNAME='retiolum' -case "$1" in - start) - stat_busy "Starting retiolum Daemon" - success=0 - /home/death/git/retiolum/.scripts/tinc_multicast/retiolum.py -n retiolum -T & - sleep 2 - if [ $success -eq 0 ]; then - add_daemon retiolum - stat_done - else - stat_fail - fi - ;; - stop) - stat_busy "Stopping retiolum Daemon" - kill `cat /var/lock/retiolum.retiolum` - rm_daemon retiolum - stat_done - ;; - restart) - $0 stop - sleep 4 - $0 start - ;; - *) - echo "usage $0 {start¦stop¦restart}" -esac -exit 0 diff --git a/modules/retiolum/scripts/tinc_multicast/retiolum.py b/modules/retiolum/scripts/tinc_multicast/retiolum.py deleted file mode 100755 index 8cf57471..00000000 --- a/modules/retiolum/scripts/tinc_multicast/retiolum.py +++ /dev/null @@ -1,349 +0,0 @@ -#!/usr/bin/python2 -import sys, os, time, signal, socket, subprocess, thread, random, Queue, binascii, logging, hashlib, urllib2 #these should all be in the stdlib -from optparse import OptionParser - -def pub_encrypt(hostname_t, text): #encrypt data with public key - logging.debug("encrypt: " + text) - if hostname_t.find("`") != -1: return(-1) - try: - enc_text = subprocess.os.popen("echo '" + text + "' | openssl rsautl -pubin -inkey /etc/tinc/" + netname + "/hosts/.pubkeys/" + hostname_t + " -encrypt | base64 -w0") - return(enc_text.read()) - except: - return(-1) - -def priv_decrypt(enc_data): #decrypt data with private key - if enc_data.find("`") != -1: return(-1) - dec_text = subprocess.os.popen("echo '" + enc_data + "' | base64 -d | openssl rsautl -inkey /etc/tinc/" + netname + "/rsa_key.priv -decrypt") - return(dec_text.read()) - -def address2hostfile(hostname, address): #adds address to hostsfile or restores it if address is empty - hostfile = "/etc/tinc/" + netname + "/hosts/" + hostname - addr_file = open(hostfile, "r") - addr_cache = addr_file.readlines() - addr_file.close() - if address != "": - addr_cache.insert(0, "Address = " + address + "\n") - addr_file = open(hostfile, "w") - addr_file.writelines(addr_cache) - addr_file.close - logging.info("sending SIGHUP to tinc deamon!") - tincd_ALRM = subprocess.call(["tincd -n " + netname + " --kill=HUP" ],shell=True) - else: - recover = subprocess.os.popen("tar xzf /etc/tinc/" + netname + "/hosts/hosts.tar.gz -C /etc/tinc/" + netname + "/hosts/ " + hostname) - -def findhostinlist(hostslist, hostname, ip): #finds host + ip in list - for line in xrange(len(hostslist)): - if hostname == hostslist[line][0] and ip == hostslist[line][1]: - return line - return -1 #nothing found - -def getHostname(netname): - tconf = open("/etc/tinc/" + netname + "/tinc.conf", "r") - feld = tconf.readlines() - tconf.close() - for x in feld: - if x.startswith("Name"): - return str(x.partition("=")[2].lstrip().rstrip("\n")) - - print("hostname not found!") - return -1 #nothing found - -def get_hostfiles(url_files, url_md5sum): - try: - get_hosts_tar = urllib2.urlopen(url_files) - get_hosts_md5 = urllib2.urlopen(url_md5sum) - hosts_tar = get_hosts_tar.read() - hosts_md5 = get_hosts_md5.read() - - if str(hosts_md5) == str(hashlib.md5(hosts_tar).hexdigest() + " hosts.tar.gz\n"): - hosts = open("/etc/tinc/" + netname + "/hosts/hosts.tar.gz", "w") - hosts.write(hosts_tar) - hosts.close() - else: - logging.error("hosts.tar.gz md5sum check failed!") - except: - logging.error("hosts file download failed!") - - -####Thread functions - - -def sendthread(sendfifo, ghostmode): #send to multicast, sends keep alive packets - while True: - try: - #{socket init start - ANY = "0.0.0.0" - SENDPORT = 23542 - MCAST_ADDR = "224.168.2.9" - MCAST_PORT = 1600 - - sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) #initalize socket with udp - sock.bind((ANY,SENDPORT)) #now bound to Interface and Port - sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 255) #activate multicast - #}socket init end - - if ghostmode == 0: - - i = 9 - - while True: - i += 1 - if not sendfifo.empty(): - sock.sendto(sendfifo.get(), (MCAST_ADDR,MCAST_PORT) ) - logging.info("send: sending sendfifo") - else: - time.sleep(1) - if i == 10: - sock.sendto("#Stage1#" + netname + "#" + hostname + "#", (MCAST_ADDR,MCAST_PORT) ) - logging.debug("send: sending keep alive") - i = 0 - else: - while True: - if not sendfifo.empty(): - sock.sendto(sendfifo.get(), (MCAST_ADDR,MCAST_PORT) ) - logging.info("send: sending sendfifo") - else: - time.sleep(1) - - except: - logging.error("send: socket init failed") - time.sleep(10) - - - -def recvthread(timeoutfifo, authfifo): #recieves input from multicast, send them to timeout or auth - while True: - try: - ANY = "0.0.0.0" - MCAST_ADDR = "224.168.2.9" - MCAST_PORT = 1600 - - sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) #create a UDP socket - sock.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1) #allow multiple sockets to use the same PORT number - sock.bind((ANY,MCAST_PORT)) #Bind to the port that we know will receive multicast data - sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 255) #tell the kernel that we are a multicast socket - - - status = sock.setsockopt(socket.IPPROTO_IP, - socket.IP_ADD_MEMBERSHIP, #Tell the kernel that we want to add ourselves to a multicast group - socket.inet_aton(MCAST_ADDR) + socket.inet_aton(ANY)); #The address for the multicast group is the third param - - while True: - while True: - - try: - data, addr = sock.recvfrom(1024) - ip, port = addr - break - except socket.error, e: - pass - - logging.debug("recv: got data") - dataval = data.split("#") - if dataval[0] == "": - if dataval[2] == netname: - if dataval[1] == "Stage1": - if dataval[3] != hostname: - timeoutfifo.put(["tst", dataval[3], ip]) - logging.info("recv: got Stage1: writing data to timeout") - logging.debug("recv: ;tst;" + dataval[3] + ";" + ip) - if dataval[1] == "Stage2": - if dataval[3] == hostname: - authfifo.put([dataval[1], dataval[3], ip, dataval[4]]) - logging.info("recv: got Stage2: writing data to auth") - logging.debug("recv: ;" + dataval[1] + ";" + dataval[3] + ";" + ip + ";" + dataval[4]) - if dataval[1] == "Stage3": - if dataval[3] != hostname: - authfifo.put([dataval[1], dataval[3], ip, dataval[4]]) - logging.info("recv: got Stage3: writing data to auth") - logging.debug("recv: ;" + dataval[1] + ";" + dataval[3] + ";" + ip + ";" + dataval[4]) - except: - logging.error("recv: socket init failed") - time.sleep(10) - -def timeoutthread(timeoutfifo, authfifo): #checks if the hostname is already in the list, deletes timeouted nodes -# hostslist = [] #hostname, ip, timestamp - - while True: - if not timeoutfifo.empty(): - curhost = timeoutfifo.get() - if curhost[0] == "add": - with hostslock: - hostslist.append([curhost[1], curhost[2], time.time()]) - address2hostfile(curhost[1], curhost[2]) - logging.info("adding host to hostslist") - elif curhost[0] == "tst": - with hostslock: - line = findhostinlist(hostslist, curhost[1], curhost[2]) - if line != -1: - hostslist[line][2] = time.time() - logging.debug("timeout: refreshing timestamp of " + hostslist[line][0]) - else: - authfifo.put(["Stage1", curhost[1], curhost[2]]) - logging.info("timeout: writing to auth") - - else: - i = 0 - with hostslock: - while i < len(hostslist): - if time.time() - hostslist[i][2] > 60: - address2hostfile(hostslist[i][0], "") - hostslist.remove(hostslist[i]) - logging.info("timeout: deleting dead host") - else: - i += 1 - time.sleep(2) - -def auththread(authfifo, sendfifo, timeoutfifo): #manages authentication with clients (bruteforce sensitve, should be fixed) - authlist = [] #hostname, ip, Challenge, timestamp - - - while True: - try: - if not authfifo.empty(): - logging.debug("auth: authfifo is not empty") - curauth = authfifo.get() - if curauth[0] == "Stage1": - line = findhostinlist(authlist, curauth[1], curauth[2]) - if line == -1: - challengenum = random.randint(0,65536) - encrypted_message = pub_encrypt(curauth[1], "#" + hostname + "#" + str(challengenum) + "#") - authlist.append([curauth[1], curauth[2], challengenum, time.time()]) - else: - encrypted_message = pub_encrypt(authlist[line][0], "#" + hostname + "#" + str(authlist[line][2]) + "#") - if encrypted_message == -1: - logging.info("auth: RSA Encryption Error") - else: - sendtext = "#Stage2#" + netname + "#" + curauth[1] + "#" + encrypted_message + "#" - sendfifo.put(sendtext) - logging.info("auth: got Stage1 sending now Stage2") - logging.debug("auth: " + sendtext) - - if curauth[0] == "Stage2": - dec_message = priv_decrypt(curauth[3]) - splitmes = dec_message.split("#") - if splitmes[0] == "": - encrypted_message = pub_encrypt(splitmes[1], "#" + splitmes[2] + "#") - if encrypted_message == -1: - logging.error("auth: RSA Encryption Error") - else: - sendtext = "#Stage3#" + netname + "#" + curauth[1] + "#" + encrypted_message + "#" - sendfifo.put(sendtext) - logging.info("auth: got Stage2 sending now Stage3") - logging.debug("auth: " + sendtext) - - if curauth[0] == "Stage3": - line = findhostinlist(authlist, curauth[1], curauth[2]) - if line != -1: - dec_message = priv_decrypt(curauth[3]) - splitmes = dec_message.split("#") - logging.info("auth: checking challenge") - if splitmes[0] == "": - if splitmes[1] == str(authlist[line][2]): - timeoutfifo.put(["add", curauth[1], curauth[2]]) - del authlist[line] - logging.info("auth: Stage3 checked, sending now to timeout") - else: logging.error("auth: challenge checking failed") - else: logging.error("auth: decryption failed") - - else: - i = 0 - while i < len(authlist): - if time.time() - authlist[i][3] > 120: - del authlist[i] - logging.info("auth: deleting timeoutet auth") - else: - i += 1 - time.sleep(1) - except: - logging.error("auth: thread crashed") - -def process_start(): #starting of the process - #download and untar hostfile - logging.info("downloading hostfiles") - get_hostfiles("http://vpn.miefda.org/hosts.tar.gz", "http://vpn.miefda.org/hosts.md5") #Currently Hardcoded, should be editable by config or parameter - tar = subprocess.call(["tar -xzf /etc/tinc/" + netname + "/hosts/hosts.tar.gz -C /etc/tinc/" + netname + "/hosts/"], shell=True) - - #initialize fifos - sendfifo = Queue.Queue() #sendtext - authfifo = Queue.Queue() #Stage{1, 2, 3} hostname ip enc_data - timeoutfifo = Queue.Queue() #State{tst, add} hostname ip - - #start threads - thread_recv = thread.start_new_thread(recvthread, (timeoutfifo, authfifo)) - thread_send = thread.start_new_thread(sendthread, (sendfifo, option.ghost)) - thread_timeout = thread.start_new_thread(timeoutthread, (timeoutfifo, authfifo)) - thread_auth = thread.start_new_thread(auththread, (authfifo, sendfifo, timeoutfifo)) - -def process_restart(signum, frame): - logging.error("root: restarting process") - with hostslock: - del hostslist[:] - #download and untar hostfile - logging.info("downloading hostfiles") - get_hostfiles("http://vpn.miefda.org/hosts.tar.gz", "http://vpn.miefda.org/hosts.md5") #Currently Hardcoded, should be editable by config or parameter - tar = subprocess.call(["tar -xzf /etc/tinc/" + netname + "/hosts/hosts.tar.gz -C /etc/tinc/" + netname + "/hosts/"], shell=True) - - logging.info("sending SIGHUP") - tincd_ALRM = subprocess.call(["tincd -n " + netname + " --kill=HUP" ],shell=True) - -def kill_process(signum, frame): - logging.error("got SIGINT/SIGTERM exiting now") - os.remove("/var/lock/retiolum." + netname) - if option.tinc != False: - stop_tincd = subprocess.call(["tincd -n " + netname + " -k"],shell=True) - sys.exit(0) - -#Program starts here! - -parser = OptionParser() -parser.add_option("-n", "--netname", dest="netname", help="the netname of the tinc network") -parser.add_option("-H", "--hostname", dest="hostname", default="default", help="your nodename, if not given, it will try too read it from tinc.conf") -parser.add_option("-t", "--timeout", dest="timeout", default=65536, help="timeout after retiolum gets restartet, default is 65536") -parser.add_option("-d", "--debug", dest="debug", default="0", help="debug level: 0,1,2,3 if empty debug level=0") -parser.add_option("-g", "--ghost", action="store_true", dest="ghost", default=False, help="deactivates active sending, keeps you anonymous in the public network") -parser.add_option("-T", "--Tinc", action="store_true", dest="tinc", default=False, help="starts tinc with this script") -(option, args) = parser.parse_args() - -if option.netname == None: - parser.error("Netname is required, use -h for help!") -if option.hostname == "default": - option.hostname = getHostname(option.netname) - -hostname = option.hostname -netname = option.netname -hostslist = [] -hostslock = thread.allocate_lock() - -#set process name -if not os.path.exists("/var/lock/retiolum." + netname): - pidfile = open("/var/lock/retiolum." + netname, "w") - pidfile.write(str(os.getpid())) - pidfile.close() -else: - logging.error("pidfile already exists") - sys.exit(0) - -#Logging stuff -LEVELS = {'3' : logging.DEBUG, - '2' : logging.INFO, - '1' : logging.ERROR, - '0' : logging.CRITICAL} - -level_name = option.debug -level = LEVELS.get(level_name, logging.NOTSET) -logging.basicConfig(level=level) - -#normally tinc doesnt start with retiolum -if option.tinc != False: - start_tincd = subprocess.call(["tincd -n " + netname ],shell=True) - -process_start() - -signal.signal(signal.SIGTERM, kill_process) -signal.signal(signal.SIGINT, kill_process) -signal.signal(signal.SIGUSR1, process_restart) - -while True: - time.sleep(float(option.timeout)) - process_restart(0, 0) diff --git a/modules/retiolum/scripts/tinc_setup/README b/modules/retiolum/scripts/tinc_setup/README deleted file mode 100644 index 11d6f6e9..00000000 --- a/modules/retiolum/scripts/tinc_setup/README +++ /dev/null @@ -1,18 +0,0 @@ -This directory contains the build and install scripts for shack-retiolum - -1. build_arch - arch linux build script -2. build_debian - debian build script -3. build_debian_clean - debian script which builds a clean tinc daemon -4. build_ec2 - Amazon ec2 base instance build script -5. install.sh - configures the tinc daemon - $1 is the nickname - $2 is the ip-address - also writes a python file inside the tinc/retiolum folder which posts - the public key into the IRC:freenode/#tincspasm -6. build_no.de - nonfunct no.de smartmachine build script diff --git a/modules/retiolum/scripts/tinc_setup/autoupdate_cron.sh b/modules/retiolum/scripts/tinc_setup/autoupdate_cron.sh deleted file mode 100644 index d5d41aaf..00000000 --- a/modules/retiolum/scripts/tinc_setup/autoupdate_cron.sh +++ /dev/null @@ -1,7 +0,0 @@ -cat </dev/null -12 23 * * * cd /home/node/etc/tinc/retiolum/hosts/ && /opt/local/bin/git pull && pkill -HUP tincd -EOF - diff --git a/modules/retiolum/scripts/tinc_setup/bootstrap.sh b/modules/retiolum/scripts/tinc_setup/bootstrap.sh deleted file mode 100644 index 32919e7d..00000000 --- a/modules/retiolum/scripts/tinc_setup/bootstrap.sh +++ /dev/null @@ -1,11 +0,0 @@ -if [ ! `id -u` -eq "0" ] -then - echo "not root, trying sudo" - exec sudo "$0" "$@" -fi - -mkdir -p /etc/tinc/retiolum/ -git clone git://github.com/miefda/retiolum.git /etc/tinc/retiolum/hosts -cd /etc/tinc/retiolum/hosts/.scripts - -echo "use the build script of your choice from /etc/tinc/retiolum/hosts/.scripts" diff --git a/modules/retiolum/scripts/tinc_setup/build_arch.sh b/modules/retiolum/scripts/tinc_setup/build_arch.sh deleted file mode 100755 index 5ef5d765..00000000 --- a/modules/retiolum/scripts/tinc_setup/build_arch.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -set -e -sudo pacman -S openssl gcc lzo -curl http://www.tinc-vpn.org/packages/tinc-1.0.13.tar.gz | tar xz -cd tinc-1.0.13 -./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var -make -sudo make install -cd .. - -echo "overwriting python to python2" -sed 's/\/usr\/bin\/python/\/usr\/bin\/python2/g' install.sh >install2.sh -mv install2.sh install.sh - diff --git a/modules/retiolum/scripts/tinc_setup/build_debian.sh b/modules/retiolum/scripts/tinc_setup/build_debian.sh deleted file mode 100755 index 52e61390..00000000 --- a/modules/retiolum/scripts/tinc_setup/build_debian.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -set -x -if [ ! "$MYIP" ] -then - MYIP=10.0.7.7.55 -fi -if [ ! "$MYHOSTNAME" ] -then - MYHOSTNAME="penis" -fi - -if [ "$MYHOSTNAME" = "penis" ]; -then - read -n1 -p "name is penis, are u sure? [yN]" - if [[ "$REPLY" != [yY] ]] - then - echo "then better RTFC" - echo "bailing out" - exit 0 - fi -fi -apt-get install tinc git curl python - -./install.sh "$MYHOSTNAME" "$MYIP" - -# for autostart -sed -i '/retiolum/d' /etc/tinc/nets.boot -echo "retiolum" >> /etc/tinc/nets.boot -sed -i '/EXTRA/d' /etc/tinc/nets.boot -echo "EXTRA=\"\"" >> /etc/default/tinc - -/etc/init.d/tinc start diff --git a/modules/retiolum/scripts/tinc_setup/build_debian_clean.sh b/modules/retiolum/scripts/tinc_setup/build_debian_clean.sh deleted file mode 100755 index a7332f4e..00000000 --- a/modules/retiolum/scripts/tinc_setup/build_debian_clean.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -set -xe -MYIP=10.0.7.7.55 - -apt-get install tinc git curl gcc gcc-dev build-essential libssl-dev python - -git clone https://github.com/makefu/shack-retiolum.git - -mkdir build -cd build -curl http://www.oberhumer.com/opensource/lzo/download/lzo-2.04.tar.gz | tar -xz -cd lzo-2.04 -./configure --prefix=/usr -make -sudo make install -cd .. -curl http://www.tinc-vpn.org/packages/tinc-1.0.13.tar.gz | tar xz -cd tinc-1.0.13 -./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var -make -sudo make install -cd ../.. - -cd shack-retiolum -./install.sh `hostname` $MYIP - -rm shack-retiolum -# for autostart -echo "retiolum" >> /etc/tinc/nets.boot -echo "EXTRA=\"--user=tincd --chroot\"" >> /etc/default/tinc diff --git a/modules/retiolum/scripts/tinc_setup/build_ec2.sh b/modules/retiolum/scripts/tinc_setup/build_ec2.sh deleted file mode 100755 index 79f2af28..00000000 --- a/modules/retiolum/scripts/tinc_setup/build_ec2.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -set -e -sudo yum install -y gcc openssl-devel -mkdir build -cd build -curl http://www.oberhumer.com/opensource/lzo/download/lzo-2.04.tar.gz | tar xz -cd lzo-2.04 -./configure --prefix=/usr -make -sudo make install -cd .. -curl http://www.tinc-vpn.org/packages/tinc-1.0.13.tar.gz | tar xz -cd tinc-1.0.13 -./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var -make -sudo make install diff --git a/modules/retiolum/scripts/tinc_setup/build_no.de.sh b/modules/retiolum/scripts/tinc_setup/build_no.de.sh deleted file mode 100644 index 2976d3a2..00000000 --- a/modules/retiolum/scripts/tinc_setup/build_no.de.sh +++ /dev/null @@ -1 +0,0 @@ -pkgin in lzo gcc-tools gcc-compiler gcc34 diff --git a/modules/retiolum/scripts/tinc_setup/install.sh b/modules/retiolum/scripts/tinc_setup/install.sh deleted file mode 100755 index 9df38df7..00000000 --- a/modules/retiolum/scripts/tinc_setup/install.sh +++ /dev/null @@ -1,72 +0,0 @@ -#! /bin/sh -# USE WITH GREAT CAUTION - -#make -C ../../ update -set -e -DIRNAME=`dirname $0` -CURR=`readlink -f ${DIRNAME}` -MYBIN=../../bin -netname=retiolum -# create configuration directory for $netname -mkdir -p /etc/tinc/$netname/hosts -cd /etc/tinc/$netname - -echo "added known hosts:" -ls -1 hosts | LC_ALL=C sort -echo "delete the nodes you do not trust!" - -myname="${1:-}" -if [ ! "$myname" ] -then - echo "select username: " - read myname -fi -if [ ! -e "hosts/$myname" ] -then - myipv4="${2:-}" - mynet4=10.7.7.0 - - if [ ! "$myipv4" ] - then - echo "select v4 subnet ip (1-255) :" - read v4num - myipv4=10.7.7.$v4num - if [ "$v4num" -gt 0 -a "$v4num" -lt "256" ]; - then - echo "check" - else - echo "you are made of stupid. bailing out" - exit 1 - fi - fi - echo "Subnet = $myipv4" > hosts/$myname - - myipv6=`${CURR}/../../bin/fillxx 42:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx`/128 - echo "Subnet = $myipv6" >> hosts/$myname -else - echo "own host file already exists! will not write again!" -fi - -cp $CURR/tinc-up /etc/tinc/$netname/ - -cat>tinc.conf< -#include -#include -#include - -/* - * Temper.c by Robert Kavaler (c) 2009 (relavak.com) - * All rights reserved. - * - * Temper driver for linux. This program can be compiled either as a library - * or as a standalone program (-DUNIT_TEST). The driver will work with some - * TEMPer usb devices from RDing (www.PCsensor.com). - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY Robert Kavaler ''AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Robert kavaler BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "temper.h" - -#define VENDOR_ID 0x1130 -#define PRODUCT_ID 0x660c - -struct Temper { - struct usb_device *device; - usb_dev_handle *handle; - int debug; - int timeout; -}; - - Temper * -TemperCreate(struct usb_device *dev, int timeout, int debug) -{ - Temper *t; - int ret; - - t = calloc(1, sizeof(*t)); - t->device = dev; - t->debug = debug; - t->timeout = timeout; - t->handle = usb_open(t->device); - if(!t->handle) { - free(t); - return NULL; - } - if(t->debug) { - printf("Trying to detach kernel driver\n"); - } - - ret = usb_detach_kernel_driver_np(t->handle, 0); - if(ret) { - if(errno == ENODATA) { - if(t->debug) { - printf("Device already detached\n"); - } - } else { - if(t->debug) { - printf("Detach failed: %s[%d]\n", - strerror(errno), errno); - printf("Continuing anyway\n"); - } - } - } else { - if(t->debug) { - printf("detach successful\n"); - } - } - ret = usb_detach_kernel_driver_np(t->handle, 1); - if(ret) { - if(errno == ENODATA) { - if(t->debug) - printf("Device already detached\n"); - } else { - if(t->debug) { - printf("Detach failed: %s[%d]\n", - strerror(errno), errno); - printf("Continuing anyway\n"); - } - } - } else { - if(t->debug) { - printf("detach successful\n"); - } - } - - if(usb_set_configuration(t->handle, 1) < 0 || - usb_claim_interface(t->handle, 0) < 0 || - usb_claim_interface(t->handle, 1)) { - usb_close(t->handle); - free(t); - return NULL; - } - return t; -} - - Temper * -TemperCreateFromDeviceNumber(int deviceNum, int timeout, int debug) -{ - struct usb_bus *bus; - int n; - - n = 0; - for(bus=usb_get_busses(); bus; bus=bus->next) { - struct usb_device *dev; - - for(dev=bus->devices; dev; dev=dev->next) { - if(debug) { - printf("Found device: %04x:%04x\n", - dev->descriptor.idVendor, - dev->descriptor.idProduct); - } - if(dev->descriptor.idVendor == VENDOR_ID && - dev->descriptor.idProduct == PRODUCT_ID) { - if(debug) { - printf("Found deviceNum %d\n", n); - } - if(n == deviceNum) { - return TemperCreate(dev, timeout, debug); - } - n++; - } - } - } - return NULL; -} - - void -TemperFree(Temper *t) -{ - if(t) { - if(t->handle) { - usb_close(t->handle); - } - free(t); - } -} - - static int -TemperSendCommand(Temper *t, int a, int b, int c, int d, int e, int f, int g, int h) -{ - unsigned char buf[32]; - int ret; - - bzero(buf, 32); - buf[0] = a; - buf[1] = b; - buf[2] = c; - buf[3] = d; - buf[4] = e; - buf[5] = f; - buf[6] = g; - buf[7] = h; - - if(t->debug) { - printf("sending bytes %d, %d, %d, %d, %d, %d, %d, %d\n", - a, b, c, d, e, f, g, h); - } - - ret = usb_control_msg(t->handle, 0x21, 9, 0x200, 0x01, - (char *) buf, 32, t->timeout); - if(ret != 32) { - perror("usb_control_msg failed"); - return -1; - } - return 0; -} - - static int -TemperGetData(Temper *t, char *buf, int len) -{ - int ret; - - return usb_control_msg(t->handle, 0xa1, 1, 0x300, 0x01, - (char *) buf, len, t->timeout); -} - - int -TemperGetTemperatureInC(Temper *t, float *tempC) -{ - char buf[256]; - int ret, temperature, i; - - TemperSendCommand(t, 10, 11, 12, 13, 0, 0, 2, 0); - TemperSendCommand(t, 0x54, 0, 0, 0, 0, 0, 0, 0); - for(i = 0; i < 7; i++) { - TemperSendCommand(t, 0, 0, 0, 0, 0, 0, 0, 0); - } - TemperSendCommand(t, 10, 11, 12, 13, 0, 0, 1, 0); - ret = TemperGetData(t, buf, 256); - if(ret < 2) { - return -1; - } - - temperature = (buf[1] & 0xFF) + (buf[0] << 8); - temperature += 1152; // calibration value - *tempC = temperature * (125.0 / 32000.0); - return 0; -} - - int -TemperGetOtherStuff(Temper *t, char *buf, int length) -{ - TemperSendCommand(t, 10, 11, 12, 13, 0, 0, 2, 0); - TemperSendCommand(t, 0x52, 0, 0, 0, 0, 0, 0, 0); - TemperSendCommand(t, 10, 11, 12, 13, 0, 0, 1, 0); - return TemperGetData(t, buf, length); -} - - -#define USB_TIMEOUT 1000 /* milliseconds */ -#define DEBUG_MODE 0 -#define SLEEP_TIMEOUT 10 - - int -main(int argv,char** args) -{ - - - Temper *t; - char buf[256]; - int i, ret,oneshot=0; - if (argv == 2 && (args[1][1] == 'h' || args[1][0] == 'h')) - { - printf("Temper, does the right thing in C\n"); - printf("recompile with DEBUG_MODE = 1 for all the debug printing\n"); - printf("recompile with SLEEP_TIMEOUT = XX for a different polling interval\n"); - exit(0); - } - - usb_set_debug(DEBUG_MODE); - usb_init(); - usb_find_busses(); - usb_find_devices(); - - t = TemperCreateFromDeviceNumber(0, USB_TIMEOUT, DEBUG_MODE); - if(!t) { - perror("TemperCreate"); - exit(-1); - } - - /* - TemperSendCommand(t, 10, 11, 12, 13, 0, 0, 2, 0); - TemperSendCommand(t, 0x43, 0, 0, 0, 0, 0, 0, 0); - TemperSendCommand(t, 0, 0, 0, 0, 0, 0, 0, 0); - TemperSendCommand(t, 0, 0, 0, 0, 0, 0, 0, 0); - TemperSendCommand(t, 0, 0, 0, 0, 0, 0, 0, 0); - TemperSendCommand(t, 0, 0, 0, 0, 0, 0, 0, 0); - TemperSendCommand(t, 0, 0, 0, 0, 0, 0, 0, 0); - TemperSendCommand(t, 0, 0, 0, 0, 0, 0, 0, 0); - */ - - bzero(buf, 256); - ret = TemperGetOtherStuff(t, buf, 256); - - float tempc; - - if(TemperGetTemperatureInC(t, &tempc) < 0) { - perror("TemperGetTemperatureInC"); - exit(1); - } - - printf("%.2f\n", tempc); - return 0; -} diff --git a/modules/temper/temper.h b/modules/temper/temper.h deleted file mode 100644 index 7ea6280a..00000000 --- a/modules/temper/temper.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef TEMPER_H -#define TEMPER_H - -/* - * Temper.h by Robert Kavaler (c) 2009 (relavak.com) - * All rights reserved. - * - * Temper driver for linux. This program can be compiled either as a library - * or as a standalone program (-DUNIT_TEST). The driver will work with some - * TEMPer usb devices from RDing (www.PCsensor.com). - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY Robert Kavaler ''AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Robert kavaler BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -typedef struct Temper Temper; - - -Temper *TemperCreateFromDeviceNumber(int deviceNum, int timeout, int debug); -void TemperFree(Temper *t); - -int TemperGetTemperatureInC(Temper *t, float *tempC); -int TempterGetOtherStuff(Temper *t, char *buf, int length); - -#endif diff --git a/modules/webcams/cam1.sh b/modules/webcams/cam1.sh deleted file mode 100755 index 9cf709e6..00000000 --- a/modules/webcams/cam1.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -mplayer tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0 diff --git a/modules/zoneminder/Makefile b/modules/zoneminder/Makefile deleted file mode 100644 index 27302715..00000000 --- a/modules/zoneminder/Makefile +++ /dev/null @@ -1,14 +0,0 @@ - -.PHONY: fix it so hard -it: so -so: it hard fix - apt-get install --yes zoneminder libv4l-0 - -hard: /etc/sysctl.d/zoneminder.conf -/etc/sysctl.d/zoneminder.conf: zoneminder.conf - cp $< $@ - sysctl -p $@ - -fix: zmdc.pl-LD_PRELOAD.patch - (cd /usr/bin && patch -N) < $< || : - diff --git a/modules/zoneminder/zmdc.pl-LD_PRELOAD.patch b/modules/zoneminder/zmdc.pl-LD_PRELOAD.patch deleted file mode 100644 index b00fc673..00000000 --- a/modules/zoneminder/zmdc.pl-LD_PRELOAD.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- /usr/bin/zmdc.pl 2011-05-23 22:28:57.505247793 +0200 -+++ /usr/bin/zmdc.pl 2011-05-23 22:29:45.597248242 +0200 -@@ -62,6 +62,7 @@ - $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL}; - delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; - -+$ENV{LD_PRELOAD} = '/usr/lib/libv4l/v4l2convert.so'; - my @daemons = ( - 'zmc', - 'zma', diff --git a/modules/zoneminder/zoneminder.conf b/modules/zoneminder/zoneminder.conf deleted file mode 100644 index 1eec6fd9..00000000 --- a/modules/zoneminder/zoneminder.conf +++ /dev/null @@ -1,2 +0,0 @@ -kernel.shmall = 134217728 -kernel.shmmax = 134217728 diff --git a/morse/COPYING b/morse/COPYING new file mode 100644 index 00000000..d28e4178 --- /dev/null +++ b/morse/COPYING @@ -0,0 +1,14 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 23, December 1984 + + Copyright (C) 2011 tv@shackspace + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. + diff --git a/morse/README b/morse/README new file mode 100644 index 00000000..67951c00 --- /dev/null +++ b/morse/README @@ -0,0 +1,32 @@ +MORSE(1) MORSE(1) + +NAME + morse.sh - morse code generator + +SYNOPSIS + morse [-l N] [-f N] [-c|-x] [text...] + +DESCRIPTION + Generate visible or audible from text or stdin. + +OPTIONS + -l N use N milliseconds as length of dit. Default: 60 ms + + -f N beep at N Hz. Default: 2000 Hz + + -c compile only. Morse will output morse-executable morse code. + + -x execute only. Interpret text as morse code, i.e. do not try + to convert text or stdin. + +BUGS + None.^_^ + +REPORTING BUGS + Please use Github's issue tracking system. + +AUTHOR + This program was written by tv@shackspace and is distributed under the + Do What The Fuck You Want To Public License. + + April 2011 MORSE(1) diff --git a/morse/morse.sh b/morse/morse.sh new file mode 100755 index 00000000..c84538ca --- /dev/null +++ b/morse/morse.sh @@ -0,0 +1,160 @@ +#! /bin/sh +set -euf + +freq=2000 +dit=60 +mode=compile+execute + +## plain stupid options "parser" +while test $# -gt 0; do + case "$1" in + (-l) dit=$2; shift 2;; + (-f) freq=$2; shift 2;; + (-c) mode=compile; shift 1;; + (-x) mode=execute; shift 1;; + (*) break 2;; + esac +done + +# Ein Dah ist dreimal so lang wie ein Dit. +dah=`echo "$dit * 3" | bc` + +## Convert a character to the corresponting morse code. +## Note: any unknown characters are left unaltered. +char2morse() { +tr [a-z] [A-Z] | +sed ' + # Die Pause zwischen Wörtern beträgt sieben Dits. (1/2) + s:[[:space:]]\+::g + + # Zwischen Buchstaben in einem Wort wird eine Pause von Dah eingeschoben. + s:[^ ]:& :g + + # Die Pause zwischen Wörtern beträgt sieben Dits. (2/2) + s: : :g +' | +sed ' + # Lateinische Buchstaben + # Die Pause zwischen zwei gesendeten Symbolen ist ein Dit lang. + s:A:· −:g + s:B:− · · ·:g + s:C:− · − ·:g + s:D:− · ·:g + s:E:·:g + s:F:· · − ·:g + s:G:− − ·:g + s:H:· · · ·:g + s:I:· ·:g + s:J:· − − −:g + s:K:− · −:g + s:L:· − · ·:g + s:M:− −:g + s:N:− ·:g + s:O:− − −:g + s:P:· − − ·:g + s:Q:− − · −:g + s:R:· − ·:g + s:S:· · ·:g + s:T:−:g + s:U:· · −:g + s:V:· · · −:g + s:W:· − −:g + s:X:− · · −:g + s:Y:− · − −:g + s:Z:− − · ·:g +' | +sed ' + # Ziffern + # Die Pause zwischen zwei gesendeten Symbolen ist ein Dit lang. + s:0:− − − − −:g + s:1:· − − − −:g + s:2:· · − − −:g + s:3:· · · − −:g + s:4:· · · · −:g + s:5:· · · · ·:g + s:6:− · · · ·:g + s:7:− − · · ·:g + s:8:− − − · ·:g + s:9:− − − − ·:g +' | +sed ' + # TODO Sonder- und Satzzeichen + #s:À, Å:· − − · − + #s:Ä:· − · − + #s:È:· − · · − + #s:É:· · − · · + #s:Ö:− − − · + #s:Ü:· · − − + #s:ß:· · · − − · · + #s:CH:− − − − + #s:Ñ:− − · − − + #s:. (AAA) · − · − · − + #s:, (MIM) − − · · − − + #s:: − − − · · · + #s:; − · − · − · + #s:? (IMI) · · − − · · + #s:- − · · · · − + #s:_ · · − − · − + #s:( − · − − · + #s:) − · − − · − + #s:'\'' · − − − − · + #s:= − · · · − + #s:+ · − · − · + #s:/ − · · − · + #s:@ (AC) · − − · − · +' | +sed ' + # TODO Signale + # KA + # (Spruchanfang) − · − · − + # BT + # (Pause) − · · · − + # AR + # (Spruchende) · − · − · + # VE + # (verstanden) · · · − · + # SK + # (Verkehrsende) · · · − · − + # SOS + # (internationaler + # (See-)Notruf) · · · − − − · · · + # HH + # (Fehler; Irrung; + # Wiederholung + # ab letztem + # vollständigen Wort) · · · · · · · · +' +} + +## Convert morse code to beep(1) arguments. +morse2beeparg() { +sed " + s: : -n -f 1 -l $dit:g + s:·: -n -f $freq -l $dit:g + s:−: -n -f $freq -l $dah:g +" | + sed ' + 1s:^:beep -f 1 -l 1: +' +} + +compile() { + char2morse +} + +execute() { + `morse2beeparg` +} + +## main - process either [any non-option] arguments or stdin. +if test $# -gt 0; then + echo "$*" +else + cat +fi | +case "$mode" in + (compile) compile;; + (execute) execute;; + (compile+execute) compile | execute;; + (*) echo bad mode: $mode >&2; exit 23;; +esac diff --git a/node/Makefile b/node/Makefile new file mode 100644 index 00000000..00e27b6f --- /dev/null +++ b/node/Makefile @@ -0,0 +1,8 @@ + + +.PHONY: all +all: node-v0.4.8 + cd $< && ./configure && make && make install + +node-%: + cur http://nodejs.org/dist/$@.tar.gz | tar zx diff --git a/noise/Makefile b/noise/Makefile new file mode 100644 index 00000000..932c5940 --- /dev/null +++ b/noise/Makefile @@ -0,0 +1,16 @@ + +.PHONY: all +all: select-target + +.PHONY: infest +infest: + apt-get install --yes expect beep alsa-utils ucspi-tcp espeak + f=/usr/bin/beep; chown krebs:krebs $$f && chmod 4755 $$f + getent passwd noise || useradd noise + ln -vsnf /krebs/noise/init.d/noise /etc/init.d/noise + ## tv: TODO update-rc.d is DEBIAN ONLY, fix this + update-rc.d -f noise defaults + amixer sset 'Master' 100 unmute || true + amixer sset 'PCM' 100 unmute || true + amixer sset 'PC Speaker' 100 unmute || \ + amixer sset 'Beep' 100 unmute || true diff --git a/noise/TODO b/noise/TODO new file mode 100644 index 00000000..a20f74e9 --- /dev/null +++ b/noise/TODO @@ -0,0 +1,60 @@ +#### file:noise/TODO + +- /channels +- /hist N -- zum anzeigen von N letzten Nachrichten + - Log? Es werden maximal chat_histsize Zeilen gespeichert. +- Anbindung ans MoinMoin +- IRC <-> 23.shack - Brücke +- when nick changes say "You're now known as XXX" to yourself +- twitter: push new tweets as they arrive to all connected clients with + the variable tweet_me set to ON + +- Author, Maintainer etc. direkt in die Module in der erweiterten Hilfe, also + in /help MODULENAME -> man sollte sich auf ein einheitliches Dokmentierungs- + Format einigen. + - All modules should contain: + - Author(s) w/ e-mail, Copyright, License + - Maintainer(s) w/ e-mail + - Module-Version + - last tested System-Version + - we need to export the system version +- GIT commits tweeten (shack und root) +- /kick [CHANNEL] # from channel / telnet +- /ban # :-) +- /op +- USER-A: /ping USER-B + - USER-B: /pong + - write time to USER-{A,B} +- style-sheets for everything MOAR!!1 +- libraries +- HTTP-interface +- /whois, /whoami, /whowas +- join,part&co. should support multiple channels +- /TODO,/bug,/issue or something should be added as tracking-system +- /part should say something like "X has left." +- /join should say something like "X has joined." + # it's obvious that the channels is meant... + - or else say: "X has joined channel Y." when we can join more than one + channel +- /part should unset chat_channel (somehow) else keeping /part'ing will + broadcast to chat_channel that X has quit... +- split /twitter into /tweet and X, to make it clear when tweets are fired +- POP3 mail off googlemail and show them to curious telnetters +- /set x 23 -> blah $x + +- /rewrite -- e.g. /rewrite "!%s" "/play %s" oder sowasi +- Zugriff per ssh +- module to standard unix-commands (name like /system) + - unix-commands should simply link to system +- /save TOKEN, /load TOKEN +- /op # NUR VIA SSH! (s.o.) +- MODULE-TEST-SUITE [blackbox] +- sub-modules like /chat-join which may be abbreviated as /join when + $default_command is set to /chat, YAY + - unclutter /help: + - /help -> show all (main) modules + - /help MODULE -> show help of MODULE and show all sub-modules + - /help MODULE SUB-MODULE -> show help of SUB-MODULE and show all sub^2... +- watchdog + +#### end of file. diff --git a/noise/cron/bin/zeit b/noise/cron/bin/zeit new file mode 100755 index 00000000..168a7b7b --- /dev/null +++ b/noise/cron/bin/zeit @@ -0,0 +1,18 @@ +#! /bin/sh + +beep -l 1000 -f 4000 +sleep 1 +/krebs/morse/morse.sh -l 100 -f 700 `date +%k` +sleep 1 +expect >/dev/null <$NOISE_linefeed;; + (/names) + cd /tmp/noise + . $NOISE_pid/environment + nick="${chat_nick-$NOISE_pid}" + channel="$chat_channel" + echo "Users in channel $channel" + for client in * ; do + . $client/environment + chat_nick="${chat_nick-$client}" + if test "$channel" = "$chat_channel" && test "$default_command" = chat ; then + echo "$chat_nick" + fi + unset chat_nick + unset chat_channel + unset default_command + done ;; + (*) + cd /tmp/noise + . $NOISE_pid/environment + nick="${chat_nick-$NOISE_pid}" + + echo "/send_to_channel $chat_channel $nick: $*" > $NOISE_linefeed + + + #echo /wall @@ $* >$NOISE_linefeed +esac diff --git a/noise/modules/date b/noise/modules/date new file mode 100755 index 00000000..8cd1b0c1 --- /dev/null +++ b/noise/modules/date @@ -0,0 +1,6 @@ +#! /bin/sh +case "$1" in + (--help) : ;; + (*) + date --rfc-3339=s +esac diff --git a/noise/modules/echo b/noise/modules/echo new file mode 100755 index 00000000..344dd963 --- /dev/null +++ b/noise/modules/echo @@ -0,0 +1,6 @@ +#! /bin/sh +case "$1" in + (--help) : ;; + (*) + echo "$*" +esac diff --git a/noise/modules/ein_mal_eins b/noise/modules/ein_mal_eins new file mode 100755 index 00000000..fb385b31 --- /dev/null +++ b/noise/modules/ein_mal_eins @@ -0,0 +1,37 @@ +#! /bin/bash + +R() { + echo "`od -t d -N 1 /dev/urandom | sed -rn '1s/^[0-9]+ +//p'` % $@" | bc +} + + + + +case "$1" in + (--help) echo Stellt eine einfache Aufgabe ;; + (*) + a="`R 69`" + b="`R 69`" + op="`echo "\ +Was ist, A hoch B +Was ist, A plus B +Was ist, A minus B +Was ist, A mal B +Was ist, sinus von 0 +Was ist, Pi halbe mal 2 +Was ist, 2 hoch 8 +Was ist, 2 hoch 16 +Was ist, 2 hoch 32 +Was ist, 42 geteilt durch Pi mal 100 +Was ist, l n von 1 +Was ist, 42 +Was ist, 23 +Starte den Server neu +Löte ein Kabel an einen Kompjuter +Was ist, A geteilt durch B"`" + o="$(R `echo "$op" | wc -l` + 1)" + + aufgabe=`echo "$op" | sed -n "$o{s/A/$a/;s/B/$b/;p}"` + + echo "/espeak -v Löse die Aufgabe: $aufgabe?" >$NOISE_linefeed +esac diff --git a/noise/modules/espeak b/noise/modules/espeak new file mode 100755 index 00000000..97305b5e --- /dev/null +++ b/noise/modules/espeak @@ -0,0 +1,34 @@ +#! /bin/sh + +print_var() { + echo "$1 = $2" +} + +speak() { + p="${noise_pitch-100}" + v="${noise_lang-de}" + k="${noise_capital-0}" + a="${noise_amplitude-100}" + g="${noise_gap-1}" + if test "$debug" = true; then + print_var pitch $p + print_var lang $v + print_var capital $k + print_var amplitude $a + print_var gap $g + fi + if test "$verbose" = true; then + echo "espeak: $@" + fi + #echo "espeak -p \"$pitch\" -v \"$lang\" \"$*\"" >&2 + (espeak --stdout -a $a -k $k -p $p -v $v -g $g | aplay -Dplug:dmix)</dev/null + done + ## print all documented built-in commands + sed -rn 's:^noise_([a-z]+)\(\) \{ # (.+)?$:\1 \2:p' "$NOISE" + } | sort | uniq | sed -rn ' + $s/$// + s:^([a-z]+) (.+):type /\1 to \2:p' ;; + (*) + ## call + for directory in `echo "$NOISE_PATH" | tr : \ ` ; do + for module in "$directory/$1" ; do + if test -e $module ; then + shift + exec $module --help --verbose "$@" 2>&1 + fi + done + done +esac diff --git a/noise/modules/join b/noise/modules/join new file mode 100755 index 00000000..68afcb66 --- /dev/null +++ b/noise/modules/join @@ -0,0 +1,15 @@ +#! /bin/sh + +case "$1" in + (--help) echo set default_command to chat and join channel ;; + (*) + . /tmp/noise/$NOISE_pid/environment + nick="${chat_nick-$NOISE_pid}" + echo /send_to_channel "${1-#23}" "$nick" joined the channel >$NOISE_linefeed + echo /set default_command chat >$NOISE_linefeed + echo /set chat_channel "${1-#23}" >$NOISE_linefeed + echo " joined channel ${1-#23}" + echo /part to go back to espeak ;; + + +esac diff --git a/noise/modules/lang b/noise/modules/lang new file mode 100755 index 00000000..07b6802e --- /dev/null +++ b/noise/modules/lang @@ -0,0 +1,22 @@ +#! /bin/sh + +case "$1" in + (--help) + echo "set language or list available languages" ;; + (list) + espeak --voices | sed -n '1!p' | awk '{\ + printf"/lang %s set lang to %s\n",$2,$4 + }' ;; + ('') + echo /set lang >$NOISE_linefeed ;; + (*) + if test -z "$2" ; then + echo /set lang "$1" + else + echo /set lang "$1" + shift + echo "$*" + echo /set lang "${noise_lang-de}" + fi >$NOISE_linefeed +esac + diff --git a/noise/modules/mpc b/noise/modules/mpc new file mode 100755 index 00000000..0ab72058 --- /dev/null +++ b/noise/modules/mpc @@ -0,0 +1,14 @@ +#! /bin/sh + +case "$1" in + (--help) + case "$2" in + (--verbose) mpc --help ;; + (*) echo access mpd + esac ;; + (*) + ##echo test-module called with following arguments: "$@" + ## send command for re-evaluation: + ##echo /espeak test >$NOISE_linefeed + MPD_HOST=mpd.shack mpc $@ +esac diff --git a/noise/modules/names b/noise/modules/names new file mode 100755 index 00000000..f5922064 --- /dev/null +++ b/noise/modules/names @@ -0,0 +1,22 @@ +#! /bin/sh + +case "$1" in + (--help) echo send text to everyone with @@ prepended ;; + (*) + cd /tmp/noise + . $NOISE_pid/environment + if test "$default_command" != chat ; then exit ; fi + nick="${chat_nick-$NOISE_pid}" + channel="${1-$chat_channel}" + echo "Users in channel $channel" + for client in * ; do + . $client/environment + chat_nick="${chat_nick-$client}" + if test "$channel" = "$chat_channel" && test "$default_command" = chat ; then + echo "$chat_nick" + fi + unset chat_nick + unset chat_channel + unset default_command + done +esac diff --git a/noise/modules/nick b/noise/modules/nick new file mode 100755 index 00000000..5ed1e9d9 --- /dev/null +++ b/noise/modules/nick @@ -0,0 +1,10 @@ +#! /bin/sh + +case "$1" in + (--help) echo send text to everyone with @@ prepended ;; + (*) + . /tmp/noise/$NOISE_pid/environment + nick="${chat_nick-$NOISE_pid}" + echo /send_to_channel $chat_channel $nick is now known as $1 > $NOISE_linefeed + echo /set chat_nick $1 >$NOISE_linefeed;; +esac diff --git a/noise/modules/part b/noise/modules/part new file mode 100755 index 00000000..d35ac501 --- /dev/null +++ b/noise/modules/part @@ -0,0 +1,15 @@ +#! /bin/sh + +case "$1" in + (--help) echo leave chat mode ;; + (*) + . /tmp/noise/$NOISE_pid/environment + nick="${chat_nick-$NOISE_pid}" + + echo "/send_to_channel $chat_channel $nick has quit ${*-no reason}" > $NOISE_linefeed + + echo /set default_command espeak >$NOISE_linefeed + echo "disabled chat mode (set back to espeak)" ;; + + +esac diff --git a/noise/modules/ping b/noise/modules/ping new file mode 100755 index 00000000..acf2529f --- /dev/null +++ b/noise/modules/ping @@ -0,0 +1,24 @@ +#! /bin/sh +cd /tmp/noise +case "$1" in + (--help) : ;; + ('') + . $NOISE_pid/environment + ping_timestamp=${ping_timestamp-0} + ping_challenger=${ping_challenger-0} + if test $ping_challenger != 0 ; then + echo There is already a ping challange running + else + timestamp=`date +%s%N` + for client in * ; do + echo /ping $NOISE_pid $timestamp >$client/linefeed & + done + fi + ;; + (*) + echo "/set -q ping_timestamp $2" >$NOISE_pid/linefeed + if test $NOISE_pid != $1 ; then + echo "/set -q ping_challenger $1" >$NOISE_pid/linefeed + echo "PING?" + fi +esac diff --git a/noise/modules/play b/noise/modules/play new file mode 100755 index 00000000..749b450a --- /dev/null +++ b/noise/modules/play @@ -0,0 +1,36 @@ +#! /bin/sh +case "$1" in + (--help) + echo "play an audio file" ;; + (*) + exec 2>&1 + ffs='wav mp3 ogg asf flac' + + if test -z "$*" ; then + ls $HOME/noise/samples | sed -r ' + s:\.('"`echo "$ffs" | tr \ \|`"')$: \1: + s:^:/play : + s:.*:&: + ' + else + for i in $ffs ; do + f=$HOME/noise/samples/$1.$i + test -f "$f" && + case "$i" in + wav) aplay "$f" & ;; + *) mplayer "$f" & ;; + esac && break + done || cat<$ping_challenger/linefeed + ## reset ping TODO /unset + echo /set -q ping_timestamp 0 >$NOISE_pid/linefeed + echo /set -q ping_challenger 0 >$NOISE_pid/linefeed + fi + ;; + (*) + . $1/environment + # XXX is attendee the right counterpart to 'challenger'? + attendee_nick=$chat_nick + . $NOISE_pid/environment + time=`echo "scale=3; ($2 - $ping_timestamp)/10^9" | bc` + echo "PONG! $attendee_nick ${time}s" +esac diff --git a/noise/modules/query b/noise/modules/query new file mode 100755 index 00000000..ceeff8a5 --- /dev/null +++ b/noise/modules/query @@ -0,0 +1,23 @@ +#! /bin/sh + +case "$1" in + (--help) echo send a message to a specific user ;; + (*) + cd /tmp/noise + . $NOISE_pid/environment + nick="${chat_nick-$NOISE_pid}" + target="$1" + shift + for client in * ; do + . $client/environment + if test "$target" = "${chat_nick-$client}" ; then + echo "/echo <-- $nick: $*" > $client/linefeed + echo "--> $target: $*" + exit + fi + unset chat_channel + + done + + echo "$nick not found" +esac diff --git a/noise/modules/send_to_channel b/noise/modules/send_to_channel new file mode 100755 index 00000000..4a0470af --- /dev/null +++ b/noise/modules/send_to_channel @@ -0,0 +1,17 @@ +#! /bin/sh + +case "$1" in + (--help) : ;; + (*) + cd /tmp/noise + channel="$1" + shift + for client in * ; do + . $client/environment + if test "$channel" = "$chat_channel" && test "$default_command" = chat ; then + echo "/echo $*" > $client/linefeed + fi + unset chat_channel + + done +esac diff --git a/noise/modules/sendmail b/noise/modules/sendmail new file mode 100755 index 00000000..182d96e3 --- /dev/null +++ b/noise/modules/sendmail @@ -0,0 +1,55 @@ +#!/usr/bin/python +import os,sys,smtplib,string +''' + Mail Plugin for the noise telnet suite + See: http://docs.python.org/library/smtplib.html + Author: Felix +''' + +# help +if len(sys.argv) == 2: + if sys.argv[1] == "--help": + print "send an e-mail ( \"TO(s)\" \"SUBJECT\" [string instead of EOF])" + sys.exit(0) + +# sanity +if len(sys.argv) <= 2: + print "wrong number of parameters, see help" + sys.exit(1) + +# write variables +# check of EOF +if len(sys.argv) == 4 : + EOFstring="%s\n"% sys.argv[3] +else: + EOFstring="EOF\n" + +fromaddr=u"Karl Koch" +toaddrs=sys.argv[1] +subject=sys.argv[2] + + +#write header: +msg = u"From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" % (fromaddr, toaddrs,subject) +print "Write your text now, finish with %s" % EOFstring +sys.stdout.flush() # flushing is important to make sure the line is written + +while 1: + try: + line = sys.stdin.readline() + if line == EOFstring: + break + msg = msg + line + except EOFError: + break + +msg = msg + "[!] Written with NOISE telnet" + +print "Thank you for your message! Delivering it now..." +sys.stdout.flush() +server = smtplib.SMTP('localhost') +#server.set_debuglevel(1) +server.sendmail(fromaddr,toaddrs.split(','),msg) +server.quit() +print "mail send successfully" +sys.exit(0) diff --git a/noise/modules/shackstatus b/noise/modules/shackstatus new file mode 100755 index 00000000..a5058f0a --- /dev/null +++ b/noise/modules/shackstatus @@ -0,0 +1,104 @@ +#! /bin/bash + +main() { + case "$1" in + (--help) + echo "report status of all shack services." + ;; + (*) + test "$(dig +short localhost @10.42.0.10 )" = "127.0.0.1" && + STAT_DNS_I="läuft" || STAT_DNS_I="antwortet nicht" + test "$(dig +short shackspace.de @10.42.0.10 )" = "141.31.176.214" && + STAT_DNS_E="läuft" || STAT_DNS_E="antwortet nicht" + test "$(dig +short shackspace.de @141.31.176.214 )" = "141.31.176.214" && + STAT_DNS_X="läuft"|| STAT_DNS_X="antwortet nicht" + + STAT_LINE=$(ping -c 5 -i 0.2 -q 141.31.176.214 | + awk '/packet loss/ { print 100-$6}' ) + + cat <<-EOF >$NOISE_linefeed + /set pitch 10 + /espeak -v Hallo - Ich bin Krebs. + /espeak -v Heute ist `wochentag`, der `tag` --- `monat` -- `date +%Y` + /zeit + /espeak -v tcheck der systeme: + /espeak -v Energie versorgung -- aktiv + /espeak -v shackhost -- läuft + /espeak -v telnet -- läuft + /espeak -v interner - D N S -- interne - do-mejn -- $STAT_DNS_I + /espeak -v interner - D N S -- externe - do-mejn -- $STAT_DNS_E + /espeak -v externer - D N S - $STAT_DNS_X + /espeak -v Leitungsqualität - $STAT_LINE prozent. + /temp + /espeak -v krebs kompjuting bereit + EOF + ;; + esac 2>&1 +} + +wochentag() { + case $(date +%a) in + (Mon) echo Montag ;; + (Tue) echo Dienstag ;; + (Wed) echo Mittwoch ;; + (Thu) echo Donnerstag ;; + (Fri) echo Freitag ;; + (Sat) echo Samstag ;; + (Sun) echo Sonntag ;; + esac +} + +tag() { + case $(date +%d) in + (1) echo erste ;; + (2) echo zweite ;; + (3) echo dritte ;; + (4) echo vierte ;; + (5) echo fünfte ;; + (6) echo sechste ;; + (7) echo siebte ;; + (8) echo achte ;; + (9) echo neunte ;; + (10) echo zehnte ;; + (11) echo elfte ;; + (12) echo zwölfte ;; + (13) echo dreizehnte ;; + (14) echo vierzehnte ;; + (15) echo fünfzehnte ;; + (16) echo sechzehnte ;; + (17) echo siebzehnte ;; + (18) echo achtzehnte ;; + (19) echo neunzehnte ;; + (20) echo zwanzigste ;; + (21) echo einundzwanzigste ;; + (22) echo zweiundzwanzigste ;; + (23) echo dreiundzwanzigste ;; + (24) echo vierundzwanzigste ;; + (25) echo füfundzwanzigste ;; + (26) echo sechsundzwanzigste ;; + (27) echo siebenundzwanzigste ;; + (28) echo achtundzwanzigste ;; + (29) echo neunundzwanzigste ;; + (30) echo dreissigste ;; + (31) echo einunddreissigste ;; + esac +} + +monat() { + case $(date +%b) in + (Jan) echo Januar ;; + (Feb) echo Februar ;; + (Mar) echo März ;; + (Apr) echo April ;; + (May) echo Mai ;; + (Jun) echo Juni ;; + (Jul) echo Juli ;; + (Aug) echo August ;; + (Sep) echo September ;; + (Oct) echo Oktober ;; + (Nov) echo November ;; + (Dec) echo Dezember ;; + esac +} + +main "$@" diff --git a/noise/modules/sleep b/noise/modules/sleep new file mode 100755 index 00000000..89712cac --- /dev/null +++ b/noise/modules/sleep @@ -0,0 +1,10 @@ +#! /bin/sh +case "$1" in + (--help) echo "pause for NUMBER seconds" ;; + (*) + if echo "$1" | grep -Eq '^([0-9]+(\.[0-9]*)?|[0-9]*\.[0-9]+)$' ; then + sleep "$1" + else + echo 'FAIL: $1 is not a number' + fi +esac diff --git a/noise/modules/stream b/noise/modules/stream new file mode 100755 index 00000000..1e6fd0c5 --- /dev/null +++ b/noise/modules/stream @@ -0,0 +1,64 @@ +#! /bin/sh +inputdir=$HOME/noise/streams +basename="`basename "$0"`" +case "$1" in + (--help) + if echo "$0 $*" | grep -q '[[:space:]]--verbose\>'; then + echo -e "\x1B[35mtype \x1B[32m/$basename off \x1B[35mto turn stream off\x1B[m" + for i in `ls $inputdir` ; do + filename="$inputdir/$i" + shortcut=`xmlstarlet sel -t -v /station/@shortcut "$inputdir/$i"` + title=`xmlstarlet sel -t -v /station/@title "$inputdir/$i"` + topic=`xmlstarlet sel -t -v /station/@topic "$inputdir/$i"` + stream=`xmlstarlet sel -t -v /station/@stream "$inputdir/$i"` + echo -e "\x1B[35mtype \x1B[32m/$basename $shortcut \x1B[35mfor $topic\x1B[m" + done + else + echo "play an audio stream" + fi + ;; + (*) + exec 2>&1 + ffs='xml' + + if test -z "$*" ; then + echo -e "\x1B[32m/stream off \x1B[33m- turn stream off\x1B[m" + for i in `ls $inputdir` ; do + filename="$inputdir/$i" + shortcut=`xmlstarlet sel -t -v /station/@shortcut "$inputdir/$i"` + title=`xmlstarlet sel -t -v /station/@title "$inputdir/$i"` + topic=`xmlstarlet sel -t -v /station/@topic "$inputdir/$i"` + stream=`xmlstarlet sel -t -v /station/@stream "$inputdir/$i"` + echo -e "\x1B[32m/stream $shortcut \x1B[33m- $title \x1B[35m$topic\x1B[m" + done + else if [ "$1" = "off" ]; then + [ ! -d /tmp/noise ] || ( echo "no directory /tmp/noise; aborting" ; exit 1 ) + [ -f /tmp/noise/stream.pid ] && ( kill ` cat /tmp/noise/stream.pid ` ) + [ -e /tmp/noise/stream.pid ] && rm /tmp/noise/stream.pid || ( echo "can't remove /tmp/noise/stream.pid; aborting" ; exit 1 ) + else + for i in `ls $inputdir` ; do + filename="$inputdir/$i" + shortcut=`xmlstarlet sel -t -v /station/@shortcut "$inputdir/$i"` + stream=`xmlstarlet sel -t -v /station/@stream "$inputdir/$i"` + if [ "$shortcut" == "$1" ]; then + [ ! -d /tmp/noise ] || ( umask 077 ; mkdir /tmp/noise ) || ( echo "can't create /tmp/noise; aborting" ; exit 1 ) + [ -f /tmp/noise/stream.pid ] && ( kill ` cat /tmp/noise/stream.pid ` ) + [ -e /tmp/noise/stream.pid ] && rm /tmp/noise/stream.pid || ( echo "can't remove /tmp/noise/stream.pid; aborting" ; exit 1 ) + mplayer -cache 2048 -quiet "$stream" & + ( umask 077 ; echo $! > /tmp/noise/stream.pid ) + break + fi + done || cat<] +## Echo temperature in K. If formula is given then return that result instead. +inside_temp() { + echo "scale=2; x=`/krebs/temper/temper` + 273.15; ${1-x}" | bc +} + +outside_temp() { + echo "scale=2; x=`dig +short txt outside.elwood.temp.citecs.de | + sed 's/^"DEG \([0-9]\+\.[0-9]\+\)"$/\1/' + ` + 273.15; ${1-x}" | bc +} + +espeak_inside() { + echo Die Krebs-tempera-tur beträgt $@ | to_espeak +} + +espeak_outside() { + echo Die Außen-tempera-tur beträgt $@ | to_espeak +} + +to_espeak() { + sed ' + s/\(\.[0-9]\)0\+/\1/g + s/\(\.[0-9]\)\([0-9]\)[0-9]*/ \1 \2 /; + s/^-/minus /; + s/\./ komma /; + ' | tee $NOISE_linefeed +} + +main "$@" diff --git a/noise/modules/test b/noise/modules/test new file mode 100755 index 00000000..2c0b8e0d --- /dev/null +++ b/noise/modules/test @@ -0,0 +1,13 @@ +#! /bin/sh + +case "$1" in + (--help) echo do some test-module related stuff ;; + (*) + + echo -n ">> " + read TEST + if [ $TEST == 'q' ]; then exit; fi + echo /wall @@ $TEST >$NOISE_linefeed + #sleep 1 + #sleep 1; echo /test >$NOISE_linefeed & +esac diff --git a/noise/modules/twitter b/noise/modules/twitter new file mode 100755 index 00000000..26982525 --- /dev/null +++ b/noise/modules/twitter @@ -0,0 +1,125 @@ +#!/usr/bin/python +#encode=utf8 + +#print "TODO Bug Robert to implement Twitter-OAuth!" +#exit(1) +import sys + +#sys.path.append("/usr/local/lib/") + +import twitter, os, pwd + +#os.getlogin = lambda: pwd.getpwuid(os.getuid())[0] + +sys.stderr = sys.stdout + +def shorten(text): + + text = text.replace("about ", "~") + text = text.replace("an", "1") + text = text.replace(" minutes", "m") + text = text.replace(" minute", "m") + text = text.replace(" hours", "h") + text = text.replace(" hour", "h") + text = text.replace(" seconds", "s") + text = text.replace(" second", "s") + text = text.replace(" days", "d") + text = text.replace(" day", "d") + text = text.replace(" weeks", "w") + text = text.replace(" week", "w") + text = text.replace(" years", "y") + text = text.replace(" year", "y") + text = text.replace(" ago", "") + text = text.replace("a", "1") + return text + + +def parse(text): + text = text.replace("\n","") + t = text.split(" ") + new = "" + for piece in t: + escape = "" + if piece.startswith("@"): + escape = "" + if piece[1:].lower() == "shackspam" or piece[1:].lower() == "shackspace": + escape = "" + + elif piece.startswith("#"): + escape = "" + elif piece.startswith("http://"): + escape = "" + if escape: + new += escape + piece + " " + else: + new += piece + " " + + return new + +if len(sys.argv) > 1 and sys.argv[1] == "--help": + print "read or post to the shackspam twitter timeline" + if len(sys.argv) == 3 and sys.argv[2] == "--verbose": + print "call without parameters to read" + print "use /twitter [your tweet] to tweet something to the shackspam twitter timeline" + exit() + + + +api = twitter.Api("Z7f9npE5ixvZ0lMCHDZBOg", "8z0gyfOABar1HxKvqL6fYXLqRFUPLQ9OOzDFt7Q4F4", "139766258-94TGPvNsJ8tYVv68eZewfXOIyDvRCWdycNlUgHrs", "NRnDQZPCoLrDizFvakZkSWgoG4vgGuT3OOMChSfiI") + +#api.SetXTwitterHeaders("Shackspace UTTERANCE","","0.00.0.01.42") + +if len(sys.argv) > 1: + + + tweet = u"" + + for t in sys.argv[1:]: + tweet += t.decode("utf8") + u" " + tweet = tweet[:-1] + + print u"Length: " + str(len(tweet)) + u"" + + if len(tweet) > 140: + print u"Your Tweet must be shorter than 140 characters.\n" + exit() + + status = api.PostUpdate(tweet) + + + + +else: + """print "\tshackspace tweets:" + for i in api.GetUserTimeline(): + i.text = parse(i.text) + print ("" + i.user.screen_name + " " + i.GetRelativeCreatedAt() + " " + i.text).encode("utf8").replace("\n"," ") + + print "\n\tfriends tweets" + """ + a = api.GetFriendsTimeline() + a.reverse() + for i in a: + text = i.text + ilen = len(i.user.screen_name) + len(shorten(i.GetRelativeCreatedAt())) + 2 + if i.user.screen_name.lower() == "shackspace" or i.user.screen_name.lower() == "shackspam": + info = "" + i.user.screen_name + " " + shorten(i.GetRelativeCreatedAt()) + "" + else: + info = "" + i.user.screen_name + " " + shorten(i.GetRelativeCreatedAt()) + "" + text = info + " " + parse(text) + + t = text.split(" ") + tmp = "" + for n in t: + if ((len(tmp) + len(n)) >= 80): + print parse(tmp).encode("utf8") + tmp = " " * ilen + + tmp += " " + n + if len(tmp) > ilen: + print parse(tmp).encode("utf8") + + + + + diff --git a/noise/modules/vvs b/noise/modules/vvs new file mode 100755 index 00000000..fc23375f --- /dev/null +++ b/noise/modules/vvs @@ -0,0 +1,17 @@ +#! /bin/sh + +wrapper() { + exec 2>&1 + echo date: `date +%H:%M` + "$@" +} + +case "$1" in + (--help) echo query VVS ;; + (*) + case $# in + (2) wrapper vvs.de "$@" ;; + (0) wrapper vvs ;; + (*) echo "Syntax: /vvs [ORIGIN DESTINATION]" ; return ;; + esac +esac diff --git a/noise/modules/wall b/noise/modules/wall new file mode 100755 index 00000000..c73744ea --- /dev/null +++ b/noise/modules/wall @@ -0,0 +1,8 @@ +#! /bin/sh +case "$1" in + (--help) : ;; + (?*) + for linefeed in /tmp/noise/*/linefeed ; do + echo /echo "$*" >$linefeed + done +esac diff --git a/noise/modules/zeit b/noise/modules/zeit new file mode 100755 index 00000000..9fbc33e4 --- /dev/null +++ b/noise/modules/zeit @@ -0,0 +1,19 @@ +#! /bin/sh + +case "$1" in + (--help) + echo "say current time" ;; + (*) + exec >>$NOISE_linefeed + k=`date +%k|sed 's/^[[:space:]]*1[[:space:]]*$/ein/'` + M=`date +%M|sed 's/0*//'` + echo /set pitch 10 + case "$lang" in + (de|'') echo "/espeak Es ist $k Uhr $M" ;; + (en|*-en) + test -z "$M" || M="and $M minutes" + echo "/espeak It is $k o clock $M" ;; + (*) echo "Error: unsupported lang = $lang" >&2 + esac + echo /set pitch ${noise_pitch-100} +esac 2>&1 diff --git a/noise/noise b/noise/noise new file mode 100755 index 00000000..bd6b17c8 --- /dev/null +++ b/noise/noise @@ -0,0 +1,182 @@ +#! /bin/sh + +noise_set() { # set a variable + case "$1" in + (-q|--quiet) echo=: ; shift ;; + (*) echo=echo ;; + esac + case $# in + (0) ## print all noise variables + env | sed -rn ' + s/^noise_([[:alnum:]_]+)=(.*)$/\1 = \2/p + ' | sort + ;; + (1) ## print value the specified variable + eval "echo \"$1 = \$noise_$1\"" + ;; + (*) ## set the specified variable + if echo "$1" | grep -q '[^[:alnum:]_]' ; then + fail invalid variable name "$1" + return 23 + fi + eval "old=\"\$noise_$1\"" + if test "x$old" = "x$2" ; then + eval "$echo \"$1 is already $2\"" + elif test -z "$old" ; then + eval "export noise_$1='$2' ; $echo \ +\"$1 set to $2\"" + else + eval "export noise_$1='$2' ; $echo \ +\"$1 changed from $old to $2\"" + fi + ## write variable to $env + if grep -q "^$1=" "$env" ; then + sed -ri "s'^($1)=(.*)\$'\1=\'$2\''" $env + else + echo "$1='$2'" >>$env + fi + ;; + esac +} + +noise_unset() { # unset a variable + case "$1" in + (-q|--quiet) echo=: ; shift ;; + (*) echo=echo ;; + esac + case $# in + (1) ## + unset "noise_$1" + sed -ni "/^$1=/!p" $env + ;; + (*) + fail "broken commandline: $@" + ;; + esac +} + +noise_quit() { # exit + echo "Good bye!" + exit +} + +fail() { + echo "FAIL: $*" + return 23 +} + +cleanup() { + kill $jobs + rm -f $linefeed $env + rmdir /tmp/noise/$$ 2>/dev/null + rmdir /tmp/noise 2>/dev/null +} + +exec 2>&1 +qname="`readlink -f "$0"`" +dirname="`dirname "$qname"`" +export HOME='/home/noise' +if test -d "$dirname/modules" ; then + export NOISE_PATH="${NOISE_PATH+$NOISE_PATH:}$dirname/modules" + export NOISE_PATH="${NOISE_PATH+$NOISE_PATH:}$HOME/noise/modules" +fi +mkdir -p /tmp/noise/$$ +linefeed="/tmp/noise/$$/linefeed" +env="/tmp/noise/$$/environment" +trap cleanup EXIT +mkfifo $linefeed +touch $env +## +## +## +readline() { + { read REPLY && echo "$REPLY" ; } | sed -rn " + s/[']//g + s/~%/\n/g + s/([^\\])([#<>])/\1\\\\\2/g + s:^/([a-z_]+)([[:space:]]+(.*))?$:command=\1; args='\3';:p;t + s@^([[:alnum:]_/+-]+):[[:space:]]*(.*)@command=lang; args='\1 \2';@p;t + s@^\![[:space:]]*(.*)@command=play; args='\1';@p;t + s:.*:command='$noise_default_command'; args='&';:p;t + " +} +## +## +## +while echo -n "$noise_prompt" && eval "`readline`" ; do + ## modcall + for dir in `echo "$NOISE_PATH" | tr : \ ` ; do + module="$dir/$command" + if test -x "$module" ; then +#echo foo $module:$@: + #shift + eval 'NOISE="$0" NOISE_pid="$$" NOISE_linefeed="$linefeed" "$module"' "$args" + continue 2 + fi + done + ## funcall + if type noise_$command | grep -q function ; then + eval 'noise_$command' "$args" + continue + fi + ## + fail unknown command "$command" +done <$linefeed & +jobs="${jobs+$jobs }`jobs -p`" +## +## +## +cat</dev/null +`... + +## Motto Of The Day\ + +Join the 23.shack-dev-team, we've got ` + sloccount $dirname/* | + sed -rn ' + s/.*\(SLOC\)[[:space:]]*=[[:space:]]*([0-9]+)$/\1/p + '` SLOC, ` + { + ls $dirname/modules/ + test -d ~noise/modules && ls ~noise/modules/ + } | sort | uniq | wc -l + ` mods, +`grep ^- $dirname/TODO | wc -l`+ TODOs and drive the irregular Hackathon @shackspace. +Follow http://twitter.com/shackspam FTW! + +## Hints\ + +Start your telnet session with rlwrap for MAXIMUM profit. +Get online-help with /help. + +EOF +# TODO: MOTD-candidates: +#twitter: #shackspam +#mail: shockspasm@googlemail.com +#irc: freenode/#shackspace +#afk: @shackspace +## +## +## +exec >>$linefeed +## +## +## +echo '/set -q default_command espeak' +echo '/set -q prompt "READY.~%"' +## +## +## +while read REPLY; do + case $REPLY in + (/quit) echo /quit ; exit ;; + (*) tr \; \\n | grep . ;; + esac< print all discovered hosts + +SNMPWALK Command +=============== + +snmpwalk -c shammunity 10.42.0.1 1.3.6.1.2.1.3.1.1.2 diff --git a/people/TODO.md b/people/TODO.md new file mode 100644 index 00000000..daacfd58 --- /dev/null +++ b/people/TODO.md @@ -0,0 +1,3 @@ +BUGS +===== + diff --git a/people/VERSION b/people/VERSION new file mode 100644 index 00000000..6c50e659 --- /dev/null +++ b/people/VERSION @@ -0,0 +1 @@ ++++++++[>+++++++>+++++++<<-]>.>---.<-. diff --git a/people/arping.py b/people/arping.py new file mode 100755 index 00000000..1b51ab1b --- /dev/null +++ b/people/arping.py @@ -0,0 +1,37 @@ +#!/usr/bin/python + +import logging +log = logging.getLogger('arpingy') +logging.disable(logging.WARNING) + +import os,sys +try: + if (os.geteuid() != 0): + raise Exception('no root permissions') + from scapy.all import * #might throws "no such module" + + def arpingy(iprange="10.42.1.0/24",iface='eth0'): + log.debug("pinging "+ str(iprange)) + """Arping function takes IP Address or Network, returns nested mac/ip list""" + try: + conf.verb=0 + ans,unans=arping(iprange,iface=iface,timeout=1,retry=3) + + collection = [] + for snd, rcv in ans: + result = rcv.sprintf(r"%ARP.psrc% %Ether.src%").split() + log.debug(result) + return result # take just the first arp reply + except Exception as e: + print ("something went wrong while arpinging " + str(e)) + return [] + +except Exception as e: + log.error("Cannot load arping functions!" + str(e)) + def arpingy(iprange='',iface=''): + raise Exception ('arping not available') + + +if __name__ =='__main__': + logging.basicConfig(level=logging.DEBUG) + arpingy(sys.argv[1],sys.argv[2]) diff --git a/people/arping_users.py b/people/arping_users.py new file mode 100755 index 00000000..c576e4f3 --- /dev/null +++ b/people/arping_users.py @@ -0,0 +1,54 @@ +#!/usr/bin/python +import subprocess,re,logging,sys + +from arping import arpingy +from multiprocessing import Pool +DEV='eth0' +MAC_NAMES='mac_names.lst' +data = [] +ret = {} +verb = False + +if len(sys.argv) > 1 and sys.argv[1] == 'v': + verb = True +def get_own_addr(): + data = subprocess.Popen(['/sbin/ifconfig',DEV], + stdout=subprocess.PIPE).communicate()[0].replace('\n','') + return re.sub(r'.*HWaddr ([0-9A-Fa-f:]*).*inet addr:([0-9.]*).*' , + r'\1 \2',data).split() + +def load_names(MAC_NAMES): + names = {} + f = open(MAC_NAMES) + for l in f: + mac,name = l.split() + names[mac] = name.replace('\n','') + f.close() + return names + +def arping_helper(dic): + return arpingy(**dic) + +for first in range(4): + for second in range(255): + data.append({'iprange':'10.42.'+str(first)+'.'+str(second),'iface':DEV}) + +names = load_names(MAC_NAMES) +try: + p = Pool(20) + ret = filter(lambda x:x , p.map(arping_helper, data)) + myip,mymac = get_own_addr() + ret.append([mymac,myip]) + p.terminate() +except Exception as e: + print 'you fail '+str(e) + + + +for p in ret: + if verb: + print p[0] + " => " + p[1] + if p[1] in names: + print names[p[1]]+ " is online" + + diff --git a/people/mac_names.lst b/people/mac_names.lst new file mode 100644 index 00000000..dcd3c2b0 --- /dev/null +++ b/people/mac_names.lst @@ -0,0 +1 @@ +00:40:63:c8:b5:a0 krebs diff --git a/retiolum/Makefile b/retiolum/Makefile new file mode 100644 index 00000000..0d99ee70 --- /dev/null +++ b/retiolum/Makefile @@ -0,0 +1,15 @@ +.phony: update it all so install + +all: select-target + +it: so +so: it + +/etc/tinc/retiolum/hosts: + cd $(dir $@) && git clone https://github.com/krebscode/hosts + +update: /etc/tinc/retiolum/hosts + cd $< && git pull + +install: + scripts/tinc_setup/install.sh diff --git a/retiolum/README b/retiolum/README new file mode 100644 index 00000000..9b9725f2 --- /dev/null +++ b/retiolum/README @@ -0,0 +1,29 @@ +Retiolum Darknet Module for Krebs +======================== + +Enter the darknet with the help of tinc retiolum + +Getting Started +------------- +to get you started, check out scripts/tinc_setup/README + +1. the first step you will need to do is grab a binary copy of tinc via your +packet manager, build it yourself or place all your hope into the build +script of your distribution. +2. after doing that you might want to run the scripts/tinc_setup/install.sh +script to write all the configuration files and private/public keys. +This installation is somewhat interactive so be sure not to fuck shit up. + +Other cool stuff +--------------- +in bin/ there are some cool scripts which are partly needed and partly +totally unnecessary to work with retiolum. + +As all the scripts are not too horribly long, be sure to use +`cat bin/SCRIPTNAME` to get an understanding of what they do + +besides that in scripts/ there are 3 more scripts which perform pretty +sophisticated tasks like finding instances via multicast or writing graphs +of the current retiolum network. Try them if you dare :) + + diff --git a/retiolum/bin/fillxx b/retiolum/bin/fillxx new file mode 100755 index 00000000..5e558362 --- /dev/null +++ b/retiolum/bin/fillxx @@ -0,0 +1,6 @@ +#! /bin/sh +while echo $1 | grep -q xx; do + xx=`od -An -tx1 -N 1 /dev/urandom | tr -d \ ` + set -- `echo $1 | sed s/xx/$xx/` +done +echo $1 diff --git a/retiolum/bin/hosts b/retiolum/bin/hosts new file mode 100755 index 00000000..6939f52c --- /dev/null +++ b/retiolum/bin/hosts @@ -0,0 +1,11 @@ +#! /bin/sh +set -euf + +netname=${1-retiolum} + +cd /etc/tinc/$netname/hosts + +for i in `ls`; do + sed -rn 's|^ *Subnet *= *([^ /]*)(/[0-9]*)? *$|\1\t'$i' '$i'.'$netname'|p' $i +done | sort + diff --git a/retiolum/bin/ipv6 b/retiolum/bin/ipv6 new file mode 100755 index 00000000..65a1eaa1 --- /dev/null +++ b/retiolum/bin/ipv6 @@ -0,0 +1,35 @@ +#! /bin/sh +# +# Manage IPv6 of the retiolum interface. +# +# usage: ipv6 {start,stop} +# +set -euf + +if test `id -u` != 0; then + echo "we're going sudo..." >&2 + exec sudo "$0" "$@" + exit 23 # go to hell +fi + +file=/etc/tinc/retiolum/hosts/`hostname` +addr=`sed -rn 's|^Subnet *= *(42:[0-9A-Fa-f:]*/128)|\1|p' $file` +route=42::/16 + +start() { + stop + ip -6 addr add $addr dev retiolum + ip -6 route add $route dev retiolum +} + +stop() { + ip -6 addr del $addr dev retiolum 2>/dev/null || : + ip -6 route del $route dev retiolum 2>/dev/null || : +} + +## dispatch +case "$1" in + (start) start;; + (stop) stop;; + (*) echo "You're made of stupid" 2>/dev/null; exit 23;; +esac diff --git a/retiolum/bin/tinc b/retiolum/bin/tinc new file mode 100755 index 00000000..ffa1dbee --- /dev/null +++ b/retiolum/bin/tinc @@ -0,0 +1,18 @@ +#! /bin/sh +# +set -euf + +init() { + f=/tmp/retiolum.GraphDumpFile + if ! test -f $f; then + touch $f && + chown -v tincd: $f + fi + + modprobe -v tun +} + +if init; then + exec tincd --user=tincd --net=retiolum "$@" +fi + diff --git a/retiolum/bin/update_tinc_hosts b/retiolum/bin/update_tinc_hosts new file mode 100755 index 00000000..2d5cf957 --- /dev/null +++ b/retiolum/bin/update_tinc_hosts @@ -0,0 +1,33 @@ +#! /bin/sh +set -euf + +if test "${nosudo-false}" != true -a `id -u` != 0; then + echo "we're going sudo..." >&2 + exec sudo "$0" "$@" + exit 23 # go to hell +fi + +DIRNAME=`dirname $0` +export PATH="`readlink -f $DIRNAME`:$PATH" + +hosts="${hosts-/etc/hosts}" + +bs='# BEGIN OF RETIOLUM' +es='# END OF RETIOLUM' + +case "${1-imstupid}" in + (start|restart) + if grep -q "^$bs$" $hosts && grep -q "^$es$" $hosts; then + $0 stop + echo "$bs" >> $hosts + hosts >> $hosts + echo "$es" >> $hosts + fi + ;; + (stop) + sed -ie "/^$bs$/,/^$es$/d" $hosts + ;; + (*) + echo 'Error 1: You are made of stupid!' >&2 + exit 23 +esac diff --git a/retiolum/doc/install_dotcloud b/retiolum/doc/install_dotcloud new file mode 100644 index 00000000..ea976c55 --- /dev/null +++ b/retiolum/doc/install_dotcloud @@ -0,0 +1,85 @@ +The Dotcloud provided by duostack.com is a application development platform +for simple deployment of your stuff. + +It also provides an ssh-interface via: + + dotcloud ssh project.module + + +to be able to use it without the hassle of going through the api, you will +need to create an own dsa-key for ssh to use and deploy this public key on +the machine + + ssh-keygen -t dsa -f dotcloud_project.dss + cat dotcloud_project.dss.pub (copy the contents to the dotclouds + ~/.ssh/authorized_keys2) + +find your dotcloud host ip via + + dotcloud info project.module + + +You will gain a user shell with + + ssh dotcloud@module.project -p 5960 + +we will need to build some stuff in order to get a working copy of tinc. +Everything needs to be done in userspace. + + mkdir build + cd build + curl http://www.openssl.org/source/openssl-1.0.0d.tar.gz | tar xz + cd openssl-1.0.0d + ./config --prefix=$HOME/usr -fPIC + make install + cp lib* $HOME/usr/lib + cd .. + + curl http://www.oberhumer.com/opensource/lzo/download/lzo-2.04.tar.gz | tar xz + cd lzo-2.04 + ./configure --prefix=$HOME/usr + + curl http://zlib.net/zlib-1.2.5.tar.gz | tar xz + cd zlib-1.2.5/ + ./configure --prefix=$HOME/usr + make install + +before building we need to patch the tinc daemon to run without the need +for a tun device. + +tutorial is here: +https://hackerspace.be/TincVPN + + + curl http://www.tinc-vpn.org/packages/tinc-1.0.14.tar.gz | tar xz + cd tinc-1.0.14 + #replace the device.c with the patched (empty) one from the webpage + ./configure --prefix=$HOME/usr --sysconfdir=$HOME/etc \ + --localstatedir=$HOME/var --with-openssl=`pwd`/../openssl-1.0.0d/ \ + --with-openssl-lib=`pwd`/../openssl-1.0.0d/ \ + --with-zlib-include=$HOME/usr/include --with-zlib-lib=$HOME/usr/lib + make + make install + mkdir ~/etc + mkdir -p ~/var/run + cd ~/painload/retiolum/scripts/tinc_setup + ./install cloudkrebs 10.7.7.221 + + +be sure to fix the portnumber in the generated host file and add your own +address in hosts/cloudkrebs: + + Address = my.public.address + Port = 1655 + + PUBKEY + + +also write the right in tinc.conf: + + Name = cloudkrebs + + Mode = switch + #device = ... + # no device :) + diff --git a/retiolum/doc/install_no.de b/retiolum/doc/install_no.de new file mode 100644 index 00000000..a8b72a78 --- /dev/null +++ b/retiolum/doc/install_no.de @@ -0,0 +1,4 @@ +ok, i tried to just do the same step i did in the other cloud service, but +it failed when trying to include tunnel headers.this is what to do: + +# add PATH_MAX to conf.c diff --git a/retiolum/scripts/README b/retiolum/scripts/README new file mode 100644 index 00000000..4dbb42af --- /dev/null +++ b/retiolum/scripts/README @@ -0,0 +1,16 @@ +This Folder contains all the cool scripts created for tinc_retiolum + +currently the following functions are deployed: + +adv_graphgen/ - makefu + this folder contains a script suite which parses the interesting + parameters from the syslog file by sending SIGUSR2 to the tinc process + +tinc_multicast/ - Miefda,Lassulus + A tinc multicast script suite which provides automagic-discovery in a + local network by utilizing multicast + +tinc_setup/ - makefu (i am so sorry...) + A number of scripts which build and configure tinc on a local machine. + Core is the install.sh script which actually writes the configuration + and creates users as well as private/public keys diff --git a/retiolum/scripts/adv_graphgen/README b/retiolum/scripts/adv_graphgen/README new file mode 100644 index 00000000..082e0f2b --- /dev/null +++ b/retiolum/scripts/adv_graphgen/README @@ -0,0 +1,28 @@ +The folder contains a number of scripts which provide a convenient way to +generate advanced graphs from the SIGUSR2 output of tinc. + +it currently contains the following files: + +sanitize.sh: + wrapper arond parse.py which filters the syslog file for all tinc + related lines and removes the status informations: + this means that + + May 19 20:40:44 servarch dnsmasq[5382]: reading /etc/resolv.conf + May 19 20:41:38 servarch tinc.retiolum[4780]: Error looking up pa-sharepoint.informatik.ba-stuttgart.de port 655: Name or service not known + + becomes + + Error looking up pa-sharepoint.informatik.ba-stuttgart.de port 655: Name or service not known + + and so on. + It also provides a wrapper around graphviz which automagically + generates graphs from the produced graph file + +parse.py: + reads from stdin the sanitized syslog file and prints a valid dot file + from the given output. + The parser module may also produce any other output (e.g. for dns + entries and so on) you will need to actually read and modify the source + in order to be able to do this. ~May the source be with you~ + diff --git a/retiolum/scripts/adv_graphgen/parse.py b/retiolum/scripts/adv_graphgen/parse.py new file mode 100755 index 00000000..639c5316 --- /dev/null +++ b/retiolum/scripts/adv_graphgen/parse.py @@ -0,0 +1,101 @@ +#!/usr/bin/python2 +# -*- coding: utf8 -*- + +import sys +""" TODO: Refactoring needed to pull the edges out of the node structures again, +it should be easier to handle both structures""" + +def write_digraph(nodes): + """ + writes the complete digraph in dot format + """ + print ('digraph retiolum {') + print (' node[shape=box,style=filled,fillcolor=grey]') + generate_stats(nodes) + nodes = delete_unused_nodes(nodes) + merge_edges(nodes) + for k,v in nodes.iteritems(): + write_node(k,v) + print ('}') +def generate_stats(nodes): + """ Generates some statistics of the network and nodes + """ + for k,v in nodes.iteritems(): + v['num_conns'] = len(v.get('to',[])) +def delete_unused_nodes(nodes): + new_nodes = {} + for k,v in nodes.iteritems(): + if v.get('to',[]): + new_nodes[k] = v + return new_nodes +def merge_edges(nodes): + """ merge back and forth edges into one + DESTRUCTS the current structure by deleting "connections" in the nodes + + """ + for k,v in nodes.iteritems(): + for con in v.get('to',[]): + for i,secon in enumerate(nodes[con['name']].get('to',[])): + if k == secon['name']: + del (nodes[con['name']]['to'][i]) + con['bidirectional'] = True + + +def write_node(k,v): + """ writes a single node and its edges + edges are weightet with the informations inside the nodes provided by + tinc + """ + node = " "+k+"[label=\"" + node += k+"\\l" + node += "external:"+v['external-ip']+":"+v['external-port']+"\\l" + if v.has_key('num_conns'): + node += "Num Connects:"+str(v['num_conns'])+"\\l" + for addr in v.get('internal-ip',['¯\\\\(°_o)/¯']): + node += "internal:"+addr+"\\l" + node +="\"" + if v['external-ip'] == "MYSELF": + node += ",fillcolor=steelblue1" + node += "]" + print node + + for con in v.get('to',[]): + edge = " "+k+ " -> " +con['name'] + "[weight="+str(float(con['weight'])) + if con.get('bidirectional',False): + edge += ",dir=both" + edge += "]" + print edge + +def parse_input(): + nodes={} + for line in sys.stdin: + line = line.replace('\n','') + if line == 'Nodes:': + nodes={} + for line in sys.stdin: + if line == 'End of nodes.\n': + break + l = line.replace('\n','').split() #TODO unhack me + nodes[l[0]]= { 'external-ip': l[2], 'external-port' : l[4] } + if line == 'Subnet list:': + for line in sys.stdin: + if line == 'End of subnet list.\n': + break + l = line.replace('\n','').split() + if not nodes[l[2]].get('internal-ip',False): + nodes[l[2]]['internal-ip'] = [] + nodes[l[2]]['internal-ip'].append(l[0].split('#')[0]) + if line == 'Edges:': + edges = {} + for line in sys.stdin: + if line == 'End of edges.\n': + break + l = line.replace('\n','').split() + + if not nodes[l[0]].has_key('to') : + nodes[l[0]]['to'] = [] + nodes[l[0]]['to'].append( + {'name':l[2],'addr':l[4],'port':l[6],'weight' : l[10] }) + return nodes +nodes = parse_input() +write_digraph(nodes) diff --git a/retiolum/scripts/adv_graphgen/sanitize.sh b/retiolum/scripts/adv_graphgen/sanitize.sh new file mode 100755 index 00000000..0e12d207 --- /dev/null +++ b/retiolum/scripts/adv_graphgen/sanitize.sh @@ -0,0 +1,13 @@ +GRAPH_SETTER1=dot +GRAPH_SETTER2=circo +LOG_FILE=/var/log/everything.log +OPENER=/bin/true + +sudo pkill -USR2 tincd +sudo sed -n '/tinc.retiolum/{s/.*tinc.retiolum\[[0-9]*\]: //gp}' $LOG_FILE |\ + ./parse.py > retiolum.dot + +$GRAPH_SETTER1 -Tpng -o $1retiolum_1.png retiolum.dot +$GRAPH_SETTER2 -Tpng -o $1retiolum_2.png retiolum.dot +$OPENER retiolum_1.png &>/dev/null +#rm retiolum.dot diff --git a/retiolum/scripts/autostart/Makefile b/retiolum/scripts/autostart/Makefile new file mode 100644 index 00000000..aba6bd33 --- /dev/null +++ b/retiolum/scripts/autostart/Makefile @@ -0,0 +1,14 @@ +INIT_FOLDER=/etc/init.d +.phony: all +debian: + #TODO change the tinc file before writing + cp tinc /etc/init.d/tinc + chmod +x /etc/init.d + echo "retiolum" > /etc/tinc/nets.boot + update-rc.d tinc defaults +arch: + @cp tinc /etc/rc.d + @chmod +x /etc/rc.d/tinc + @echo "add tinc to DAEMONS in /etc/rc.conf" + + diff --git a/retiolum/scripts/autostart/tinc b/retiolum/scripts/autostart/tinc new file mode 100755 index 00000000..12e77d6a --- /dev/null +++ b/retiolum/scripts/autostart/tinc @@ -0,0 +1,94 @@ +#! /bin/sh +# +### BEGIN INIT INFO +# Provides: tinc +# Required-Start: $remote_fs $network +# Required-Stop: $remote_fs $network +# Should-Start: $syslog $named +# Should-Stop: $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start tinc daemons +# Description: Create a file $NETSFILE (/etc/tinc/nets.boot), +# and put all the names of the networks in there. +# These names must be valid directory names under +# $TCONF (/etc/tinc). Lines starting with a # will be +# ignored in this file. +### END INIT INFO +# +# Based on Lubomir Bulej's Redhat init script. + +DAEMON="/usr/sbin/tincd" +NAME="tinc" +DESC="tinc daemons" +TCONF="/etc/tinc" +NETSFILE="$TCONF/nets.boot" +NETS="" + +modprobe tun + +test -f $DAEMON || exit 0 + +[ -r /etc/default/tinc ] && . /etc/default/tinc + +# foreach_net "what-to-say" action [arguments...] +foreach_net() { + if [ ! -f $NETSFILE ] ; then + echo "Please create $NETSFILE." + exit 0 + fi + echo -n "$1" + shift + egrep '^[ ]*[a-zA-Z0-9_-]+' $NETSFILE | while read net args; do + echo -n " $net" + "$@" $net $args + done + echo "." +} + +start() { + $DAEMON $EXTRA -n "$@" +} +stop() { + $DAEMON -n $1 -k +} +reload() { + $DAEMON -n $1 -kHUP +} +restart() { + stop "$@" + sleep 0.5 + i=0; + while [ -f /var/run/tinc.$1.pid ] ; do + if [ $i = '10' ] ; then + break + else + echo -n "." + sleep 0.5 + i=$(($i+1)) + fi + done + start "$@" +} + +case "$1" in + start) + foreach_net "Starting $DESC:" start + ;; + stop) + foreach_net "Stopping $DESC:" stop + ;; + reload|force-reload) + foreach_net "Reloading $DESC configuration:" reload + ;; + restart) + foreach_net "Restarting $DESC:" restart + ;; + *) + echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 + diff --git a/retiolum/scripts/tinc_multicast/retiolum b/retiolum/scripts/tinc_multicast/retiolum new file mode 100755 index 00000000..1d6b775f --- /dev/null +++ b/retiolum/scripts/tinc_multicast/retiolum @@ -0,0 +1,34 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +TINCNAME='retiolum' +case "$1" in + start) + stat_busy "Starting retiolum Daemon" + success=0 + /home/death/git/retiolum/.scripts/tinc_multicast/retiolum.py -n retiolum -T & + sleep 2 + if [ $success -eq 0 ]; then + add_daemon retiolum + stat_done + else + stat_fail + fi + ;; + stop) + stat_busy "Stopping retiolum Daemon" + kill `cat /var/lock/retiolum.retiolum` + rm_daemon retiolum + stat_done + ;; + restart) + $0 stop + sleep 4 + $0 start + ;; + *) + echo "usage $0 {start¦stop¦restart}" +esac +exit 0 diff --git a/retiolum/scripts/tinc_multicast/retiolum.py b/retiolum/scripts/tinc_multicast/retiolum.py new file mode 100755 index 00000000..8cf57471 --- /dev/null +++ b/retiolum/scripts/tinc_multicast/retiolum.py @@ -0,0 +1,349 @@ +#!/usr/bin/python2 +import sys, os, time, signal, socket, subprocess, thread, random, Queue, binascii, logging, hashlib, urllib2 #these should all be in the stdlib +from optparse import OptionParser + +def pub_encrypt(hostname_t, text): #encrypt data with public key + logging.debug("encrypt: " + text) + if hostname_t.find("`") != -1: return(-1) + try: + enc_text = subprocess.os.popen("echo '" + text + "' | openssl rsautl -pubin -inkey /etc/tinc/" + netname + "/hosts/.pubkeys/" + hostname_t + " -encrypt | base64 -w0") + return(enc_text.read()) + except: + return(-1) + +def priv_decrypt(enc_data): #decrypt data with private key + if enc_data.find("`") != -1: return(-1) + dec_text = subprocess.os.popen("echo '" + enc_data + "' | base64 -d | openssl rsautl -inkey /etc/tinc/" + netname + "/rsa_key.priv -decrypt") + return(dec_text.read()) + +def address2hostfile(hostname, address): #adds address to hostsfile or restores it if address is empty + hostfile = "/etc/tinc/" + netname + "/hosts/" + hostname + addr_file = open(hostfile, "r") + addr_cache = addr_file.readlines() + addr_file.close() + if address != "": + addr_cache.insert(0, "Address = " + address + "\n") + addr_file = open(hostfile, "w") + addr_file.writelines(addr_cache) + addr_file.close + logging.info("sending SIGHUP to tinc deamon!") + tincd_ALRM = subprocess.call(["tincd -n " + netname + " --kill=HUP" ],shell=True) + else: + recover = subprocess.os.popen("tar xzf /etc/tinc/" + netname + "/hosts/hosts.tar.gz -C /etc/tinc/" + netname + "/hosts/ " + hostname) + +def findhostinlist(hostslist, hostname, ip): #finds host + ip in list + for line in xrange(len(hostslist)): + if hostname == hostslist[line][0] and ip == hostslist[line][1]: + return line + return -1 #nothing found + +def getHostname(netname): + tconf = open("/etc/tinc/" + netname + "/tinc.conf", "r") + feld = tconf.readlines() + tconf.close() + for x in feld: + if x.startswith("Name"): + return str(x.partition("=")[2].lstrip().rstrip("\n")) + + print("hostname not found!") + return -1 #nothing found + +def get_hostfiles(url_files, url_md5sum): + try: + get_hosts_tar = urllib2.urlopen(url_files) + get_hosts_md5 = urllib2.urlopen(url_md5sum) + hosts_tar = get_hosts_tar.read() + hosts_md5 = get_hosts_md5.read() + + if str(hosts_md5) == str(hashlib.md5(hosts_tar).hexdigest() + " hosts.tar.gz\n"): + hosts = open("/etc/tinc/" + netname + "/hosts/hosts.tar.gz", "w") + hosts.write(hosts_tar) + hosts.close() + else: + logging.error("hosts.tar.gz md5sum check failed!") + except: + logging.error("hosts file download failed!") + + +####Thread functions + + +def sendthread(sendfifo, ghostmode): #send to multicast, sends keep alive packets + while True: + try: + #{socket init start + ANY = "0.0.0.0" + SENDPORT = 23542 + MCAST_ADDR = "224.168.2.9" + MCAST_PORT = 1600 + + sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) #initalize socket with udp + sock.bind((ANY,SENDPORT)) #now bound to Interface and Port + sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 255) #activate multicast + #}socket init end + + if ghostmode == 0: + + i = 9 + + while True: + i += 1 + if not sendfifo.empty(): + sock.sendto(sendfifo.get(), (MCAST_ADDR,MCAST_PORT) ) + logging.info("send: sending sendfifo") + else: + time.sleep(1) + if i == 10: + sock.sendto("#Stage1#" + netname + "#" + hostname + "#", (MCAST_ADDR,MCAST_PORT) ) + logging.debug("send: sending keep alive") + i = 0 + else: + while True: + if not sendfifo.empty(): + sock.sendto(sendfifo.get(), (MCAST_ADDR,MCAST_PORT) ) + logging.info("send: sending sendfifo") + else: + time.sleep(1) + + except: + logging.error("send: socket init failed") + time.sleep(10) + + + +def recvthread(timeoutfifo, authfifo): #recieves input from multicast, send them to timeout or auth + while True: + try: + ANY = "0.0.0.0" + MCAST_ADDR = "224.168.2.9" + MCAST_PORT = 1600 + + sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) #create a UDP socket + sock.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1) #allow multiple sockets to use the same PORT number + sock.bind((ANY,MCAST_PORT)) #Bind to the port that we know will receive multicast data + sock.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, 255) #tell the kernel that we are a multicast socket + + + status = sock.setsockopt(socket.IPPROTO_IP, + socket.IP_ADD_MEMBERSHIP, #Tell the kernel that we want to add ourselves to a multicast group + socket.inet_aton(MCAST_ADDR) + socket.inet_aton(ANY)); #The address for the multicast group is the third param + + while True: + while True: + + try: + data, addr = sock.recvfrom(1024) + ip, port = addr + break + except socket.error, e: + pass + + logging.debug("recv: got data") + dataval = data.split("#") + if dataval[0] == "": + if dataval[2] == netname: + if dataval[1] == "Stage1": + if dataval[3] != hostname: + timeoutfifo.put(["tst", dataval[3], ip]) + logging.info("recv: got Stage1: writing data to timeout") + logging.debug("recv: ;tst;" + dataval[3] + ";" + ip) + if dataval[1] == "Stage2": + if dataval[3] == hostname: + authfifo.put([dataval[1], dataval[3], ip, dataval[4]]) + logging.info("recv: got Stage2: writing data to auth") + logging.debug("recv: ;" + dataval[1] + ";" + dataval[3] + ";" + ip + ";" + dataval[4]) + if dataval[1] == "Stage3": + if dataval[3] != hostname: + authfifo.put([dataval[1], dataval[3], ip, dataval[4]]) + logging.info("recv: got Stage3: writing data to auth") + logging.debug("recv: ;" + dataval[1] + ";" + dataval[3] + ";" + ip + ";" + dataval[4]) + except: + logging.error("recv: socket init failed") + time.sleep(10) + +def timeoutthread(timeoutfifo, authfifo): #checks if the hostname is already in the list, deletes timeouted nodes +# hostslist = [] #hostname, ip, timestamp + + while True: + if not timeoutfifo.empty(): + curhost = timeoutfifo.get() + if curhost[0] == "add": + with hostslock: + hostslist.append([curhost[1], curhost[2], time.time()]) + address2hostfile(curhost[1], curhost[2]) + logging.info("adding host to hostslist") + elif curhost[0] == "tst": + with hostslock: + line = findhostinlist(hostslist, curhost[1], curhost[2]) + if line != -1: + hostslist[line][2] = time.time() + logging.debug("timeout: refreshing timestamp of " + hostslist[line][0]) + else: + authfifo.put(["Stage1", curhost[1], curhost[2]]) + logging.info("timeout: writing to auth") + + else: + i = 0 + with hostslock: + while i < len(hostslist): + if time.time() - hostslist[i][2] > 60: + address2hostfile(hostslist[i][0], "") + hostslist.remove(hostslist[i]) + logging.info("timeout: deleting dead host") + else: + i += 1 + time.sleep(2) + +def auththread(authfifo, sendfifo, timeoutfifo): #manages authentication with clients (bruteforce sensitve, should be fixed) + authlist = [] #hostname, ip, Challenge, timestamp + + + while True: + try: + if not authfifo.empty(): + logging.debug("auth: authfifo is not empty") + curauth = authfifo.get() + if curauth[0] == "Stage1": + line = findhostinlist(authlist, curauth[1], curauth[2]) + if line == -1: + challengenum = random.randint(0,65536) + encrypted_message = pub_encrypt(curauth[1], "#" + hostname + "#" + str(challengenum) + "#") + authlist.append([curauth[1], curauth[2], challengenum, time.time()]) + else: + encrypted_message = pub_encrypt(authlist[line][0], "#" + hostname + "#" + str(authlist[line][2]) + "#") + if encrypted_message == -1: + logging.info("auth: RSA Encryption Error") + else: + sendtext = "#Stage2#" + netname + "#" + curauth[1] + "#" + encrypted_message + "#" + sendfifo.put(sendtext) + logging.info("auth: got Stage1 sending now Stage2") + logging.debug("auth: " + sendtext) + + if curauth[0] == "Stage2": + dec_message = priv_decrypt(curauth[3]) + splitmes = dec_message.split("#") + if splitmes[0] == "": + encrypted_message = pub_encrypt(splitmes[1], "#" + splitmes[2] + "#") + if encrypted_message == -1: + logging.error("auth: RSA Encryption Error") + else: + sendtext = "#Stage3#" + netname + "#" + curauth[1] + "#" + encrypted_message + "#" + sendfifo.put(sendtext) + logging.info("auth: got Stage2 sending now Stage3") + logging.debug("auth: " + sendtext) + + if curauth[0] == "Stage3": + line = findhostinlist(authlist, curauth[1], curauth[2]) + if line != -1: + dec_message = priv_decrypt(curauth[3]) + splitmes = dec_message.split("#") + logging.info("auth: checking challenge") + if splitmes[0] == "": + if splitmes[1] == str(authlist[line][2]): + timeoutfifo.put(["add", curauth[1], curauth[2]]) + del authlist[line] + logging.info("auth: Stage3 checked, sending now to timeout") + else: logging.error("auth: challenge checking failed") + else: logging.error("auth: decryption failed") + + else: + i = 0 + while i < len(authlist): + if time.time() - authlist[i][3] > 120: + del authlist[i] + logging.info("auth: deleting timeoutet auth") + else: + i += 1 + time.sleep(1) + except: + logging.error("auth: thread crashed") + +def process_start(): #starting of the process + #download and untar hostfile + logging.info("downloading hostfiles") + get_hostfiles("http://vpn.miefda.org/hosts.tar.gz", "http://vpn.miefda.org/hosts.md5") #Currently Hardcoded, should be editable by config or parameter + tar = subprocess.call(["tar -xzf /etc/tinc/" + netname + "/hosts/hosts.tar.gz -C /etc/tinc/" + netname + "/hosts/"], shell=True) + + #initialize fifos + sendfifo = Queue.Queue() #sendtext + authfifo = Queue.Queue() #Stage{1, 2, 3} hostname ip enc_data + timeoutfifo = Queue.Queue() #State{tst, add} hostname ip + + #start threads + thread_recv = thread.start_new_thread(recvthread, (timeoutfifo, authfifo)) + thread_send = thread.start_new_thread(sendthread, (sendfifo, option.ghost)) + thread_timeout = thread.start_new_thread(timeoutthread, (timeoutfifo, authfifo)) + thread_auth = thread.start_new_thread(auththread, (authfifo, sendfifo, timeoutfifo)) + +def process_restart(signum, frame): + logging.error("root: restarting process") + with hostslock: + del hostslist[:] + #download and untar hostfile + logging.info("downloading hostfiles") + get_hostfiles("http://vpn.miefda.org/hosts.tar.gz", "http://vpn.miefda.org/hosts.md5") #Currently Hardcoded, should be editable by config or parameter + tar = subprocess.call(["tar -xzf /etc/tinc/" + netname + "/hosts/hosts.tar.gz -C /etc/tinc/" + netname + "/hosts/"], shell=True) + + logging.info("sending SIGHUP") + tincd_ALRM = subprocess.call(["tincd -n " + netname + " --kill=HUP" ],shell=True) + +def kill_process(signum, frame): + logging.error("got SIGINT/SIGTERM exiting now") + os.remove("/var/lock/retiolum." + netname) + if option.tinc != False: + stop_tincd = subprocess.call(["tincd -n " + netname + " -k"],shell=True) + sys.exit(0) + +#Program starts here! + +parser = OptionParser() +parser.add_option("-n", "--netname", dest="netname", help="the netname of the tinc network") +parser.add_option("-H", "--hostname", dest="hostname", default="default", help="your nodename, if not given, it will try too read it from tinc.conf") +parser.add_option("-t", "--timeout", dest="timeout", default=65536, help="timeout after retiolum gets restartet, default is 65536") +parser.add_option("-d", "--debug", dest="debug", default="0", help="debug level: 0,1,2,3 if empty debug level=0") +parser.add_option("-g", "--ghost", action="store_true", dest="ghost", default=False, help="deactivates active sending, keeps you anonymous in the public network") +parser.add_option("-T", "--Tinc", action="store_true", dest="tinc", default=False, help="starts tinc with this script") +(option, args) = parser.parse_args() + +if option.netname == None: + parser.error("Netname is required, use -h for help!") +if option.hostname == "default": + option.hostname = getHostname(option.netname) + +hostname = option.hostname +netname = option.netname +hostslist = [] +hostslock = thread.allocate_lock() + +#set process name +if not os.path.exists("/var/lock/retiolum." + netname): + pidfile = open("/var/lock/retiolum." + netname, "w") + pidfile.write(str(os.getpid())) + pidfile.close() +else: + logging.error("pidfile already exists") + sys.exit(0) + +#Logging stuff +LEVELS = {'3' : logging.DEBUG, + '2' : logging.INFO, + '1' : logging.ERROR, + '0' : logging.CRITICAL} + +level_name = option.debug +level = LEVELS.get(level_name, logging.NOTSET) +logging.basicConfig(level=level) + +#normally tinc doesnt start with retiolum +if option.tinc != False: + start_tincd = subprocess.call(["tincd -n " + netname ],shell=True) + +process_start() + +signal.signal(signal.SIGTERM, kill_process) +signal.signal(signal.SIGINT, kill_process) +signal.signal(signal.SIGUSR1, process_restart) + +while True: + time.sleep(float(option.timeout)) + process_restart(0, 0) diff --git a/retiolum/scripts/tinc_setup/README b/retiolum/scripts/tinc_setup/README new file mode 100644 index 00000000..11d6f6e9 --- /dev/null +++ b/retiolum/scripts/tinc_setup/README @@ -0,0 +1,18 @@ +This directory contains the build and install scripts for shack-retiolum + +1. build_arch + arch linux build script +2. build_debian + debian build script +3. build_debian_clean + debian script which builds a clean tinc daemon +4. build_ec2 + Amazon ec2 base instance build script +5. install.sh + configures the tinc daemon + $1 is the nickname + $2 is the ip-address + also writes a python file inside the tinc/retiolum folder which posts + the public key into the IRC:freenode/#tincspasm +6. build_no.de + nonfunct no.de smartmachine build script diff --git a/retiolum/scripts/tinc_setup/autoupdate_cron.sh b/retiolum/scripts/tinc_setup/autoupdate_cron.sh new file mode 100644 index 00000000..d5d41aaf --- /dev/null +++ b/retiolum/scripts/tinc_setup/autoupdate_cron.sh @@ -0,0 +1,7 @@ +cat </dev/null +12 23 * * * cd /home/node/etc/tinc/retiolum/hosts/ && /opt/local/bin/git pull && pkill -HUP tincd +EOF + diff --git a/retiolum/scripts/tinc_setup/bootstrap.sh b/retiolum/scripts/tinc_setup/bootstrap.sh new file mode 100644 index 00000000..32919e7d --- /dev/null +++ b/retiolum/scripts/tinc_setup/bootstrap.sh @@ -0,0 +1,11 @@ +if [ ! `id -u` -eq "0" ] +then + echo "not root, trying sudo" + exec sudo "$0" "$@" +fi + +mkdir -p /etc/tinc/retiolum/ +git clone git://github.com/miefda/retiolum.git /etc/tinc/retiolum/hosts +cd /etc/tinc/retiolum/hosts/.scripts + +echo "use the build script of your choice from /etc/tinc/retiolum/hosts/.scripts" diff --git a/retiolum/scripts/tinc_setup/build_arch.sh b/retiolum/scripts/tinc_setup/build_arch.sh new file mode 100755 index 00000000..5ef5d765 --- /dev/null +++ b/retiolum/scripts/tinc_setup/build_arch.sh @@ -0,0 +1,14 @@ +#!/bin/sh +set -e +sudo pacman -S openssl gcc lzo +curl http://www.tinc-vpn.org/packages/tinc-1.0.13.tar.gz | tar xz +cd tinc-1.0.13 +./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var +make +sudo make install +cd .. + +echo "overwriting python to python2" +sed 's/\/usr\/bin\/python/\/usr\/bin\/python2/g' install.sh >install2.sh +mv install2.sh install.sh + diff --git a/retiolum/scripts/tinc_setup/build_debian.sh b/retiolum/scripts/tinc_setup/build_debian.sh new file mode 100755 index 00000000..52e61390 --- /dev/null +++ b/retiolum/scripts/tinc_setup/build_debian.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -x +if [ ! "$MYIP" ] +then + MYIP=10.0.7.7.55 +fi +if [ ! "$MYHOSTNAME" ] +then + MYHOSTNAME="penis" +fi + +if [ "$MYHOSTNAME" = "penis" ]; +then + read -n1 -p "name is penis, are u sure? [yN]" + if [[ "$REPLY" != [yY] ]] + then + echo "then better RTFC" + echo "bailing out" + exit 0 + fi +fi +apt-get install tinc git curl python + +./install.sh "$MYHOSTNAME" "$MYIP" + +# for autostart +sed -i '/retiolum/d' /etc/tinc/nets.boot +echo "retiolum" >> /etc/tinc/nets.boot +sed -i '/EXTRA/d' /etc/tinc/nets.boot +echo "EXTRA=\"\"" >> /etc/default/tinc + +/etc/init.d/tinc start diff --git a/retiolum/scripts/tinc_setup/build_debian_clean.sh b/retiolum/scripts/tinc_setup/build_debian_clean.sh new file mode 100755 index 00000000..a7332f4e --- /dev/null +++ b/retiolum/scripts/tinc_setup/build_debian_clean.sh @@ -0,0 +1,31 @@ +#!/bin/bash +set -xe +MYIP=10.0.7.7.55 + +apt-get install tinc git curl gcc gcc-dev build-essential libssl-dev python + +git clone https://github.com/makefu/shack-retiolum.git + +mkdir build +cd build +curl http://www.oberhumer.com/opensource/lzo/download/lzo-2.04.tar.gz | tar +xz +cd lzo-2.04 +./configure --prefix=/usr +make +sudo make install +cd .. +curl http://www.tinc-vpn.org/packages/tinc-1.0.13.tar.gz | tar xz +cd tinc-1.0.13 +./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var +make +sudo make install +cd ../.. + +cd shack-retiolum +./install.sh `hostname` $MYIP + +rm shack-retiolum +# for autostart +echo "retiolum" >> /etc/tinc/nets.boot +echo "EXTRA=\"--user=tincd --chroot\"" >> /etc/default/tinc diff --git a/retiolum/scripts/tinc_setup/build_ec2.sh b/retiolum/scripts/tinc_setup/build_ec2.sh new file mode 100755 index 00000000..79f2af28 --- /dev/null +++ b/retiolum/scripts/tinc_setup/build_ec2.sh @@ -0,0 +1,16 @@ +#!/bin/sh +set -e +sudo yum install -y gcc openssl-devel +mkdir build +cd build +curl http://www.oberhumer.com/opensource/lzo/download/lzo-2.04.tar.gz | tar xz +cd lzo-2.04 +./configure --prefix=/usr +make +sudo make install +cd .. +curl http://www.tinc-vpn.org/packages/tinc-1.0.13.tar.gz | tar xz +cd tinc-1.0.13 +./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var +make +sudo make install diff --git a/retiolum/scripts/tinc_setup/build_no.de.sh b/retiolum/scripts/tinc_setup/build_no.de.sh new file mode 100644 index 00000000..2976d3a2 --- /dev/null +++ b/retiolum/scripts/tinc_setup/build_no.de.sh @@ -0,0 +1 @@ +pkgin in lzo gcc-tools gcc-compiler gcc34 diff --git a/retiolum/scripts/tinc_setup/install.sh b/retiolum/scripts/tinc_setup/install.sh new file mode 100755 index 00000000..9df38df7 --- /dev/null +++ b/retiolum/scripts/tinc_setup/install.sh @@ -0,0 +1,72 @@ +#! /bin/sh +# USE WITH GREAT CAUTION + +#make -C ../../ update +set -e +DIRNAME=`dirname $0` +CURR=`readlink -f ${DIRNAME}` +MYBIN=../../bin +netname=retiolum +# create configuration directory for $netname +mkdir -p /etc/tinc/$netname/hosts +cd /etc/tinc/$netname + +echo "added known hosts:" +ls -1 hosts | LC_ALL=C sort +echo "delete the nodes you do not trust!" + +myname="${1:-}" +if [ ! "$myname" ] +then + echo "select username: " + read myname +fi +if [ ! -e "hosts/$myname" ] +then + myipv4="${2:-}" + mynet4=10.7.7.0 + + if [ ! "$myipv4" ] + then + echo "select v4 subnet ip (1-255) :" + read v4num + myipv4=10.7.7.$v4num + if [ "$v4num" -gt 0 -a "$v4num" -lt "256" ]; + then + echo "check" + else + echo "you are made of stupid. bailing out" + exit 1 + fi + fi + echo "Subnet = $myipv4" > hosts/$myname + + myipv6=`${CURR}/../../bin/fillxx 42:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx`/128 + echo "Subnet = $myipv6" >> hosts/$myname +else + echo "own host file already exists! will not write again!" +fi + +cp $CURR/tinc-up /etc/tinc/$netname/ + +cat>tinc.conf< +#include +#include +#include + +/* + * Temper.c by Robert Kavaler (c) 2009 (relavak.com) + * All rights reserved. + * + * Temper driver for linux. This program can be compiled either as a library + * or as a standalone program (-DUNIT_TEST). The driver will work with some + * TEMPer usb devices from RDing (www.PCsensor.com). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY Robert Kavaler ''AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Robert kavaler BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "temper.h" + +#define VENDOR_ID 0x1130 +#define PRODUCT_ID 0x660c + +struct Temper { + struct usb_device *device; + usb_dev_handle *handle; + int debug; + int timeout; +}; + + Temper * +TemperCreate(struct usb_device *dev, int timeout, int debug) +{ + Temper *t; + int ret; + + t = calloc(1, sizeof(*t)); + t->device = dev; + t->debug = debug; + t->timeout = timeout; + t->handle = usb_open(t->device); + if(!t->handle) { + free(t); + return NULL; + } + if(t->debug) { + printf("Trying to detach kernel driver\n"); + } + + ret = usb_detach_kernel_driver_np(t->handle, 0); + if(ret) { + if(errno == ENODATA) { + if(t->debug) { + printf("Device already detached\n"); + } + } else { + if(t->debug) { + printf("Detach failed: %s[%d]\n", + strerror(errno), errno); + printf("Continuing anyway\n"); + } + } + } else { + if(t->debug) { + printf("detach successful\n"); + } + } + ret = usb_detach_kernel_driver_np(t->handle, 1); + if(ret) { + if(errno == ENODATA) { + if(t->debug) + printf("Device already detached\n"); + } else { + if(t->debug) { + printf("Detach failed: %s[%d]\n", + strerror(errno), errno); + printf("Continuing anyway\n"); + } + } + } else { + if(t->debug) { + printf("detach successful\n"); + } + } + + if(usb_set_configuration(t->handle, 1) < 0 || + usb_claim_interface(t->handle, 0) < 0 || + usb_claim_interface(t->handle, 1)) { + usb_close(t->handle); + free(t); + return NULL; + } + return t; +} + + Temper * +TemperCreateFromDeviceNumber(int deviceNum, int timeout, int debug) +{ + struct usb_bus *bus; + int n; + + n = 0; + for(bus=usb_get_busses(); bus; bus=bus->next) { + struct usb_device *dev; + + for(dev=bus->devices; dev; dev=dev->next) { + if(debug) { + printf("Found device: %04x:%04x\n", + dev->descriptor.idVendor, + dev->descriptor.idProduct); + } + if(dev->descriptor.idVendor == VENDOR_ID && + dev->descriptor.idProduct == PRODUCT_ID) { + if(debug) { + printf("Found deviceNum %d\n", n); + } + if(n == deviceNum) { + return TemperCreate(dev, timeout, debug); + } + n++; + } + } + } + return NULL; +} + + void +TemperFree(Temper *t) +{ + if(t) { + if(t->handle) { + usb_close(t->handle); + } + free(t); + } +} + + static int +TemperSendCommand(Temper *t, int a, int b, int c, int d, int e, int f, int g, int h) +{ + unsigned char buf[32]; + int ret; + + bzero(buf, 32); + buf[0] = a; + buf[1] = b; + buf[2] = c; + buf[3] = d; + buf[4] = e; + buf[5] = f; + buf[6] = g; + buf[7] = h; + + if(t->debug) { + printf("sending bytes %d, %d, %d, %d, %d, %d, %d, %d\n", + a, b, c, d, e, f, g, h); + } + + ret = usb_control_msg(t->handle, 0x21, 9, 0x200, 0x01, + (char *) buf, 32, t->timeout); + if(ret != 32) { + perror("usb_control_msg failed"); + return -1; + } + return 0; +} + + static int +TemperGetData(Temper *t, char *buf, int len) +{ + int ret; + + return usb_control_msg(t->handle, 0xa1, 1, 0x300, 0x01, + (char *) buf, len, t->timeout); +} + + int +TemperGetTemperatureInC(Temper *t, float *tempC) +{ + char buf[256]; + int ret, temperature, i; + + TemperSendCommand(t, 10, 11, 12, 13, 0, 0, 2, 0); + TemperSendCommand(t, 0x54, 0, 0, 0, 0, 0, 0, 0); + for(i = 0; i < 7; i++) { + TemperSendCommand(t, 0, 0, 0, 0, 0, 0, 0, 0); + } + TemperSendCommand(t, 10, 11, 12, 13, 0, 0, 1, 0); + ret = TemperGetData(t, buf, 256); + if(ret < 2) { + return -1; + } + + temperature = (buf[1] & 0xFF) + (buf[0] << 8); + temperature += 1152; // calibration value + *tempC = temperature * (125.0 / 32000.0); + return 0; +} + + int +TemperGetOtherStuff(Temper *t, char *buf, int length) +{ + TemperSendCommand(t, 10, 11, 12, 13, 0, 0, 2, 0); + TemperSendCommand(t, 0x52, 0, 0, 0, 0, 0, 0, 0); + TemperSendCommand(t, 10, 11, 12, 13, 0, 0, 1, 0); + return TemperGetData(t, buf, length); +} + + +#define USB_TIMEOUT 1000 /* milliseconds */ +#define DEBUG_MODE 0 +#define SLEEP_TIMEOUT 10 + + int +main(int argv,char** args) +{ + + + Temper *t; + char buf[256]; + int i, ret,oneshot=0; + if (argv == 2 && (args[1][1] == 'h' || args[1][0] == 'h')) + { + printf("Temper, does the right thing in C\n"); + printf("recompile with DEBUG_MODE = 1 for all the debug printing\n"); + printf("recompile with SLEEP_TIMEOUT = XX for a different polling interval\n"); + exit(0); + } + + usb_set_debug(DEBUG_MODE); + usb_init(); + usb_find_busses(); + usb_find_devices(); + + t = TemperCreateFromDeviceNumber(0, USB_TIMEOUT, DEBUG_MODE); + if(!t) { + perror("TemperCreate"); + exit(-1); + } + + /* + TemperSendCommand(t, 10, 11, 12, 13, 0, 0, 2, 0); + TemperSendCommand(t, 0x43, 0, 0, 0, 0, 0, 0, 0); + TemperSendCommand(t, 0, 0, 0, 0, 0, 0, 0, 0); + TemperSendCommand(t, 0, 0, 0, 0, 0, 0, 0, 0); + TemperSendCommand(t, 0, 0, 0, 0, 0, 0, 0, 0); + TemperSendCommand(t, 0, 0, 0, 0, 0, 0, 0, 0); + TemperSendCommand(t, 0, 0, 0, 0, 0, 0, 0, 0); + TemperSendCommand(t, 0, 0, 0, 0, 0, 0, 0, 0); + */ + + bzero(buf, 256); + ret = TemperGetOtherStuff(t, buf, 256); + + float tempc; + + if(TemperGetTemperatureInC(t, &tempc) < 0) { + perror("TemperGetTemperatureInC"); + exit(1); + } + + printf("%.2f\n", tempc); + return 0; +} diff --git a/temper/temper.h b/temper/temper.h new file mode 100644 index 00000000..7ea6280a --- /dev/null +++ b/temper/temper.h @@ -0,0 +1,39 @@ +#ifndef TEMPER_H +#define TEMPER_H + +/* + * Temper.h by Robert Kavaler (c) 2009 (relavak.com) + * All rights reserved. + * + * Temper driver for linux. This program can be compiled either as a library + * or as a standalone program (-DUNIT_TEST). The driver will work with some + * TEMPer usb devices from RDing (www.PCsensor.com). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * THIS SOFTWARE IS PROVIDED BY Robert Kavaler ''AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL Robert kavaler BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +typedef struct Temper Temper; + + +Temper *TemperCreateFromDeviceNumber(int deviceNum, int timeout, int debug); +void TemperFree(Temper *t); + +int TemperGetTemperatureInC(Temper *t, float *tempC); +int TempterGetOtherStuff(Temper *t, char *buf, int length); + +#endif diff --git a/webcams/cam1.sh b/webcams/cam1.sh new file mode 100755 index 00000000..9cf709e6 --- /dev/null +++ b/webcams/cam1.sh @@ -0,0 +1,2 @@ +#!/bin/sh +mplayer tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0 diff --git a/zoneminder/Makefile b/zoneminder/Makefile new file mode 100644 index 00000000..27302715 --- /dev/null +++ b/zoneminder/Makefile @@ -0,0 +1,14 @@ + +.PHONY: fix it so hard +it: so +so: it hard fix + apt-get install --yes zoneminder libv4l-0 + +hard: /etc/sysctl.d/zoneminder.conf +/etc/sysctl.d/zoneminder.conf: zoneminder.conf + cp $< $@ + sysctl -p $@ + +fix: zmdc.pl-LD_PRELOAD.patch + (cd /usr/bin && patch -N) < $< || : + diff --git a/zoneminder/zmdc.pl-LD_PRELOAD.patch b/zoneminder/zmdc.pl-LD_PRELOAD.patch new file mode 100644 index 00000000..b00fc673 --- /dev/null +++ b/zoneminder/zmdc.pl-LD_PRELOAD.patch @@ -0,0 +1,10 @@ +--- /usr/bin/zmdc.pl 2011-05-23 22:28:57.505247793 +0200 ++++ /usr/bin/zmdc.pl 2011-05-23 22:29:45.597248242 +0200 +@@ -62,6 +62,7 @@ + $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL}; + delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; + ++$ENV{LD_PRELOAD} = '/usr/lib/libv4l/v4l2convert.so'; + my @daemons = ( + 'zmc', + 'zma', diff --git a/zoneminder/zoneminder.conf b/zoneminder/zoneminder.conf new file mode 100644 index 00000000..1eec6fd9 --- /dev/null +++ b/zoneminder/zoneminder.conf @@ -0,0 +1,2 @@ +kernel.shmall = 134217728 +kernel.shmmax = 134217728 -- cgit v1.2.3 [cgit] Unable to lock slot /tmp/cgit/89300000.lock: Permission denied (13)