checksec是一个脚本软件,也就是用脚本写的一个文件,不到2000行,可用来学习shell。
源码参见 下载方法之一为 wgetchecksec用来干什么?
用来检查可执行文件属性,例如PIE, RELRO, PaX, Canaries, ASLR, Fortify SourcePIE是什么意思?
(PIC:Position Independnet Code位置无关代码) position independent executableRELRO是什么意思?
Built with RELRO RELRO stands for RELocation Read-Only, it is a mitigation technique to harden data sections of an ELF/process.Pax是什么意思?
Stack Canary ASLR是什么意思?checksec使用方法
checksec –file /usr/sbin/sshd
源码解读:
ubuntu测试important!!!! self.assertShellExitEquals()太重要了- def assertShellOutputEquals(self, text, args, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, msg=”“, invert=False, expected=None):
- ”’Test a shell command matches a specific output”’
- rc, report, out = self._testlib_shell_cmd(args, stdin=stdin, stdout=stdout, stderr=stderr)
- result = ‘Got exit code %d. Looking for exact text “%s” (%s)\n’ % (rc, text, ” “.join(args))
- if not invert:
- self.assertEquals(text, out, msg + result + report)
- else:
- self.assertNotEquals(text, out, msg + result + report)
- if expected != None:
- result = ‘Got exit code %d. Expected %d (%s)\n’ % (rc, expected, ” “.join(args))
- self.assertEquals(rc, expected, msg + result + report)
现代Linux操作系统的栈溢出(上)