@@ -55,6 +55,7 @@ def main(skip_docker, distribution):
55
55
shell = True ,
56
56
capture_output = True ,
57
57
text = True ,
58
+ check = False ,
58
59
)
59
60
if yarac_process .returncode != 0 :
60
61
raise InstallationError ('Failed to compile yara test signatures' )
@@ -72,7 +73,7 @@ def _install_docker_images():
72
73
logging .info ('Pulling fact extraction container' )
73
74
74
75
docker_process = subprocess .run (
75
- 'docker pull fkiecad/fact_extractor' , shell = True , stdout = PIPE , stderr = STDOUT , text = True
76
+ 'docker pull fkiecad/fact_extractor' , shell = True , stdout = PIPE , stderr = STDOUT , text = True , check = False
76
77
)
77
78
if docker_process .returncode != 0 :
78
79
raise InstallationError (f'Failed to pull extraction container:\n { docker_process .stdout } ' )
@@ -89,10 +90,15 @@ def _create_firmware_directory():
89
90
90
91
data_dir_name = config .backend .firmware_file_storage_directory
91
92
mkdir_process = subprocess .run (
92
- f'sudo mkdir -p --mode=0744 { data_dir_name } ' , shell = True , stdout = PIPE , stderr = STDOUT , text = True
93
+ f'sudo mkdir -p --mode=0744 { data_dir_name } ' , shell = True , stdout = PIPE , stderr = STDOUT , text = True , check = False
93
94
)
94
95
chown_process = subprocess .run (
95
- f'sudo chown { os .getuid ()} :{ os .getgid ()} { data_dir_name } ' , shell = True , stdout = PIPE , stderr = STDOUT , text = True
96
+ f'sudo chown { os .getuid ()} :{ os .getgid ()} { data_dir_name } ' ,
97
+ shell = True ,
98
+ stdout = PIPE ,
99
+ stderr = STDOUT ,
100
+ text = True ,
101
+ check = False ,
96
102
)
97
103
if not all (code == 0 for code in (mkdir_process .returncode , chown_process .returncode )):
98
104
raise InstallationError (
@@ -122,26 +128,28 @@ def _install_plugins(distribution, skip_docker, only_docker=False):
122
128
def _install_yara ():
123
129
yara_version = 'v4.2.3' # must be the same version as `yara-python` in `install/requirements_common.txt`
124
130
125
- yara_process = subprocess .run ('yara --version' , shell = True , stdout = PIPE , stderr = STDOUT , text = True )
131
+ yara_process = subprocess .run ('yara --version' , shell = True , stdout = PIPE , stderr = STDOUT , text = True , check = False )
126
132
if yara_process .returncode == 0 and yara_process .stdout .strip () == yara_version .strip ('v' ):
127
133
logging .info ('Skipping yara installation: Already installed and up to date' )
128
134
return
129
135
130
136
logging .info (f'Installing yara { yara_version } ' )
131
137
archive = f'{ yara_version } .zip'
132
138
download_url = f'https://github.com/VirusTotal/yara/archive/refs/tags/{ archive } '
133
- wget_process = subprocess .run (f'wget { download_url } ' , shell = True , stdout = PIPE , stderr = STDOUT , text = True )
139
+ wget_process = subprocess .run (
140
+ f'wget { download_url } ' , shell = True , stdout = PIPE , stderr = STDOUT , text = True , check = False
141
+ )
134
142
if wget_process .returncode != 0 :
135
143
raise InstallationError (f'Error on yara download.\n { wget_process .stdout } ' )
136
- unzip_process = subprocess .run (f'unzip { archive } ' , shell = True , stdout = PIPE , stderr = STDOUT , text = True )
144
+ unzip_process = subprocess .run (f'unzip { archive } ' , shell = True , stdout = PIPE , stderr = STDOUT , text = True , check = False )
137
145
Path (archive ).unlink ()
138
146
if unzip_process .returncode != 0 :
139
147
raise InstallationError (f'Error on yara extraction.\n { unzip_process .stdout } ' )
140
- yara_folder = [p for p in Path ('.' ).iterdir () if p .name .startswith ('yara-' )][0 ]
148
+ yara_folder = [p for p in Path ().iterdir () if p .name .startswith ('yara-' )][0 ]
141
149
with OperateInDirectory (yara_folder .name , remove = True ):
142
150
os .chmod ('bootstrap.sh' , 0o775 ) # noqa: PTH101
143
151
for command in ['./bootstrap.sh' , './configure --enable-magic' , 'make -j$(nproc)' , 'sudo make install' ]:
144
- cmd_process = subprocess .run (command , shell = True , stdout = PIPE , stderr = STDOUT , text = True )
152
+ cmd_process = subprocess .run (command , shell = True , stdout = PIPE , stderr = STDOUT , text = True , check = False )
145
153
if cmd_process .returncode != 0 :
146
154
raise InstallationError (f'Error in yara installation.\n { cmd_process .stdout } ' )
147
155
@@ -152,7 +160,7 @@ def _install_checksec():
152
160
logging .info ('Installing checksec.sh' )
153
161
checksec_url = 'https://raw.githubusercontent.com/slimm609/checksec.sh/2.5.0/checksec'
154
162
wget_process = subprocess .run (
155
- f'wget -P { BIN_DIR } { checksec_url } ' , shell = True , stdout = PIPE , stderr = STDOUT , text = True
163
+ f'wget -P { BIN_DIR } { checksec_url } ' , shell = True , stdout = PIPE , stderr = STDOUT , text = True , check = False
156
164
)
157
165
if wget_process .returncode != 0 :
158
166
raise InstallationError (f'Error during installation of checksec.sh\n { wget_process .stdout } ' )
0 commit comments