(args)
| 110 | |
| 111 | |
| 112 | def cmd_wm_verify(args): |
| 113 | from StegaPy import StegaPy, StegaPyConfig |
| 114 | from StegaPy.plugin.dwtdugad import DWTDugadPlugin |
| 115 | cfg = StegaPyConfig(password=args.password) |
| 116 | plugin = DWTDugadPlugin(); plugin.config = cfg |
| 117 | sp = StegaPy(plugin, cfg) |
| 118 | |
| 119 | stego = _read(args.input) |
| 120 | sig = _read(args.sig) |
| 121 | score = sp.check_mark(stego, os.path.basename(args.input), sig) |
| 122 | |
| 123 | high = plugin.get_high_watermark_level() |
| 124 | low = plugin.get_low_watermark_level() |
| 125 | if score >= high: |
| 126 | verdict = "水印有效(高置信)" |
| 127 | elif score >= low: |
| 128 | verdict = "水印可能存在(低置信)" |
| 129 | else: |
| 130 | verdict = "未检测到水印" |
| 131 | print(f"相关性得分: {score:.4f} → {verdict}") |
| 132 | |
| 133 | |
| 134 | def cmd_wm_generate_sig(args): |
no test coverage detected