(args)
| 74 | |
| 75 | |
| 76 | def cmd_extract(args): |
| 77 | from StegaPy import StegaPy |
| 78 | plugin, cfg = _make_lsb_plugin( |
| 79 | algo=args.algo, |
| 80 | bits=1, |
| 81 | password=args.password, |
| 82 | compress=True, # 从数据头读取,此处仅作占位 |
| 83 | encrypt=bool(args.password), |
| 84 | ) |
| 85 | sp = StegaPy(plugin, cfg) |
| 86 | |
| 87 | stego = _read(args.input) |
| 88 | fname, data = sp.extract_data(stego, os.path.basename(args.input)) |
| 89 | |
| 90 | out_dir = args.output or os.path.dirname(os.path.abspath(args.input)) |
| 91 | out_path = os.path.join(out_dir, fname or 'extracted_data') |
| 92 | _write(out_path, data) |
| 93 | print(f"提取完成 → {out_path} ({len(data)/1024:.1f} KB)") |
| 94 | |
| 95 | |
| 96 | def cmd_wm_embed(args): |
no test coverage detected