
إطار عمل لتجزئة الأذونات المعلنة في إضافات Chromium وملفات APK، مما يتيح التجميع والبحث والتنقل عبر الحزم التي يُحتمل أن تكون ضارّة.
Permhash هو إطار عمل قابل للتوسعة لتجزئة الأذونات المعلنة المطبقة على إضافات المتصفح المبنية على Chromium وملفات APK، مما يتيح التجميع والبحث والتنقل بشكل مشابه لتجزئة الاستيراد (import hashing) وتجزئة الترويسة الغنية (rich header hashing).
يستطيع Permhash حاليًا العمل على أربعة أنواع من الملفات، لكنه قابل للتوسعة ليشمل ما هو أبعد من ذلك:
قم بتثبيت مكتبة permhash
pip install permhash
استيراد permhash
from permhash import functions as permhash
استخدام permhash
# The path variable should be the full path to the file you wish to use to calculate the permhash.
# Calculate the permhash for a CRX
ph = permhash.permhash_crx(path)
# Calculate the permhash for a CRX manifest
ph = permhash.permhash_crx_manifest(path)
# Calculate the permhash for an APK
ph = permhash.permhash_apk(path)
# Calculate the permhash for an APK manifest
ph = permhash.permhash_apk_manifest(path)
مثال على حساب permhash بكميات كبيرة.
import csv
import os
from permhash import functions as permhash
def bulk_permhash_crx_manifest(path, output):
"""
Computes the permhash from a directory of CRX manifests
Outputs the results in a csv passed as input
:param path: The targeted directory
:type path: string
:param output:
:type path: string
"""
with open(output, mode="w", encoding="utf-8") as results:
out_writer = csv.writer(
results, delimiter=",", quotechar='"', quoting=csv.QUOTE_MINIMAL
)
out_writer.writerow(["filename", "permhash"])
for filename in os.listdir(path):
if path.endswith("/"):
full_path = path + filename
else:
full_path = path + "/" + filename
calculated_permhash = permhash.permhash_crx_manifest(full_path)
if calculated_permhash:
out_writer.writerow([filename, calculated_permhash])
يمكن استخدام Permhash أيضًا كأداة لسطر الأوامر. قدّم المسار الكامل للملف لحساب permhash عبر المفتاح --path/-p ونوع الملف الذي يتم تحليله عبر المفتاح --type/-t. سيُخرج الأمر permhash أو False إذا كان الملف غير صالح.
permhash --type crx --path '[PATH TO CRX File]'
permhash --type crx_manifest --path '[PATH TO CRX Manifest File]'
permhash --type apk --path '[PATH TO APK File]'
permhash --type apk_manifest --path '[PATH TO APK Manifest Files]'
اطّلع على مدونة Mandiant Permhash لمزيد من التفاصيل.
يمكن استخدام مجموعة Permhash على Google لتسهيل النقاش.
هذا ليس منتجًا رسميًا مدعومًا من Google.