Another janky check bun script
Some checks failed
Wiki Resources Sanity Checks / ruff-checks (push) Failing after 2s
Some checks failed
Wiki Resources Sanity Checks / ruff-checks (push) Failing after 2s
This commit is contained in:
24
runbooks/atomic-rootkit-scan/check-bun.py
Normal file
24
runbooks/atomic-rootkit-scan/check-bun.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
from requests import get
|
||||||
|
|
||||||
|
def remote_pkg_list():
|
||||||
|
pkgs = get('https://raw.githubusercontent.com/lenucksi/aur-malware-check/refs/heads/master/malicious_npm_packages.txt')
|
||||||
|
ret = set()
|
||||||
|
for line in pkgs.content.decode():
|
||||||
|
if line.startswith('#'):
|
||||||
|
continue
|
||||||
|
ret.add(line)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def local_pkgs():
|
||||||
|
return set([e for e in Path(f'{Path.home()}/.bun/install/cache/').iterdir()])
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
remote_pkgs = remote_pkg_list()
|
||||||
|
for pkg in local_pkgs():
|
||||||
|
if pkg in remote_pkgs:
|
||||||
|
print(f'COMPROMISED - {pkg}')
|
||||||
|
else:
|
||||||
|
print(f'CLEAN - {pkg}')
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user