LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   [Bash] filetype problem (https://www.linuxquestions.org/questions/programming-9/%5Bbash%5D-filetype-problem-501114/)

////// 11-13-2006 04:59 AM

[Bash] filetype problem
 
Hello, I have a little problem, I'm running low interaction honeypot and it stores all files it receives from ftp - tfpt etc. as a <MD5 sum>.bin, like this:

Code:

slax hexdumps # ls -a1
./
../
11b209305d1a3f5390bd089e6e00f46f.bin
30c8dc4d7a898d070c05d1a9378d81d2.bin
9b72b6891831b7c04aedfd60e614112e.bin
f9dc4a724a268dc50f599d91414a25a8.bin

When I take a look at those files there is different kind of files like:

Text documents
Windows exe's
Unknown
etc.

Code:

Name_____________________________________|Size______|Filetype____________|
11b209305d1a3f5390bd089e6e00f46f.bin      137B      Unknown
30c8dc4d7a898d070c05d1a9378d81d2.bin      150B      Plain Text Document
9b72b6891831b7c04aedfd60e614112e.bin      1.9KB      Windows Executable
f9dc4a724a268dc50f599d91414a25a8.bin      1.0KB      Unknown

The question is, how can I choose in a script, for example, Windows Executables and copy those files to the other folder.

TIA

/////

druuna 11-13-2006 05:06 AM

Hi,

Did you try to use the file command?

This command tries to determine the file type. I.e:
Code:

$ file infile
infile: ASCII text

$ file nzbperl
nzbperl: perl script text executable

Hope this helps.

////// 11-13-2006 05:11 AM

Excellent :)

Thank you very much, so simple solution :)

Cheers,

//////


All times are GMT -5. The time now is 10:58 AM.