Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
binwalk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-gitdep
binwalk
Commits
84e83d0f
Commit
84e83d0f
authored
Jan 12, 2014
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added --cast option
parent
5c4291ec
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
28 deletions
+31
-28
magic.py
src/binwalk/core/magic.py
+31
-28
settings.py
src/binwalk/core/settings.py
+0
-0
signature.py
src/binwalk/modules/signature.py
+0
-0
No files found.
src/binwalk/core/magic.py
View file @
84e83d0f
...
@@ -2,32 +2,35 @@ import binwalk.core.C
...
@@ -2,32 +2,35 @@ import binwalk.core.C
from
binwalk.core.compat
import
*
from
binwalk.core.compat
import
*
class
Magic
(
object
):
class
Magic
(
object
):
'''
'''
Minimalist Python wrapper around libmagic.
Minimalist Python wrapper around libmagic.
'''
'''
LIBMAGIC_FUNCTIONS
=
[
LIBMAGIC_FUNCTIONS
=
[
binwalk
.
core
.
C
.
Function
(
name
=
"magic_open"
,
type
=
int
),
binwalk
.
core
.
C
.
Function
(
name
=
"magic_open"
,
type
=
int
),
binwalk
.
core
.
C
.
Function
(
name
=
"magic_load"
,
type
=
int
),
binwalk
.
core
.
C
.
Function
(
name
=
"magic_load"
,
type
=
int
),
binwalk
.
core
.
C
.
Function
(
name
=
"magic_buffer"
,
type
=
str
),
binwalk
.
core
.
C
.
Function
(
name
=
"magic_buffer"
,
type
=
str
),
]
]
MAGIC_NO_CHECK_TEXT
=
0x020000
MAGIC_CONTINUE
=
0x000020
MAGIC_NO_CHECK_APPTYPE
=
0x008000
MAGIC_NO_CHECK_TEXT
=
0x020000
MAGIC_NO_CHECK_TOKENS
=
0x100000
MAGIC_NO_CHECK_APPTYPE
=
0x008000
MAGIC_NO_CHECK_ENCODING
=
0x200000
MAGIC_NO_CHECK_TOKENS
=
0x100000
MAGIC_NO_CHECK_ENCODING
=
0x200000
MAGIC_FLAGS
=
MAGIC_NO_CHECK_TEXT
|
MAGIC_NO_CHECK_ENCODING
|
MAGIC_NO_CHECK_APPTYPE
|
MAGIC_NO_CHECK_TOKENS
MAGIC_FLAGS
=
MAGIC_NO_CHECK_TEXT
|
MAGIC_NO_CHECK_ENCODING
|
MAGIC_NO_CHECK_APPTYPE
|
MAGIC_NO_CHECK_TOKENS
def
__init__
(
self
,
magic_file
=
None
):
if
magic_file
:
def
__init__
(
self
,
magic_file
=
None
,
flags
=
0
):
self
.
magic_file
=
str2bytes
(
magic_file
)
if
magic_file
:
self
.
magic_file
=
str2bytes
(
magic_file
)
self
.
libmagic
=
binwalk
.
core
.
C
.
Library
(
"magic"
,
self
.
LIBMAGIC_FUNCTIONS
)
else
:
self
.
magic_file
=
None
self
.
magic_cookie
=
self
.
libmagic
.
magic_open
(
self
.
MAGIC_FLAGS
)
self
.
libmagic
.
magic_load
(
self
.
magic_cookie
,
self
.
magic_file
)
self
.
libmagic
=
binwalk
.
core
.
C
.
Library
(
"magic"
,
self
.
LIBMAGIC_FUNCTIONS
)
def
buffer
(
self
,
data
):
self
.
magic_cookie
=
self
.
libmagic
.
magic_open
(
self
.
MAGIC_FLAGS
|
flags
)
return
self
.
libmagic
.
magic_buffer
(
self
.
magic_cookie
,
str2bytes
(
data
),
len
(
data
))
self
.
libmagic
.
magic_load
(
self
.
magic_cookie
,
self
.
magic_file
)
def
buffer
(
self
,
data
):
return
self
.
libmagic
.
magic_buffer
(
self
.
magic_cookie
,
str2bytes
(
data
),
len
(
data
))
src/binwalk/core/settings.py
View file @
84e83d0f
This diff is collapsed.
Click to expand it.
src/binwalk/modules/signature.py
View file @
84e83d0f
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment