/
README
153 lines (109 loc) · 4.55 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
NAME
ELF::Extract::Sections - Extract Raw Chunks of data from identifiable
ELF Sections
VERSION
version 0.0104
CAVEATS
1. Beta Software
This code is relatively new. It exists only as a best attempt at
present until further notice. It has proven practical for at least
one application, and this is why the module exists. However, it
can't be guaranteed it will work for whatever you want it to in all
cases. Please report any bugs you find.
2. Feature Incomplete
This only presently has a very barebones functionality, which should
however prove practical for most purposes. If you have any
suggestions, please tell me via "report bugs". If you never seek,
you'll never find.
3. Humans
This code is written by a human, and like all human code, it sucks.
There will be bugs. Please report them.
SYNOPSIS
use ELF::Extract::Sections;
# Create an extractor object for foo.so
my $extractor = ELF::Extract::Sections->new( file => '/path/to/foo.so' );
# Scan file for section data, returns a hash
my %sections = ${ $extractor->sections };
# Retreive the section object for the comment section
my $data = $sections{.comment};
# Print the stringified explanation of the section
print "$data";
# Get the raw bytes out of the section.
print $data->contents # returns bytes
PUBLIC ATTRIBUTES
-> file
Returns the file the section data is being created for.
-> sections
Returns a HashRef of the available sections.
-> scanner
Returns the name of the default scanner plugin
PUBLIC METHODS
-> new ( file => FILENAME )
-> new ( file => FILENAME , scanner => 'Objdump' )
Creates A new Section Extractor object
-> sorted_sections ( field => SORT_BY )
-> sorted_sections ( field => SORT_BY, descending => DESCENDING )
Returns an ArrayRef sorted by the SORT_BY field. May be Ascending or
Descending depending on requirements.
DESCENDING
Optional parameters. True for descending, False or absensent for
ascending.
SORT_BY
A String of the field to sort by. Valid options at present are
name The Section Name
offset
The Sections offset relative to the start of the file.
size The Size of the section.
PUBLIC ATTRIBUTE BUILDERS
These aren't really user servicable, but they make your front end work.
-> _build_sections
PRIVATE ATTRIBUTES
-> _scanner_package
-> _scanner_instance
PRIVATE ATTRIBUTE BUILDERS
-> _build__scanner_package
-> _build__scanner_instance
PRIVATE_METHODS
-> _stash_record( HashRef, Str, Str )
-> _build_section_section( Str, Int, Int, File )
-> _build_section_table( HashRef )
-> _scan_guess_size
-> _scan_with_size
DEBUGGING
This library uses Log::Log4perl. To see more verbose processing notices,
do this:
use Log::Log4perl qw( :easy );
Log::Log4perl->easy_init($DEBUG);
For convenience to make sure you don't happen to miss this fact, we
never initialize Log4perl ourself, so it will spit the following message
if you have not set it up:
Log4perl: Seems like no initialization happened. Forgot to call init()?
To suppress this, just do
use Log::Log4perl qw( :easy );
I request however you don't do that for modules intended to be consumed
by others without good cause.
BUGS
Please report any bugs or feature requests to "bug-elf-extract-sections
at rt.cpan.org", or through the web interface at
<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ELF-Extract-Sections>. I
will be notified, and then you'll automatically be notified of progress
on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc ELF::Extract::Sections
You can also look for information at:
* RT: CPAN's request tracker
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=ELF-Extract-Sections>
* AnnoCPAN: Annotated CPAN documentation
<http://annocpan.org/dist/ELF-Extract-Sections>
* CPAN Ratings
<http://cpanratings.perl.org/d/ELF-Extract-Sections>
* Search CPAN
<http://search.cpan.org/dist/ELF-Extract-Sections/>
ACKNOWLEDGEMENTS
AUTHOR
Kent Fredric <kentnl@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2009 by Kent Fredric.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.