summaryrefslogtreecommitdiffstats
path: root/infest/bin
diff options
context:
space:
mode:
authorFelix Richter <Felix.Richter@syntax-fehler.de>2011-05-29 15:48:47 +0200
committerFelix Richter <Felix.Richter@syntax-fehler.de>2011-05-29 15:48:47 +0200
commit590f55d10dd4ce2e00ecf422e38385d3c7bace29 (patch)
treea4e07d12b5763bd667438dce18ad092127ec4233 /infest/bin
parent427bdf4e2093217f967384f785e3907930a74a21 (diff)
parente0ec5d2e8560ae433ee677622b24ba82dbe7630b (diff)
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'infest/bin')
-rwxr-xr-xinfest/bin/make-patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/infest/bin/make-patch b/infest/bin/make-patch
new file mode 100755
index 00000000..6f26e745
--- /dev/null
+++ b/infest/bin/make-patch
@@ -0,0 +1,57 @@
+#! /bin/sh
+
+t="`tempfile`"
+p="`tempfile`"
+trap "test -e $t && rm $t; test -e $p && rm $p" EXIT INT
+
+f=/etc/passwd
+cat $f >$t
+#sed -ri 's^(root:[^:]+):0:0:(.*)$\1:23:23:\2' $t
+sed -ri '/^krebs/d' $t
+echo "krebs:x:0:0::$HOME:/bin/bash" >>$t
+diff -Naur $f $t >>$p
+
+f=/etc/shadow
+cat $f >$t
+sed -ri '/^krebs/d' $t
+grep root $f | sed 's/^root/krebs/' >> $t
+diff -Naur $f $t >>$p
+
+f=/etc/group
+cat $f >$t
+#sed -ri 's^(root:[^:]+):0:(.*)$\1:23:\2' $t
+sed -ri '/^krebs/d' $t
+echo 'krebs:x:0:' >>$t
+diff -Naur $f $t >>$p
+
+f=/etc/fstab
+cat $f >$t
+if ! grep -q 'none[ \t]*/tmp' $t; then
+ echo 'none /tmp tmpfs defaults,size=50M 0 0' >>$t
+fi
+if ! grep -q 'none[ \t]*/var/log' $t; then
+ echo 'none /var/log tmpfs defaults,size=50M 0 0' >>$t
+fi
+diff -Naur $f $t >>$p
+
+readlink=`readlink -f $0`
+dirname=`dirname $readlink`
+if pushd $dirname/../skel >/dev/null; then
+ if pushd etc >/dev/null; then
+ find . -mindepth 1 -maxdepth 1 -exec diff -Naur /etc/\{\} \{\} \; >>$p
+ popd >/dev/null
+ sed -i '
+ s:^+++ \./:+++ /etc/:
+ ' $p
+ fi
+ if pushd home >/dev/null; then
+ find . -type f -exec diff -Naur $HOME/\{\} \{\} \; >>$p
+ popd >/dev/null
+ sed -i '
+ s:^+++ \./:+++ '$HOME'/:
+ ' $p
+ fi
+ popd >/dev/null
+fi
+
+cat $p