summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@iiso>2011-11-12 12:14:07 +0100
committertv <tv@iiso>2011-11-12 12:14:07 +0100
commit2a85942bb7b227b80275dfdf6ee88814b86f4dbb (patch)
treecfa26d0a5bc9f72b3d7c992f0ca062590fabdca9
parentd8c022c85e1a93da813b0aebf5002fa87c387879 (diff)
parente4e74037c0bc7f1b286b2b2f73c007204752295c (diff)
Merge branch 'master' of github.com:krebscode/painload
-rw-r--r--.gitmodules3
-rw-r--r--infest/profiles/README9
-rwxr-xr-xpunani/tightnani/tightnani-web.py48
-rw-r--r--punani/tightnani/tightnani_db25
-rwxr-xr-xretiolum/scripts/adv_graphgen/parse_tinc_stats.py5
-rwxr-xr-xretiolum/scripts/adv_graphgen/sanitize.sh18
-rwxr-xr-xretiolum/scripts/adv_graphgen/tinc_stats.py2
m---------submodules/github/jbalogh/python-irclib0
8 files changed, 102 insertions, 8 deletions
diff --git a/.gitmodules b/.gitmodules
index 3677b710..2823cad5 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -16,3 +16,6 @@
[submodule "submodules/github/makefu/dpfhack_display"]
path = submodules/github/makefu/dpfhack_display
url = https://github.com/makefu/dpfhack_pearl
+[submodule "submodules/github/jbalogh/python-irclib"]
+ path = submodules/github/jbalogh/python-irclib
+ url = https://github.com/jbalogh/python-irclib.git
diff --git a/infest/profiles/README b/infest/profiles/README
new file mode 100644
index 00000000..cab5fd93
--- /dev/null
+++ b/infest/profiles/README
@@ -0,0 +1,9 @@
+Install different profiles for a user on the system
+
+UseCase:
+./load-profile bob
+ [if necessary, check out the bob submodule]
+ [write dotfiles of profile bob for logged-in users ~]
+
+./load-profile system
+ [write krebs additions to /etc and /root]
diff --git a/punani/tightnani/tightnani-web.py b/punani/tightnani/tightnani-web.py
new file mode 100755
index 00000000..52f5004f
--- /dev/null
+++ b/punani/tightnani/tightnani-web.py
@@ -0,0 +1,48 @@
+#!/usr/bin/python
+
+import web
+import json
+
+urls = (
+ '/', 'Index',
+ '/dump','Dump',
+ '/reload','Reload',
+ '/(.+)/(.+)', 'ArchFinder',
+)
+
+
+PDB_FILE="tightnani_db"
+
+pdb= json.load(open(PDB_FILE))
+
+class Index:
+ def GET(self):
+ ret = """Welcome to the Tightnani API<br/>
+Retrieve a package name for your distribution with: /ARCH/PKG"""
+ return ret
+
+class Reload:
+ def GET(self):
+ pdb= json.load(open(PDB_FILE))
+ return "DB reloaded"
+
+
+class Dump:
+ def GET(self):
+ return json.dumps(pdb,sort_keys=True,indent=4)
+
+class ArchFinder:
+ def GET(self,packer,package):
+ if not packer or not package: web.BadRequest()
+ else:
+ packer = pdb['packer-symlinks'].get(packer,packer) #try to resolve similar packers
+ ret = pdb.get(package,{}).get(packer,False)
+ if not ret: web.NotFound()
+ else: return ret
+
+
+
+if __name__ == "__main__":
+ app = web.application(urls,globals())
+ app.internalerror = web.debugerror
+ app.run()
diff --git a/punani/tightnani/tightnani_db b/punani/tightnani/tightnani_db
new file mode 100644
index 00000000..d15a9ad4
--- /dev/null
+++ b/punani/tightnani/tightnani_db
@@ -0,0 +1,25 @@
+{
+ "packer-symlinks" : {
+ "packer" : "yaourt",
+ "aptitude" : "apt-get",
+ "bauerbill" : "yaourt"
+ },
+ "vim" : {
+ "apt-get" : "vim",
+ "pacman" : "vim",
+ "brew" : "vim",
+ "yum" : "vim"
+ },
+ "python" : {
+ "apt-get" : "python",
+ "pacman" : "python2"
+ },
+ "python2" : {
+ "apt-get" : "python",
+ "pacman" : "python2"
+ },
+ "python3" : {
+ "apt-get" : "python3",
+ "pacman" : "python"
+ }
+}
diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
index 410e5229..b8054b0d 100755
--- a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
+++ b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
@@ -59,6 +59,9 @@ def generate_stats(nodes):
pass
for k,v in nodes.iteritems():
conns = v.get('to',[])
+ for c in conns: #sanitize weights
+ if float(c['weight']) > 9000: c['weight'] = str(9001)
+ elif float(c['weight']) < 0: c['weight'] = str(0)
v['num_conns'] = len(conns)
v['avg_weight'] = get_node_avg_weight(conns)
v['availability'] = get_node_availability(k,jlines)
@@ -132,7 +135,7 @@ def write_node(k,v):
node = " "+k+"[label=\""
node += k+"\\l"
node += "availability: %f\\l" % v['availability']
- node += "avg weight: %.2f\\l" % v['avg_weight']
+ #node += "avg weight: %.2f\\l" % v['avg_weight']
if v.has_key('num_conns'):
node += "Num Connects:"+str(v['num_conns'])+"\\l"
node += "external:"+v['external-ip']+":"+v['external-port']+"\\l"
diff --git a/retiolum/scripts/adv_graphgen/sanitize.sh b/retiolum/scripts/adv_graphgen/sanitize.sh
index 402ce256..5572b9d9 100755
--- a/retiolum/scripts/adv_graphgen/sanitize.sh
+++ b/retiolum/scripts/adv_graphgen/sanitize.sh
@@ -1,4 +1,5 @@
#!/bin/sh
+set -xeuf
cd $(dirname `readlink -f $0`)
GRAPH_SETTER1=dot
GRAPH_SETTER2=circo
@@ -9,16 +10,21 @@ TYPE=svg
TYPE2=png
OPENER=/bin/true
DOTFILE=`mktemp`
-trap 'rm $DOTFILE' SIGTERM
+trap 'rm $DOTFILE' INT TERM
sudo LOG_FILE=$LOG_FILE python tinc_stats.py |\
python parse_tinc_stats.py > $DOTFILE
-$GRAPH_SETTER1 -T$TYPE -o $1/retiolum_1.$TYPE $DOTFILE
-$GRAPH_SETTER2 -T$TYPE -o $1/retiolum_2.$TYPE $DOTFILE
-$GRAPH_SETTER3 -T$TYPE -o $1/retiolum_3.$TYPE $DOTFILE
-$GRAPH_SETTER4 -T$TYPE -o $1/retiolum_4.$TYPE $DOTFILE
+
+i=1
+for setter in dot circo 'neato -Goverlap=prism ' sfdp
+do
+ tmpgraph=`mktemp --tmpdir=$1`
+ $setter -T$TYPE -o $tmpgraph $DOTFILE
+ chmod go+rx $tmpgraph
+ mv $tmpgraph $1retiolum_$i.$TYPE
+ i=`expr $i + 1`
+done
#convert -resize 20% $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
-#$OPENER $1/retiolum_1.$TYPE &>/dev/null
diff --git a/retiolum/scripts/adv_graphgen/tinc_stats.py b/retiolum/scripts/adv_graphgen/tinc_stats.py
index be3bbbff..d0d47aff 100755
--- a/retiolum/scripts/adv_graphgen/tinc_stats.py
+++ b/retiolum/scripts/adv_graphgen/tinc_stats.py
@@ -78,6 +78,6 @@ def parse_input(log_data):
if __name__ == '__main__':
import subprocess,time
- subprocess.popen("pkill -SIGUSR2 tincd")
+ subprocess.call(["pkill","-SIGUSR2", "tincd"])
time.sleep(1)
print json.dumps(parse_input((get_tinc_block(SYSLOG_FILE))))
diff --git a/submodules/github/jbalogh/python-irclib b/submodules/github/jbalogh/python-irclib
new file mode 160000
+Subproject 5c347d82f796e79adfccf5cf90846cc068e66b4