51 lines
2.1 KiB
Python
51 lines
2.1 KiB
Python
#!/usr/bin/env python3
|
|
import logging
|
|
import argparse
|
|
from m2m.nbiot import factory
|
|
from m2m.utils import fmt_val
|
|
|
|
# Configure logging to hide noisy internal AT command logs for this report
|
|
logging.basicConfig(level=logging.WARNING)
|
|
|
|
def sim_deep_forensics(port):
|
|
# Supports BG96, BG95, or BC66
|
|
module = factory('BG95', port)
|
|
|
|
with module:
|
|
print("="*50)
|
|
print(" SIM CARD NETWORK FORENSICS REPORT")
|
|
print("="*50)
|
|
|
|
# Basic Identification
|
|
print(f"{'ICCID:':<25} {fmt_val(module.read_iccid())}")
|
|
print(f"{'IMSI:':<25} {fmt_val(module.read_imsi())}")
|
|
|
|
# Core PLMN Information
|
|
print("\n--- HOME & REGISTRATION ---")
|
|
print(f"{'Home PLMN (HPLMN):':<25} {fmt_val(module.get_home_plmn())}")
|
|
print(f"{'Last Registered (RPLMN):':<25} {fmt_val(module.get_registered_plmn())}")
|
|
|
|
# Priority Lists
|
|
print("\n--- PRIORITY LISTS (EHPLMN / EPLMN) ---")
|
|
print(f"{'Equivalent Home:':<25} {fmt_val(module.read_ehplmns())}")
|
|
print(f"{'Equivalent PLMNs:':<25} {fmt_val(module.read_eplmns())}")
|
|
|
|
# Advanced Selection Lists (with Access Technology)
|
|
print("\n--- SELECTOR LISTS (with Access Tech) ---")
|
|
print(f"{'User Controlled:':<25} {fmt_val(module.read_user_plmn_act())}")
|
|
print(f"{'Operator Controlled:':<25} {fmt_val(module.read_operator_plmn_act())}")
|
|
print(f"{'HPLMN Selector:':<25} {fmt_val(module.read_hplmn_act())}")
|
|
print(f"{'Legacy PLMN Selector:':<25} {fmt_val(module.read_plmn_selector())}")
|
|
|
|
# Restrictions & Special Groups
|
|
print("\n--- RESTRICTIONS ---")
|
|
print(f"{'Forbidden PLMNs:':<25} {fmt_val(module.read_forbidden_plmns())}")
|
|
print(f"{'Closed Access Group:':<25} {fmt_val(module.read_cag_info())}")
|
|
|
|
print("\n" + "="*50)
|
|
|
|
if __name__ == "__main__":
|
|
parser = argparse.ArgumentParser(description="Run SIM forensics report.")
|
|
parser.add_argument("port", nargs="?", default="/dev/ttyUSB0", help="Serial port (e.g. /dev/ttyUSB0 or MOCK)")
|
|
args = parser.parse_args()
|
|
sim_deep_forensics(args.port)
|