LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-13-2006, 04:59 AM   #1
//////
Member
 
Registered: Nov 2005
Location: Land of Linux :: Finland
Distribution: Arch Linux && OpenBSD 7.4 && Pop!_OS && Kali && Qubes-Os
Posts: 824

Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350
[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

/////
 
Old 11-13-2006, 05:06 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
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.
 
Old 11-13-2006, 05:11 AM   #3
//////
Member
 
Registered: Nov 2005
Location: Land of Linux :: Finland
Distribution: Arch Linux && OpenBSD 7.4 && Pop!_OS && Kali && Qubes-Os
Posts: 824

Original Poster
Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350
Excellent

Thank you very much, so simple solution

Cheers,

//////
 
  


Reply

Tags
bash, filetype



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
filetype aware tab completion bash gearoid_murphy Linux - General 2 10-29-2006 06:52 AM
Filetype .ps.gz ? zoffmann Debian 5 10-07-2005 04:11 PM
filetype AGilley007 Slackware 3 07-29-2004 12:13 PM
sid filetype helios the sun Linux - Newbie 7 06-28-2004 05:49 PM
why won't it read this filetype? robster Linux - General 6 02-17-2004 07:46 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration