mirror of
https://github.com/MobSF/Mobile-Security-Framework-MobSF.git
synced 2026-10-12 02:06:59 +00:00
Windows Python tempfile permission error fix (#2309)
* Fix PermissionError: [Errno 13] Permission denied Windows Python tempfile permission error fix
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# -*- coding: utf_8 -*-
|
||||
"""Module holding the functions for code analysis."""
|
||||
|
||||
import os
|
||||
import logging
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
@@ -37,9 +38,11 @@ def get_perm_rules(perm_rules, android_permissions):
|
||||
dynamic_rules.append(p)
|
||||
rules = yaml.dump(dynamic_rules)
|
||||
if rules:
|
||||
tmp = tempfile.NamedTemporaryFile(mode='w')
|
||||
tmp = tempfile.NamedTemporaryFile(
|
||||
mode='w',
|
||||
delete=False)
|
||||
tmp.write(rules)
|
||||
tmp.flush()
|
||||
tmp.close()
|
||||
return tmp
|
||||
except Exception:
|
||||
logger.error('Getting Permission Rules')
|
||||
@@ -98,7 +101,7 @@ def code_analysis(app_dir, typ, manifest_file, android_permissions):
|
||||
[src],
|
||||
{}))
|
||||
logger.info('Android Permission Mapping Completed')
|
||||
rule_file.close()
|
||||
os.unlink(rule_file.name)
|
||||
# NIAP Scan
|
||||
niap_findings = niap_scan(
|
||||
niap_rules.as_posix(),
|
||||
|
||||
Reference in New Issue
Block a user