LIEF: Library to Instrument Executable Formats Version 0.17.0
|
Loading...
Searching...
No Matches
Go to the documentation of this file.
16#ifndef LIEF_ABSTRACT_SECTION_H
17#define LIEF_ABSTRACT_SECTION_H
31 static constexpr size_t npos = -1;
35 name_(std::move(name))
42 virtual std::string
name()
const {
47 virtual const std::string&
fullname()
const {
53 virtual span<const uint8_t>
content()
const {
58 virtual void size(uint64_t size) {
63 virtual uint64_t
size()
const {
68 virtual uint64_t
offset()
const {
76 return virtual_address_;
80 virtual_address_ = virtual_address;
82 virtual void name(std::string name) {
85 name_ = std::move(name);
87 virtual void content(
const std::vector<uint8_t>&) {}
91 virtual void offset(uint64_t offset) {
100 size_t search(uint64_t integer,
size_t pos,
size_t size)
const;
101 size_t search(
const std::vector<uint8_t>& pattern,
size_t pos = 0)
const;
102 size_t search(
const std::string& pattern,
size_t pos = 0)
const;
103 size_t search(uint64_t integer,
size_t pos = 0)
const;
107 std::vector<size_t>
search_all(uint64_t v,
size_t size)
const;
112 void accept(Visitor& visitor)
const override;
121 uint64_t virtual_address_ = 0;
123 uint64_t offset_ = 0;
127 std::vector<size_t> search_all_(
const T& v)
const;
Class which represents an abstracted section.
Definition Abstract/Section.hpp:29
virtual void offset(uint64_t offset)
Definition Abstract/Section.hpp:91
virtual void content(const std::vector< uint8_t > &)
Change section content.
Definition Abstract/Section.hpp:89
virtual void size(uint64_t size)
Change the section size.
Definition Abstract/Section.hpp:60
virtual uint64_t size() const
section's size (size in the binary, not the virtual size)
Definition Abstract/Section.hpp:65
std::vector< size_t > search_all(const std::string &v) const
virtual void virtual_address(uint64_t virtual_address)
Definition Abstract/Section.hpp:79
size_t search(uint64_t integer, size_t pos, size_t size) const
Section(const Section &)=default
virtual const std::string & fullname() const
Return the complete section's name which might trailing (0) bytes.
Definition Abstract/Section.hpp:50
size_t search(const std::vector< uint8_t > &pattern, size_t pos=0) const
std::vector< size_t > search_all(uint64_t v) const
Section(std::string name)
Definition Abstract/Section.hpp:34
size_t search(uint64_t integer, size_t pos=0) const
double entropy() const
Section's entropy.
virtual void name(std::string name)
Change the section's name.
Definition Abstract/Section.hpp:84
virtual std::string name() const
section's name
Definition Abstract/Section.hpp:44
friend std::ostream & operator<<(std::ostream &os, const Section &entry)
virtual span< const uint8_t > content() const
section's content
Definition Abstract/Section.hpp:55
~Section() override=default
virtual uint64_t offset() const
Offset in the binary.
Definition Abstract/Section.hpp:70
size_t search(const std::string &pattern, size_t pos=0) const
std::vector< size_t > search_all(uint64_t v, size_t size) const
void accept(Visitor &visitor) const override
Method so that the visitor can visit us.
Section & operator=(const Section &)=default
virtual uint64_t virtual_address() const
Address where the section should be mapped.
Definition Abstract/Section.hpp:75
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41