gwcheck

Check .gnu.warning.* sections in ELF object files
Log | Files | Refs | README | LICENSE

commit 1431daf9b2371a7bfafdab0dc51161345ce42fdd
Author: Frederic Cambus <fred@statdns.com>
Date:   Thu,  4 Nov 2021 11:47:03 +0100

Initial commit.

Diffstat:
AAUTHORS | 5+++++
ALICENSE | 24++++++++++++++++++++++++
Agwcheck | 30++++++++++++++++++++++++++++++
Arequirements.txt | 1+
4 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/AUTHORS b/AUTHORS @@ -0,0 +1,5 @@ +gwcheck is developed by: + +Frederic Cambus <fred AT statdns DOT com> + +Site: https://www.cambus.net diff --git a/LICENSE b/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2021, Frederic Cambus +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/gwcheck b/gwcheck @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 + +# +# gwcheck +# Copyright (c) 2021, Frederic Cambus +# https://github.com/fcambus/gwcheck +# +# Created: 2011-11-04 +# Last Updated: 2021-11-04 +# +# gwcheck is released under the BSD 2-Clause license. +# See LICENSE file for details. +# +# SPDX-License-Identifier: BSD-2-Clause +# + +import sys +from elftools.elf.elffile import ELFFile + + +def main(): + with open(sys.argv[1], "rb") as f: + for section in ELFFile(f).iter_sections(): + if section["sh_type"] == "SHT_PROGBITS": + if section.name.startswith(".gnu.warning"): + print(section.data().decode("utf-8")) + + +if __name__ == "__main__": + main() diff --git a/requirements.txt b/requirements.txt @@ -0,0 +1 @@ +pyelftools