example.py 207 B

1234567891011121314151617
  1. #! /usr/bin/python
  2. import magic
  3. ms = magic.open(magic.NONE)
  4. ms.load()
  5. tp = ms.file("/bin/ls")
  6. print (tp)
  7. f = open("/bin/ls", "rb")
  8. buf = f.read(4096)
  9. f.close()
  10. tp = ms.buffer(buf)
  11. print (tp)
  12. ms.close()