Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Fri, 1 Jun 2012 17:12:50 +0200
From: Frank Dittrich <frank_dittrich@...mail.com>
To: john-dev@...ts.openwall.com
Subject: New version of john.bash_completion

Hi magnum,

here is an enhanced version of the bash completion script (diff against
current git version attached).

Improvements:

1.
Allow -re= and --re= treated like --restore= for non-jumbo versions
(which lack --regen-lost-salts=).

2.
Don't allow -for=, --for=, -fo=, --fo= being treated like --format= if
there is more than one option starting with --for or --fo known to john.

3.
Avoid
$ ./john --option=
begin completed to
$ ./john --option=--option=
for any options added in future john versions.

Frank

--- john.bash_completion.orig	2012-05-28 19:10:42.346567026 +0000
+++ john.bash_completion	2012-06-01 15:07:56.102609967 +0000
@@ -150,6 +150,11 @@ _john()
 			return 0
 			;;
 		-?(-)fo?(r|rm|rma|rmat)=*)
+			if [[ "_${cur#*o}" == "_=" || "_${cur#*o}" == "_r=" ]] ; then
+				if [[ `echo "${valopts}"|grep -c "^-*${cur%=}"` -ne 1 ]] ; then
+					return 0
+				fi
+			fi
 			cur=${cur#*=}
 			formats=`${first} |sed -n '/^--format/,$ { s#^--format=[ A-Za-z]*:##; /^--/ b; s#^ *##; s#\<dynamic_n\>#dynamic#; s#[/ ]#\n#g; p }'`
 			COMPREPLY=( $(compgen -W "${formats}" -- ${cur}) )
@@ -171,7 +176,12 @@ _john()
 			fi
 			return 0
 			;;
-		-?(-)res?(t|to|tor|tore)=*|-?(-)sta?(t|tu|tus)=*)
+		-?(-)re?(s|st|sto|stor|store)=*|-?(-)sta?(t|tu|tus)=*)
+			if [[ "_${cur}" == "_-re=" || "_${cur}" == "_--re=" ]] ; then
+				if [[ `echo "${valopts}"|grep -c "^--re"` -ne 1 ]] ; then
+					return 0
+				fi
+			fi
 # If there is no .rec file in the current directory, the old completion logic will show all files:
 ##echo _`for f in *.rec; do echo ${f%.rec};done`_
 			cur=${cur#*=}
@@ -451,9 +461,6 @@ _john()
 			fi
 			return 0
 			;;
-		--session=*|--mem-file-size=*|--field-separator-char=*|--fix-state-delay=*|--max-run-time=*|--mkpc=*)
-			return 0
-			;;
 		-?(-)pla?(t|tf|tfo|tfor|tform)=+(L|l)*|-?(-)dev?(i|ic|ice)=+(L|l)*)
 			# CUDA doesn't allow --device=LIST
 			# workaround: check if --platform= is allowed
@@ -491,6 +498,9 @@ _john()
 			fi
 			return 0
 			;;
+		-*=)
+			return 0;
+			;;
 		-*)
 			compreplya=`compgen -W "${options} ${hidden}" -- ${cur}`
 			if [[ "_${compreplya}_" == "__" ]] ; then

Powered by blists - more mailing lists

Your e-mail address:

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