Nmap Development mailing list archives

Re: [Patch] KRAD Ascii Art (A short and sweet patch)


From: Daniel Miller <bonsaiviking () gmail com>
Date: Wed, 19 Mar 2014 09:49:29 -0500

On 03/19/2014 08:34 AM, Jay Bosamiya wrote:
--- configure   (revision 32783)
+++ configure   (working copy)
@@ -9392,7 +9392,6 @@
  fi
# Krad ASCII ART#!#@$!@#$
-if test -f docs/leet-nmap-ascii-art.txt; then
-       cat docs/leet-nmap-ascii-art.txt
-fi
+ls docs/leet-nmap-ascii-art*.txt 2>/dev/null | sort -R | tail -1 | while read file; do cat $file; done;
+
  echo "Configuration complete.  Type make (or gmake on some *BSD machines) to compile."
Jay,

sort -R is a GNU extension, so this will break on non-GNU systems like OS X, Solaris, *BSD, etc. Here's an alternative shuffle that uses POSIX-specified awk and sort, as well as avoiding the non-POSIX (though widely supported) "tail -[0-9]*" syntax:

cat $(ls docs/leet-nmap-ascii-art*.txt 2>/dev/null | awk 'BEGIN{srand();}{print rand()"\t"$0}' | sort | head -n 1 | cut -f 2-)

Thanks for the patch!

Dan
_______________________________________________
Sent through the dev mailing list
http://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/


Current thread: