diff options
author | root <root@krebs> | 2011-09-09 18:20:34 +0200 |
---|---|---|
committer | root <root@krebs> | 2011-09-09 18:20:34 +0200 |
commit | 176c9ac08ad9c2ddc430b2d1a194f6be41115f5b (patch) | |
tree | 82ea214ff1d45799099576e4ff007c34a6b7c990 | |
parent | dac9eb2553987778500e0bc7e54ad2a28124969d (diff) | |
parent | 150ce5757d2982da740bd9ce2b44b57b6d2831c6 (diff) |
Merge branch 'master' of github.com:krebscode/painload
-rwxr-xr-x | god/Reaktor/index | 6 | ||||
-rwxr-xr-x | gold/mining/bin/archlinux-cruise-control | 13 | ||||
-rwxr-xr-x | json/sh/json.sh | 14 | ||||
-rwxr-xr-x | noise/noise | 8 | ||||
-rwxr-xr-x | retiolum/bin/hosts | 4 | ||||
-rwxr-xr-x | retiolum/bin/ipv6 | 2 | ||||
-rwxr-xr-x | retiolum/bin/update_tinc_hosts | 6 | ||||
-rw-r--r-- | retiolum/hosts/sir_krebs_a_lot | 11 | ||||
-rwxr-xr-x | retiolum/scripts/tinc_setup/tinc-up | 6 | ||||
-rwxr-xr-x | util/bin/anonbox.net | 8 | ||||
-rwxr-xr-x | util/bin/dict.leo.org | 36 | ||||
-rwxr-xr-x | util/bin/my-global-ipv4-addr | 3 | ||||
-rwxr-xr-x | util/bin/naturalvoices.att | 4 | ||||
-rwxr-xr-x | util/bin/translate.google | 4 |
14 files changed, 76 insertions, 49 deletions
diff --git a/god/Reaktor/index b/god/Reaktor/index index fdf6bffc..a7840bb2 100755 --- a/god/Reaktor/index +++ b/god/Reaktor/index @@ -27,11 +27,13 @@ fi cd tmp/jsb-$jsb_version # TODO only if it is not already configured properly -sed -i ' +cache="`cat config/udp-send`" +echo "$cache" | +sed ' s/^host *=.*/host="'$host'"/ s/^passwd *=.*/passwd="'$passwd'"/ s/^printto *=.*/printto="'$printto'"/ -' config/udp-send +' > config/udp-send # TODO output modules: stderr, jsb-udp, remount-ro, ... PYTHONUNBUFFERED=y $listener | tee /dev/stderr | bin/jsb-udp diff --git a/gold/mining/bin/archlinux-cruise-control b/gold/mining/bin/archlinux-cruise-control index de5a0fa4..ba1c35da 100755 --- a/gold/mining/bin/archlinux-cruise-control +++ b/gold/mining/bin/archlinux-cruise-control @@ -4,7 +4,7 @@ export EDITOR=vim echo "!! ARCHLINUX Cruise Control Mining installer !!" echo "** adding main network profile" cp /etc/network.d/examples/ethernet-dhcp /etc/network.d/main -echo 'POST_UP="sed -i \"1i nameserver 8.8.8.8\" /etc/resolv.conf"' >> /etc/network.d/main +echo 'POST_UP="cache=\"\$(cat /etc/resolv.conf)\"; echo \"\$cache\" | sed \"1i nameserver 8.8.8.8\" > /etc/resolv.conf"' >> /etc/network.d/main echo "** adding worker account" grep -q worker /etc/passwd || adduser worker gpasswd -a worker wheel @@ -25,7 +25,9 @@ echo "syntax on" > /home/worker/.vimrc echo "syntax on" > /root/.vimrc echo "** installing tinc" [ "`yaourt -Q tinc`" ] || yaourt -S --noconfirm tinc -sed -i -e 's/.*\%wheel.*/%wheel ALL=(ALL) NOPASSWD: ALL/1' /etc/sudoers +cache="`cat /etc/sudoers`" +echo "$cache" | +sed 's/.*\%wheel.*/%wheel ALL=(ALL) NOPASSWD: ALL/1' > /etc/sudoers echo "** Installing ATI drivers" [ "`yaourt -Q catalyst-utils`" ] || yaourt -S --noconfirm catalyst-utils [ "`yaourt -Q catalyst-hook`" ] || yaourt -S --noconfirm catalyst-hook @@ -33,8 +35,11 @@ echo "** Installing ATI drivers" echo "** installing X" pacman --needed -S --noconfirm xorg-server xorg-apps xorg-appres xorg-xinit xautolock xlockmore xorg-fonts xorg-xhost xorg-xauth xterm rxvt-unicode fluxbox slim echo "** editing slim configuration" -sed -i 's/.*default_user.*/default_user worker/' /etc/slim.conf -sed -i 's/.*auto_login.*/auto_login yes/' /etc/slim.conf +cache="`cat /etc/slim.conf`" +echo "$cache" | sed ' + s/.*default_user.*/default_user worker/ + s/.*auto_login.*/auto_login yes/ +' > /etc/slim.conf echo "** Installing mining tools and overclocking stuff" [ "`yaourt -Q phoenix-miner-svn`" ] || yaourt -S --noconfirm phoenix-miner-svn echo "!! warning, you might need to adjust the version number of AMDOverdriveCTRL !!" diff --git a/json/sh/json.sh b/json/sh/json.sh index 2a64d371..79f8529a 100755 --- a/json/sh/json.sh +++ b/json/sh/json.sh @@ -6,23 +6,23 @@ set -euf # XXX json_key is something like PWD^^ normalize_json() { - sed -rn ' + sed -n ' 1s/^/cat<<EOF\n/ # TODO handle escaped double quotes - s/"[^"]+"/"$(echo -n & | base64)"/g + s/"[^"]\+"/"$(echo -n & | base64)"/g $s/$/\nEOF/ p ' | sh | tr -d '[:space:]' } json_to_sh() { - sed -rn ' + sed -n ' s/,/;/g s/\[/begin_json_array;/g; s/\]/end_json_array;/g s/\{/begin_json_object;/g; s/\}/end_json_object;/g - s/("[^"]+"):/json_set_key \1;/g - s/;("[^"]+")/;json_set string \1;/g - s/;([0-9.]+)/;json_set number `echo -n \1 | base64`;/g + s/\("[^"]\+"\):/json_set_key \1;/g + s/;\("[^"]\+"\)/;json_set string \1;/g + s/;\([0-9.]\+\)/;json_set number `echo -n \1 | base64`;/g s/;;/;/g s/;/\n/g p @@ -37,7 +37,7 @@ end_json_object() { pop_key # TODO check if is %%%MAKEJSONOBJ%%% #echo obj: $1 `set | sed -rn "s/^(${json_key}_[a-zA-Z]+)_VALUE=(.*)/\1/p"` >&2 #json_set object "`set | sed -rn "s/^(${json_key}_[a-zA-Z]+)_VALUE=(.*)/\1/p"`" - json_set object "`set | sed -rn "s/^(${json_key}_[a-zA-Z]+)=(.*)/\1/p"`" + json_set object "`set | sed -n "s/^\(${json_key}_[a-zA-Z]\+\)=\(.*\)/\1/p"`" } begin_json_array() { :; } end_json_array() { :; } diff --git a/noise/noise b/noise/noise index 99a08023..615277a6 100755 --- a/noise/noise +++ b/noise/noise @@ -31,8 +31,8 @@ noise_set() { # set a variable fi ## write variable to $env if grep -q "^$1=" "$env" ; then - env_cache="`cat $env`" - echo "$env_cache" | + cache="`cat $env`" + echo "$cache" | sed "s'^\($1\)=\(.*\)\$'\1=\'$2\''" > $env else echo "$1='$2'" >>$env @@ -49,7 +49,9 @@ noise_unset() { # unset a variable case $# in (1) ## unset "noise_$1" - sed -ni "/^$1=/!p" $env + cache="`cat $env`" + echo "$cache" | + sed -n "/^$1=/!p" > $env ;; (*) fail "broken commandline: $@" diff --git a/retiolum/bin/hosts b/retiolum/bin/hosts index 6939f52c..bd0c77dc 100755 --- a/retiolum/bin/hosts +++ b/retiolum/bin/hosts @@ -6,6 +6,8 @@ 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 + sed -n ' + s|^ *Subnet *= *\([^ /]*\)\(/[0-9]*\)\? *$|\1\t'$i' '$i'.'$netname'|p + ' $i done | sort diff --git a/retiolum/bin/ipv6 b/retiolum/bin/ipv6 index 65a1eaa1..34c6de71 100755 --- a/retiolum/bin/ipv6 +++ b/retiolum/bin/ipv6 @@ -13,7 +13,7 @@ if test `id -u` != 0; then fi file=/etc/tinc/retiolum/hosts/`hostname` -addr=`sed -rn 's|^Subnet *= *(42:[0-9A-Fa-f:]*/128)|\1|p' $file` +addr=`sed -n 's|^Subnet *= *\(42:[0-9A-Fa-f:]*/128\)|\1|p' $file` route=42::/16 start() { diff --git a/retiolum/bin/update_tinc_hosts b/retiolum/bin/update_tinc_hosts index fe0785e3..86a28992 100755 --- a/retiolum/bin/update_tinc_hosts +++ b/retiolum/bin/update_tinc_hosts @@ -29,9 +29,13 @@ case "${*-I am made of stupid}" in ;; ('create magic') $0 has magic || $0 print magic >> $hosts < /dev/null + $0 start ;; ('destroy magic') - $0 has magic && sed -ie "/^$bs$/,/^$es$/d" $hosts + if $0 has magic; then + cache="`cat $hosts`" + echo "$cache" | sed "/^$bs$/,/^$es$/d" > $hosts + fi ;; ('has magic') grep -q "^$bs$" $hosts && grep -q "^$es$" $hosts diff --git a/retiolum/hosts/sir_krebs_a_lot b/retiolum/hosts/sir_krebs_a_lot new file mode 100644 index 00000000..14e9d242 --- /dev/null +++ b/retiolum/hosts/sir_krebs_a_lot @@ -0,0 +1,11 @@ +Address = 84.23.79.81 +Subnet = 10.7.7.100 +Subnet = 42:48bd:f4cd:b2f1:ff6b:865c:d041:def6/128 +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEAzkVF0BSWUEqzdUidLTa6qL4wlNSb8gaxyZperzoAj65d5l25SCqc +jjqvREcE6p+jM4t1STXoohnNvexubNXW3PVo5Zpew+BsaGjVvow0LkqCJ9k96Rrk +JzU5lAVH6om3/QYws/Ot0zq1Z/+Xw/0+9JpVKhEipMWLpLgjAvWdvzSW6aBIHVN1 +3E85fkTE5f0azct+XNSNzUebdyIy8wu/EexGmFI9bN+ewIvqjZJdvxP+Ank55MsE +8P7K9TKwVXw440MGqqoQaOhdaT75TL+2nsAfWYcrNnE3YehMOmCMp9oY+RAvsIkK +iAYyF5l7ZTi/7KGHNsG7rr0cbytiz2nS6wIDAQAB +-----END RSA PUBLIC KEY----- diff --git a/retiolum/scripts/tinc_setup/tinc-up b/retiolum/scripts/tinc_setup/tinc-up index ae7c68e6..9a557787 100755 --- a/retiolum/scripts/tinc_setup/tinc-up +++ b/retiolum/scripts/tinc_setup/tinc-up @@ -4,15 +4,15 @@ dirname="`dirname "$0"`" conf=$dirname/tinc.conf -name=`sed -rn 's|^ *Name *= *([^ ]*) *$|\1|p' $conf` +name=`sed -n 's|^ *Name *= *\([^ ]*\) *$|\1|p' $conf` host=$dirname/hosts/$name route4=10.7.7.0/24 -addr4=`sed -rn 's|^ *Subnet *= *(10\.[^ ]*) *$|\1|p' $host` +addr4=`sed -n 's|^ *Subnet *= *\(10\.[^ ]*\) *$|\1|p' $host` route6=42::/16 -addr6=`sed -rn 's|^ *Subnet *= *(42:[^ ]*) *$|\1|p' $host` +addr6=`sed -n 's|^ *Subnet *= *\(42:[^ ]*\) *$|\1|p' $host` ifconfig $INTERFACE up $addr4 route add -net $route4 dev $INTERFACE diff --git a/util/bin/anonbox.net b/util/bin/anonbox.net index d038cd0a..3b648afb 100755 --- a/util/bin/anonbox.net +++ b/util/bin/anonbox.net @@ -13,12 +13,12 @@ GET() { ## retrieve data eval "$(${GET-GET} | - sed -rn ' -s^<dd><p>([[:alnum:]@.]+)</p></dd>$\ + sed -n ' +s^<dd><p>\([[:alnum:]@.]\+\)</p></dd>$\ email="\1" ; p -s^<dd><p><a href="([^"\\]+)">.*</a></p></dd>$\ +s^<dd><p><a href="\([^"\\]\+\)">.*</a></p></dd>$\ uri="\1/" ; p -s^<dd><p>([0-9]+)/([0-9]+)/([0-9]+) ([0-9]+):([0-9]+) ([ap]).m.</p></dd>$\ +s^<dd><p>\([0-9]\+\)/\([0-9]\+\)/\([0-9]\+\) \([0-9]\+\):\([0-9]\+\) \([ap]\).m.</p></dd>$\ Y=20\3 ; \ m=\1 ; \ d=\2 ; \ diff --git a/util/bin/dict.leo.org b/util/bin/dict.leo.org index 6a9d9669..03f16b96 100755 --- a/util/bin/dict.leo.org +++ b/util/bin/dict.leo.org @@ -14,7 +14,7 @@ if test -d "$cache_dir" ; then else curl --silent "$url" fi | -sed 's/>\( *.\)/>\n\1/g' | sed -rn ' +sed 's/>\( *.\)/>\n\1/g' | sed -n ' s/[[:space:]]/ /g /<!-- # Werbung # -->/,/<\/td>/b /<!-- ============================================== -->/,/^<\/td>/b @@ -23,7 +23,7 @@ sed 's/>\( *.\)/>\n\1/g' | sed -rn ' /<div id="divMoreInfo" class="popup">/,/^ <\/table>/b ## show link in rendered version - s/^<a href="(.*searchLocRelinked.*)">$/&mehr: \1/ + s/^<a href="\(.*searchLocRelinked.*\)">$/&mehr: \1/ s/^mehr >>// s/<[Bb][Rr] *\/>/,/g @@ -36,34 +36,34 @@ sed 's/>\( *.\)/>\n\1/g' | sed -rn ' s/.*/<!--(&)-->/ p ' \ -| w3m -cols 1024 -T text/html -dump | sed -r ' - s/[[:space:]]+/ /g +| w3m -cols 1024 -T text/html -dump | sed ' + s/[[:space:]]\+/ /g s/ ,/,/g s/^ //;s/ $// s/[┌┬┐└┴┘├┼┤─]//g s/ *│ */|/g s/\[ \]// s/\[Speichern\] der ausgewa:hlten Wo:rter im Trainer// - s/^\|\|//;s/\|\| ?$// -' | sed -rn ' + s/^||//;s/|| \?$// +' | sed -n ' /^\[EN-> DE\]/,$b s/^mehr: /+ / - s/^ENGLISCH\|\|DEUTSCH ?/= Englisch -> Deutsch/ - s/^\|([0-9]+) (Treffer)\|$/= \1 \2/ - s/^([^|]+)\|\|([^|]+)$/- \1|\2/ + s/^ENGLISCH||DEUTSCH \?/= Englisch -> Deutsch/ + s/^|\([0-9]\+\) \(Treffer\)|$/= \1 \2/ + s/^\([^|]\+\)||\([^|]\+\)$/- \1|\2/ - s/^[^=+#-][^|]+$/## &/ + s/^[^=+#-][^|]\+$/## &/ p -' | sed -rn ' +' | sed -n ' /^$/b - s/ ([?!])/\1/g - s/([[(]) /\1/g;s/ ([])])/\1/g + s/ \([?!]\)/\1/g + s/\([[(]\) /\1/g;s/ \([]\)]\)/\1/g - s/ \([0-9]+ of [0-9]+\) ?//;# TODO + s/ ([0-9]\+ of [0-9]\+) \?//;# TODO #s/^##.*Grundform.*/\n#&/ - /^## .*Grundform.*/,/^##( .*)?/{ + /^## .*Grundform.*/,/^##\( .*\)\?/{ /##/{/Grundform/!p} b } @@ -71,13 +71,13 @@ sed 's/>\( *.\)/>\n\1/g' | sed -rn ' /^## Informationen /,$b;# TODO #/^## Beispiele/,$b;# TODO #/^## Wendungen/,$b;# TODO - /^\+/b;# TODO + /^+/b;# TODO #/^=/b;# TODO p -' | sed -r ' +' | sed ' ## - s/\|(.*)/\n [32m\1[m/g + s/|\(.*\)/\n [32m\1[m/g s/^#.*/\n[33m&[m/ s/##.*Treffer $/\n[1;33m#&[m/ diff --git a/util/bin/my-global-ipv4-addr b/util/bin/my-global-ipv4-addr index 305d3f80..71608a8a 100755 --- a/util/bin/my-global-ipv4-addr +++ b/util/bin/my-global-ipv4-addr @@ -8,7 +8,8 @@ if test $# = 1; then has() { type "$1" 1>/dev/null 2>/dev/null; } parse() { - sed -rn 's/.*((1?[0-9][0-9]|2[0-5][0-9])\.(1?[0-9][0-9]|2[0-5][0-9])\.(1?[0-9][0-9]|2[0-5][0-9])\.(1?[0-9][0-9]|2[0-5][0-9])).*/\1/p' | grep . + sed -n 's/.*\(\(1\?[0-9][0-9]\|2[0-5][0-9]\)\.\(1\?[0-9][0-9]\|2[0-5][0-9]\)\.\(1\?[0-9][0-9]\|2[0-5][0-9]\)\.\(1\?[0-9][0-9]\|2[0-5][0-9]\)\).*/\1/p' | + grep . } get () { # TODO get random valid user agent diff --git a/util/bin/naturalvoices.att b/util/bin/naturalvoices.att index 9a944d8b..07fb6e17 100755 --- a/util/bin/naturalvoices.att +++ b/util/bin/naturalvoices.att @@ -24,8 +24,8 @@ done (cd "$pwd/../.." && git submodule update --init) { - for arg; do echo "$arg"; done | sed -rn ' - s/^--(.*=.*)/\1/p;t + for arg; do echo "$arg"; done | sed -n ' + s/^--\(.*=.*\)/\1/p;t s/.*/text="${text+$text }&"/p;t ' cat<<EOF diff --git a/util/bin/translate.google b/util/bin/translate.google index 1a1be6b6..45da6463 100755 --- a/util/bin/translate.google +++ b/util/bin/translate.google @@ -19,8 +19,8 @@ done (cd "$pwd/../.." && git submodule update --init) { - for arg; do echo "$arg"; done | sed -rn ' - s/^--(.*=.*)/\1/p;t + for arg; do echo "$arg"; done | sed -n ' + s/^--\(.*=.*\)/\1/p;t s/.*/text="${text+$text }&"/p;t ' cat<<EOF |