Sponsored Content
Top Forums Programming Editing or Adding to ELF string tables Post 302255818 by otheus on Friday 7th of November 2008 07:47:56 AM
Old 11-07-2008
I gave it a whirrl. While it gave me a nice tree-view of the elf binary, it was not so simple to add or change section data. It appears you have to do it "by hand" -- ie, create a table, calculate the correct pointer, and change the entry in the table for that pointer. Not particularly time-saving. Smilie
 

8 More Discussions You Might Find Interesting

1. Linux

editing ELF file

Hello, This is not exactly relevant to Linux kernel but I'm gonna ask any way. Is there any way I can modify a 64-bit ELF object file to make it look like 32-bit ELF object file and link it (using `ld`) with 32-bit ELF file? I tried libelf but was unsuccessful. I had this pretty link... (1 Reply)
Discussion started by: tejuwala
1 Replies

2. Shell Programming and Scripting

string editing in files

Hi all, I'm fairly new to scripting in linux and need some help. I have an file that looks something like this: ~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Some comments # Some comments # Some comments # Some comments # Some comments # Some comments abc:/path/to/somewhere:X... (3 Replies)
Discussion started by: Avatar Gixxer
3 Replies

3. Shell Programming and Scripting

SH Script help. editing string

I have a string that looks like this username|field1|field2|field3 the data has a delimiter of "|" how can i edit field1, keeping the rest of the data the same also how can i edit field2 and 3. (3 Replies)
Discussion started by: nookie
3 Replies

4. Programming

ELF-string table

hello everybody! I want to read the string table of an object file(which is in ELF format). I get the sh_name value but i cant find a way to read the value in the string table that this index represent. I program in C. thanx a lot folks! (3 Replies)
Discussion started by: nicos
3 Replies

5. UNIX for Dummies Questions & Answers

Help with editing string elements

Hi All I have a question. I would like to edit some string characters by replacing with characters of choice located in another file. For example in sample file>S5_SK1.chr01 NNNNNNNNNNNNNNNNNNNCAGCATGCAATAAGGTGACATAGATATACCCACACACCACACCCTAACACTAACCCTAATCTAACCCTGGCCAACCTGTTT... (9 Replies)
Discussion started by: pawannoel
9 Replies

6. Shell Programming and Scripting

Editing part of the string

Hi guys got a problem here hope u all can help me. I learn that sed can actually edit a string but you need to know the old attribute to change to new 1. Example: sed "s/$title:$author/$title:$Nauthor/g" "Harry Potter - The Half Blood Prince:J.K Rowling:40.30:10:50" Each delimiter : represent... (4 Replies)
Discussion started by: GQiang
4 Replies

7. Shell Programming and Scripting

Need help regarding String editing

Hi Geeks I am working on trimming the logs and extracting the XMLs from it. I am facing one problem here. My XML String is ending with ...........Request></Body></Envelope>S/R sometimes there is more then just S/R in the end. I want to delete anything comes after </Envelope>... (3 Replies)
Discussion started by: santy00110011
3 Replies

8. Shell Programming and Scripting

Editing in vi - adding words to a line

i have lines in a file similar to this: results=$(echo Total: ${res} | command | command) now I need to add text before the word "results", but i dont know how to do it. here's what i tried: %s~results=.*echo Total:.* ${7}~PROCESS \; results=.*echo Total:.* ${7}~g the problem is,... (1 Reply)
Discussion started by: SkySmart
1 Replies
ELF_GETSCN(3)						   BSD Library Functions Manual 					     ELF_GETSCN(3)

NAME
elf_getscn, elf_ndxscn, elf_newscn, elf_nextscn -- get/allocate section information for an ELF object LIBRARY
ELF Access Library (libelf, -lelf) SYNOPSIS
#include <libelf.h> Elf_Scn * elf_getscn(Elf *elf, size_t index); size_t elf_ndxscn(Elf_Scn *scn); Elf_Scn * elf_newscn(Elf *elf); Elf_Scn * elf_nextscn(Elf *elf, Elf_Scn *scn); DESCRIPTION
These functions are used to iterate through the sections associated with an ELF descriptor. Function elf_getscn() will return a section descriptor for the section at index index in the object denoted by ELF descriptor elf. An error will be signalled if the specified section does not exist. Function elf_ndxscn() returns the section table index associated with section descriptor scn. Function elf_newscn() creates a new section and appends it to the list of sections associated with descriptor elf. The library will automat- ically increment the e_shnum field of the ELF header associated with descriptor elf, and will set the ELF_F_DIRTY flag on the returned sec- tion descriptor. For ELF descriptors opened for writing, the ELF library will automatically create an empty section at index zero (SHN_UNDEF) on the first call to elf_newscn(). Function elf_nextscn() takes a section descriptor scn and returns a pointer to the section descriptor at the next higher index. Argument scn is allowed to be NULL, in which case this function will return a pointer to the section descriptor at index 1. If no further sections are present, function elf_nextscn() will return a NULL pointer. RETURN VALUES
Functions elf_getscn(), elf_newscn() and elf_nextscn() return a valid pointer to a section descriptor if successful, or NULL if an error occurs. Function elf_ndxscn() returns a valid section table index if successful, or SHN_UNDEF if an error occurs. ERRORS
These functions may fail with the following errors: [ELF_E_ARGUMENT] Arguments elf or scn were NULL. [ELF_E_ARGUMENT] Argument index exceeded the current number of sections in the ELF object. [ELF_E_ARGUMENT] Argument elf was not a descriptor for an ELF file. [ELF_E_ARGUMENT] Section descriptor scn was not associated with ELF descriptor elf. [ELF_E_CLASS] Descriptor elf was of an unknown ELF class. [ELF_E_SECTION] Argument elf specified extended section numbering in the ELF header with the section header at index SHN_UNDEF not being of type SHT_NULL. SEE ALSO
elf(3), elf_flagdata(3), elf_flagscn(3), elf_getdata(3), elf_getshdr(3), gelf(3) BSD
October 22, 2007 BSD
All times are GMT -4. The time now is 09:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy