<div dir="ltr"><br><div class="gmail_quote"><div dir="ltr">On Thu, 24 Nov 2016 at 13:36 Bill Kenworthy <<a href="mailto:billk@iinet.net.au">billk@iinet.net.au</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">What's the best way to get kernel version from a binary?<br class="gmail_msg">
<br></blockquote><div><br></div><div>Is this a standard(ish) linux kernel? I would use the magic library that sits behind file(1)<br><br></div><div>in python:<br><br></div><div>import magic<br></div><div>description = magic.detect_from_filename('/boot/vmlinux').name<br><br></div><div>Then you'll have a string like:<br><br>Linux kernel x86 boot executable bzImage, version 4.9.0-rc5-amd64 (<a href="mailto:debian-kernel@lists.debian.org">debian-kernel@lists.debian.org</a>) #1 SMP Debian 4.9~rc5-1~exp1 (2016-11-14), RO-rootFS, swap_dev 0x3, Normal VGA<br><br></div><div>to deal with, but that'll be fairly stable and pretty easy to parse.<br><br></div><div>hth,<br></div></div></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">-- Clinton Roy, Software Engineer with Bloomberg L.P.<br></div></div>