
Framework per l'hashing delle autorizzazioni dichiarate nelle estensioni Chromium e negli APK, che consente clustering, hunting e pivoting su pacchetti potenzialmente dannosi.
Permhash è un framework estensibile per calcolare l'hash delle autorizzazioni dichiarate applicate alle estensioni del browser basate su Chromium e agli APK, consentendo clustering, hunting e pivoting simili all'import hashing e al rich header hashing.
Permhash è attualmente in grado di funzionare su quattro tipi di file, ma è estensibile oltre a questi:
Installa la libreria permhash
pip install permhash
Importa permhash
from permhash import functions as permhash
Usa 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)
Un esempio di calcolo del permhash in blocco.
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 può essere utilizzato anche come strumento da riga di comando. Fornisci il percorso completo del file per calcolare il permhash tramite l'opzione --path/-p e il tipo di file analizzato tramite l'opzione --type/-t. Il comando restituirà il permhash oppure False se il file non è valido.
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]'
Consulta il Mandiant Permhash Blog per maggiori dettagli.
Il Permhash Google Group può essere utilizzato per facilitare la discussione.
Questo non è un prodotto ufficialmente supportato da Google.