Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 28 May 2012 21:12:54 +0200
From: Frank Dittrich <frank_dittrich@...mail.com>
To: john-dev@...ts.openwall.com
Subject: Re: Fwd: bash auto-completion for john

On 05/27/2012 01:19 PM, magnum wrote:
> committed now

Thanks.
Another bugfix for non-jumbo versions:
I shouldn't suggest possible completions for --pot= and --config=, if
the john version doesn't know these options.
Patch attached.

BTW:
Should this script really stay in src, or should it be moved to run or
some other directory?
I am somewhat worried about binary-only john packages, which might not
include any src file (but I am not sure about this).

Frank

--- john.bash_completion.orig	2012-05-25 13:56:10.857866340 +0000
+++ john.bash_completion	2012-05-28 09:26:43.139726426 +0000
@@ -388,7 +388,7 @@ _john()
 			return 0
 			;;
 		-?(-)en?(c|co|cod|codi|codin|coding)=*)
-			if  echo "${options}" | grep "^--encoding=" > /dev/null ; then
+			if  echo "${valopts}" | grep "^--encoding=" > /dev/null ; then
 				# --encoding=LIST writes to stderr
 				encodings=`${first} --encoding=LIST 2>&1|grep -v 'Supported encodings'|sed 's#[,)]##g'|sed 's#(or ##g'`
 			cur=${cur#*=}
@@ -402,24 +402,27 @@ _john()
 			return 0
 			;;
 		-?(-)po?(t)=*)
-			# if --pot= is used, john always looks for the file $PWD
-			# (tested with system-wide and local build of john)
-			cur=${cur#*=}
-			#redirect stderr just in case __expand_tilde_by_ref
-			#doesn't exist everywhere
-			#(I'm a bit worried because of the __ at the begin.
-			#May be this function isn't part of an "official" API.)
-			#
-			__expand_tilde_by_ref cur 2>/dev/null
-			_filedir "pot"
+			if  echo "${valopts}" | grep "^--encoding=" > /dev/null ; then
+				# if --pot= is used, john always looks for the file $PWD
+				# (tested with system-wide and local build of john)
+				cur=${cur#*=}
+				#redirect stderr just in case __expand_tilde_by_ref
+				#doesn't exist everywhere
+				#(I'm a bit worried because of the __ at the begin.
+				#May be this function isn't part of an "official" API.)
+				__expand_tilde_by_ref cur 2>/dev/null
+				_filedir "pot"
+			fi
 			return 0
 			;;
 		-?(-)co?(n|nf|nfi|nfig)=*)
-			# if --config= is used, john always looks for files in $PWD
-			# (tested for system-wide and local builds)
-			cur=${cur#*=}
-			__expand_tilde_by_ref cur 2>/dev/null
-			_filedir '@...nf|ini)'
+			if  echo "${valopts}" | grep "^--encoding=" > /dev/null ; then
+				# if --config= is used, john always looks for files in $PWD
+				# (tested for system-wide and local builds)
+				cur=${cur#*=}
+				__expand_tilde_by_ref cur 2>/dev/null
+				_filedir '@...nf|ini)'
+			fi
 			return 0
 			;;
 		-?(-)sav?(e|e-|e-m|e-me|e-mem|e-memo|e-memor|e-memory)=*)
@@ -428,7 +431,7 @@ _john()
 			return 0
 			;;
 		-?(-)reg?(e|en|en-|en-l|en-lo|en-los|en-lost|en-lost-|en-lost-s|en-lost-sa|en-lost-sal|en-lost-salt|en-lost-salts)=*)
-			if echo "${options}" | grep "^--regen-lost-salts=" > /dev/null ; then
+			if echo "${valopts}" | grep "^--regen-lost-salts=" > /dev/null ; then
 				cur=${cur#*=}
 				COMPREPLY=( $(compgen -W "1 2 3 4 5" -- ${cur}) )
 			fi

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ