Skip to content

Commit

Permalink
Update code_analysis.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ajinabraham authored Dec 19, 2023
1 parent dbf9b13 commit 57b8e13
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions mobsf/StaticAnalyzer/views/android/code_analysis.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf_8 -*-
"""Module holding the functions for code analysis."""

import os
import logging
import tempfile
from pathlib import Path
Expand Down Expand Up @@ -37,9 +38,10 @@ def get_perm_rules(perm_rules, android_permissions):
dynamic_rules.append(p)
rules = yaml.dump(dynamic_rules)
if rules:
tmp = tempfile.NamedTemporaryFile(mode='w', delete=False)
tmp = tempfile.NamedTemporaryFile(
mode='w',
delete=False)
tmp.write(rules)
tmp.flush()
tmp.close()
return tmp
except Exception:
Expand Down Expand Up @@ -99,10 +101,7 @@ def code_analysis(app_dir, typ, manifest_file, android_permissions):
[src],
{}))
logger.info('Android Permission Mapping Completed')
try:
os.remove(rule_file.name)
except:
pass
os.unlink(rule_file.name)
# NIAP Scan
niap_findings = niap_scan(
niap_rules.as_posix(),
Expand Down

0 comments on commit 57b8e13

Please sign in to comment.