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
9258050b
Commit
9258050b
authored
Jan 08, 2014
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated setup
parent
ef96a6fd
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
128 additions
and
113 deletions
+128
-113
setup.py
setup.py
+128
-113
hexdiff.py
src/binwalk/modules/hexdiff.py
+0
-0
No files found.
setup.py
View file @
9258050b
...
@@ -11,153 +11,168 @@ MODULE_NAME = "binwalk"
...
@@ -11,153 +11,168 @@ MODULE_NAME = "binwalk"
# Python2/3 compliance
# Python2/3 compliance
try
:
try
:
raw_input
raw_input
except
NameError
:
except
NameError
:
raw_input
=
input
raw_input
=
input
# This is super hacky.
# This is super hacky.
if
"--yes"
in
sys
.
argv
:
if
"--yes"
in
sys
.
argv
:
sys
.
argv
.
pop
(
sys
.
argv
.
index
(
"--yes"
))
sys
.
argv
.
pop
(
sys
.
argv
.
index
(
"--yes"
))
IGNORE_WARNINGS
=
True
IGNORE_WARNINGS
=
True
else
:
else
:
IGNORE_WARNINGS
=
False
IGNORE_WARNINGS
=
False
# cd into the src directory, no matter where setup.py was invoked from
# cd into the src directory, no matter where setup.py was invoked from
os
.
chdir
(
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"src"
))
os
.
chdir
(
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"src"
))
def
which
(
command
):
def
which
(
command
):
# /usr/local/bin is usually the default install path, though it may not be in $PATH
# /usr/local/bin is usually the default install path, though it may not be in $PATH
usr_local_bin
=
os
.
path
.
sep
.
join
([
os
.
path
.
sep
,
'usr'
,
'local'
,
'bin'
,
command
])
usr_local_bin
=
os
.
path
.
sep
.
join
([
os
.
path
.
sep
,
'usr'
,
'local'
,
'bin'
,
command
])
try
:
try
:
location
=
subprocess
.
Popen
([
"which"
,
command
],
shell
=
False
,
stdout
=
subprocess
.
PIPE
)
.
communicate
()[
0
]
.
strip
()
location
=
subprocess
.
Popen
([
"which"
,
command
],
shell
=
False
,
stdout
=
subprocess
.
PIPE
)
.
communicate
()[
0
]
.
strip
()
except
KeyboardInterrupt
as
e
:
except
KeyboardInterrupt
as
e
:
raise
e
raise
e
except
Exception
as
e
:
except
Exception
as
e
:
pass
pass
if
not
location
and
os
.
path
.
exists
(
usr_local_bin
):
if
not
location
and
os
.
path
.
exists
(
usr_local_bin
):
location
=
usr_local_bin
location
=
usr_local_bin
return
location
return
location
def
warning
(
lines
,
terminate
=
True
,
prompt
=
True
):
def
warning
(
lines
,
terminate
=
True
,
prompt
=
True
):
WIDTH
=
115
WIDTH
=
115
if
not
IGNORE_WARNINGS
:
print
(
"
\n
"
+
"*"
*
WIDTH
)
for
line
in
lines
:
print
(
line
)
print
(
"*"
*
WIDTH
,
"
\n
"
)
if
prompt
:
if
raw_input
(
'Continue installation anyway (Y/n)? '
)
.
lower
()
.
startswith
(
'n'
):
terminate
=
True
else
:
terminate
=
False
if
terminate
:
sys
.
exit
(
1
)
def
find_binwalk_module_paths
():
paths
=
[]
try
:
import
binwalk
paths
=
binwalk
.
__path__
except
KeyboardInterrupt
as
e
:
raise
e
except
Exception
:
pass
return
paths
def
remove_binwalk_module
():
for
path
in
find_binwalk_module_paths
():
try
:
remove_tree
(
path
)
except
OSError
as
e
:
pass
script_path
=
which
(
MODULE_NAME
)
if
script_path
:
try
:
print
(
"removing '
%
s'"
%
script_path
)
os
.
unlink
(
script_path
)
except
KeyboardInterrupt
as
e
:
pass
except
Exception
as
e
:
pass
if
not
IGNORE_WARNINGS
:
class
UninstallCommand
(
Command
):
print
(
"
\n
"
+
"*"
*
WIDTH
)
description
=
"Uninstalls the Python module"
for
line
in
lines
:
user_options
=
[]
print
(
line
)
print
(
"*"
*
WIDTH
,
"
\n
"
)
if
prompt
:
def
initialize_options
(
self
):
if
raw_input
(
'Continue installation anyway (Y/n)? '
)
.
lower
()
.
startswith
(
'n'
):
pass
terminate
=
True
else
:
terminate
=
False
if
terminate
:
def
finalize_options
(
self
)
:
sys
.
exit
(
1
)
pass
class
UninstallCommand
(
Command
):
def
run
(
self
):
description
=
"Uninstalls the Python module"
remove_binwalk_module
()
user_options
=
[]
def
initialize_options
(
self
):
pass
def
finalize_options
(
self
):
pass
def
run
(
self
):
try
:
import
binwalk
for
path
in
binwalk
.
__path__
:
try
:
remove_tree
(
path
)
except
OSError
as
e
:
pass
except
KeyboardInterrupt
as
e
:
raise
e
except
Exception
as
e
:
pass
script_path
=
which
(
MODULE_NAME
)
if
script_path
:
try
:
print
(
"removing '
%
s'"
%
script_path
)
os
.
unlink
(
script_path
)
except
KeyboardInterrupt
as
e
:
pass
except
Exception
as
e
:
pass
class
CleanCommand
(
Command
):
class
CleanCommand
(
Command
):
description
=
"Clean Python build directories"
description
=
"Clean Python build directories"
user_options
=
[]
user_options
=
[]
def
initialize_options
(
self
):
def
initialize_options
(
self
):
pass
pass
def
finalize_options
(
self
):
def
finalize_options
(
self
):
pass
pass
def
run
(
self
):
def
run
(
self
):
try
:
try
:
remove_tree
(
"build"
)
remove_tree
(
"build"
)
except
KeyboardInterrupt
as
e
:
except
KeyboardInterrupt
as
e
:
raise
e
raise
e
except
Exception
:
except
Exception
:
pass
pass
try
:
try
:
remove_tree
(
"dist"
)
remove_tree
(
"dist"
)
except
KeyboardInterrupt
as
e
:
except
KeyboardInterrupt
as
e
:
raise
e
raise
e
except
Exception
:
except
Exception
:
pass
pass
# Check pre-requisite Python modules during an install
# Check pre-requisite Python modules during an install
if
"install"
in
sys
.
argv
:
if
"install"
in
sys
.
argv
:
print
(
"checking pre-requisites"
)
print
(
"checking pre-requisites"
)
try
:
try
:
import
pyqtgraph
import
pyqtgraph
from
pyqtgraph.Qt
import
QtCore
,
QtGui
,
QtOpenGL
from
pyqtgraph.Qt
import
QtCore
,
QtGui
,
QtOpenGL
except
ImportError
as
e
:
except
ImportError
as
e
:
msg
=
[
"Pre-requisite warning: "
+
str
(
e
),
msg
=
[
"Pre-requisite warning: "
+
str
(
e
),
"To take advantage of
%
s's graphing capabilities, please install this module."
%
MODULE_NAME
,
"To take advantage of
%
s's graphing capabilities, please install this module."
%
MODULE_NAME
,
]
]
warning
(
msg
,
prompt
=
True
)
warning
(
msg
,
prompt
=
True
)
# If an older version of binwalk is currently installed, completely remove it to prevent conflicts
existing_binwalk_modules
=
find_binwalk_module_paths
()
if
existing_binwalk_modules
and
not
os
.
path
.
exists
(
os
.
path
.
join
(
existing_binwalk_modules
[
0
],
"core"
)):
remove_binwalk_module
()
# Re-build the magic file during a build/install
# Re-build the magic file during a build/install
if
"install"
in
sys
.
argv
or
"build"
in
sys
.
argv
:
if
"install"
in
sys
.
argv
or
"build"
in
sys
.
argv
:
# Generate a new magic file from the files in the magic directory
# Generate a new magic file from the files in the magic directory
print
(
"creating
%
s magic file"
%
MODULE_NAME
)
print
(
"creating
%
s magic file"
%
MODULE_NAME
)
magic_files
=
os
.
listdir
(
"magic"
)
magic_files
=
os
.
listdir
(
"magic"
)
magic_files
.
sort
()
magic_files
.
sort
()
fd
=
open
(
"
%
s/magic/
%
s"
%
(
MODULE_NAME
,
MODULE_NAME
),
"wb"
)
fd
=
open
(
"
%
s/magic/
%
s"
%
(
MODULE_NAME
,
MODULE_NAME
),
"wb"
)
for
magic
in
magic_files
:
for
magic
in
magic_files
:
fpath
=
os
.
path
.
join
(
"magic"
,
magic
)
fpath
=
os
.
path
.
join
(
"magic"
,
magic
)
if
os
.
path
.
isfile
(
fpath
):
if
os
.
path
.
isfile
(
fpath
):
fd
.
write
(
open
(
fpath
,
"rb"
)
.
read
())
fd
.
write
(
open
(
fpath
,
"rb"
)
.
read
())
fd
.
close
()
fd
.
close
()
# The data files to install along with the module
# The data files to install along with the module
install_data_files
=
[
"magic/*"
,
"config/*"
,
"plugins/*"
,
"modules/*"
,
"core/*"
]
install_data_files
=
[
"magic/*"
,
"config/*"
,
"plugins/*"
,
"modules/*"
,
"core/*"
]
# Install the module, script, and support files
# Install the module, script, and support files
setup
(
name
=
MODULE_NAME
,
setup
(
name
=
MODULE_NAME
,
version
=
"2.0.0 beta"
,
version
=
"2.0.0 beta"
,
description
=
"Firmware analysis tool"
,
description
=
"Firmware analysis tool"
,
author
=
"Craig Heffner"
,
author
=
"Craig Heffner"
,
url
=
"https://github.com/devttys0/
%
s"
%
MODULE_NAME
,
url
=
"https://github.com/devttys0/
%
s"
%
MODULE_NAME
,
requires
=
[
"magic"
,
"pyqtgraph"
],
requires
=
[
"magic"
,
"pyqtgraph"
],
packages
=
[
MODULE_NAME
],
packages
=
[
MODULE_NAME
],
package_data
=
{
MODULE_NAME
:
install_data_files
},
package_data
=
{
MODULE_NAME
:
install_data_files
},
scripts
=
[
os
.
path
.
join
(
"scripts"
,
MODULE_NAME
)],
scripts
=
[
os
.
path
.
join
(
"scripts"
,
MODULE_NAME
)],
cmdclass
=
{
'clean'
:
CleanCommand
,
'uninstall'
:
UninstallCommand
}
cmdclass
=
{
'clean'
:
CleanCommand
,
'uninstall'
:
UninstallCommand
}
)
)
src/binwalk/modules/hexdiff.py
View file @
9258050b
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