New file(1) port

This commit is contained in:
Dirk Vogt
2012-06-18 10:53:30 +00:00
committed by Thomas Veerman
parent 991c41db8f
commit 835f680238
307 changed files with 28432 additions and 32769 deletions
+9 -8
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()