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
458df42e
Commit
458df42e
authored
Nov 07, 2014
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ability to pass raw strings to be scanned via API
parent
11ad600c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
5 deletions
+15
-5
common.py
src/binwalk/core/common.py
+0
-0
module.py
src/binwalk/core/module.py
+3
-3
general.py
src/binwalk/modules/general.py
+12
-2
No files found.
src/binwalk/core/common.py
View file @
458df42e
This diff is collapsed.
Click to expand it.
src/binwalk/core/module.py
View file @
458df42e
...
@@ -354,10 +354,10 @@ class Module(object):
...
@@ -354,10 +354,10 @@ class Module(object):
# Values in self.target_file_list are either already open files (BlockFile instances), or paths
# Values in self.target_file_list are either already open files (BlockFile instances), or paths
# to files that need to be opened for scanning.
# to files that need to be opened for scanning.
if
isinstance
(
next_target_file
,
binwalk
.
core
.
common
.
BlockFile
):
if
isinstance
(
next_target_file
,
str
):
fp
=
next_target_file
else
:
fp
=
self
.
config
.
open_file
(
next_target_file
)
fp
=
self
.
config
.
open_file
(
next_target_file
)
else
:
fp
=
next_target_file
self
.
status
.
clear
()
self
.
status
.
clear
()
self
.
status
.
total
=
fp
.
length
self
.
status
.
total
=
fp
.
length
...
...
src/binwalk/modules/general.py
View file @
458df42e
# Module to process general user input options (scan length, starting offset, etc).
# Module to process general user input options (scan length, starting offset, etc).
import
io
import
os
import
os
import
sys
import
sys
import
argparse
import
argparse
...
@@ -67,6 +68,10 @@ class General(Module):
...
@@ -67,6 +68,10 @@ class General(Module):
short
=
None
,
short
=
None
,
type
=
binwalk
.
core
.
common
.
BlockFile
,
type
=
binwalk
.
core
.
common
.
BlockFile
,
kwargs
=
{
'files'
:
[]}),
kwargs
=
{
'files'
:
[]}),
# Hidden, API-only arguments
Option
(
long
=
"string"
,
kwargs
=
{
'subclass'
:
binwalk
.
core
.
common
.
StringFile
}),
]
]
KWARGS
=
[
KWARGS
=
[
...
@@ -82,6 +87,7 @@ class General(Module):
...
@@ -82,6 +87,7 @@ class General(Module):
Kwarg
(
name
=
'files'
,
default
=
[]),
Kwarg
(
name
=
'files'
,
default
=
[]),
Kwarg
(
name
=
'show_help'
,
default
=
False
),
Kwarg
(
name
=
'show_help'
,
default
=
False
),
Kwarg
(
name
=
'keep_going'
,
default
=
False
),
Kwarg
(
name
=
'keep_going'
,
default
=
False
),
Kwarg
(
name
=
'subclass'
,
default
=
io
.
FileIO
),
]
]
PRIMARY
=
False
PRIMARY
=
False
...
@@ -89,6 +95,10 @@ class General(Module):
...
@@ -89,6 +95,10 @@ class General(Module):
def
load
(
self
):
def
load
(
self
):
self
.
target_files
=
[]
self
.
target_files
=
[]
# A special case for when we're loaded into IDA
if
self
.
subclass
==
io
.
FileIO
and
binwalk
.
core
.
idb
.
LOADED_IN_IDA
:
self
.
subclass
=
binwalk
.
core
.
idb
.
IDBFileIO
# Order is important with these two methods
# Order is important with these two methods
self
.
_open_target_files
()
self
.
_open_target_files
()
self
.
_set_verbosity
()
self
.
_set_verbosity
()
...
@@ -141,7 +151,7 @@ class General(Module):
...
@@ -141,7 +151,7 @@ class General(Module):
if
swap
is
None
:
if
swap
is
None
:
swap
=
self
.
swap_size
swap
=
self
.
swap_size
return
binwalk
.
core
.
common
.
BlockFile
(
fname
,
length
=
length
,
offset
=
offset
,
swap
=
swap
,
block
=
block
,
peek
=
peek
)
return
binwalk
.
core
.
common
.
BlockFile
(
fname
,
subclass
=
self
.
subclass
,
length
=
length
,
offset
=
offset
,
swap
=
swap
,
block
=
block
,
peek
=
peek
)
def
_open_target_files
(
self
):
def
_open_target_files
(
self
):
'''
'''
...
@@ -151,7 +161,7 @@ class General(Module):
...
@@ -151,7 +161,7 @@ class General(Module):
# Validate the target files listed in target_files
# Validate the target files listed in target_files
for
tfile
in
self
.
files
:
for
tfile
in
self
.
files
:
# Ignore directories.
# Ignore directories.
if
not
os
.
path
.
isdir
(
tfile
):
if
not
self
.
subclass
==
io
.
FileIO
or
not
os
.
path
.
isdir
(
tfile
):
# Make sure we can open the target files
# Make sure we can open the target files
try
:
try
:
self
.
target_files
.
append
(
self
.
open_file
(
tfile
))
self
.
target_files
.
append
(
self
.
open_file
(
tfile
))
...
...
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