Skip to content

Commit 6a2042b

Browse files
committed
Remove flags
1 parent 019b94f commit 6a2042b

File tree

7 files changed

+137
-382
lines changed

7 files changed

+137
-382
lines changed

docs/source/install.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Once you see the following msg, then you're all set::
2929
-d, --detail TEXT Show detail report. Optionally specify the
3030
name of a rule/label
3131
-o, --output FILE Output report in JSON
32+
-w, --webreport FILE Generate web report
3233
-a, --apk FILE APK file [required]
3334
-r, --rule PATH Rules directory [default:
3435
/home/$USER/.quark-engine/quark-rules]
@@ -49,12 +50,7 @@ Once you see the following msg, then you're all set::
4950
--multi-process INTEGER RANGE Allow analyzing APK with N processes, where
5051
N doesn't exceeds the number of usable CPUs
5152
- 1 to avoid memory exhaustion. [x>=1]
52-
--rizin-path FILE Specify a Rizin executable for Quark to
53-
perform analyses.
54-
--disable-rizin-installation Don't install Rizin automatically when no
55-
Rizin instance with a compatible version is
56-
found.
57-
--version Show the version and exit.
53+
--version Show the version and exit.
5854
--help Show this message and exit.
5955

6056
To learn how to scan multiple samples in a directory, please have a look at :ref:`Directory Scanning <dir_scan>`

docs/source/testing.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,3 @@ Now Quark also supports `Rizin`_ as one of our Android analysis frameworks. You
5050
For now, Quark is compatible with Rizin v0.3.4. But, users don't have to installed a Rizin with that version. Quark provides a feature to automatically setup a independent Rizin. In this way, the dependency will not conflict with your environment. Type in the above command and let Quark handle everything else for you.
5151

5252
If there is a working installation of Rizin installed in the system, Quark will check its version to determine if it is compatible. If true, Quark automatically uses it for the analysis. Otherwise, Quark uses the independent Rizin installed in the Quark directory (``~/.quark-engine``).
53-
54-
You can use option ``--rizin-path`` to specify the path of the Rizin executable.
55-
56-
.. code-block:: bash
57-
58-
quark -a Ahmyth.apk -s --core-library rizin --rizin-path path_to_a_rizin_executable
59-
60-
Moreover, if you don't want Quark to install an independent Rizin, you can use the flag ``--disable-rizin-installation`` to disable this feature.

quark/cli.py

Lines changed: 7 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,9 @@
1717
from quark.rulegeneration import RuleGeneration
1818
from quark.utils.colors import yellow
1919
from quark.utils.graph import select_label_menu, show_comparison_graph
20-
from quark.utils.pprint import (
21-
print_error,
22-
print_info,
23-
print_success,
24-
print_warning,
25-
)
20+
from quark.utils.pprint import print_info, print_success, print_warning
21+
from quark.utils.tools import find_rizin
2622
from quark.utils.weight import Weight
27-
from quark.utils.tools import find_rizin_instance, _get_rizin_version
2823
from quark.webreport.generate import ReportGenerator
2924

3025
logo()
@@ -152,20 +147,6 @@
152147
required=False,
153148
default=1,
154149
)
155-
@click.option(
156-
"--rizin-path",
157-
"rizin_path",
158-
type=click.Path(exists=True, file_okay=True, dir_okay=False),
159-
help="Specify a Rizin executable for Quark to perform analyses.",
160-
)
161-
@click.option(
162-
"--disable-rizin-installation",
163-
"disable_rizin_installation",
164-
default=False,
165-
is_flag=True,
166-
help="Don't install Rizin automatically when no Rizin instance with"
167-
+ " a compatible version is found.",
168-
)
169150
def entry_point(
170151
summary,
171152
detail,
@@ -183,45 +164,16 @@ def entry_point(
183164
comparison,
184165
core_library,
185166
num_of_process,
186-
rizin_path,
187-
disable_rizin_installation,
188167
):
189168
"""Quark is an Obfuscation-Neglect Android Malware Scoring System"""
190169
# Load rules
191170
rule_buffer_list = []
192171
rule_filter = summary or detail
193172

194-
# Check Rizin version
195173
if core_library.lower() == "rizin":
196-
if not rizin_path:
197-
if disable_rizin_installation:
198-
print_info("Disable automatic Rizin installation.")
199-
200-
rizin_path = find_rizin_instance(
201-
disable_rizin_installation=disable_rizin_installation
202-
)
203-
204-
if not rizin_path:
205-
print_error(
206-
"No valid Rizin executable found. Please specify the path"
207-
+ "to the Rizin executable by using option --rizin-path."
208-
)
209-
return
210-
else:
211-
version = _get_rizin_version(rizin_path)
212-
if rizin_path.startswith(config.HOME_DIR):
213-
print_info(
214-
f"Use the Rizin executable (version {version})"
215-
+ " installed in the Quark directory."
216-
)
217-
else:
218-
print_info(
219-
f"Use the Rizin executable (version {version})"
220-
+ " installed in the system PATH."
221-
)
222-
223-
else:
224-
print_info(f"Use the user-specified Rizin executable.")
174+
rizin_path = find_rizin()
175+
else:
176+
rizin_path = ""
225177

226178
# Determine the location of rules
227179
if rule_filter and rule_filter.endswith("json"):
@@ -469,7 +421,8 @@ def entry_point(
469421

470422
json_report = data.get_json_report()
471423
report_html = ReportGenerator(
472-
json_report).get_analysis_report_html()
424+
json_report
425+
).get_analysis_report_html()
473426

474427
if ".html" not in webreport:
475428
webreport = f"{webreport}.html"

quark/config.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
DIR_PATH = f"{HOME_DIR}quark-rules"
1010

1111
DEBUG = False
12-
COMPATIBLE_RAZIN_VERSIONS = ["0.3.4"]
12+
COMPATIBLE_RAZIN_VERSIONS = ["v0.3.4"]
1313

1414
RIZIN_DIR = f"{HOME_DIR}rizin/"
15-
RIZIN_COMMIT = "2373c53880e017be86afed5454bca5b5017b920e"
1615

1716
Path(HOME_DIR).mkdir(parents=True, exist_ok=True)

quark/report.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from quark.core.quark import Quark
88
from quark.core.struct.ruleobject import RuleObject
9-
from quark.utils.tools import find_rizin_instance
9+
from quark.utils.tools import find_rizin
1010

1111

1212
class Report:
@@ -46,7 +46,7 @@ def analysis(self, apk, rule, core_library="androguard", rizin_path=None):
4646
if rizin_path:
4747
self.rizin_path = rizin_path
4848
elif not self.rizin_path:
49-
self.rizin_path = find_rizin_instance(
49+
self.rizin_path = find_rizin(
5050
disable_rizin_installation=self.disable_rizin_installation
5151
)
5252

0 commit comments

Comments
 (0)