LIEF: Library to Instrument Executable Formats Version 0.16.0
Loading...
Searching...
No Matches
LIEF::Section Class Reference

Class which represents an abstracted section. More...

#include <Section.hpp>

Inheritance diagram for LIEF::Section:
Collaboration diagram for LIEF::Section:

Public Member Functions

 Section ()=default
 
 Section (std::string name)
 
 ~Section () override=default
 
Sectionoperator= (const Section &)=default
 
 Section (const Section &)=default
 
virtual std::string name () const
 section's name
 
virtual const std::string & fullname () const
 Return the complete section's name which might trailing (0) bytes.
 
virtual span< const uint8_t > content () const
 section's content
 
virtual void size (uint64_t size)
 Change the section size.
 
virtual uint64_t size () const
 section's size (size in the binary, not the virtual size)
 
virtual uint64_t offset () const
 Offset in the binary.
 
virtual uint64_t virtual_address () const
 Address where the section should be mapped.
 
virtual void virtual_address (uint64_t virtual_address)
 
virtual void name (std::string name)
 Change the section's name.
 
virtual void content (const std::vector< uint8_t > &)
 Change section content.
 
virtual void offset (uint64_t offset)
 
double entropy () const
 Section's entropy.
 
size_t search (uint64_t integer, size_t pos, size_t size) const
 
size_t search (const std::vector< uint8_t > &pattern, size_t pos=0) const
 
size_t search (const std::string &pattern, size_t pos=0) const
 
size_t search (uint64_t integer, size_t pos=0) const
 
std::vector< size_t > search_all (uint64_t v, size_t size) const
 
std::vector< size_t > search_all (uint64_t v) const
 
std::vector< size_t > search_all (const std::string &v) const
 
void accept (Visitor &visitor) const override
 Method so that the visitor can visit us.
 
- Public Member Functions inherited from LIEF::Object
 Object ()
 
 Object (const Object &other)
 
Objectoperator= (const Object &other)
 
template<class T >
output_t< T > as ()
 
template<class T >
output_const_t< T > as () const
 
virtual bool operator== (const Object &other) const
 
virtual bool operator!= (const Object &other) const
 
virtual ~Object ()
 

Static Public Attributes

static constexpr size_t npos = -1
 

Additional Inherited Members

- Public Types inherited from LIEF::Object
template<class T >
using output_t = add_pointer_t<decay_t<T>>
 
template<class T >
using output_const_t = add_pointer_t<add_const_t<decay_t<T>>>
 

Detailed Description

Class which represents an abstracted section.

Constructor & Destructor Documentation

◆ Section() [1/3]

LIEF::Section::Section ( )
default

◆ Section() [2/3]

LIEF::Section::Section ( std::string name)
inline

◆ ~Section()

LIEF::Section::~Section ( )
overridedefault

◆ Section() [3/3]

LIEF::Section::Section ( const Section & )
default

Member Function Documentation

◆ accept()

void LIEF::Section::accept ( Visitor & visitor) const
overridevirtual

Method so that the visitor can visit us.

Implements LIEF::Object.

◆ content() [1/2]

virtual span< const uint8_t > LIEF::Section::content ( ) const
inlinevirtual

section's content

Reimplemented in LIEF::ELF::Section, LIEF::MachO::Section, and LIEF::PE::Section.

◆ content() [2/2]

virtual void LIEF::Section::content ( const std::vector< uint8_t > & )
inlinevirtual

Change section content.

Reimplemented in LIEF::ELF::Section, LIEF::MachO::Section, and LIEF::PE::Section.

◆ entropy()

double LIEF::Section::entropy ( ) const

Section's entropy.

◆ fullname()

virtual const std::string & LIEF::Section::fullname ( ) const
inlinevirtual

Return the complete section's name which might trailing (0) bytes.

◆ name() [1/2]

virtual std::string LIEF::Section::name ( ) const
inlinevirtual

section's name

Reimplemented in LIEF::PE::Section.

◆ name() [2/2]

virtual void LIEF::Section::name ( std::string name)
inlinevirtual

Change the section's name.

Reimplemented in LIEF::PE::Section.

◆ offset() [1/2]

virtual uint64_t LIEF::Section::offset ( ) const
inlinevirtual

Offset in the binary.

Reimplemented in LIEF::ELF::Section.

◆ offset() [2/2]

virtual void LIEF::Section::offset ( uint64_t offset)
inlinevirtual

Reimplemented in LIEF::ELF::Section.

◆ operator=()

Section & LIEF::Section::operator= ( const Section & )
default

◆ search() [1/4]

size_t LIEF::Section::search ( const std::string & pattern,
size_t pos = 0 ) const

◆ search() [2/4]

size_t LIEF::Section::search ( const std::vector< uint8_t > & pattern,
size_t pos = 0 ) const

◆ search() [3/4]

size_t LIEF::Section::search ( uint64_t integer,
size_t pos,
size_t size ) const

◆ search() [4/4]

size_t LIEF::Section::search ( uint64_t integer,
size_t pos = 0 ) const

◆ search_all() [1/3]

std::vector< size_t > LIEF::Section::search_all ( const std::string & v) const

◆ search_all() [2/3]

std::vector< size_t > LIEF::Section::search_all ( uint64_t v) const

◆ search_all() [3/3]

std::vector< size_t > LIEF::Section::search_all ( uint64_t v,
size_t size ) const

◆ size() [1/2]

virtual uint64_t LIEF::Section::size ( ) const
inlinevirtual

section's size (size in the binary, not the virtual size)

Reimplemented in LIEF::ELF::Section.

◆ size() [2/2]

virtual void LIEF::Section::size ( uint64_t size)
inlinevirtual

Change the section size.

Reimplemented in LIEF::ELF::Section.

◆ virtual_address() [1/2]

virtual uint64_t LIEF::Section::virtual_address ( ) const
inlinevirtual

Address where the section should be mapped.

◆ virtual_address() [2/2]

virtual void LIEF::Section::virtual_address ( uint64_t virtual_address)
inlinevirtual

Member Data Documentation

◆ npos

size_t LIEF::Section::npos = -1
staticconstexpr

The documentation for this class was generated from the following file: