Find revelation files

36 views
Skip to first unread message

ANIS El Achèche

unread,
Jul 1, 2015, 5:46:09 AM7/1/15
to revelatio...@googlegroups.com
Hi!

How can I use the find command to find all the revelation files in my Linux Box?

Combining find with the file command don't give a good result as the revelation files mime type is "application/octet-stream" and it's not a unique mime-type.

Thank you in advance

Regards,
El Achèche ANIS
An Ubuntu-tn Member & Events Team Coordinator
Official Ubuntu Member  | Member @CLibre.tn | SysAdmin @ApptivIT
elac...@ubuntu.com | # whoami
"I am what I am because of who we all are" - The Ubuntu Philosophy

ANIS El Achèche

unread,
Jul 1, 2015, 5:48:17 AM7/1/15
to revelatio...@googlegroups.com

Alexey Kislin

unread,
Jul 1, 2015, 7:05:52 AM7/1/15
to revelatio...@googlegroups.com
You can try this:
find . -type f | while read -r line; do head -c 6 "$line" | xxd -p && echo "$line"; done | grep -A 1 72766c

--
You received this message because you are subscribed to the Google Groups "Revelation Password Manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to revelation-pass...@googlegroups.com.
To post to this group, send email to revelatio...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/revelation-password/CAHAJJJpfowZmLDZvZZWy7DvT-1H8Ebni%2BU1OP7Er2i8dC5Oirw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Steve Singer

unread,
Jul 6, 2015, 7:12:09 AM7/6/15
to revelatio...@googlegroups.com
The following explains and amends Kislin's "one liner" to produce just a list of file names, stripping the revelation password file signature from the output.

#!/bin/sh

# Combining *find* with the *file* command don't give a good result as the
# revelation files mime type is "application/octet-stream" and it's not a
# unique mime-type.

# How can I use the linux 'find' command to show all revelation password files?
# [posted in Google Groups "Revelation"]

# find . -type f | while read -r line; do head -c 6 "$line" | xxd -p && echo "$line"; done | grep -A 1 72766c

# explanation
#-------------
# 'find' selects each regular file in the current working
#  directory (and its subdirectories), printing its name.
# for each filename
#    'head' extracts the 1st 6 bytes from that file
#    'xxd' converts them to hexdump format,
#    'printf' prefixes the dumped signature to the
#     filename from 'find', separated by a blank
# 'grep' only passes on lines that begin with '72766c',
#   the signature for revelation password files
# 'cut' strips the signature, leaving only the
#   filename from 'find'

# Clearly, this sequence can be generalized for other
# types of data files by supplying a signature as a
# parameter.

# pretty-print as multi-line
# add parameter for signature
# all params in CAPS
# collapse to one line per file found and
# replace 'echo' with 'printf'

SIG
='72766c'
find
. -type f                             \
 
| while read -r LINE; do                  \
      printf
"%s %s\n"                     \
             $
(head -c 6 "$LINE" | xxd -p) \
             
"$LINE";                      \
   
done                                    \
 
| grep "$SIG"                             \
 
| cut -d " " -f 2-


Reply all
Reply to author
Forward
0 new messages