title: Reading Binary File (.out) in Python and disassemble with Capstone
body: <p>I have some trouble reading the .text section of a binary file.</p>
  
  <p>The binary is compiled by gcc.</p>
  
  <pre><code>readelf -S binary_file
  </code></pre>
  
  <p>This command shows that </p>
  
  <pre><code>.text   PROGBITS    0000831C   00031C   000340
  </code></pre>
  
  <p>The address if the .text section is 0000831c, offset = 00031c and size = 000340</p>
  
  <p>I have tried</p>
  
  <pre><code>file = open('binary_file')
  content = file.readlines()
  </code></pre>
  
  <p>And the Capstone could not recognize.</p>
  
  <p>If the .text content looks like</p>
  
  <pre><code> f102 030e 0000 a0e3 
  </code></pre>
  
  <p>how to read it as</p>
  
  <pre><code>content = b'\xf1\x02\x03\x0e\x00\x00\xa0\xe3'
  </code></pre>