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
5f12cf41
Commit
5f12cf41
authored
Sep 07, 2017
by
Craig Heffner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added autocomplete install option to install bash autocomplete file
parent
4d65bace
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
4 deletions
+43
-4
setup.py
setup.py
+43
-4
No files found.
setup.py
View file @
5f12cf41
...
...
@@ -236,6 +236,43 @@ class CleanCommand(Command):
pass
class
AutoCompleteCommand
(
Command
):
description
=
"Install bash autocomplete file"
user_options
=
[]
def
initialize_options
(
self
):
pass
def
finalize_options
(
self
):
pass
def
run
(
self
):
options
=
[]
autocomplete_file_path
=
"/etc/bash_completion.d/
%
s"
%
MODULE_NAME
auto_complete
=
'''_binwalk()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="
%
s"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}
complete -F _binwalk binwalk'''
(
out
,
err
)
=
subprocess
.
Popen
([
"binwalk"
,
"--help"
],
stdout
=
subprocess
.
PIPE
)
.
communicate
()
for
line
in
out
.
splitlines
():
if
b
'--'
in
line
:
long_opt
=
line
.
split
(
b
'--'
)[
1
]
.
split
(
b
'='
)[
0
]
.
split
()[
0
]
.
strip
()
options
.
append
(
'--'
+
long_opt
.
decode
(
'utf-8'
))
with
open
(
autocomplete_file_path
,
"w"
)
as
fp
:
fp
.
write
(
auto_complete
%
' '
.
join
(
options
))
class
TestCommand
(
Command
):
description
=
"Run unit-tests"
user_options
=
[]
...
...
@@ -255,10 +292,11 @@ install_data_files = []
for
data_dir
in
[
"magic"
,
"config"
,
"plugins"
,
"modules"
,
"core"
]:
install_data_files
.
append
(
"
%
s
%
s*"
%
(
data_dir
,
os
.
path
.
sep
))
# Create a version.py file which defines the current binwalk version.
# This file is excluded from git in the .gitignore file.
sys
.
stdout
.
write
(
"creating
%
s
%
s"
%
(
VERSION_FILE
,
os
.
linesep
))
with
open
(
VERSION_FILE
,
"w"
)
as
fp
:
if
'install'
in
' '
.
join
(
sys
.
argv
)
or
'build'
in
' '
.
join
(
sys
.
argv
):
# Create a version.py file which defines the current binwalk version.
# This file is excluded from git in the .gitignore file.
sys
.
stdout
.
write
(
"creating
%
s
%
s"
%
(
VERSION_FILE
,
os
.
linesep
))
with
open
(
VERSION_FILE
,
"w"
)
as
fp
:
fp
.
write
(
"# This file has been auto-generated by setup.py
\n
"
)
fp
.
write
(
'__version__ = "
%
s"'
%
MODULE_VERSION
)
...
...
@@ -283,4 +321,5 @@ setup(
'uninstall'
:
UninstallCommand
,
'idainstall'
:
IDAInstallCommand
,
'idauninstall'
:
IDAUnInstallCommand
,
'autocomplete'
:
AutoCompleteCommand
,
'test'
:
TestCommand
})
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