'Check for various security options of binary (ref: http://www.trapkit.de/tools/checksec.sh)
Args:
- file: path name of file to check (String)
Returns:
- dictionary of (setting(String), status(Int)) (Dict)'

def checksec(self, filename=None):

    result = {}
    result['RELRO'] = 0
    result['CANARY'] = 0
    result['NX'] = 1
    result['PIE'] = 0
    result['FORTIFY'] = 0
    if (filename is None):
        filename = self.getfile()
    if (not filename):
        return None
    out = execute_external_command(('%s    -W    -a    "%s"    2>&1' % (config.READELF, filename)))
    if ('Error:' in out):
        return None
    for line in out.splitlines():
        if ('GNU_RELRO' in line):
            result['RELRO'] |= 2
        if ('BIND_NOW' in line):
            result['RELRO'] |= 1
        if ('__stack_chk_fail' in line):
            result['CANARY'] = 1
        if (('GNU_STACK' in line) and ('RWE' in line)):
            result['NX'] = 0
        if (('Type:' in line) and ('DYN    (' in line)):
            result['PIE'] = 4
        if (('(DEBUG)' in line) and (result['PIE'] == 4)):
            result['PIE'] = 1
        if ('_chk@' in line):
            result['FORTIFY'] = 1
    if (result['RELRO'] == 1):
        result['RELRO'] = 0
    return result
