title: How do I find the offset and signature of the PE header in python?
body: <p>I am not sure how to go about this. I do know that the signature is 50 45 00 00 but I am not sure how to take an .exe file and count the amount of times it is used in python. </p>
  
  <p>By the end of it, it should have the magic number, offset of the PE header, PE signature, entrypoint, image base, number of sections with the PE, name of each sections with offset. </p>
  
  <p>Here is what I have so far (it is only for the magic number):</p>
  
  <pre><code>def sig(content):
      content = content.encode("hex")
      content = str(content)
      signature = content[0:2].upper()
      sig2 = content[2:4].upper()
      print "Magic Number: " + str(signature) + " " + str(sig2)
  </code></pre>
  
  <p>If you can help, please let me know!</p>