From 2ac79fe340b28b10d37bb2f9c0c846fc82653a81 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 3 Apr 2013 10:07:48 -0400 Subject: add build time --- retiolum/scripts/adv_graphgen/parse_tinc_anon.py | 2 ++ retiolum/scripts/adv_graphgen/parse_tinc_stats.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_anon.py b/retiolum/scripts/adv_graphgen/parse_tinc_anon.py index 21c36e0f..82ee2f2e 100755 --- a/retiolum/scripts/adv_graphgen/parse_tinc_anon.py +++ b/retiolum/scripts/adv_graphgen/parse_tinc_anon.py @@ -52,11 +52,13 @@ def write_stat_node(nodes): ''' Write a `stats` node in the corner This node contains infos about the current number of active nodes and connections inside the network ''' + from time import localtime,strftime num_conns = 0 num_nodes = len(nodes) for k,v in nodes.iteritems(): num_conns+= len(v['to']) node_text = " stats_node [shape=box,label=\"Statistics\\l" + node_text += "Build Date : %s\\l" % strftime("%Y-%m-%d %H:%M:%S",localtime()) node_text += "Active Nodes: %s\\l" % num_nodes node_text += "Connections : %s\\l" % num_conns node_text += "\"" diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py index e5bd96a8..e6a67e2c 100755 --- a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py +++ b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py @@ -54,6 +54,7 @@ def write_stat_node(nodes): ''' Write a `stats` node in the corner This node contains infos about the current number of active nodes and connections inside the network ''' + from time import localtime,strftime num_conns = 0 num_nodes = len(nodes) try: @@ -64,6 +65,7 @@ def write_stat_node(nodes): for k,v in nodes.iteritems(): num_conns+= len(v['to']) node_text = " stats_node [label=\"Statistics\\l" + node_text += "Build Date : %s\\l" % strftime("%Y-%m-%d %H:%M:%S",localtime()) node_text += "Active Nodes: %s\\l" % num_nodes node_text += "Connections : %s\\l" % num_conns node_text += "\"" @@ -172,8 +174,8 @@ def write_node(k,v): if v.has_key('num_conns'): node += "Num Connects:"+str(v['num_conns'])+"\\l" node += "external:"+v['external-ip']+":"+v['external-port']+"\\l" - for addr in v.get('internal-ip',['¯\\\\(°_o)/¯']): - node += "internal:"+addr+"\\l" + for addr in v.get('internal-ip',['dunno lol']): #['¯\\\\(°_o)/¯']): + node += "internal:%s\\l"%addr node +="\"" # warning if node only has one connection -- cgit v1.2.3 From 5a6a263564129d4c441938ef35e9c6c6da60b20e Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 3 Apr 2013 10:11:16 -0400 Subject: add graphite stats support --- retiolum/scripts/github_listener/github_listener.conf | 1 + retiolum/scripts/github_listener/handle_request | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/retiolum/scripts/github_listener/github_listener.conf b/retiolum/scripts/github_listener/github_listener.conf index c4f0a8b6..3ab07a21 100644 --- a/retiolum/scripts/github_listener/github_listener.conf +++ b/retiolum/scripts/github_listener/github_listener.conf @@ -3,3 +3,4 @@ command=nc -lvv -p 5432 -c "./handle_request /opt/github_listener/retiolum/hosts user=tinc directory=/krebs/retiolum/scripts/github_listener/ autorestart=true +environment=GRAPHITE_HOST=no_omo diff --git a/retiolum/scripts/github_listener/handle_request b/retiolum/scripts/github_listener/handle_request index 5b42524a..211ca776 100755 --- a/retiolum/scripts/github_listener/handle_request +++ b/retiolum/scripts/github_listener/handle_request @@ -2,11 +2,15 @@ # Possible Shell Vars # WEBDIR # HOSTFOLDER + set -euf +export GRAPHITE_HOST=${GRAPHITE_HOST:-no_omo} +PATH=$PATH:../../../util/bin if [ "x${2:-}" = x ];then echo "usage: $0 HOSTDIRECTORY WEBDIRECTORY" exit 1 fi +NOW=$(timer) export HOSTDIR=${1:-../../hosts} WEBDIR=${2:-/var/www/euer.krebsco.de/retiolum/} echo "sorry for keeping you waiting, please be patient" @@ -20,4 +24,5 @@ cd - >&2 ../../bin/create-supernode-tar $WEBDIR echo "almost done..." ../../bin/create-host-tar $WEBDIR -echo "Thank you for your patience!" +echo "Thank you for your patience! I stole $(timer $NOW)ms of your time, sorry about that." +graphitec 'retiolum.pack.build_time' $(timer $NOW) -- cgit v1.2.3 From 35acaff77b9495fc7f10dd4312e2173de21d26ca Mon Sep 17 00:00:00 2001 From: makefu Date: Thu, 4 Apr 2013 10:06:57 -0400 Subject: fix file traps --- retiolum/scripts/adv_graphgen/anonytize.sh | 3 +-- retiolum/scripts/adv_graphgen/sanitize.sh | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/retiolum/scripts/adv_graphgen/anonytize.sh b/retiolum/scripts/adv_graphgen/anonytize.sh index 2e2045e4..4aad6993 100755 --- a/retiolum/scripts/adv_graphgen/anonytize.sh +++ b/retiolum/scripts/adv_graphgen/anonytize.sh @@ -10,7 +10,7 @@ TYPE=svg TYPE2=png OPENER=/bin/true DOTFILE=`mktemp --suffix=anon` -trap 'rm $DOTFILE' INT TERM KILL +trap 'rm $DOTFILE' INT TERM KILL EXIT sudo -E python tinc_stats2json |\ python parse_tinc_anon.py> $DOTFILE @@ -28,4 +28,3 @@ convert $1/retiolum_1.$TYPE $1/retiolum_1.$TYPE2 #convert -resize 20% $1/retiolum_2.$TYPE $1/retiolum_2.$TYPE2 #convert -resize 20% $1/retiolum_3.$TYPE $1/retiolum_3.$TYPE2 #convert -resize 20% $1/retiolum_4.$TYPE $1/retiolum_4.$TYPE2 -rm $DOTFILE diff --git a/retiolum/scripts/adv_graphgen/sanitize.sh b/retiolum/scripts/adv_graphgen/sanitize.sh index 846cc549..c8071dc3 100755 --- a/retiolum/scripts/adv_graphgen/sanitize.sh +++ b/retiolum/scripts/adv_graphgen/sanitize.sh @@ -10,7 +10,7 @@ TYPE=svg TYPE2=png OPENER=/bin/true DOTFILE=`mktemp --suffix=san` -trap 'rm $DOTFILE' INT TERM KILL +trap 'rm $DOTFILE' INT TERM KILL EXIT sudo -E python tinc_stats2json |\ python parse_tinc_stats.py > $DOTFILE -- cgit v1.2.3 From fcbbb6d3691ef67fc7845212f09e064634cf49f1 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 4 Apr 2013 16:39:59 +0200 Subject: retiolum/hosts: add machine --- retiolum/hosts/machine | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 retiolum/hosts/machine diff --git a/retiolum/hosts/machine b/retiolum/hosts/machine new file mode 100644 index 00000000..4927fc84 --- /dev/null +++ b/retiolum/hosts/machine @@ -0,0 +1,11 @@ +Subnet = 10.243.60.31 +Subnet = 42:698d:4e02:4d70:b080:acdd:513d:70aa + +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEAvkLboZ6wRALd++ntUXfyzCT9G1pWSJNJhrdut8dPfz/+IIbx4thz +tbq5apWQRaHj6IILMiQqpfUkhbfz3WS2YP62f8nAzKLKB0zzRAJ1lQjoZOXQseQJ +Ydyf9dEDhRtnSnOwsmSDEch/2KhgCj+fdMcnbcoAg3PYJGzsz2ykEtoh80Rv1IQa +tW285CP2GooRp1gwy3WKL6at/uW6D4/tTIimHML5JbLKj7mH+3nOyrhRGyZP1b9s +XtdkePuaQKrIjmv4rEIYx2taFmmQp7XpC2m4Vdoy7WdIzR3WTgWo546IOygY1KIW +fDOH+3UoG5oI6y4hNNa7+NH8DpmdtzXYnQIDAQAB +-----END RSA PUBLIC KEY----- -- cgit v1.2.3 From 63cd8fed9e012340ad2534dc7929825c9aa399cd Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 22 Apr 2013 15:09:31 +0200 Subject: let -> $((COUNTER+=1)) in quest for posix compliance --- retiolum/scripts/tinc_setup/new_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index 1ff42e54..9d478714 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -93,7 +93,7 @@ get_hostname() LCOUNTER=0 if test -e $TSTFILE; then while test -e $TSTFILE; do - let LCOUNTER=LCOUNTER+1 + $((LCOUNTER+=1)) TSTFILE=$TEMPDIR/hosts/$1$LCOUNTER done HOSTN=$1$LCOUNTER -- cgit v1.2.3 From fbf5e446a47132684bdaa616ce2cb72c44543b50 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 22 Apr 2013 15:13:45 +0200 Subject: fix bug in new_install --- retiolum/scripts/tinc_setup/new_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retiolum/scripts/tinc_setup/new_install.sh b/retiolum/scripts/tinc_setup/new_install.sh index 9d478714..db154877 100755 --- a/retiolum/scripts/tinc_setup/new_install.sh +++ b/retiolum/scripts/tinc_setup/new_install.sh @@ -93,7 +93,7 @@ get_hostname() LCOUNTER=0 if test -e $TSTFILE; then while test -e $TSTFILE; do - $((LCOUNTER+=1)) + : $((LCOUNTER+=1)) TSTFILE=$TEMPDIR/hosts/$1$LCOUNTER done HOSTN=$1$LCOUNTER -- cgit v1.2.3 From 0ab171778fe183b95d6cbf2998f986b866df1947 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 22 Apr 2013 15:15:26 +0200 Subject: add graphgen dependencies --- retiolum/scripts/adv_graphgen/DEPS | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 retiolum/scripts/adv_graphgen/DEPS diff --git a/retiolum/scripts/adv_graphgen/DEPS b/retiolum/scripts/adv_graphgen/DEPS new file mode 100644 index 00000000..f14c0aa6 --- /dev/null +++ b/retiolum/scripts/adv_graphgen/DEPS @@ -0,0 +1,2 @@ +graphviz +imagemagick -- cgit v1.2.3 From e703a1606471901008938c72900367770afee8f3 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 22 Apr 2013 15:17:15 +0200 Subject: update Reaktor - add color translator --- Reaktor/IRC/asybot.py | 8 ++++++-- Reaktor/IRC/index | 2 +- Reaktor/IRC/translate_colors.py | 31 +++++++++++++++++++++++++++++++ Reaktor/commands/whatweb | 6 +++--- Reaktor/repos/consolidate_dns/index | 5 +++-- Reaktor/repos/whatweb | 2 +- 6 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 Reaktor/IRC/translate_colors.py diff --git a/Reaktor/IRC/asybot.py b/Reaktor/IRC/asybot.py index df758ed6..2cb533ea 100755 --- a/Reaktor/IRC/asybot.py +++ b/Reaktor/IRC/asybot.py @@ -2,7 +2,7 @@ # # //Reaktor/IRC/asybot.py # - +from translate_colors import translate_colors def is_executable(x): import os return os.path.exists(x) and os.access(x, os.X_OK) @@ -24,6 +24,9 @@ formatter = logging.Formatter( '%(filename)s: %(levelname)s: %(message)s') hdlr.setFormatter(formatter) log.addHandler(hdlr) +# s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g -- removes color codes + + class asybot(asychat): def __init__(self, server, port, nickname, targets, **kwargs): asychat.__init__(self) @@ -110,6 +113,7 @@ class asybot(asychat): def PRIVMSG(text): for line in self.wrapper.wrap(text): msg = 'PRIVMSG %s :%s' % (','.join(params), line) + log.info(msg) self.push(msg) sleep(1) @@ -151,7 +155,7 @@ class asybot(asychat): return pid = p.pid for line in iter(p.stdout.readline,""): - PRIVMSG(line) + PRIVMSG(translate_colors(line)) log.debug('%s stdout: %s' % (pid, line)) p.wait() elapsed = time() - start diff --git a/Reaktor/IRC/index b/Reaktor/IRC/index index 50022ec9..cc2652fe 100755 --- a/Reaktor/IRC/index +++ b/Reaktor/IRC/index @@ -3,4 +3,4 @@ set -xeuf # cd //Reaktor cd $(dirname $(readlink -f $0))/.. -host=irc.freenode.net target='#krebsco' python IRC/asybot.py "$@" +host=irc.freenode.net target='#krebs' python IRC/asybot.py "$@" diff --git a/Reaktor/IRC/translate_colors.py b/Reaktor/IRC/translate_colors.py new file mode 100644 index 00000000..bd716618 --- /dev/null +++ b/Reaktor/IRC/translate_colors.py @@ -0,0 +1,31 @@ + + +COLOR_MAP = { + "\x1b[0m" : "\x0F", # reset + "\x1b[37m" : "\x0300", + "\x1b[30m" : "\x0301", + "\x1b[34m" : "\x0302", + "\x1b[32m" : "\x0303", + "\x1b[31m" : "\x0304", + "\x1b[33m" : "\x0305", + "\x1b[35m" : "\x0306", + "\x1b[33m" : "\x0307", + "\x1b[33m" : "\x0308", + "\x1b[32m" : "\x0309", + "\x1b[36m" : "\x0310", + "\x1b[36m" : "\x0311", + "\x1b[34m" : "\x0312", + "\x1b[31m" : "\x0313", + "\x1b[30m" : "\x0314", + "\x1b[37m" : "\x0315", + "\x1b[1m" : "\x02", # bold on + "\x1b[22m" : "\x02" # bold off + } +def translate_colors (line): + for color,replace in COLOR_MAP.items(): + line = line.replace(color,replace) + return line + +if __name__ == "__main__": + import sys + print (translate_colors(sys.stdin.read())) diff --git a/Reaktor/commands/whatweb b/Reaktor/commands/whatweb index 84130d5c..afe20360 100755 --- a/Reaktor/commands/whatweb +++ b/Reaktor/commands/whatweb @@ -2,6 +2,6 @@ #wrapper for WhatWeb here=$(dirname `readlink -f $0`) whatweb_bin="$here/../repos/whatweb/whatweb" -[ -e "$whatweb_bin" ] || ( echo "!! Whatweb app does not exist" && exit 1 ) -[ "balls$1" = "balls" ] && ( echo "!! no host given" && exit 1) -exec $whatweb_bin -a 3 "$1" +[ ! -e "$whatweb_bin" ] && echo "!! Whatweb app does not exist" && exit 1 +[ -z "${1:-}" ] && echo "!! no host given" && exit 1 +exec $whatweb_bin -a 3 "$1" 2>&1 diff --git a/Reaktor/repos/consolidate_dns/index b/Reaktor/repos/consolidate_dns/index index 1a0dd81e..3dd42fbd 100755 --- a/Reaktor/repos/consolidate_dns/index +++ b/Reaktor/repos/consolidate_dns/index @@ -9,7 +9,7 @@ import tempfile os.chdir (os.path.dirname (os.path.realpath (sys.argv[0]))) dnsrecon_enabled = False DNSRECON = "../dnsrecon/dnsrecon.py" -dnsrecon_wordlist="namelist.txt" +dnsrecon_wordlist="../dnsrecon/namelist.txt" silent=open("/dev/null","w") gxfr_enabled = False GXFR = "../gxfr/gxfr.py" @@ -42,7 +42,8 @@ else: if dnsrecon_enabled: dnsrecon_tmp = tempfile.NamedTemporaryFile(delete=False).name print ("Starting dnsrecon, this may take some time") - p = Popen([DNSRECON,"-d",DOMAIN,"--csv",dnsrecon_tmp,'-D',dnsrecon_wordlist,"-t","brt,srv,axfr","--skip"],stdout=silent,stderr=silent) + #print (" ".join([DNSRECON,"-d",DOMAIN,"--csv",dnsrecon_tmp,'-D',dnsrecon_wordlist,"-t","brt,srv,axfr","--skip"])) + p = Popen([DNSRECON,"-d",DOMAIN,"--csv",dnsrecon_tmp,'-D',dnsrecon_wordlist,"-t","brt,srv,axfr"] ,stdout=silent,stderr=silent) p.wait() reader = csv.reader(open(dnsrecon_tmp)) for row in reader: diff --git a/Reaktor/repos/whatweb b/Reaktor/repos/whatweb index daab5f21..0918a0d9 160000 --- a/Reaktor/repos/whatweb +++ b/Reaktor/repos/whatweb @@ -1 +1 @@ -Subproject commit daab5f21f13024ee8ec47e88f668c5308d6b59da +Subproject commit 0918a0d9b75df77f9c3e9eb360b6b22824582a20 -- cgit v1.2.3 From 26cdfdd8e9940de84a88a36f402504be8fd42ef1 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 22 Apr 2013 15:21:40 +0200 Subject: add new wookBox --- retiolum/hosts/wookBox | 10 ---------- retiolum/hosts/wookBox1 | 11 +++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) delete mode 100644 retiolum/hosts/wookBox create mode 100644 retiolum/hosts/wookBox1 diff --git a/retiolum/hosts/wookBox b/retiolum/hosts/wookBox deleted file mode 100644 index 5f1fac86..00000000 --- a/retiolum/hosts/wookBox +++ /dev/null @@ -1,10 +0,0 @@ -Subnet = 10.243.129.48 -Subnet = 42:b4f7:9cc9:b129:47a2:fb17:704a:9242 ------BEGIN RSA PUBLIC KEY----- -MIIBCgKCAQEA1Sh6ue0vNr6MU80p04d93k50Fb1nMob3JB/c2OnGQb+QTKiaSFmS -gyUT1V7UFgcxsXlnvpGpez0MwSW908PyhUS9urO7bedi9O4jKy0fD4sKyRXY4ob7 -R1Z45bMLaRj/25IYqrr/cecDb9/dyMlVU0CiUQY/O9hJvuuUEWYhJO0ubHU2eMoY -I7cgx7FaxgxVJH1g3u/Ol+Q73oX3HHUt2qk3SuSDi4JklMY+9wysW7GfrcpK3h5o -jX3J9X7nCMitIstGPNrjIoKXWNH1Dbzwq0yW3XOo3TlOtecwG1G5g9Gz+HcdjoHa -2jL0AjWtm2klOCXnuq5xe2WJ5wjqzzemWQIDAQAB ------END RSA PUBLIC KEY----- diff --git a/retiolum/hosts/wookBox1 b/retiolum/hosts/wookBox1 new file mode 100644 index 00000000..bdecc6bd --- /dev/null +++ b/retiolum/hosts/wookBox1 @@ -0,0 +1,11 @@ +Subnet = 10.243.203.163 +Subnet = 42:710f:fef4:bfda:fc9c:fcce:266d:62f1 +Address = 188.40.39.66 +-----BEGIN RSA PUBLIC KEY----- +MIIBCgKCAQEArpm7/ni2lkizLos7j3Y1L9Qrsp0r4G/5T50CCt9fstIrSM+SO23E +iTTHMBjBWAN9DXuP1VFKttu3SGTmKshbSKdvizs+eg3jlM4+KJRrUwrKTD5O/bfe +rH4HI8HH9CPyYBEdvxDg4lK+QHzSAZKVFADSYTy7GKb5MR0vFa32AW0yzHLMyPvS +z8fDg4SaS6gfc3LA7X0cDTVhfB+ulgsLomG4Lwi9XuRnLmn0Ax0nh9HU7GmEtt4l +Ju/3XMyybbAur73MKThlXMLIWkHiQBL7j1A+04kG59lWNi2YB9VuxbVTEvCZp+pR +5RRgKz05BL4e/JD9N2pvs+YmqrvL2a3t8QIDAQAB +-----END RSA PUBLIC KEY----- -- cgit v1.2.3 From 57fb05c0512f9c12ff56924cdc0d835f1999754a Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 24 Apr 2013 20:36:57 +0200 Subject: removed retarded visionmedia --- .gitmodules | 3 --- submodules/github/visionmedia/query | 1 - 2 files changed, 4 deletions(-) delete mode 160000 submodules/github/visionmedia/query diff --git a/.gitmodules b/.gitmodules index e704edfa..1f9347d2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "submodules/github/visionmedia/query"] - path = submodules/github/visionmedia/query - url = https://github.com/visionmedia/query [submodule "submodules/github/tmpvar/jsdom"] path = submodules/github/tmpvar/jsdom url = https://github.com/tmpvar/jsdom diff --git a/submodules/github/visionmedia/query b/submodules/github/visionmedia/query deleted file mode 160000 index 02baed4f..00000000 --- a/submodules/github/visionmedia/query +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 02baed4f5eb2d22e3ebb0688243c97fe04e7b53d -- cgit v1.2.3 From 9f38a2b96abb3fdc4cce5ef23c791728268b7b6f Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 24 Apr 2013 20:44:19 +0200 Subject: add minikrebs --- .gitmodules | 2 +- minikrebs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 160000 minikrebs diff --git a/.gitmodules b/.gitmodules index e704edfa..a8070de9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -30,4 +30,4 @@ url = https://github.com/urbanadventurer/WhatWeb.git [submodule "minikrebs"] path = minikrebs - url = https://github.com/krebscode/minikrebs.git + url = ./minikrebs diff --git a/minikrebs b/minikrebs new file mode 160000 index 00000000..9055c82e --- /dev/null +++ b/minikrebs @@ -0,0 +1 @@ +Subproject commit 9055c82ee7eb0938eb06963abbcfd65322e9b0ec -- cgit v1.2.3 From 5d904ef7620cda3355b601793441fc804ff506a9 Mon Sep 17 00:00:00 2001 From: makefu Date: Wed, 24 Apr 2013 20:52:00 +0200 Subject: fix minikrebs --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 4a06e547..1f9347d2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -27,4 +27,4 @@ url = https://github.com/urbanadventurer/WhatWeb.git [submodule "minikrebs"] path = minikrebs - url = ./minikrebs + url = https://github.com/krebscode/minikrebs.git -- cgit v1.2.3