LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-17-2011, 09:07 AM   #1
RayK
LQ Newbie
 
Registered: Mar 2011
Posts: 1

Rep: Reputation: 0
Parsing a binary file


Is it possible to parse through a binary file using a script using either Korn shell or Bash
 
Old 03-17-2011, 09:35 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by RayK View Post
Is it possible to parse through a binary file using a script using either Korn shell or Bash
No way for anyone to answer this, based on what you ask. What kind of file, and what do you mean by 'parse'??
 
Old 03-17-2011, 10:16 AM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Looking for an object ?

readelf -s <file> | less
readelf -s <file> | grep <name>

objdump -Dslx <file> | more
 
Old 03-17-2011, 11:20 AM   #4
Telengard
Member
 
Registered: Apr 2007
Location: USA
Distribution: Kubuntu 8.04
Posts: 579
Blog Entries: 8

Rep: Reputation: 148Reputation: 148
Quote:
Originally Posted by RayK View Post
Is it possible to parse through a binary file using a script using either Korn shell or Bash
You haven't given us enough context to answer fully, but I'll take a stab at it.

Code:
~$ file /bin/bash
/bin/bash: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.8, dynamically linked (uses shared libs), stripped
~$ strings /bin/bash | tail
bcoalesce: CHAIN(mp2) != mp1
malloc: %s:%d: assertion botched
free: called with already freed block argument
free: called with unallocated block argument
free: underflow detected; mh_nbytes out of range
free: start and end chunk sizes differ
malloc: block on free list clobbered
realloc: called with unallocated block argument
realloc: underflow detected; mh_nbytes out of range
realloc: start and end chunk sizes differ
~$ hd /bin/bash | tail
000ab640  20 6a 0a 00 64 47 00 00  00 00 00 00 00 00 00 00  | j..dG..........|
000ab650  20 00 00 00 00 00 00 00  cb 00 00 00 08 00 00 00  | ...............|
000ab660  03 00 00 00 a0 41 0f 08  84 b1 0a 00 18 4d 00 00  |.....A.......M..|
000ab670  00 00 00 00 00 00 00 00  20 00 00 00 00 00 00 00  |........ .......|
000ab680  d0 00 00 00 01 00 00 00  00 00 00 00 00 00 00 00  |................|
000ab690  84 b1 0a 00 0c 00 00 00  00 00 00 00 00 00 00 00  |................|
000ab6a0  01 00 00 00 00 00 00 00  01 00 00 00 03 00 00 00  |................|
000ab6b0  00 00 00 00 00 00 00 00  90 b1 0a 00 df 00 00 00  |................|
000ab6c0  00 00 00 00 00 00 00 00  01 00 00 00 00 00 00 00  |................|
000ab6d0
~$
To get more useful responses you should consider the following:
 
  


Reply



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
Help: Opening GenICs binary file, writing to binary file for GADGET-2 (in C) parallax147 Programming 0 10-05-2010 11:06 AM
[SOLVED] Parsing a file? elfoozo Programming 13 03-26-2010 03:25 PM
(Debian) xorg.conf file, (EE) Problem parsing the config file unclerick94 Linux - Newbie 1 07-28-2009 02:27 PM
Reading/Wirting file/parsing xml file using javascript fakhrul Programming 1 08-14-2007 05:08 PM
Need help with file parsing BrianK Programming 2 09-02-2005 05:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:37 AM.

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