Skip to content

Commit

Permalink
Merge pull request #103 from MobSF/0.4.5
Browse files Browse the repository at this point in the history
Support multiprocessing strategy
  • Loading branch information
ajinabraham authored Nov 14, 2024
2 parents 3a35968 + f04236a commit 3d87bc5
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ verify_ssl = true

[packages]
colorama = ">=0.4.5"
libsast = ">=3.1.4"
libsast = ">=3.1.5"
semgrep = "==1.86.0"
sarif-om = ">=1.0.4"
jschema-to-python = ">=1.2.3"
Expand Down
8 changes: 4 additions & 4 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ Requires Python 3.7+

```bash
$ mobsfscan
usage: mobsfscan [-h] [--json] [--sarif] [--sonarqube] [--html] [--type {android,ios,auto}] [-o OUTPUT] [-c CONFIG] [-w] [--no-fail] [-v] [path ...]
usage: mobsfscan [-h] [--json] [--sarif] [--sonarqube] [--html] [--type {android,ios,auto}]
[-o OUTPUT] [-c CONFIG] [-mp {default,billiard,thread}] [-w] [--no-fail] [-v]
[path ...]

positional arguments:
path Path can be file(s) or directories with source code

optional arguments:
options:
-h, --help show this help message and exit
--json set output format as JSON
--sarif set output format as SARIF 2.1.0
Expand All @@ -48,6 +50,8 @@ optional arguments:
output filename to save the result
-c CONFIG, --config CONFIG
location to .mobsf config file
-mp {default,billiard,thread}, --multiprocessing {default,billiard,thread}
optional: specify multiprocessing strategy
-w, --exit-warning non zero exit code on warning
--no-fail force zero exit code, takes precedence over --exit-warning
-v, --version show mobsfscan version
Expand Down
9 changes: 7 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,24 @@ inputs:
args:
description: |
positional arguments:
path Path can be file(s) or directories with source code
path Path can be file(s) or directories with source code
optional arguments:
-h, --help show this help message and exit
--json set output format as JSON
--sarif set output format as SARIF 2.1.0
--sonarqube set output format compatible with SonarQube
--html set output format as HTML
--type {android,ios,auto}
optional: force android or ios rules explicitly
-o OUTPUT, --output OUTPUT
output filename to save the result
-c CONFIG, --config CONFIG
Location to .mobsf config file
location to .mobsf config file
-mp {default,billiard,thread}, --multiprocessing {default,billiard,thread}
optional: specify multiprocessing strategy
-w, --exit-warning non zero exit code on warning
--no-fail force zero exit code, takes precedence over --exit-warning
-v, --version show mobsfscan version
required: true

Expand Down
2 changes: 1 addition & 1 deletion mobsfscan/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
__title__ = 'mobsfscan'
__authors__ = 'Ajin Abraham'
__copyright__ = f'Copyright {datetime.now().year} Ajin Abraham, OpenSecurity'
__version__ = '0.4.4'
__version__ = '0.4.5'
__version_info__ = tuple(int(i) for i in __version__.split('.'))
__all__ = [
'__title__',
Expand Down
5 changes: 5 additions & 0 deletions mobsfscan/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ def main():
parser.add_argument('-c', '--config',
help='location to .mobsf config file',
required=False)
parser.add_argument('-mp', '--multiprocessing',
help='optional: specify multiprocessing strategy',
choices=['default', 'billiard', 'thread'],
default='default')
parser.add_argument('-w', '--exit-warning',
help='non zero exit code on warning',
action='store_true',
Expand All @@ -80,6 +84,7 @@ def main():
is_json,
args.type,
args.config,
args.multiprocessing,
).scan()
if args.sonarqube:
sonarqube.sonarqube_output(
Expand Down
9 changes: 8 additions & 1 deletion mobsfscan/mobsfscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@


class MobSFScan:
def __init__(self, paths, json, scan_type='auto', config=False) -> None:
def __init__(
self,
paths,
json,
scan_type='auto',
config=False,
mp='default') -> None:
self.scan_type = scan_type
self.conf = get_config(paths, config)
self.options = {
Expand All @@ -35,6 +41,7 @@ def __init__(self, paths, json, scan_type='auto', config=False) -> None:
'ignore_rules': self.conf['ignore_rules'],
'severity_filter': self.conf['severity_filter'],
'show_progress': not json,
'multiprocessing': mp,
}
self.paths = paths
self.result = {
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jschema-to-python==1.2.3
jsonpickle==4.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
libsast==3.1.4
libsast==3.1.5
markdown-it-py==3.0.0
mdurl==0.1.2
opentelemetry-api==1.25.0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_version(rel_path):
long_description_content_type='text/markdown',
install_requires=[
'colorama>=0.4.5',
'libsast>=3.1.0',
'libsast>=3.1.5',
'semgrep==1.86.0',
'sarif-om>=1.0.4',
'jschema-to-python>=1.2.3',
Expand Down

0 comments on commit 3d87bc5

Please sign in to comment.