Exemplo n.º 1
0
def initialize_parser():

    description = 'Process data stream and subtract each byte by ' \
                  'the supplied key. Numeric values may be provided ' \
                  'as regular integers or hexadecimal with the \'0x\' prefix.'

    parser = BinDataHelper.generic_args(description)

    parser.add_argument('key',
                        type=BinDataHelper.autokey,
                        help='Single or multibyte key value. '
                        'May be supplied as an integer or '
                        'as a hex value with the \'0x\' prefix.')
    parser.add_argument('-c',
                        '--count',
                        type=BinDataHelper.autoint,
                        default=0,
                        help='Interval to increment key value on each byte '
                        'iteration. Range of 0x00 - 0xff.')
    parser.add_argument('-sn',
                        '--skip-nulls',
                        action='store_true',
                        default=False,
                        help='When processing the buffer, skip all null '
                        '(\'0x00\') bytes.')
    parser.add_argument('-sk',
                        '--skip-key',
                        action='store_true',
                        default=False,
                        help='Skip bytes that match the supplied key value.')

    return parser
Exemplo n.º 2
0
def initialize_parser():

    description = 'Process data stream and swap each byte. ' \
                  'Numeric values may be provided ' \
                  'as regular integers or hexadecimal with the \'0x\' prefix.'

    parser = BinDataHelper.generic_args(description)

    return parser
Exemplo n.º 3
0
def initialize_parser():

    description = 'Process data stream and negate each byte. ' \
                  'Numeric values may be provided ' \
                  'as regular integers or hexadecimal with the \'0x\' prefix.'

    parser = BinDataHelper.generic_args(description)

    parser.add_argument('-sn', '--skip-nulls',
                        action='store_true',
                        default=False,
                        help='When processing the buffer, skip all null '
                             '(\'0x00\') bytes.')

    return parser
Exemplo n.º 4
0
def initialize_parser():

    description = 'Process data stream and rotate each byte. ' \
                  'Numeric values may be provided ' \
                  'as regular integers or hexadecimal with the \'0x\' prefix.'

    parser = BinDataHelper.generic_args(description)

    parser.add_argument('count',
                        type=BinDataHelper.autoint,
                        help='Number of times to perform rotation. '
                        'Defaults to the left.')
    parser.add_argument('-r',
                        '--right',
                        action='store_true',
                        default=False,
                        help='Override default rotation direction, and '
                        'instead rotate bits to the right.')

    return parser
Exemplo n.º 5
0
def initialize_parser():

    description = 'Instead of a standard single byte xor operation, ' \
                  'xor end byte with previous byte and continue in a ' \
                  'decrementing fashion until the final byte is ' \
                  'reached at the beginning.'

    parser = BinDataHelper.generic_args(description)

    parser.add_argument('-r', '--reverse',
                        action='store_true',
                        default=False,
                        help='Reverse the process, applying pairwise '
                             'at the beginning rather than the end.')
    parser.add_argument('-k', '--pw-xor-key',
                        type=BinDataHelper.autoint,
                        default=0,
                        help='Key to use to start or end the XOR '
                             '(depending on if \'r\' is used). '
                             'Must be 0x00-0xff. Defaults to 0x00.')

    return parser