ROSE  0.11.145.0
Public Types | Public Member Functions | List of all members
Rose::BinaryAnalysis::MagicNumber Class Reference

Description

Definition at line 16 of file MagicNumber.h.

Public Types

enum  Mechanism {
  FAST,
  SLOW,
  NONE
}
 How to search for magic numbers. More...
 

Public Member Functions

 MagicNumber ()
 Create a magic number analyzer. More...
 
 MagicNumber (const MagicNumber &)=delete
 
MagicNumberoperator= (const MagicNumber &)=delete
 
Mechanism mechanism () const
 Property: The mechanism being used to find magic numbers. More...
 
std::string identify (const MemoryMap::Ptr &, rose_addr_t va) const
 Identify the magic number at the specified address. More...
 
size_t maxBytesToCheck () const
 Property: Max number of bytes to check at once. More...
 
void maxBytesToCheck (size_t n)
 Property: Max number of bytes to check at once. More...
 

Member Enumeration Documentation

How to search for magic numbers.

See MagicNumber::mechanism property.

Definition at line 21 of file MagicNumber.h.

Constructor & Destructor Documentation

Rose::BinaryAnalysis::MagicNumber::MagicNumber ( )
inline

Create a magic number analyzer.

Definition at line 34 of file MagicNumber.h.

Member Function Documentation

Mechanism Rose::BinaryAnalysis::MagicNumber::mechanism ( ) const
inline

Property: The mechanism being used to find magic numbers.

Multiple machanisms are available:

  • If the libmagic library is available then that mechanism is used the the return value is FAST.
  • If libmagic is not available and this is a Unix machine, then the file(1) command is invoked on a temporary file. The return value in this case is SLOW.
  • If this is Windows and the libmagic library is not available then the return value is NONE. In this case, all calls to identify will throw a std::runtime_error.

This property is read-only.

Definition at line 56 of file MagicNumber.h.

size_t Rose::BinaryAnalysis::MagicNumber::maxBytesToCheck ( ) const
inline

Property: Max number of bytes to check at once.

This property is the maximum number of bytes that should be passed at once to the magic-number checking funtions. The library imposes a hard-coded limit, but the user may set this to a lower value to gain speed. Trying to set this to a higher value than the hard-coded limit will result in using the hard-coded limit.

Definition at line 65 of file MagicNumber.h.

void Rose::BinaryAnalysis::MagicNumber::maxBytesToCheck ( size_t  n)
inline

Property: Max number of bytes to check at once.

This property is the maximum number of bytes that should be passed at once to the magic-number checking funtions. The library imposes a hard-coded limit, but the user may set this to a lower value to gain speed. Trying to set this to a higher value than the hard-coded limit will result in using the hard-coded limit.

Definition at line 66 of file MagicNumber.h.

std::string Rose::BinaryAnalysis::MagicNumber::identify ( const MemoryMap::Ptr ,
rose_addr_t  va 
) const

Identify the magic number at the specified address.


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