LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 09-29-2009, 06:55 PM   #1
vendtagain
Member
 
Registered: Sep 2009
Distribution: Slackware, Debian, Mac OS X, Zenwalk, Puppy, Gentoo
Posts: 199

Rep: Reputation: 32
writing binaries


just curious if there is a way to read and write binaries?
 
Old 09-29-2009, 06:57 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,627

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
Quote:
just curious if there is a way to read and write binaries?
other than using a hex editor .
that is what i use to hack MS Windows .lib's

for *nix i just recompile the source
 
Old 09-29-2009, 07:31 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,363

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
You can do a binary open in C and Perl; possibly other langs.
Actually, on *nix, there's no difference in the open(), its the use of read() or freed() and/or seek().
http://www.perlmonks.org/?node_id=135323
http://www.nextdawn.nl/c-tutorial-binary-file-io
 
Old 09-29-2009, 07:44 PM   #4
DragonSlayer48DX
Registered User
 
Registered: Dec 2006
Posts: 1,454
Blog Entries: 1

Rep: Reputation: 75
Quote:
Originally Posted by vendtagain View Post
just curious if there is a way to read and write binaries?
Exactly how do you mean that? Binaries are created by compiling source code.
 
Old 09-29-2009, 07:49 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,363

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
He could mean binary data files, that's what I assumed, although legal reverse engineering of code is the same principle.
 
Old 09-29-2009, 08:14 PM   #6
vendtagain
Member
 
Registered: Sep 2009
Distribution: Slackware, Debian, Mac OS X, Zenwalk, Puppy, Gentoo
Posts: 199

Original Poster
Rep: Reputation: 32
I noticed when trying to open a binary(as in a compiled program) in a gui text editor, it says it can't read it, like it doesn't know 1's and 0's? i guess you could call it "reverse engineering", if by that you mean forming it back into a format humans could actually understand. im familiar with C but not how the computer reads the compiled binary.
 
Old 09-29-2009, 08:23 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,363

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
I doubt a gui editor will handle it, that's not what they are for. There may be an 'advanced' option somewhere in the menus...
You'll prob have to go cmd line; try vi/vim or you can use od http://linux.die.net/man/1/od
 
Old 09-29-2009, 08:32 PM   #8
vendtagain
Member
 
Registered: Sep 2009
Distribution: Slackware, Debian, Mac OS X, Zenwalk, Puppy, Gentoo
Posts: 199

Original Poster
Rep: Reputation: 32
command line is actually my preference, gui makes me feel like an idiot and typically just takes more work to do anything. any programs that can convert binary to a more human format?
 
Old 09-29-2009, 08:39 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,363

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Try that od cmd with the relevant params. Provides a dual col display; eg hex codes for a ew bytes, then the equiv (if possible) in ACII (ie human readable).
Note that it can't reverse compile; that's specialised task.

To comply with LQ rules I'd like to ask exactly what you are trying to do and is it strictly legal?
 
Old 09-29-2009, 08:55 PM   #10
vendtagain
Member
 
Registered: Sep 2009
Distribution: Slackware, Debian, Mac OS X, Zenwalk, Puppy, Gentoo
Posts: 199

Original Poster
Rep: Reputation: 32
im curious about how computers work. i have been interested in how things and computers work since a wee child, but there is a giant gap between hardware and software like a giant black hole that i'm just trying to figure out.
 
Old 09-29-2009, 09:08 PM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,363

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Ok, just be aware that reverse engineering/decompiling someone else's code is frequently illegal.
I believe(?) it's allowed for 'interoperability' purposes in some(!) jurisdictions. Maybe a moderator will come along and clarify.
Feel free to work on GPL (Linux stuff) as it comes with the src anyway.
Alternately, write a short C prog & compile & link it, then see if you can de-compile it.
 
Old 09-29-2009, 09:20 PM   #12
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
If your interest is merely didactic, you should first start with assembler. That's the closest you are going to get to the hardware nowadays. You could open a binary program in an hex editor, but all you are going to see is a lot of number in base 16 which will make absolutely no sense to you, unless you know all the assembly mnemonics from memory (that's why first of anything, your'd need to learn assembly to make any sense at all of what you see in an hex editor.

Hexadecimal editors usually provide options to view number in binary format and the ascii equivalents as well. But that depends on the editor you choose.
 
Old 09-29-2009, 09:23 PM   #13
vendtagain
Member
 
Registered: Sep 2009
Distribution: Slackware, Debian, Mac OS X, Zenwalk, Puppy, Gentoo
Posts: 199

Original Poster
Rep: Reputation: 32
curiosity killed the cat? sniff sniff
(i hope i didn't break a trademark)
 
Old 09-29-2009, 09:26 PM   #14
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
[edit]Goodness ... waiting two hours to "save" a response is not
a good idea ;D[/edit]

Last edited by Tinkster; 09-29-2009 at 09:28 PM. Reason: edit
 
Old 09-29-2009, 10:02 PM   #15
vendtagain
Member
 
Registered: Sep 2009
Distribution: Slackware, Debian, Mac OS X, Zenwalk, Puppy, Gentoo
Posts: 199

Original Poster
Rep: Reputation: 32
its kinda awkward trying to learn from two sides of a spectrum and trying to meet in the middle, I didn't expect to get so many responses. ridiculous.
 
  


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
Writing Apps & Helpers for writers (all kinds) tech-writing, fiction, etc?? linus72 Debian 9 09-28-2009 09:34 AM
Writing to tty causes writing to disk? (in ancient 2.2.x kernel) borsburn Linux - Kernel 0 12-17-2008 12:47 PM
LXer: Democratization, Writing and Writing Code LXer Syndicated Linux News 0 11-22-2006 05:03 AM
cd writing software which supports multisession writing jayakrishnan Linux - General 3 03-24-2003 05:51 AM
Binaries socks Linux - Newbie 1 11-20-2002 09:39 AM

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

All times are GMT -5. The time now is 11:38 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