@@ -448,7 +448,7 @@ def debug(self, argv=[], *a, **kw):
448
448
449
449
def _describe (self , * a , ** kw ):
450
450
log .info_once (
451
- '%s\n %-10s %s-%s-%s\n %s' ,
451
+ '%s\n %-12s %s-%s-%s\n %s' ,
452
452
repr (self .path ),
453
453
'Arch:' ,
454
454
self .arch ,
@@ -2002,6 +2002,16 @@ def packed(self):
2002
2002
""":class:`bool`: Whether the current binary is packed with UPX."""
2003
2003
return b'UPX!' in self .get_data ()[:0xFF ]
2004
2004
2005
+ @property
2006
+ def stripped (self ):
2007
+ """:class:`bool`: Whether the current binary has been stripped of symbols"""
2008
+ return not any (section ['sh_type' ] == 'SHT_SYMTAB' for section in self .iter_sections ())
2009
+
2010
+ @property
2011
+ def debuginfo (self ):
2012
+ """:class:`bool`: Whether the current binary has debug information"""
2013
+ return self .get_section_by_name ('.debug_info' ) is not None
2014
+
2005
2015
@property
2006
2016
def pie (self ):
2007
2017
""":class:`bool`: Whether the current binary is position-independent."""
@@ -2045,68 +2055,74 @@ def checksec(self, banner=True, color=True):
2045
2055
2046
2056
# Kernel version?
2047
2057
if self .version and self .version != (0 ,):
2048
- res .append ('Version:' .ljust (10 ) + '.' .join (map (str , self .version )))
2058
+ res .append ('Version:' .ljust (12 ) + '.' .join (map (str , self .version )))
2049
2059
if self .build :
2050
- res .append ('Build:' .ljust (10 ) + self .build )
2060
+ res .append ('Build:' .ljust (12 ) + self .build )
2051
2061
2052
2062
res .extend ([
2053
- "RELRO:" .ljust (10 ) + {
2063
+ "RELRO:" .ljust (12 ) + {
2054
2064
'Full' : green ("Full RELRO" ),
2055
2065
'Partial' : yellow ("Partial RELRO" ),
2056
2066
None : red ("No RELRO" )
2057
2067
}[self .relro ],
2058
- "Stack:" .ljust (10 ) + {
2068
+ "Stack:" .ljust (12 ) + {
2059
2069
True : green ("Canary found" ),
2060
2070
False : red ("No canary found" )
2061
2071
}[self .canary ],
2062
- "NX:" .ljust (10 ) + {
2072
+ "NX:" .ljust (12 ) + {
2063
2073
True : green ("NX enabled" ),
2064
2074
False : red ("NX disabled" ),
2065
2075
None : yellow ("NX unknown - GNU_STACK missing" ),
2066
2076
}[self .nx ],
2067
- "PIE:" .ljust (10 ) + {
2077
+ "PIE:" .ljust (12 ) + {
2068
2078
True : green ("PIE enabled" ),
2069
2079
False : red ("No PIE (%#x)" % self .address )
2070
2080
}[self .pie ],
2071
2081
])
2072
2082
2073
2083
# Execstack may be a thing, even with NX enabled, because of glibc
2074
2084
if self .execstack and self .nx is not False :
2075
- res .append ("Stack:" .ljust (10 ) + red ("Executable" ))
2085
+ res .append ("Stack:" .ljust (12 ) + red ("Executable" ))
2076
2086
2077
2087
# Are there any RWX areas in the binary?
2078
2088
#
2079
2089
# This will occur if NX is disabled and *any* area is
2080
2090
# RW, or can expressly occur.
2081
2091
if self .rwx_segments or (not self .nx and self .writable_segments ):
2082
- res += [ "RWX:" .ljust (10 ) + red ("Has RWX segments" ) ]
2092
+ res += [ "RWX:" .ljust (12 ) + red ("Has RWX segments" ) ]
2083
2093
2084
2094
if self .rpath :
2085
- res += [ "RPATH:" .ljust (10 ) + red (repr (self .rpath )) ]
2095
+ res += [ "RPATH:" .ljust (12 ) + red (repr (self .rpath )) ]
2086
2096
2087
2097
if self .runpath :
2088
- res += [ "RUNPATH:" .ljust (10 ) + red (repr (self .runpath )) ]
2098
+ res += [ "RUNPATH:" .ljust (12 ) + red (repr (self .runpath )) ]
2089
2099
2090
2100
if self .packed :
2091
- res .append ('Packer:' .ljust (10 ) + red ("Packed with UPX" ))
2101
+ res .append ('Packer:' .ljust (12 ) + red ("Packed with UPX" ))
2092
2102
2093
2103
if self .fortify :
2094
- res .append ("FORTIFY:" .ljust (10 ) + green ("Enabled" ))
2104
+ res .append ("FORTIFY:" .ljust (12 ) + green ("Enabled" ))
2095
2105
2096
2106
if self .asan :
2097
- res .append ("ASAN:" .ljust (10 ) + green ("Enabled" ))
2107
+ res .append ("ASAN:" .ljust (12 ) + green ("Enabled" ))
2098
2108
2099
2109
if self .msan :
2100
- res .append ("MSAN:" .ljust (10 ) + green ("Enabled" ))
2110
+ res .append ("MSAN:" .ljust (12 ) + green ("Enabled" ))
2101
2111
2102
2112
if self .ubsan :
2103
- res .append ("UBSAN:" .ljust (10 ) + green ("Enabled" ))
2113
+ res .append ("UBSAN:" .ljust (12 ) + green ("Enabled" ))
2104
2114
2105
2115
if self .shadowstack :
2106
- res .append ("SHSTK:" .ljust (10 ) + green ("Enabled" ))
2116
+ res .append ("SHSTK:" .ljust (12 ) + green ("Enabled" ))
2107
2117
2108
2118
if self .ibt :
2109
- res .append ("IBT:" .ljust (10 ) + green ("Enabled" ))
2119
+ res .append ("IBT:" .ljust (12 ) + green ("Enabled" ))
2120
+
2121
+ if not self .stripped :
2122
+ res .append ("Stripped:" .ljust (12 ) + red ("No" ))
2123
+
2124
+ if self .debuginfo :
2125
+ res .append ("Debuginfo:" .ljust (12 ) + red ("Yes" ))
2110
2126
2111
2127
# Check for Linux configuration, it must contain more than
2112
2128
# just the version.
0 commit comments