New file(1) port

This commit is contained in:
Dirk Vogt
2012-05-02 13:23:57 +02:00
committed by Thomas Veerman
parent 991c41db8f
commit 835f680238
307 changed files with 28437 additions and 32774 deletions

View File

@@ -1,16 +1,17 @@
#! /usr/bin/python
import magic
ms = magic.open(magic.MAGIC_NONE)
ms = magic.open(magic.NONE)
ms.load()
type = ms.file("/path/to/some/file")
print type
tp = ms.file("/bin/ls")
print (tp)
f = file("/path/to/some/file", "r")
buffer = f.read(4096)
f = open("/bin/ls", "rb")
buf = f.read(4096)
f.close()
type = ms.buffer(buffer)
print type
tp = ms.buffer(buf)
print (tp)
ms.close()