lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 4 May 2016 13:37:01 +0100
From:	Kieran Bingham <kieran@...uared.org.uk>
To:	buzdelabuz2@...il.com, jan.kiszka@...mens.com
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] Improve types abstraction for gdb python scripts

On 04/05/16 04:12, buzdelabuz2@...il.com wrote:
> From: Dom Cote <buzdelabuz2+git@...il.com>
> 
> Change the read_u16 function so it accepts both 'str' and 'byte'
> as type for the arguments.
> 
> When calling read_memory() from gdb API, depending on if
> it was built with 2.7 or 3.X, the format used to return the
> data will differ ( 'str' for 2.7, and 'byte' for 3.X ).
> 
> Add a function read_memoryview() to be able to get a
> 'memoryview' object back from read_memory() both with
> python 2.7 and 3.X .
> 
> Tested with python 3.4 and 2.7
> Tested with gdb 7.7

I have also tested with Python 3.4, 2.7 on GDB 11

> 
> Signed-off-by: Dom Cote <buzdelabuz2+git@...il.com>

Acked-by: Kieran Bingham <kieran@...gham.xyz>
Tested-by: Kieran Bingham <kieran@...gham.xyz>

> ---
>  scripts/gdb/linux/utils.py | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/gdb/linux/utils.py b/scripts/gdb/linux/utils.py
> index 0893b326a28b..dba6c88ea7b9 100644
> --- a/scripts/gdb/linux/utils.py
> +++ b/scripts/gdb/linux/utils.py
> @@ -87,11 +87,24 @@ def get_target_endianness():
>      return target_endianness
>  
>  
> +def read_memoryview(inf, start, length):
> +    return memoryview(inf.read_memory(start, length))
> +
> +
>  def read_u16(buffer):
> +    value = [0, 0]
> +
> +    if type(buffer[0]) is str:
> +        value[0] = ord(buffer[0])
> +        value[1] = ord(buffer[1])
> +    else:
> +        value[0] = buffer[0]
> +        value[1] = buffer[1]
> +
>      if get_target_endianness() == LITTLE_ENDIAN:
> -        return ord(buffer[0]) + (ord(buffer[1]) << 8)
> +        return value[0] + (value[1] << 8)
>      else:
> -        return ord(buffer[1]) + (ord(buffer[0]) << 8)
> +        return value[1] + (value[0] << 8)
>  
>  
>  def read_u32(buffer):
> 

-- 
Regards

Kieran Bingham

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ