diff options
40 files changed, 844 insertions, 12 deletions
diff --git a/Monitoring/htpasswd.users b/Monitoring/htpasswd.users new file mode 100644 index 00000000..7d4bbd6c --- /dev/null +++ b/Monitoring/htpasswd.users @@ -0,0 +1,2 @@ +nagiosadmin:wriRAagrgh5mk +shack:i8ZRZOQKu3mgw diff --git a/assimilator/bin/git-clone-into b/assimilator/bin/git-clone-into new file mode 100755 index 00000000..67e820e6 --- /dev/null +++ b/assimilator/bin/git-clone-into @@ -0,0 +1,48 @@ +#! /bin/sh +# +# usage: git-clone-into repository directory +# +set -euf + +tempdir() { + set -- `tempnam $1` + mkdir $1 + echo $1 +} + +## [prefix] -> tempnam +tempnam() { + until set -- $1 ${1-}`candnam` && ! test -e $2; do :; done + echo $2 +} + +candnam() { + uuidgen 2>/dev/null || date +%s%N +} + + + + tmp_remote=`candnam` + tmp_branch=`candnam` + + subdir=$2 + if test -e $subdir; then + echo 'You are made of stupid!' >&2 + exit 23 + fi + tmpdir=`tempdir /tmp/tempdir-` + #trap "test -d $tmpdir && rm -vfR $tmpdir" EXIT + trap "test -d $tmpdir && rm -fR $tmpdir" EXIT + repository="${1-$repository}" + git clone "$repository" $tmpdir + (cd $tmpdir + subdir="$subdir" git filter-branch --tree-filter ' + if ! test -d $subdir; then + mkdir -p $subdir + git ls-tree -z --name-only $GIT_COMMIT | xargs -I. --null mv . $subdir + fi + ' + git checkout -b $tmp_branch) + git remote add $tmp_remote $tmpdir + git fetch $tmp_remote + git merge $tmp_remote/$tmp_branch # TODO configurable branch diff --git a/beep.lol b/beep.lol new file mode 100755 index 00000000..f9c29dba --- /dev/null +++ b/beep.lol @@ -0,0 +1 @@ +beep -l 350 -f 392 -D 100 --new -l 350 -f 392 -D 100 --new -l 350 -f 392 -D 100 --new -l 250 -f 311.1 -D 100 --new -l 25 -f 466.2 -D 100 --new -l 350 -f 392 -D 100 --new -l 250 -f 311.1 -D 100 --new -l 25 -f 466.2 -D 100 --new -l 700 -f 392 -D 100 --new -l 350 -f 587.32 -D 100 --new -l 350 -f 587.32 -D 100 --new -l 350 -f 587.32 -D 100 --new -l 250 -f 622.26 -D 100 --new -l 25 -f 466.2 -D 100 --new -l 350 -f 369.99 -D 100 --new -l 250 -f 311.1 -D 100 --new -l 25 -f 466.2 -D 100 --new -l 700 -f 392 -D 100 --new -l 350 -f 784 -D 100 --new -l 250 -f 392 -D 100 --new -l 25 -f 392 -D 100 --new -l 350 -f 784 -D 100 --new -l 250 -f 739.98 -D 100 --new -l 25 -f 698.46 -D 100 --new -l 25 -f 659.26 -D 100 --new -l 25 -f 622.26 -D 100 --new -l 50 -f 659.26 -D 400 --new -l 25 -f 415.3 -D 200 --new -l 350 -f 554.36 -D 100 --new -l 250 -f 523.25 -D 100 --new -l 25 -f 493.88 -D 100 --new -l 25 -f 466.16 -D 100 --new -l 25 -f 440 -D 100 --new -l 50 -f 466.16 -D 400 --new -l 25 -f 311.13 -D 200 --new -l 350 -f 369.99 -D 100 --new -l 250 -f 311.13 -D 100 --new -l 25 -f 392 -D 100 --new -l 350 -f 466.16 -D 100 --new -l 250 -f 392 -D 100 --new -l 25 -f 466.16 -D 100 --new -l 700 -f 587.32 -D 100 --new -l 350 -f 784 -D 100 --new -l 250 -f 392 -D 100 --new -l 25 -f 392 -D 100 --new -l 350 -f 784 -D 100 --new -l 250 -f 739.98 -D 100 --new -l 25 -f 698.46 -D 100 --new -l 25 -f 659.26 -D 100 --new -l 25 -f 622.26 -D 100 --new -l 50 -f 659.26 -D 400 --new -l 25 -f 415.3 -D 200 --new -l 350 -f 554.36 -D 100 --new -l 250 -f 523.25 -D 100 --new -l 25 -f 493.88 -D 100 --new -l 25 -f 466.16 -D 100 --new -l 25 -f 440 -D 100 --new -l 50 -f 466.16 -D 400 --new -l 25 -f 311.13 -D 200 --new -l 350 -f 392 -D 100 --new -l 250 -f 311.13 -D 100 --new -l 25 -f 466.16 -D 100 --new -l 300 -f 392.00 -D 150 --new -l 250 -f 311.13 -D 100 --new -l 25 -f 466.16 -D 100 --new -l 700 -f 392 diff --git a/census/arping_users.py b/census/arping_users.py index ec3557d4..934f9bea 100755 --- a/census/arping_users.py +++ b/census/arping_users.py @@ -29,8 +29,8 @@ def load_names(MAC_NAMES): def arping_helper(dic): return arpingy(**dic) -for first in range(1,3): - for second in range(255): +for first in range(1,4): + for second in range(256): data.append({'iprange':'10.42.'+str(first)+'.'+str(second),'iface':DEV}) names = load_names(MAC_NAMES) diff --git a/census/mac_names.lst b/census/mac_names.lst index ae58b539..85fbfb25 100644 --- a/census/mac_names.lst +++ b/census/mac_names.lst @@ -3,5 +3,12 @@ 00:26:c7:bd:a7:1a Martin 04:1e:64:05:39:28 Stephan 5c:59:48:22:2d:d2 Phil -00:21:00:fb:5c:b6 Kah Hah -00:1e:64:27:3b:72 Felix +00:21:00:fb:5c:b6 Kah-Hah +00:1e:64:27:3b:72 Felix +40:30:04:4f:de:73 Armin +00:26:c6:82:51:38 samuirai +3c:8b:fe:5c:4e:da Moh-Moh +00:26:bb:69:98:cc Jan +78:dd:08:d5:34:28 Patrick +78:ca:39:6e:ed:16 Tillman +00:22:43:25:61:79 Te vau diff --git a/cholerab/PROJECTS b/cholerab/PROJECTS new file mode 100644 index 00000000..6c9ac791 --- /dev/null +++ b/cholerab/PROJECTS @@ -0,0 +1,13 @@ +uPM: + GUI definieren und Testen +TODOer/TODO Jeopardy: + Schemata Sammelstelle (programme) +Miner MITM PoC: + Paper schreiben + Verschiedene wege miner zu manipulieren + DoS, verschiedene Wege +Mandatory Infest: + deploye die Coolen verkrebsungen, weniger intrusive + - das krebs logo + - PS1 variable + - tinc diff --git a/cholerab/README b/cholerab/README new file mode 100644 index 00000000..7b53aeaa --- /dev/null +++ b/cholerab/README @@ -0,0 +1,72 @@ + +~/p/krebscode/painload/infest/home + aggressive + cooperative + -- currently it is aggressive and stupid + +~/p/krebscode/painload/infest/etc + aggressive + cooperative + -- currently it is aggressive and stupid + + +- node install script + + +=== +# this is the current installation process [by example] +<code> + ssh root@pornocauster -p 2222 + git clone https://github.com/krebscode/painload.git /krebs + cd /krebs + apt-get install --yes make + make infest + shutdown -r now + + ssh -i .ssh/krebs/also.id_rsa krebs@pornocauster -p 2222 +</code> + +=== + +- conflicting ~/.profile +- morse: beep not found wegen rc.local +- /etc/.vimrc legacy compat + + +~/p/krebscode/painload/node/Makefile + ./configure --prefix=$HOME + and ensure that the resulting bin is in $PATH + which node or build + + +//krebscode/painload/retiolum/scripts/tinc_setup/install.sh or something + should be called by painload/infest + and should be enterprise enough to be infested multiple times + -- please see how infest/bin/make-patch is generating a patch, that gets + applied by Makefile + +//krebscode/painload/noise + - should be infested host-specifically + - i.e. to start automatically at KREBS + +//krebscode/painload/noise + - NOISE-STREAMS-MODULE + - should have a module to allow switching of the streams + - should have a module to allow managing of streams + - is this mergable with noise/modules/stream [by chris] + - or can we replace noise/modules/stream + +//krebscode/painload/streams + - should be infested host-specifically + - i.e. to start automatically at KREBS + - the last stream should be playbacked + - should be controlable by noise [see NOISE-STREAM-MODULE] + + +## merge conflicts below +view.py: contains view classes for cholerab +cholerab.py: main file + +start with : +python cholerab.py + diff --git a/cholerab/RETIOLUM b/cholerab/RETIOLUM new file mode 100644 index 00000000..66de3521 --- /dev/null +++ b/cholerab/RETIOLUM @@ -0,0 +1,8 @@ +Makefile: + update: + when hosts folder is not yet a git repository, check out + http://github.com/krebscode/hosts.git (no https, because this fails on old systems) + +Non-Root Supernodes: (makefu) + check out the DUP!step problem on krebsbob.no.de and krebs.no.de, + fix it for more profit! diff --git a/cholerab/UPM b/cholerab/UPM new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/cholerab/UPM diff --git a/cholerab/WISHLIST b/cholerab/WISHLIST new file mode 100644 index 00000000..b4b8e861 --- /dev/null +++ b/cholerab/WISHLIST @@ -0,0 +1,5 @@ +Krebs Modules Wishlist + +Temperature Threshold Sensor: + send out alarm via espeak or mail or irc or usb rocket launcher to open + the window when the temperature is too high diff --git a/cholerab/bling/README_svg b/cholerab/bling/README_svg new file mode 100644 index 00000000..887f7e04 --- /dev/null +++ b/cholerab/bling/README_svg @@ -0,0 +1,2 @@ +The Krebs' color is R:228 G:0 B:43 + diff --git a/cholerab/bling/filter.sh b/cholerab/bling/filter.sh new file mode 100755 index 00000000..39bac362 --- /dev/null +++ b/cholerab/bling/filter.sh @@ -0,0 +1,3 @@ +#! /bin/sh +set -euf +echo "[31;1m`cat "$1"`[m" | sed 's/x/[41m [m/g' diff --git a/cholerab/bling/krebs-v1.txt b/cholerab/bling/krebs-v1.txt new file mode 100644 index 00000000..c9852522 --- /dev/null +++ b/cholerab/bling/krebs-v1.txt @@ -0,0 +1,9 @@ + 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/cholerab/bling/krebs-v2.txt b/cholerab/bling/krebs-v2.txt new file mode 100644 index 00000000..f8006628 --- /dev/null +++ b/cholerab/bling/krebs-v2.txt @@ -0,0 +1,13 @@ + x x x x +xx x xx xx xx x +xx x xx xx xx x + xxx x x xxx + xxx xxxxx xxx + x xxxxxxx x + xxxxxxxxxxxxx + xxxxxxx + xxxxxxxxxxx + x xxx x + x x x x x x + x x x x x x + x xx x x xx x diff --git a/cholerab/bling/krebs-v2.xcf b/cholerab/bling/krebs-v2.xcf Binary files differnew file mode 100644 index 00000000..2bada0ce --- /dev/null +++ b/cholerab/bling/krebs-v2.xcf diff --git a/cholerab/bling/krebs-v2f.txt b/cholerab/bling/krebs-v2f.txt new file mode 100644 index 00000000..95f367ae --- /dev/null +++ b/cholerab/bling/krebs-v2f.txt @@ -0,0 +1,13 @@ + xx xx xx xx +xxxx xx xxxx xxxx xxxx xx +xxxx xx xxxx xxxx xxxx xx + xxxxxx xx xx xxxxxx + xxxxxx xxxxxxxxxx xxxxxx + xx xxxxxxxxxxxxxx xx + xxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxx + xx xxxxxx xx + xx xx xx xx xx xx + xx xx xx xx xx xx + xx xxxx xx xx xxxx xx diff --git a/cholerab/bling/krebs_42.svg b/cholerab/bling/krebs_42.svg new file mode 100644 index 00000000..4bf9a2b1 --- /dev/null +++ b/cholerab/bling/krebs_42.svg @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + id="svg2876" + version="1.1" + inkscape:version="0.47 r22583" + width="891" + height="743" + sodipodi:docname="krebs_plain.svg"> + <metadata + id="metadata2882"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs2880"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 0.5 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="1 : 0.5 : 1" + inkscape:persp3d-origin="0.5 : 0.33333333 : 1" + id="perspective2884" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1436" + inkscape:window-height="856" + id="namedview2878" + showgrid="false" + inkscape:snap-to-guides="true" + inkscape:snap-grids="true" + inkscape:snap-bbox="true" + inkscape:zoom="0.81830417" + inkscape:cx="267.69326" + inkscape:cy="420.38158" + inkscape:window-x="4" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="svg2876" /> + <path + style="fill:#e4002b;fill-opacity:1" + d="m 244.0219,617.03493 c -0.21558,-0.56245 -0.27058,-11.13745 -0.12223,-23.5 l 0.26974,-22.47737 22,-0.5 22,-0.5 0.26031,-44.76841 0.26031,-44.7684 23.23969,0.2684 23.23969,0.26841 0.257,67.7787 c 0.20362,53.70074 -0.004,67.87425 -1,68.23871 -2.76038,1.01019 -90.01678,0.97154 -90.40451,-0.04 z" + id="path3699" /> + <path + style="fill:#e4002b;fill-opacity:1" + d="m 382.14297,617.3264 c -0.26297,-0.69786 -0.5896,-41.99384 -0.72584,-91.76884 l -0.24772,-90.5 -68,0 -68,0 -0.5,22.5 -0.5,22.5 -21.97012,0.27012 c -13.36172,0.16427 -22.37364,0.67349 -23,1.29959 -0.67593,0.67568 -1.20172,24.12474 -1.52988,68.22989 l -0.5,67.2004 -21.93,0.27 c -12.06149,0.14851 -22.28992,-0.0899 -22.72984,-0.52984 -0.43992,-0.43992 -0.82782,-31.38642 -0.86202,-68.77 l -0.0622,-67.97016 22.79201,-0.5 22.79201,-0.5 0.5,-46 0.5,-46 45,-0.5 45,-0.5 0,-22 0,-22 -68.5,-0.5 -68.5,-0.5 -0.26044,-44.96044 c -0.1701,-29.364 -0.62018,-45.32106 -1.29748,-46 -0.61887,-0.62038 -9.58642,-1.24117 -22.23955,-1.53956 l -21.20253,-0.5 -0.5,-44.20083 c -0.32035,-28.31979 -0.87003,-44.57056 -1.52988,-45.22989 -0.62605,-0.62554 -9.644729,-1.13497 -23.000009,-1.29916 l -21.97011,-0.27012 0,-46.49999 0,-46.500003 22.5,-0.5 22.499999,-0.5 0.5,-22.5 0.5,-22.500001 23,0 23,0 0.5,69.000001 0.5,68.999993 22.5,0 22.5,0 0.5,-68.999993 0.5,-69.000001 22.5,0 22.5,0 0,114.999994 0,115 -21.20253,0.5 c -13.06388,0.30807 -21.61243,0.91088 -22.27041,1.57041 -0.70812,0.7098 -0.97678,8.28986 -0.79747,22.5 l 0.27041,21.42959 43.93935,0.26065 c 29.90385,0.17739 44.27815,-0.0774 45,-0.79755 0.64951,-0.64801 1.25447,-9.47074 1.56065,-22.76065 l 0.5,-21.70245 21.20125,-0.5 c 15.49421,-0.36541 21.55085,-0.8496 22.5,-1.79875 0.94915,-0.94915 1.43334,-7.00579 1.79875,-22.5 l 0.5,-21.20125 21.4221,-0.27039 c 13.74507,-0.17349 21.89799,-0.66533 22.75,-1.37244 1.86497,-1.54779 1.93794,-42.34431 0.0779,-43.54815 -0.6875,-0.44496 -10.925,-1.03402 -22.75,-1.30902 l -21.5,-0.5 -0.26043,-44.93956 c -0.14323,-24.716769 0.0913,-45.291272 0.52112,-45.721122 0.42985,-0.42985 21.24704,-0.821311 46.26043,-0.869914 l 45.47888,-0.08837 0.5,68.309476 0.5,68.30949 45.5,0 45.5,0 0,-21.5 0,-21.5 -23,-0.5 -23,-0.5 0,-46.49999 0,-46.500005 46.5,0 46.5,0 0.25532,90.903935 c 0.1807,64.33897 0.57702,91.29158 1.35619,92.23042 0.83731,1.0089 6.16306,1.39102 22.24469,1.59606 l 21.1438,0.26958 0.5,21.70245 c 0.30615,13.2884 0.91117,22.11267 1.56054,22.76054 0.72197,0.7203 15.24754,0.97491 45.5,0.79755 l 44.43946,-0.26054 0.27041,-21.42959 c 0.17932,-14.2111 -0.0893,-21.79015 -0.79755,-22.5 -0.66039,-0.66191 -9.35028,-1.26123 -22.77041,-1.57041 l -21.70245,-0.5 -0.5,-44.20083 c -0.32022,-28.30803 -0.87016,-44.57069 -1.52947,-45.22947 -0.62361,-0.62311 -9.494,-1.13529 -22.5,-1.29917 l -21.47053,-0.27053 0,-46.49999 0,-46.500005 22,-0.5 22,-0.5 0.5,-22.5 0.5,-22.500001 23.5,0 23.5,0 0.5,69.000001 0.5,68.999995 22,0 22,0 0.5,-68.999995 0.5,-69.000001 23,0 23,0 0,115.499996 0,115.5 -22.5,0.5 -22.5,0.5 -0.5,45.5 -0.5,45.5 -68.5,0.5 -68.5,0.5 0,22 0,22 45.5,0.5 45.5,0.5 0.5,46 0.5,46 22.5,0.5 22.5,0.5 0,69 0,69 -23,0 -23,0 -0.25705,-67.95705 c -0.17172,-45.39696 -0.60248,-68.30329 -1.29755,-69 -0.62555,-0.62702 -9.69546,-1.24235 -22.74295,-1.54295 l -21.70245,-0.5 -0.27081,-20.92262 c -0.17312,-13.3749 -0.66822,-21.40146 -1.37245,-22.25 -1.53612,-1.85091 -133.80901,-1.97511 -135.65674,-0.12738 -0.9155,0.9155 -1.2,22.47577 -1.2,90.94098 0,49.35754 -0.36973,89.96949 -0.82162,90.24878 -0.45189,0.27928 -10.91439,0.58003 -23.25,0.66833 l -22.42838,0.16054 -0.5,-68.35931 -0.5,-68.35932 -22,0 -22,0 -0.5,68.5 -0.5,68.5 -22.77416,0.26884 c -17.67944,0.20869 -22.88111,-0.015 -23.25228,-1 z" + id="path3697" /> + <path + style="fill:#e4002b;fill-opacity:1" + d="m 567.13302,617.3174 c -0.2648,-0.69275 -0.36494,-31.85984 -0.22253,-69.25984 l 0.25892,-68 23,0 23,0 0.5,45 0.5,45 22,0.5 22,0.5 0,23.5 0,23.5 -45.27747,0.26021 c -35.68808,0.2051 -45.37943,-0.007 -45.75892,-1 z" + id="path2921" /> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Adore64;-inkscape-font-specification:Adore64" + x="152.65131" + y="714.11517" + id="text3744"><tspan + sodipodi:role="line" + id="tspan3746" + x="152.65131" + y="714.11517" + style="font-size:85px;fill:#e4002b;fill-opacity:1">42::/16</tspan></text> +</svg> diff --git a/cholerab/bling/krebs_plain.svg b/cholerab/bling/krebs_plain.svg new file mode 100644 index 00000000..3d048097 --- /dev/null +++ b/cholerab/bling/krebs_plain.svg @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + id="svg2876" + version="1.1" + inkscape:version="0.47 r22583" + width="891" + height="743" + sodipodi:docname="Screen Shot 2011-08-04 at 04.13.20.png"> + <metadata + id="metadata2882"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs2880"> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 0.5 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="1 : 0.5 : 1" + inkscape:persp3d-origin="0.5 : 0.33333333 : 1" + id="perspective2884" /> + </defs> + <sodipodi:namedview + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1" + objecttolerance="10" + gridtolerance="10" + guidetolerance="10" + inkscape:pageopacity="0" + inkscape:pageshadow="2" + inkscape:window-width="1436" + inkscape:window-height="856" + id="namedview2878" + showgrid="false" + inkscape:snap-to-guides="true" + inkscape:snap-grids="true" + inkscape:snap-bbox="true" + inkscape:zoom="0.81830417" + inkscape:cx="445.5" + inkscape:cy="371.5" + inkscape:window-x="4" + inkscape:window-y="0" + inkscape:window-maximized="1" + inkscape:current-layer="svg2876" /> + <path + style="fill:#e4002b;fill-opacity:1" + d="m 244.0219,617.03493 c -0.21558,-0.56245 -0.27058,-11.13745 -0.12223,-23.5 l 0.26974,-22.47737 22,-0.5 22,-0.5 0.26031,-44.76841 0.26031,-44.7684 23.23969,0.2684 23.23969,0.26841 0.257,67.7787 c 0.20362,53.70074 -0.004,67.87425 -1,68.23871 -2.76038,1.01019 -90.01678,0.97154 -90.40451,-0.04 z" + id="path3699" /> + <path + style="fill:#e4002b;fill-opacity:1" + d="m 382.14297,617.3264 c -0.26297,-0.69786 -0.5896,-41.99384 -0.72584,-91.76884 l -0.24772,-90.5 -68,0 -68,0 -0.5,22.5 -0.5,22.5 -21.97012,0.27012 c -13.36172,0.16427 -22.37364,0.67349 -23,1.29959 -0.67593,0.67568 -1.20172,24.12474 -1.52988,68.22989 l -0.5,67.2004 -21.93,0.27 c -12.06149,0.14851 -22.28992,-0.0899 -22.72984,-0.52984 -0.43992,-0.43992 -0.82782,-31.38642 -0.86202,-68.77 l -0.0622,-67.97016 22.79201,-0.5 22.79201,-0.5 0.5,-46 0.5,-46 45,-0.5 45,-0.5 0,-22 0,-22 -68.5,-0.5 -68.5,-0.5 -0.26044,-44.96044 c -0.1701,-29.364 -0.62018,-45.32106 -1.29748,-46 -0.61887,-0.62038 -9.58642,-1.24117 -22.23955,-1.53956 l -21.20253,-0.5 -0.5,-44.20083 c -0.32035,-28.31979 -0.87003,-44.57056 -1.52988,-45.22989 -0.62605,-0.62554 -9.644729,-1.13497 -23.000009,-1.29916 l -21.97011,-0.27012 0,-46.49999 0,-46.500003 22.5,-0.5 22.499999,-0.5 0.5,-22.5 0.5,-22.500001 23,0 23,0 0.5,69.000001 0.5,68.999993 22.5,0 22.5,0 0.5,-68.999993 0.5,-69.000001 22.5,0 22.5,0 0,114.999994 0,115 -21.20253,0.5 c -13.06388,0.30807 -21.61243,0.91088 -22.27041,1.57041 -0.70812,0.7098 -0.97678,8.28986 -0.79747,22.5 l 0.27041,21.42959 43.93935,0.26065 c 29.90385,0.17739 44.27815,-0.0774 45,-0.79755 0.64951,-0.64801 1.25447,-9.47074 1.56065,-22.76065 l 0.5,-21.70245 21.20125,-0.5 c 15.49421,-0.36541 21.55085,-0.8496 22.5,-1.79875 0.94915,-0.94915 1.43334,-7.00579 1.79875,-22.5 l 0.5,-21.20125 21.4221,-0.27039 c 13.74507,-0.17349 21.89799,-0.66533 22.75,-1.37244 1.86497,-1.54779 1.93794,-42.34431 0.0779,-43.54815 -0.6875,-0.44496 -10.925,-1.03402 -22.75,-1.30902 l -21.5,-0.5 -0.26043,-44.93956 c -0.14323,-24.716769 0.0913,-45.291272 0.52112,-45.721122 0.42985,-0.42985 21.24704,-0.821311 46.26043,-0.869914 l 45.47888,-0.08837 0.5,68.309476 0.5,68.30949 45.5,0 45.5,0 0,-21.5 0,-21.5 -23,-0.5 -23,-0.5 0,-46.49999 0,-46.500005 46.5,0 46.5,0 0.25532,90.903935 c 0.1807,64.33897 0.57702,91.29158 1.35619,92.23042 0.83731,1.0089 6.16306,1.39102 22.24469,1.59606 l 21.1438,0.26958 0.5,21.70245 c 0.30615,13.2884 0.91117,22.11267 1.56054,22.76054 0.72197,0.7203 15.24754,0.97491 45.5,0.79755 l 44.43946,-0.26054 0.27041,-21.42959 c 0.17932,-14.2111 -0.0893,-21.79015 -0.79755,-22.5 -0.66039,-0.66191 -9.35028,-1.26123 -22.77041,-1.57041 l -21.70245,-0.5 -0.5,-44.20083 c -0.32022,-28.30803 -0.87016,-44.57069 -1.52947,-45.22947 -0.62361,-0.62311 -9.494,-1.13529 -22.5,-1.29917 l -21.47053,-0.27053 0,-46.49999 0,-46.500005 22,-0.5 22,-0.5 0.5,-22.5 0.5,-22.500001 23.5,0 23.5,0 0.5,69.000001 0.5,68.999995 22,0 22,0 0.5,-68.999995 0.5,-69.000001 23,0 23,0 0,115.499996 0,115.5 -22.5,0.5 -22.5,0.5 -0.5,45.5 -0.5,45.5 -68.5,0.5 -68.5,0.5 0,22 0,22 45.5,0.5 45.5,0.5 0.5,46 0.5,46 22.5,0.5 22.5,0.5 0,69 0,69 -23,0 -23,0 -0.25705,-67.95705 c -0.17172,-45.39696 -0.60248,-68.30329 -1.29755,-69 -0.62555,-0.62702 -9.69546,-1.24235 -22.74295,-1.54295 l -21.70245,-0.5 -0.27081,-20.92262 c -0.17312,-13.3749 -0.66822,-21.40146 -1.37245,-22.25 -1.53612,-1.85091 -133.80901,-1.97511 -135.65674,-0.12738 -0.9155,0.9155 -1.2,22.47577 -1.2,90.94098 0,49.35754 -0.36973,89.96949 -0.82162,90.24878 -0.45189,0.27928 -10.91439,0.58003 -23.25,0.66833 l -22.42838,0.16054 -0.5,-68.35931 -0.5,-68.35932 -22,0 -22,0 -0.5,68.5 -0.5,68.5 -22.77416,0.26884 c -17.67944,0.20869 -22.88111,-0.015 -23.25228,-1 z" + id="path3697" /> + <path + style="fill:#e4002b;fill-opacity:1" + d="m 567.13302,617.3174 c -0.2648,-0.69275 -0.36494,-31.85984 -0.22253,-69.25984 l 0.25892,-68 23,0 23,0 0.5,45 0.5,45 22,0.5 22,0.5 0,23.5 0,23.5 -45.27747,0.26021 c -35.68808,0.2051 -45.37943,-0.007 -45.75892,-1 z" + id="path2921" /> +</svg> diff --git a/cholerab/cholerab-live/README b/cholerab/cholerab-live/README new file mode 100644 index 00000000..b778b98c --- /dev/null +++ b/cholerab/cholerab-live/README @@ -0,0 +1,6 @@ + +view.py: contains view classes for cholerab +cholerab.py: main file + +start with : +python cholerab.py diff --git a/cholerab/cholerab-live/chol_net.py b/cholerab/cholerab-live/chol_net.py new file mode 100644 index 00000000..ee0f5378 --- /dev/null +++ b/cholerab/cholerab-live/chol_net.py @@ -0,0 +1,82 @@ +from socket import socket, AF_INET,SOCK_DGRAM,IPPROTO_UDP,SOL_SOCKET,SO_REUSEADDR,IP_MULTICAST_TTL,IP_MULTICAST_LOOP,INADDR_ANY,inet_aton,IP_ADD_MEMBERSHIP,IPPROTO_IP +import struct +import threading +import logging +log = None +from select import select +GROUP = '224.110.42.23' +PORT = 42023 +log = logging.getLogger('CholerabNet') +class CholerabMulicastNet(threading.Thread): + def __init__(self,cholerab,group=GROUP,port=PORT): + threading.Thread.__init__(self) + self.cholerab=cholerab + self.group=group + self.port=port + self.initSocket() + def send_char(self,x,y,char): + """ translates given params into network message """ + self.send_mc("%s %d %d" %(str(ord(char)),x,y)) + def send_mc(self,arg): + """ Sends message via multicast""" + try: + log.debug("Sending '%s' to %s:%d" % (arg,self.group,self.port)) + self.ignore_next += 1# we need this to work together correctly with reused sockets + self.s.sendto("%s" % arg,0,(self.group,self.port)) + except Exception ,e: + self.ignore_next -=1 + log.error("IN send_mc:%s"%str(e)) + + def initSocket (self,rcv=1): + ''' Initializes a Multicast socket ''' + host = '' + log.debug("Setting up Multicast Socket") + self.s = socket(AF_INET,SOCK_DGRAM, IPPROTO_UDP) + self.s.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) + self.s.setsockopt(IPPROTO_IP, IP_MULTICAST_TTL, 32) + self.s.setsockopt(IPPROTO_IP,IP_MULTICAST_LOOP,1) # we do not want our own packets to be replayed + if rcv==1: + log.debug("Configuring for Read AND Write") + self.s.bind((host,PORT)) + mreq = struct.pack("4sl", inet_aton(GROUP), INADDR_ANY) + self.s.setsockopt(IPPROTO_IP,IP_ADD_MEMBERSHIP,mreq) + def run(self): + self.running = 1 + self.ignore_next = 0 + while self.running: + # break if we do not want to loop on + ready,output,exception = select([self.s],[],[],1) # try every second + for r in ready: + if r == self.s: + log.debug(str(self.ignore_next)) + (data,addr) = self.s.recvfrom(1024) + if not self.ignore_next: + log.debug("Received Data from %s, data %s"%(str(addr),str(data))) + self.receive_net(addr,data) + else: + self.ignore_next -= 1 + + def send_stupid(self,addr): + """ sends YOU ARE MADE OF STUPID to the right host """ + #TODO implement me + pass + + def receive_net(self,addr,data): + """ resolves which nick sent the message + TODO handle user resolution in mulicast """ + try: + address,port = addr + arr = str(data).split() + char = arr[0] + x = arr[1] + y = arr[2] + self.cholerab.write_char(int(x),int(y),chr(int(char))) + except Exception, e: + log.error("Triggered YOU ARE MADE OF STUPID: %s" % str(e)) + self.send_stupid(addr) + + def stop(self): + ''' + stops the whole treading stuff gracefully + ''' + self.running=0 diff --git a/cholerab/cholerab-live/chol_net.pyc b/cholerab/cholerab-live/chol_net.pyc Binary files differnew file mode 100644 index 00000000..0694ad6d --- /dev/null +++ b/cholerab/cholerab-live/chol_net.pyc diff --git a/cholerab/cholerab-live/cholerab.py b/cholerab/cholerab-live/cholerab.py new file mode 100755 index 00000000..eb9e66df --- /dev/null +++ b/cholerab/cholerab-live/cholerab.py @@ -0,0 +1,36 @@ +#!/usr/bin/python2 +# -*- coding: utf-8 -*- +import curses,time +from view import CursesView +from chol_net import CholerabMulicastNet +import logging +logging.basicConfig(filename='here.log',level=logging.DEBUG) +log = logging.getLogger('main') +class Cholerab: + def __init__(self): + self.view = CursesView(cholerab=self) + self.transport = CholerabMulicastNet(cholerab=self) + def send_char(self,x,y,char): + log.info("Sending %s at (%d,%d) to connected peers" %(char,x,y)) + self.transport.send_char(x,y,char) + + def write_char(self,x,y,char): + log.info("Writing %s at (%d,%d) to view" %(char,x,y)) + self.view.write_char(x,y,char,user=2) + def stop(self): + self.view.stop() + self.transport.stop() + def main(self): + self.view.start() + self.transport.start() + self.view.join() + #after view dies, kill the transport as well + self.transport.stop() + self.transport.join() +def main(): + log.debug('started main') + chol = Cholerab() + chol.main() + +if __name__ == "__main__": + main() diff --git a/cholerab/cholerab-live/view.py b/cholerab/cholerab-live/view.py new file mode 100644 index 00000000..6a75f655 --- /dev/null +++ b/cholerab/cholerab-live/view.py @@ -0,0 +1,112 @@ +#!/usr/bin/python2 + +from curses import * +import socket +import threading +import logging +log = logging.getLogg |