/usr/lib/cups/driver/ptouch is in printer-driver-ptouch 1.3-8.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | #!/usr/bin/env python3
# compressor.py
from subprocess import Popen, PIPE
def compress(value):
"""Compresses a byte array with the xz binary"""
process = Popen(["xz", "--compress", "--force"], stdin=PIPE, stdout=PIPE)
return process.communicate(value)[0]
def decompress(value):
"""Decompresses a byte array with the xz binary"""
process = Popen(["xz", "--decompress", "--stdout", "--force"],
stdin=PIPE, stdout=PIPE)
return process.communicate(value)[0]
def compress_file(path):
"""Compress the file at 'path' with the xz binary"""
process = Popen(["xz", "--compress", "--force", "--stdout", path], stdout=PIPE)
return process.communicate()[0]
# compressor.py
import os
import sys
from optparse import OptionParser
from sys import argv
import base64
try:
import cPickle as pickle
except ImportError:
import pickle
from io import BytesIO
from os.path import basename
from errno import EPIPE
def load():
ppds_compressed = base64.b64decode(ppds_compressed_b64)
ppds_decompressed = decompress(ppds_compressed)
ppds = pickle.loads(ppds_decompressed)
return ppds
def ls():
binary_name = basename(argv[0])
ppds = load()
for key, value in ppds.items():
if key == 'ARCHIVE': continue
for ppd in value[2]:
try:
print(ppd.replace('"', '"' + binary_name + ':', 1))
except IOError as e:
# Errors like broken pipes (program which takes the standard
# output terminates before this program terminates) should not
# generate a traceback.
if e.errno == EPIPE: exit(0)
raise
def cat(ppd):
# Ignore driver's name, take only PPD's
ppd = ppd.split(":")[-1]
# Remove also the index
ppd = "0/" + ppd[ppd.find("/")+1:]
ppds = load()
ppds['ARCHIVE'] = BytesIO(decompress(ppds['ARCHIVE']))
if ppd in ppds:
start = ppds[ppd][0]
length = ppds[ppd][1]
ppds['ARCHIVE'].seek(start)
return ppds['ARCHIVE'].read(length)
def main():
usage = "usage: %prog list\n" \
" %prog cat URI"
version = "%prog 1.0.2\n" \
"Copyright (c) 2013 Vitor Baptista.\n" \
"This is free software; see the source for copying conditions.\n" \
"There is NO warranty; not even for MERCHANTABILITY or\n" \
"FITNESS FOR A PARTICULAR PURPOSE."
parser = OptionParser(usage=usage,
version=version)
(options, args) = parser.parse_args()
if len(args) == 0 or len(args) > 2:
parser.error("incorrect number of arguments")
if args[0].lower() == 'list':
ls()
elif args[0].lower() == 'cat':
if not len(args) == 2:
parser.error("incorrect number of arguments")
ppd = cat(args[1])
if not ppd:
parser.error("Printer '%s' does not have default driver!" % args[1])
try:
# avoid any assumption of encoding or system locale; just print the
# bytes of the PPD as they are
if sys.version_info.major < 3:
sys.stdout.write(ppd)
else:
sys.stdout.buffer.write(ppd)
except IOError as e:
# Errors like broken pipes (program which takes the standard output
# terminates before this program terminates) should not generate a
# traceback.
if e.errno == EPIPE: exit(0)
raise
else:
parser.error("argument " + args[0] + " invalid")
# PPDs Archive
ppds_compressed_b64 = b"/Td6WFoAAATm1rRGAgAhARYAAAB0L+Wj4CpwGbVdAEAAyynXgKBkJ1IWv/boY8vTM9MktbLOpatIGjz3QEXi/jpWYIhyvau9pwPzxqg+zs296STl+/7VxlaQeRtSyBhGxdvR+f5bvjQsOKjoxM7x1lUuzSw9ak6mKu2akPLkkQhZASnPtN4c8nnCtCFJhyfENa2l63kvnDvDwTpbgYArind7c6Zn6Qw9cDyOzRaN7zjE2xDMHEf3749XdbcKVmrzyUFsz3/JgCAUZntQYrEKgWfgd4DtBI83a5IZorhEXGMNpi5GWXVncf+Y6kRYJFx4Em3xzVBAnOCmvNxsgw+ZjFHG6QwXdTBqhwkWMDz9DIBxjNAnqAyzkeJlKtQJYdioj007ENgeiU31mOVHxGjRm2Vr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yaq3d7jwGNgAnDOTSUvIDwItlDPHIXdjmapXUMUzYWCDCZ6tNZScp6mre9mWMoL8hbzdUn4Cb7mG/od7QvhnQgDIuNMRal+eZT6dM1DkNti+XVZh9PYb5I1ETpZai4wlh/JRuZK9/XXCjkR8SFC6u6ClRzYanl2Sk1jmsQ4J478CnExX/gzijP98p89+s6ai9RlXJSUBVp41Pl3NspwNBSVMvcASsZt54MgC7p2t3ZPRP/JziLa7SpXxXR5MznQT4ZOK7ss602bCTvMhUyxlRJVaPsshzKn6g1idfvo2jiLCNJBCgM1OGpTmRlDELrhpfMgYyMuJKBXE652xBnhDvtJG2cbY0+T3TUz1dgV4a2orUEBUScsSPt+yJ87p6ejhMrVBQS3yr6g1n8pOXfDxeu4sHdnSfRomTZ3YlBwb3HBc5dBl7N8tASWQ37pz/cYtRSqF2HRfCRjkVypi8pzQ5qLlDN/RRv6FaGUI4vStimMq6810FrG9SuK4DOEXbp7sKlV6nmmWx936ENh3gGwM4jyDcjo69yd4ZBD8vzjeeAuR8VbxuRVtkE/RdYOavboLLU5+1Tmgq6mHm+BeKfTLbrdzl+KOT4D2+TxlEmlw/Cg+5cmLNbfBnxpzxPDzN8Myn6APYwjKtdEopA5XO93u1crHc7cpjvlaU8jTxjDo1Tj9+njz8E7O68ucG4seK1iqIz0JQskHWRo445yLQJwIDzC4YBhbQOdgKPzxkBFVY0LtECRW01qAYt1vPu7p4/DjIa2f3X/pYbYdqSxtl8Ie0AR+cmovdhIeFBPH3yDyC9seSjbjlc/BwhW7Cf9ucKK/4xEpidPAAAAALnB7C21beh4AAHRM/FUAACvLtmpscRn+wIAAAAABFla"
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
# We don't want a KeyboardInterrupt throwing a
# traceback into stdout.
pass
|