
Chromium एक्सटेंशन और APK में घोषित अनुमतियों की हैशिंग के लिए फ्रेमवर्क, जो संभावित रूप से दुर्भावनापूर्ण पैकेजों में क्लस्टरिंग, हंटिंग और पिवोटिंग को सक्षम बनाता है।
Permhash एक extensible framework है जो Chromium-आधारित ब्राउज़र एक्सटेंशन और APKs पर लागू घोषित permissions को hash करता है, जिससे import hashing और rich header hashing के समान clustering, hunting और pivoting संभव होता है।
Permhash वर्तमान में चार प्रकार की फ़ाइलों पर चलने में सक्षम है, लेकिन इससे आगे भी extensible है:
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 को कमांडलाइन टूल के रूप में भी उपयोग किया जा सकता है। --path/-p स्विच में permhash की गणना करने के लिए फ़ाइल का पूरा पथ और --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 Blog देखें।
चर्चा को सुविधाजनक बनाने के लिए Permhash Google Group का उपयोग किया जा सकता है।
यह आधिकारिक रूप से समर्थित Google उत्पाद नहीं है।