/usr/lib/cups/driver/m2300w is in printer-driver-m2300w 0.51-13.
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 | #!/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
import json
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 = json.loads(ppds_decompressed.decode(encoding='ASCII'))
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()
# Encode to binary, decode base64, decompress and convert to bytes again
ppds['ARCHIVE'] = BytesIO(decompress(base64.b64decode(ppds['ARCHIVE'].encode('ASCII'))))
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+Wj4BTsDl5dAD2IggMSmC9Xe3c+WFJMBuVbGurz5oMNJxu0DVl4P7VOZOsyrhGIR5v1fjY9ckzuuIdGw+tWRSemlPH1t7zxrd62UcxpkcT86tLSX9MzdMQ8C+vd/3w9YzMr9ru6hrhsjyR38BGgLADRi81T+m0udP8BjPUl7Y5i2dr6ZcLDSVLAHTy7yY91EpO9BsfALj886LzdxGLuf2zHJ4dDhH4xzhSPDgaF6BCEnxGXfNgTScJjVMgCMBwCyFtjVr547l2y0X4oR3SndZXc97Km6BPXjU4aflFLSOYibzKbg0Qm//8u0YhKvPFOnQ2yZLFNdtkkvGOJb+NhVJIQZr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sGR9P093h4915zQraLBDaX0phCUjoSk4i/NaEyHXv42SY4DpbGIDriTEMdrq5X1cMWFPItr9zOzM1ZI40aJeW9jarhQ7qGOk1yL2NEmM3zeKW9n7FDvq/Xonj1hl5aC6BFR3Vw+EcsnNa/yEVUl1UDiSd8j5FgufQqIu3RODNJLz/nTc5cmMcI2VV0k1IPFNiIqMpN9GM/aVh8ojiNvJSNjc/JNYfmw6w3sddW5eExl43r1d6AAAAAADs4krc0gwWAAH6HO0pAACrcMXBscRn+wIAAAAABFla"
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
# We don't want a KeyboardInterrupt throwing a
# traceback into stdout.
pass
|