From 851fb93dd3d1778da12752977cfbe4fff7d65ecb Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 29 Aug 2011 10:05:36 +0200 Subject: punani: add dryrun,hard,filebased search punani is now able to search for packages via files and packages in debian-based and arch-based systems. Fix bug in punani godmode --- punani/bin/punani | 156 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 122 insertions(+), 34 deletions(-) diff --git a/punani/bin/punani b/punani/bin/punani index 7af6f0f8..f01cedb7 100755 --- a/punani/bin/punani +++ b/punani/bin/punani @@ -6,7 +6,7 @@ # -E -i spec insert a package to the target filesystem # -E -r spec remove a package # - +set -euf godmode() { if test "${nosudo-false}" != true -a `id -u` != 0; then echo "Warning: we require god mode..." >&2 @@ -15,44 +15,44 @@ godmode() { fi } -if pacman --version 2>/dev/null | fgrep -q Pacman; then - system="${system+$system, }arch-like" -fi +# return the 'system' variable +# currently be: +# arch-like +# debian-like +guess_system() +{ + if [ -f "/etc/arch-release" ] ;then + system="${system+$system, }arch-like" + fi + if [ -f "/etc/lsb-release" -o -f "/etc/debian_version" ] ;then + system="${system+$system, }debian-like" + fi -case "$system" in - (*arch-like*) - punani_Engineer_insert() { - pacman -Sy "$1" - } - punani_Engineer_remove() { - pacman -Rcs "$1" - } - ;; - (*) - email='krebs@syntax-fehler.de' - irc_host='irc.freenode.org' - irc_channel='#tincspasm' - cat>&2<&2< Date: Mon, 29 Aug 2011 12:38:56 +0200 Subject: punani: fix help/hard conflict, system function handle_system is now the function which does the right thing for all distro specific stuff --- punani/bin/punani | 239 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 152 insertions(+), 87 deletions(-) diff --git a/punani/bin/punani b/punani/bin/punani index f01cedb7..f9244c53 100755 --- a/punani/bin/punani +++ b/punani/bin/punani @@ -9,7 +9,7 @@ set -euf godmode() { if test "${nosudo-false}" != true -a `id -u` != 0; then - echo "Warning: we require god mode..." >&2 + echo "!! we require god mode..." >&2 exec sudo "$0" "$@" exit 23 # go to hell fi @@ -43,7 +43,142 @@ arch_aur_helper() echo "!! To be Implemented" return 1 } +handle_system () { + case "$system" in + (*arch-like*) + # dryrun + # TODO dryrun not dry enough for aur helper + if [ "${dryrun-}" ];then + pacman () { echo "pacman $@" ; } + pkgfile () { echo "pkgfile $@"; } + yaourt () { echo "yaourt $@" ; } + fi + + # get dependencies : + # we need pkgfile + if ! [ `which pkgfile` ] ; then + pacman -S --noconfirm pkgtools + pkgfile -u + fi + punani_Scientist_update() { + pacman -Sy + pkgtool -u + } + + punani_Engineer_insert() { + # punani under archlinux first tries to load the packages with the given file name + # it needs pkgfile for that + # + # when trying harder it tries to load the package with the given name directly via yaourt + echo "** trying to find package with given file" + if pacman -Sy `pkgfile $1`; then + echo "++ finished" + exit 0 + else + echo "!! nothing found in base repos" + if [ "${hard-}" ] ; then + echo "** trying harder" + echo "** trying yaourt directly with given package" + mgr=`arch_aur_helper` + if $mgr -S $1 ;then + echo "++ finished" + exit 0 + else + echo "!! giving up...i am sorry" + exit 1 + fi + echo + else + echo "?? When in doubt try $0 -h -Ei $1 " + fi + fi + } + punani_Engineer_remove() { + pacman -Rcs "`pacman -Ql | grep $1$ | awk '{print $1}'`" + if [ "${hard-}" ] ; then + echo "** trying harder" + echo "** directly delete given package name" + pacman -Rcs "$1" + fi + } + ;; + (*debian-like*) + if [ "${dryrun-}" ]; then + apt-file () { echo $@; } + apt-get () { echo $@; } + fi + [ `which apt-file` ] || apt-get install --yes apt-file && apt-file update + punani_Scientist_update() { + apt-get update + apt-file update + } + punani_Scientist_search() { + apt-file search $1 && exit 0 + if [ "${hard-}" ] ; then + apt-cache search $1 + fi + } + punani_Engineer_insert() { + if apt-get install `apt-file search $1`;then + echo "++ finished" + else + if [ "${hard-}" ] ; then + echo "** trying harder" + apt-get install $1 + fi + fi + } + punani_Engineer_remove() { + apt-get remove --purge "`apt-file search $1`" + if [ "${hard-}" ] ; then + echo "** trying harder" + echo "** directly delete given package name" + apt-get remove --purge "$1" + fi + } + ;; + (*) + email='krebs@syntax-fehler.de' + irc_host='irc.freenode.org' + irc_channel='#tincspasm' + cat>&2<&2 exit 23;; - esac - ;; + esac;; + (Scientist) + case $OPT in + (s) command="${ns}_${role}_search";; + (y) command="${ns}_${role}_update";; + (*) + echo 'Error 1: You are made of stupid!' >&2 + exit 23;; + esac ;; (undefined) case $OPT in (E) role=Engineer;; + (S) role=Scientist;; (*) exit 23;; esac @@ -82,96 +226,17 @@ punani $@ case $role in (Engineer) godmode $@;; + (Scientist) + case $command in + (*_update) godmode $@;; + esac;; esac shift `echo $OPTIND-1 | bc` guess_system -case "$system" in - (*arch-like*) - # get dependencies : - # we need pkgfile - if [ "${dryrun-}" ];then - pacman () { echo "pacman $@" ; } - pkgfile () { echo "pkgfile $@"; } - yaourt () { echo "yaourt $@" ; } - fi - if ! [ `which pkgfile` ] ; then - pacman -S --noconfirm pkgtools - pkgfile -u - fi - punani_Scientist_update() { - pacman -Sy - pkgtool -u - } - - punani_Engineer_insert() { - # punani under archlinux first tries to load the packages with the given file name - # it needs pkgfile for that - # - # when trying harder it tries to load the package with the given name directly via yaourt - echo "** trying to find package with given file" - if pacman -Sy `pkgfile $1`; then - echo "++ finished" - exit 0 - else - echo "!! nothing found in base repos" - if [ "${hard-}" ] ; then - echo "** trying harder" - echo "** trying yaourt directly with given package" - mgr=`arch_aur_helper` - if $mgr -S $1 ;then - echo "++ finished" - exit 0 - else - echo "!! giving up...i am sorry" - exit 1 - fi - echo - else - echo "?? When in doubt try $0 -Ei --hard $1 " - fi - fi - } - punani_Engineer_remove() { - pacman -Rcs "`pacman -Ql | grep $1$ | awk '{print $1}'`" - if [ "${hard-}" ] ; then - echo "trying harder" - echo "** directly delete given package name" - pacman -Rcs "$1" - fi - } - ;; - (*debian-like*) - if [ "${dryrun-}" ]; then - apt-file () { echo $@; } - apt-get () { echo $@; } - fi - [ `which apt-file` ] || apt-get install --yes apt-file && apt-file update - punani_Scientist_update() { - apt-get update - apt-file update - } - - ;; - (*) - email='krebs@syntax-fehler.de' - irc_host='irc.freenode.org' - irc_channel='#tincspasm' - cat>&2< Date: Mon, 29 Aug 2011 13:30:51 +0200 Subject: fix dpfhack_display now as submodule --- .gitmodules | 3 +++ oncology/dpfhack_display | 1 + submodules/github/makefu/dpfhack_display | 1 + 3 files changed, 5 insertions(+) create mode 120000 oncology/dpfhack_display create mode 160000 submodules/github/makefu/dpfhack_display diff --git a/.gitmodules b/.gitmodules index ed0cb4ed..3677b710 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "submodules/github/tautologistics/node-htmlparser"] path = submodules/github/tautologistics/node-htmlparser url = https://github.com/tautologistics/node-htmlparser +[submodule "submodules/github/makefu/dpfhack_display"] + path = submodules/github/makefu/dpfhack_display + url = https://github.com/makefu/dpfhack_pearl diff --git a/oncology/dpfhack_display b/oncology/dpfhack_display new file mode 120000 index 00000000..9666b7bc --- /dev/null +++ b/oncology/dpfhack_display @@ -0,0 +1 @@ +../submodules/github/makefu/dpfhack_display \ No newline at end of file diff --git a/submodules/github/makefu/dpfhack_display b/submodules/github/makefu/dpfhack_display new file mode 160000 index 00000000..c66acd31 --- /dev/null +++ b/submodules/github/makefu/dpfhack_display @@ -0,0 +1 @@ +Subproject commit c66acd31125dc18bc2638569d6ba081f21bcef50 -- cgit v1.2.3 From cd4f8b3394e02bcb7d86d53d1b98b4b4b868b78b Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 29 Aug 2011 13:46:45 +0200 Subject: punani/doc: initial commit releases covers a way to guess the release of the distro --- punani/doc/releases | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 punani/doc/releases diff --git a/punani/doc/releases b/punani/doc/releases new file mode 100644 index 00000000..3b372d56 --- /dev/null +++ b/punani/doc/releases @@ -0,0 +1,35 @@ +# release files (guess the os distribution) +# from http://linuxmafia.com/faq/Admin/release-files.html +Annvix: /etc/annvix-release +Arch Linux: /etc/arch-release +Arklinux: /etc/arklinux-release +Aurox Linux: /etc/aurox-release +BlackCat: /etc/blackcat-release +Cobalt: /etc/cobalt-release +Conectiva: /etc/conectiva-release +Debian: /etc/debian_version, /etc/debian_release (rare) +Fedora Core: /etc/fedora-release +Gentoo Linux: /etc/gentoo-release +Immunix: /etc/immunix-release +Knoppix: knoppix_version +Linux-From-Scratch: /etc/lfs-release +Linux-PPC: /etc/linuxppc-release +Mandrake: /etc/mandrake-release +Mandriva/Mandrake Linux: /etc/mandriva-release, /etc/mandrake-release, /etc/mandakelinux-release +MkLinux: /etc/mklinux-release +Novell Linux Desktop: /etc/nld-release +PLD Linux: /etc/pld-release +Red Hat: /etc/redhat-release, /etc/redhat_version (rare) +Slackware: /etc/slackware-version, /etc/slackware-release (rare) +SME Server (Formerly E-Smith): /etc/e-smith-release +Solaris SPARC: /etc/release +Sun JDS: /etc/sun-release +SUSE Linux: /etc/SuSE-release, /etc/novell-release +SUSE Linux ES9: /etc/sles-release +Tiny Sofa: /etc/tinysofa-release +TurboLinux: /etc/turbolinux-release +Ubuntu Linux: /etc/lsb-release +UltraPenguin: /etc/ultrapenguin-release +UnitedLinux: /etc/UnitedLinux-release (covers SUSE SLES8) +VA-Linux/RH-VALE: /etc/va-release +Yellow Dog: /etc/yellowdog-release -- cgit v1.2.3 From 568fbd7fa5541182bbbc33560863ec9c3ff01d48 Mon Sep 17 00:00:00 2001 From: makefu Date: Tue, 6 Sep 2011 21:20:37 +0200 Subject: cholerab/reaktor: add privileged functions description privileged functions might be implemented via asymmetric encryption this is described in the privileged_function text file --- cholerab/reaktor/priviliged_functions | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 cholerab/reaktor/priviliged_functions diff --git a/cholerab/reaktor/priviliged_functions b/cholerab/reaktor/priviliged_functions new file mode 100644 index 00000000..a673267e --- /dev/null +++ b/cholerab/reaktor/priviliged_functions @@ -0,0 +1,24 @@ +Use Case 1: Request update on Host +================================= + +< user> bot: update +< bot> /whois user +< bot> /msg user [CHALLENGE] +< user> /msg bot [CHALLENGE-RESPONSE] +< bot> updating... +< bot> now on rev XXXXX + +Command Flow +---------------- +The bot has a locally stored list of [trusted] hosts along with their public +key, preferably from the tinc/retiolum directory. + +The bot encrypts a 1K Byte long message with the public key of the host +retrieved by the /whois command. + +This challenge is sent to the user requesting the command via private message. +The user then decrpyts the message with its own private key and sends the +decrpyted message to the bot. + +The bot then executes the requested command if the challenge is answered +correctly -- cgit v1.2.3 From 89d92c55e7ddc0aec61ae8210592410f37f73502 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 12 Sep 2011 14:54:35 +0200 Subject: punani: fix parsing bug, add fallback helper --- punani/bin/punani | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/punani/bin/punani b/punani/bin/punani index f9244c53..1dd72542 100755 --- a/punani/bin/punani +++ b/punani/bin/punani @@ -31,7 +31,8 @@ guess_system() } arch_aur_helper() { - manager="yaourt clyde packer bauerbill tupac pacaur paktahn pbfetch aurget aurora cower powaur" + # pacman is the last fallback helper + manager="yaourt clyde packer bauerbill tupac pacaur paktahn pbfetch aurget aurora cower powaur pacman" for i in $manager;do mgr=`which $i` if [ "$mgr" ] ;then @@ -39,8 +40,7 @@ arch_aur_helper() return 0 fi done - echo "!! no aur helper found" - echo "!! To be Implemented" + echo "!! no helper found, this should never happen(tm)." return 1 } handle_system () { @@ -64,6 +64,14 @@ handle_system () { pacman -Sy pkgtool -u } + punani_Scientist_search() { + pkgfile $1 + if [ "${hard-}" ] ; then + mgr=`arch_aur_helper` + $mgr -Ss $1 + fi + + } punani_Engineer_insert() { # punani under archlinux first tries to load the packages with the given file name @@ -71,7 +79,7 @@ handle_system () { # # when trying harder it tries to load the package with the given name directly via yaourt echo "** trying to find package with given file" - if pacman -Sy `pkgfile $1`; then + if pacman -S `pkgfile $1` 2>/dev/null; then echo "++ finished" exit 0 else @@ -182,7 +190,7 @@ EOF punani (){ ns=punani role=undefined - while getopts 'dfhvSopEir' OPT; do + while getopts 'dfhvSsopEir' OPT; do case $OPT in (f) force=true; continue;; (h) hard=true; continue;; @@ -237,7 +245,6 @@ guess_system handle_system -command="${ns}_Engineer_insert" for name; do "$command" "$name" done -- cgit v1.2.3 From 81ab02668cc37c6e540fbfbc23a32828901b4660 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 12 Sep 2011 15:01:01 +0200 Subject: punani: deobfuscate source, handle multiple parms --- punani/bin/punani | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/punani/bin/punani b/punani/bin/punani index 1dd72542..7278e38a 100755 --- a/punani/bin/punani +++ b/punani/bin/punani @@ -90,10 +90,10 @@ handle_system () { mgr=`arch_aur_helper` if $mgr -S $1 ;then echo "++ finished" - exit 0 + return 0 else echo "!! giving up...i am sorry" - exit 1 + return 1 fi echo else @@ -241,10 +241,10 @@ case $role in esac shift `echo $OPTIND-1 | bc` -guess_system - +guess_system handle_system -for name; do - "$command" "$name" + +for name in "$@"; do + "$command" "$name" || echo "!! could not install $name" done -- cgit v1.2.3 From a9ee98ec26277014fd0f55ff414a71ece5c749aa Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 12 Sep 2011 15:04:25 +0200 Subject: punani/doc/release: add Angstrom linux detection --- punani/doc/releases | 3 +++ 1 file changed, 3 insertions(+) diff --git a/punani/doc/releases b/punani/doc/releases index 3b372d56..98c4ea82 100644 --- a/punani/doc/releases +++ b/punani/doc/releases @@ -33,3 +33,6 @@ UltraPenguin: /etc/ultrapenguin-release UnitedLinux: /etc/UnitedLinux-release (covers SUSE SLES8) VA-Linux/RH-VALE: /etc/va-release Yellow Dog: /etc/yellowdog-release + +# own collection +Angstrom: /etc/angstrom-version -- cgit v1.2.3 From a8ab9dbc2de0ee3aa744485255360b5e5e8b45cd Mon Sep 17 00:00:00 2001 From: root Date: Wed, 14 Sep 2011 20:36:40 +0200 Subject: Reaktor/asybot: add syslog logging feature --- Reaktor/IRC/asybot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Reaktor/IRC/asybot.py b/Reaktor/IRC/asybot.py index 9021d22f..99cb2fe6 100755 --- a/Reaktor/IRC/asybot.py +++ b/Reaktor/IRC/asybot.py @@ -15,8 +15,12 @@ from datetime import datetime as date, timedelta from sys import exit from re import split, search -import logging -log = logging.getLogger() +import logging,logging.handlers +log = logging.getLogger('asybot') +hdlr = logging.handlers.SysLogHandler(facility=logging.handlers.SysLogHandler.LOG_DAEMON) +formatter = logging.Formatter( '%(filename)s: %(levelname)s: %(message)s') +hdlr.setFormatter(formatter) +log.addHandler(hdlr) class asybot(asychat): def __init__(self, server, port, nickname, targets, **kwargs): -- cgit v1.2.3