Author: hanska-guest
Date: 2008-06-17 08:38:58 +0000 (Tue, 17 Jun 2008)
New Revision: 182

Modified:
   trunk/debian/changelog
   trunk/debian/extra/cronjob
   trunk/debian/extra/john-mail.conf
Log:
* debian/extra/:
  - john-mailer.conf and cronjob extended to allow per-group password
    cracking -- thanks to Fabian Zeindl (see LP194036)

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2008-06-09 14:16:26 UTC (rev 181)
+++ trunk/debian/changelog      2008-06-17 08:38:58 UTC (rev 182)
@@ -3,8 +3,11 @@
   * debian/man/john.8:
     - updated the locations of john's session files (Closes: #360591)
     - updated descriptions of --rules and --test (Closes: #485422)
+  * debian/extra/:
+    - john-mailer.conf and cronjob extended to allow per-group password
+      cracking -- thanks to Fabian Zeindl (see LP194036)
 
- -- David Paleino <[EMAIL PROTECTED]>  Mon, 09 Jun 2008 16:15:19 +0200
+ -- David Paleino <[EMAIL PROTECTED]>  Tue, 17 Jun 2008 10:37:55 +0200
 
 john (1.7.2-3) unstable; urgency=low
 

Modified: trunk/debian/extra/cronjob
===================================================================
--- trunk/debian/extra/cronjob  2008-06-09 14:16:26 UTC (rev 181)
+++ trunk/debian/extra/cronjob  2008-06-17 08:38:58 UTC (rev 182)
@@ -22,6 +22,9 @@
 RESTORE=$RUNDIR/restore
 
 PASSFILE=`grep -v ^# /etc/john/john-mail.conf | grep -e "[ ]*passfile[ ]*=[ 
]*" | sed -e "s/#.*//" -e "s/.*=[ ]*//" |head -1`
+GROUP=`grep -v ^# /etc/john/john-mail.conf | grep -e "[ ]*group[ ]*=[ ]*" | 
sed -e "s/#.*//" -e "s/.*=[ ]*//" | head -1`
+
+[ ! -d $PIDDIR ] || mkdir -p $PIDDIR
 cd $RUNDIR
 
 # Gets the PID of the process that should be running john,
@@ -181,16 +184,39 @@
 
 }
 
+# filters the passwd file by given group
+alter_passwd()
+{
+       if [[ ! -z $GROUP ]]; then
+               ALTEREDPASSWD=$PASSWD.altered.for.john
+               rm -f $ALTEREDPASSWD
+               touch $ALTEREDPASSWD
+               chmod 0600 $ALTEREDPASSWD
+               for x in `grep -e ^$GROUP: /etc/group | cut -d: -f4 | tr ',' ' 
'`
+               do
+                       grep -e ^$x: $PASSWD >> $ALTEREDPASSWD
+               done
+               PASSWD=$ALTEREDPASSWD
+       fi
+}
+
+# removes the altered file
+remove_altered_passwd()
+{
+       rm -f $PASSWD.altered.for.john
+}
 if [ $# -ne 1 ]; then
        echo "$0 {start|stop} "
        exit 1;
 else
        case "$1" in
                start)
+                       alter_passwd
                        john_start
                        ;;
                stop)
                        john_stop
+                       remove_altered_passwd
                        ;;
                *)
                        exit 1;

Modified: trunk/debian/extra/john-mail.conf
===================================================================
--- trunk/debian/extra/john-mail.conf   2008-06-09 14:16:26 UTC (rev 181)
+++ trunk/debian/extra/john-mail.conf   2008-06-17 08:38:58 UTC (rev 182)
@@ -23,3 +23,8 @@
 # REAL PASSWORD FILE HERE, OR IT WILL BE LOST. Simply specify a location
 # that is considered safe for john to put a copy of the password file.
 passfile=/var/run/john/cronpasswd
+
+# The group directive specifies the group whose members' passwords will 
+# be checked by john. This is useful, for example, if you want to check 
+# just the group which is allowed to login remotely, ...
+#group=ssh


_______________________________________________
Pkg-john-commits mailing list
Pkg-john-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/pkg-john-commits

Reply via email to