RUB-NDS / PRET

Printer Exploitation Toolkit - The tool that made dumpster diving obsolete.
http://hacking-printers.net
GNU General Public License v2.0
3.81k stars 605 forks source link

Older LaserJets' PJL requires Backslash '\' Path Separator, not Forward Slash '/' #80

Open HughHood opened 1 year ago

HughHood commented 1 year ago

After testing PRET with two different LaserJet 4050N's and receiving errors on simple things like 'ls' commands, I put it in Debug mode and saw why.

PRET was issuing forward slashes '/' as path separators when sending commands to the printer. The LaserJet 4050's (and perhaps others) choke on this.

The fix is found in the helper.py file at line 510:

class const(): # define constants SEP = '/' # use posixoid path separator

By changing it to:

SEP = '\\' # use backslash path separator (LJ 4050N, others)

PRET worked fine. Note, the backslash must be escaped by prefacing it with a backslash.

I might suggest putting a comment to this effect in the helper.py file, and also in the main Readme file.

I suppose you could put some logic in the scripts to change SEP based on the printer model, but at least a comment would direct users how to fix this themselves if they have a printer that requires Backslashes in file paths.

Thanks. I'm enjoying getting to know PRET, although I have yet to be able to access the main LynxOS directories on the 4050's by using the \...\...\...\ technique.