Skip to content

Instantly share code, notes, and snippets.

@raylax
Created December 29, 2024 04:08
Show Gist options
  • Save raylax/2e26cc8228f8dcbfbea3a0393f3d47f1 to your computer and use it in GitHub Desktop.
Save raylax/2e26cc8228f8dcbfbea3a0393f3d47f1 to your computer and use it in GitHub Desktop.
import sys
import tarfile
def check(path: str):
no_asciis: list[str] = []
with tarfile.open(path) as tar:
for item in tar.getmembers():
if item.name.isascii():
continue
no_asciis.append(item.name)
if no_asciis:
print(f"[!] 内容包含非ascii字符 - [{','.join(no_asciis)}]")
return
print("[*] OK")
if __name__ == '__main__':
if len(sys.argv) < 2:
print("[-] Usage check-of.py [PATH]")
check(sys.argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment