# Path: mobsf/StaticAnalyzer/views/common/shared_func.py
# def url_n_email_extract(dat, relative_path):
#     """Extract URLs and Emails from Source Code."""
#     urls = []
#     emails = []
#     urllist = []
#     url_n_file = []
#     email_n_file = []
#     # URLs Extraction My Custom regex
#     pattern = re.compile(
#         (
#             r'((?:https?://|s?ftps?://|'
#             r'file://|javascript:|data:|www\d{0,3}[.])'
#             r'[\w().=/;,#:@?&~*+!$%\'{}-]+)'
#         ),
#         re.UNICODE)
#     urllist = re.findall(pattern, dat)
#     uflag = 0
#     for url in urllist:
#         if url not in urls:
#             urls.append(url)
#             uflag = 1
#     if uflag == 1:
#         url_n_file.append(
#             {'urls': urls, 'path': escape(relative_path)})
# 
#     # Email Extraction Regex
#     regex = re.compile(r'[\w.-]{1,20}@[\w-]{1,20}\.[\w]{2,10}')
#     eflag = 0
#     for email in regex.findall(dat.lower()):
#         if (email not in emails) and (not email.startswith('//')):
#             emails.append(email)
#             eflag = 1
#     if eflag == 1:
#         email_n_file.append(
#             {'emails': emails, 'path': escape(relative_path)})
#     return urllist, url_n_file, email_n_file


import logging
from pathlib import Path
from enum import Enum
from django.conf import settings
from mobsf.MalwareAnalyzer.views.MalwareDomainCheck import (
    MalwareDomainCheck,
)
from mobsf.StaticAnalyzer.views.common.shared_func import (
    url_n_email_extract,
)
from mobsf.StaticAnalyzer.views.sast_engine import scan
        code_findings = scan(
            objective_c_rules.as_posix(),
            {'.m'},
            [src],
            settings.SKIP_CLASS_PATH)
        if code_findings:
            source_types.add(_SourceType.objc)
        code_findings.update(scan(
            swift_rules.as_posix(),
            {'.swift'},
            [src],
            settings.SKIP_CLASS_PATH))
        if code_findings:
            source_types.add(_SourceType.swift)
        api_findings = scan(
            api_rules.as_posix(),
            {'.m', '.swift'},
            [src],
            settings.SKIP_CLASS_PATH)

        # Extract URLs and Emails
        skp = settings.SKIP_CLASS_PATH
        for pfile in Path(src).rglob('*'):
            if (
                (pfile.suffix in ('.m', '.swift')
                    and any(skip_path in pfile.as_posix()
                            for skip_path in skp) is False
                    and pfile.is_dir() is False)
            ):
                relative_java_path = pfile.as_posix().replace(src, '')

# Path: mobsf/StaticAnalyzer/views/common/shared_func.py
# def url_n_email_extract(dat, relative_path):
#     """Extract URLs and Emails from Source Code."""
#     urls = []
#     emails = []
#     urllist = []
#     url_n_file = []
#     email_n_file = []
#     # URLs Extraction My Custom regex
#     pattern = re.compile(
#         (
#             r'((?:https?://|s?ftps?://|'
#             r'file://|javascript:|data:|www\d{0,3}[.])'
#             r'[\w().=/;,#:@?&~*+!$%\'{}-]+)'
#         ),
#         re.UNICODE)
#     urllist = re.findall(pattern, dat)
#     uflag = 0
#     for url in urllist:
#         if url not in urls:
#             urls.append(url)
#             uflag = 1
#     if uflag == 1:
#         url_n_file.append(
#             {'urls': urls, 'path': escape(relative_path)})
# 
#     # Email Extraction Regex
#     regex = re.compile(r'[\w.-]{1,20}@[\w-]{1,20}\.[\w]{2,10}')
#     eflag = 0
#     for email in regex.findall(dat.lower()):
#         if (email not in emails) and (not email.startswith('//')):
#             emails.append(email)
#             eflag = 1
#     if eflag == 1:
#         email_n_file.append(
#             {'emails': emails, 'path': escape(relative_path)})
#     return urllist, url_n_file, email_n_file


# Path: mobsf/StaticAnalyzer/views/ios/code_analysis.py
import logging
from pathlib import Path
from enum import Enum
from django.conf import settings
from mobsf.MalwareAnalyzer.views.MalwareDomainCheck import (
    MalwareDomainCheck,
)
from mobsf.StaticAnalyzer.views.common.shared_func import (
    url_n_email_extract,
)
from mobsf.StaticAnalyzer.views.sast_engine import scan

        code_findings = scan(
            objective_c_rules.as_posix(),
            {'.m'},
            [src],
            settings.SKIP_CLASS_PATH)
        if code_findings:
            source_types.add(_SourceType.objc)
        code_findings.update(scan(
            swift_rules.as_posix(),
            {'.swift'},
            [src],
            settings.SKIP_CLASS_PATH))
        if code_findings:
            source_types.add(_SourceType.swift)
        api_findings = scan(
            api_rules.as_posix(),
            {'.m', '.swift'},
            [src],
            settings.SKIP_CLASS_PATH)

        # Extract URLs and Emails
        skp = settings.SKIP_CLASS_PATH
        for pfile in Path(src).rglob('*'):
            if (
                (pfile.suffix in ('.m', '.swift')
                    and any(skip_path in pfile.as_posix()
                            for skip_path in skp) is False
                    and pfile.is_dir() is False)
            ):
                relative_java_path = pfile.as_posix().replace(src, '')

                urls, urls_nf, emails_nf = url_n_email_extract(