summaryrefslogtreecommitdiffstats
path: root/elchos/root-image/krebs/bin
diff options
context:
space:
mode:
authorroot <root@flap>2014-05-06 10:00:33 -0400
committerroot <root@flap>2014-05-06 10:00:33 -0400
commit4d8016064edd5e5dc1d194ea5ec0fce4f07b8f2a (patch)
treed8ecba8651604e51d6f887449641ac627844ae63 /elchos/root-image/krebs/bin
parentf44c8529e6d04b557d93cc862599b956ed21f0de (diff)
parentd0367082a5c1296cefed641b4eda736b29a3ad69 (diff)
Merge branch 'master' of https://github.com/krebscode/painload
Diffstat (limited to 'elchos/root-image/krebs/bin')
-rwxr-xr-xelchos/root-image/krebs/bin/add-reaktor-secret.sh24
-rwxr-xr-xelchos/root-image/krebs/bin/macid.sh2
-rwxr-xr-xelchos/root-image/krebs/bin/reaktor-shell.sh4
-rwxr-xr-xelchos/root-image/krebs/bin/refresh-shares.ship11
-rwxr-xr-xelchos/root-image/krebs/bin/set-hostname.sh5
-rwxr-xr-xelchos/root-image/krebs/bin/start-ncdc.ship23
-rwxr-xr-xelchos/root-image/krebs/bin/tor-get-hidden-service.sh2
-rwxr-xr-xelchos/root-image/krebs/bin/tor_configure_hidden_service.ship16
-rwxr-xr-xelchos/root-image/krebs/bin/tor_publish_ssh.ship12
-rwxr-xr-xelchos/root-image/krebs/bin/update-search.sh5
-rwxr-xr-xelchos/root-image/krebs/bin/vim_sane_defaults.ship10
11 files changed, 114 insertions, 0 deletions
diff --git a/elchos/root-image/krebs/bin/add-reaktor-secret.sh b/elchos/root-image/krebs/bin/add-reaktor-secret.sh
new file mode 100755
index 00000000..92681449
--- /dev/null
+++ b/elchos/root-image/krebs/bin/add-reaktor-secret.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+set -euf
+green='\e[0;32m'
+red='\e[0;31m'
+nc='\e[0m'
+black='\e[0;30m'
+
+printf "${green}Add a Reaktor Secret ${nc}\n"
+printf "${red}(no spaces in input plox)${nc}\n"
+
+nick=${1:-}
+while test -z "${nick:-}" ;do
+ printf "provide Nick Name:\n"
+ read nick
+done
+
+secret=${2:-}
+while test -z "${secret:-}" ;do
+ printf "provide Secret:$black\n"
+ read secret
+done
+
+echo "$nick $secret" >> /krebs/painload/Reaktor/admin.lst
+printf "${green}done${nc}"
diff --git a/elchos/root-image/krebs/bin/macid.sh b/elchos/root-image/krebs/bin/macid.sh
new file mode 100755
index 00000000..0fccc84b
--- /dev/null
+++ b/elchos/root-image/krebs/bin/macid.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+ip addr | grep ether | awk '{print $2}' | sort |md5sum | awk '{print $1}' | dd bs=1 count=6 2>/dev/null
diff --git a/elchos/root-image/krebs/bin/reaktor-shell.sh b/elchos/root-image/krebs/bin/reaktor-shell.sh
new file mode 100755
index 00000000..117c64f6
--- /dev/null
+++ b/elchos/root-image/krebs/bin/reaktor-shell.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+echo "IP Addresses:"
+/krebs/painload/Reaktor/commands/ips || echo "no IPs!"
+/krebs/bin/add-reaktor-secret.sh
diff --git a/elchos/root-image/krebs/bin/refresh-shares.ship b/elchos/root-image/krebs/bin/refresh-shares.ship
new file mode 100755
index 00000000..364d7758
--- /dev/null
+++ b/elchos/root-image/krebs/bin/refresh-shares.ship
@@ -0,0 +1,11 @@
+#!/bin/sh
+#TODO:
+#!/usr/bin/env ship
+set -euf
+#@include filehooker
+. /krebs/lib/filehooker
+ncdc_user="hooker"
+
+share_all_partitions
+systemctl restart hddtemp.service
+exit 0
diff --git a/elchos/root-image/krebs/bin/set-hostname.sh b/elchos/root-image/krebs/bin/set-hostname.sh
new file mode 100755
index 00000000..31101a18
--- /dev/null
+++ b/elchos/root-image/krebs/bin/set-hostname.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+hostn="elch_$(/krebs/bin/macid.sh)"
+hostnamectl set-hostname "$hostn"
+hostname $hostn
+echo "$hostn" > /etc/hostname
diff --git a/elchos/root-image/krebs/bin/start-ncdc.ship b/elchos/root-image/krebs/bin/start-ncdc.ship
new file mode 100755
index 00000000..1d47bcfb
--- /dev/null
+++ b/elchos/root-image/krebs/bin/start-ncdc.ship
@@ -0,0 +1,23 @@
+#!/usr/bin/env ship
+set -euf
+#@include filehooker
+. /krebs/lib/filehooker
+#@include network
+ncdc_user="hooker"
+
+useradd -m $ncdc_user ||:
+
+sudo -u $ncdc_user /usr/bin/tmux new-session -s dcpp -n ncdc -d ncdc 2>/dev/null || echo "ncdc is already running"
+
+nick=$(cat /etc/hostname)
+echo "using nick $nick"
+ncdc_configure_nick "$nick"
+sleep 1
+dc_hub="adcs://elchhub.nsupdate.info:2781"
+echo "connecting to $dc_hub"
+ncdc_configure_hub "$dc_hub" "elch"
+
+
+share_all_partitions
+
+exit 0
diff --git a/elchos/root-image/krebs/bin/tor-get-hidden-service.sh b/elchos/root-image/krebs/bin/tor-get-hidden-service.sh
new file mode 100755
index 00000000..c9946366
--- /dev/null
+++ b/elchos/root-image/krebs/bin/tor-get-hidden-service.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+cat /var/lib/tor/hidden_service/hostname
diff --git a/elchos/root-image/krebs/bin/tor_configure_hidden_service.ship b/elchos/root-image/krebs/bin/tor_configure_hidden_service.ship
new file mode 100755
index 00000000..1e026d26
--- /dev/null
+++ b/elchos/root-image/krebs/bin/tor_configure_hidden_service.ship
@@ -0,0 +1,16 @@
+#!/bin/sh
+#@include core
+. /krebs/lib/core
+#@include network
+. /krebs/lib/network
+#@include tor
+. /krebs/lib/tor
+
+sleep_time=5
+test -w "$torrc" || ( error "$torrc is not writable!"; exit 1 ) || exit 1
+
+configure_hidden_service
+test ! -e $hidden_service_dir/hostname && \
+ info "hidden service file does not exist, restarting tor" && \
+ systemctl restart tor && \
+ sleep 1
diff --git a/elchos/root-image/krebs/bin/tor_publish_ssh.ship b/elchos/root-image/krebs/bin/tor_publish_ssh.ship
new file mode 100755
index 00000000..2ecee9fb
--- /dev/null
+++ b/elchos/root-image/krebs/bin/tor_publish_ssh.ship
@@ -0,0 +1,12 @@
+#!/usr/bin/env ship
+#@include core
+. /krebs/lib/core
+#@include network
+. /krebs/lib/network
+#@include tor
+. /krebs/lib/tor
+
+test -w "$torrc" || ( error "$torrc is not writable!"; exit 1 ) || exit 1
+
+configure_hidden_service
+cat $hidden_service_dir/hostname | send_irc
diff --git a/elchos/root-image/krebs/bin/update-search.sh b/elchos/root-image/krebs/bin/update-search.sh
new file mode 100755
index 00000000..665f6543
--- /dev/null
+++ b/elchos/root-image/krebs/bin/update-search.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+for i in /media/vag*;do
+ updatedb -l 0 -o "$i/mlocate.db" -U "$i"
+done
+echo "update complete"
diff --git a/elchos/root-image/krebs/bin/vim_sane_defaults.ship b/elchos/root-image/krebs/bin/vim_sane_defaults.ship
new file mode 100755
index 00000000..fcc7ffcf
--- /dev/null
+++ b/elchos/root-image/krebs/bin/vim_sane_defaults.ship
@@ -0,0 +1,10 @@
+#!/bin/sh
+#@strict
+#@include core
+. /krebs/lib/core
+#@include vim
+. /krebs/lib/vim
+#@mainifyme
+touch $vimrc
+info "configuring vim"
+vim_conf_sane_defaults