Skip to content

Commit

Permalink
code QA
Browse files Browse the repository at this point in the history
  • Loading branch information
ajinabraham committed Dec 2, 2023
1 parent 60b1e8d commit d0ce5a1
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
7 changes: 3 additions & 4 deletions mobsf/DynamicAnalyzer/views/android/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from pathlib import Path

from mobsf.MobSF.utils import (
EMAIL_REGEX,
URL_REGEX,
is_file_exists,
python_list,
)
Expand All @@ -18,10 +20,7 @@
from mobsf.MalwareAnalyzer.views.MalwareDomainCheck import (
MalwareDomainCheck,
)
from mobsf.StaticAnalyzer.views.common.shared_func import (
EMAIL_REGEX,
URL_REGEX,
)


logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion mobsf/DynamicAnalyzer/views/ios/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import re
from pathlib import Path

from mobsf.StaticAnalyzer.views.common.shared_func import (
from mobsf.MobSF.utils import (
EMAIL_REGEX,
URL_REGEX,
)
Expand Down
11 changes: 11 additions & 0 deletions mobsf/MobSF/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@
ADB_PATH = None
BASE64_REGEX = re.compile(r'^[-A-Za-z0-9+/]*={0,3}$')
MD5_REGEX = re.compile(r'^[0-9a-f]{32}$')
# Regex to capture strings between quotes or <string> tag
STRINGS_REGEX = re.compile(r'(?<=\")(.+?)(?=\")|(?<=\<string>)(.+?)(?=\<)')
# MobSF Custom regex to catch maximum URI like strings
URL_REGEX = re.compile(
(
r'((?:https?://|s?ftps?://|'
r'file://|javascript:|data:|www\d{0,3}[.])'
r'[\w().=/;,#:@?&~*+!$%\'{}-]+)'
),
re.UNICODE)
EMAIL_REGEX = re.compile(r'[\w+.-]{1,20}@[\w-]{1,20}\.[\w]{2,10}')


class Color(object):
Expand Down
14 changes: 3 additions & 11 deletions mobsf/StaticAnalyzer/views/common/shared_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

from mobsf.MobSF import settings
from mobsf.MobSF.utils import (
EMAIL_REGEX,
STRINGS_REGEX,
URL_REGEX,
is_md5,
print_n_send_error_response,
upstream_proxy,
Expand All @@ -37,17 +40,6 @@


logger = logging.getLogger(__name__)
# Regex to capture strings between quotes or <string> tag
STRINGS_REGEX = re.compile(r'(?<=\")(.+?)(?=\")|(?<=\<string>)(.+?)(?=\<)')
# MobSF Custom regex to catch maximum URI like strings
URL_REGEX = re.compile(
(
r'((?:https?://|s?ftps?://|'
r'file://|javascript:|data:|www\d{0,3}[.])'
r'[\w().=/;,#:@?&~*+!$%\'{}-]+)'
),
re.UNICODE)
EMAIL_REGEX = re.compile(r'[\w+.-]{1,20}@[\w-]{1,20}\.[\w]{2,10}')


def hash_gen(app_path) -> tuple:
Expand Down

0 comments on commit d0ce5a1

Please sign in to comment.