
{"id":16373,"date":"2015-05-08T16:12:05","date_gmt":"2015-05-08T16:12:05","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=16373"},"modified":"2015-05-08T16:12:05","modified_gmt":"2015-05-08T16:12:05","slug":"hacking-with-strace-to-find-about-write-calls-in-a-program","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2015\/05\/08\/hacking-with-strace-to-find-about-write-calls-in-a-program\/","title":{"rendered":"Hacking with strace to find about write calls in a program"},"content":{"rendered":"<pre>\n$strace -e write python dig.py \nwrite(1, \"\\33[31mI think lscpu command is us\"..., 69I think lscpu command is using proc filesystem to get data.\n) = 69\nwrite(1, \"\\33[31m\/* \/sys paths *\/\\33[0m\\n\", 26\/* \/sys paths *\/\n) = 26\nwrite(1, \"\\33[31m#define _PATH_SYS_SYSTEM   \"..., 63#define _PATH_SYS_SYSTEM        \"\/sys\/devices\/system\"\n) = 63\nwrite(1, \"\\33[31m#define _PATH_SYS_CPU      \"..., 65#define _PATH_SYS_CPU           _PATH_SYS_SYSTEM \"\/cpu\"\n) = 65\nwrite(1, \"\\33[31m#define _PATH_SYS_NODE     \"..., 66#define _PATH_SYS_NODE          _PATH_SYS_SYSTEM \"\/node\"\n) = 66\nwrite(1, \"\\33[31m#define _PATH_PROC_XEN     \"..., 53#define _PATH_PROC_XEN          \"\/proc\/xen\"\n) = 53\nwrite(1, \"\\33[31m#define _PATH_PROC_XENCAP  \"..., 72#define _PATH_PROC_XENCAP       _PATH_PROC_XEN \"\/capabilities\"\n) = 72\nwrite(1, \"\\33[31m#define _PATH_PROC_CPUINFO \"..., 57#define _PATH_PROC_CPUINFO      \"\/proc\/cpuinfo\"\n) = 57\nwrite(1, \"\\33[31m#define _PATH_PROC_PCIDEVS \"..., 65#define _PATH_PROC_PCIDEVS      \"\/proc\/bus\/pci\/devices\"\n) = 65\nwrite(1, \"\\33[31m#define _PATH_PROC_SYSINFO \"..., 57#define _PATH_PROC_SYSINFO      \"\/proc\/sysinfo\"\n) = 57\nwrite(1, \"\\33[31m#define _PATH_PROC_STATUS  \"..., 61#define _PATH_PROC_STATUS       \"\/proc\/self\/status\"\n) = 61\nwrite(1, \"\\33[31m#define _PATH_PROC_VZ   \\\"\/p\"..., 44#define _PATH_PROC_VZ   \"\/proc\/vz\"\n) = 44\nwrite(1, \"\\33[31m#define _PATH_PROC_BC   \\\"\/p\"..., 44#define _PATH_PROC_BC   \"\/proc\/bc\"\n) = 44\nwrite(1, \"\\33[31m#define _PATH_PROC_DEVICETR\"..., 61#define _PATH_PROC_DEVICETREE   \"\/proc\/device-tree\"\n) = 61\nwrite(1, \"\\33[31m#define _PATH_DEV_MEM      \"..., 52#define _PATH_DEV_MEM           \"\/dev\/mem\"\n) = 52\nwrite(1, \"\\33[31m\\33[0m\\n\", 10\n)         = 10\nwrite(1, \"Number of commands found is :  0\"..., 33Number of commands found is :  0\n) = 33\n+++ exited with 0 +++\n$\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>$strace -e write python dig.py write(1, &#8220;\\33[31mI think lscpu command is us&#8221;&#8230;, 69I think lscpu command is using proc filesystem to get data. ) = 69 write(1, &#8220;\\33[31m\/* \/sys paths *\/\\33[0m\\n&#8221;, 26\/* \/sys paths *\/ ) = 26 write(1, &#8220;\\33[31m#define _PATH_SYS_SYSTEM &#8220;&#8230;, 63#define _PATH_SYS_SYSTEM &#8220;\/sys\/devices\/system&#8221; ) = 63 write(1, &#8220;\\33[31m#define _PATH_SYS_CPU &#8220;&#8230;, 65#define _PATH_SYS_CPU _PATH_SYS_SYSTEM &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2015\/05\/08\/hacking-with-strace-to-find-about-write-calls-in-a-program\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Hacking with strace to find about write calls in a program&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[83],"tags":[1496],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/16373"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=16373"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/16373\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=16373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=16373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=16373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}