Peach :: Generators :: data :: IcmpChecksum :: Class IcmpChecksum
[hide private]

Class IcmpChecksum

source code


Will generate the ICMP checksum of Block or another Generator. IcmpChecksum can can detect recursive calls and provides a default based on ICMP RFC.

Produced value is 16 bits.

Example:

>>> block = Block([ Static('12345') ])
>>> icmpChecksum = IcmpChecksum( block )
>>> print icmpChecksum.getValue()
5
Instance Methods [hide private]
 
__init__(self, block) source code
 
_checksum(self, checksum_packet)
Calculate checksum
source code
 
getValue(self)
Return data, passed through a transformer if set.
source code
string
getRawValue(self)
Returns size of block as string.
source code
Block
getBlock(self)
Get block object we act on.
source code
 
setBlock(self, block)
Set block we act on.
source code
Class Variables [hide private]
  _inGetRawValue = 0
Method Details [hide private]

__init__(self, block)
(Constructor)

source code 
Parameters:
  • block (Block) - Block to get size of

getRawValue(self)

source code 

Returns size of block as string.

Returns: string
size of specified Block

getBlock(self)

source code 

Get block object we act on.

Returns: Block
current Block

setBlock(self, block)

source code 

Set block we act on.

Parameters:
  • block (Block) - Block to set.