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

Can't specify port with lpdtest.py #59

Open skilfoy opened 2 years ago

skilfoy commented 2 years ago

Whether I change the default port in the script from 515 to (for example) 30886 or if I specify the port in the bash command with the option --port 30886, I get the same error:

Traceback (most recent call last): File "lpdtest.py", line 185, in s.send(bytes("\002"+queue+"\n",'utf-8')) TypeError: str() takes at most 1 argument (2 given)

If I don't specify the port, the script seems to fire off, although the print server is not on port 515, so nothing happens. But at least I don't get an error. The error only occurs when I specify the port.

Why does changing the port number make the script think that there's an additional argument? And how can this be fixed?

0xWerz commented 2 years ago

you may just need to edit the script :D, specifically change the default variable at the line 48. parser.add_argument("--port", type=int, help="printer port",default=30886 )

unique-EJ commented 1 year ago

File "./lpd/lpdtest.py", line 185 - TypeError.

$ python2
Python 2.7.18 (default, Jul  1 2022, 12:27:04) 
[GCC 9.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> bytes("")
''
>>> bytes("\002")
'\x02'
>>> 
>>> bytes("\002"+"\n")
'\x02\n'
>>> bytes("\002"+"\n",'utf-8')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: str() takes at most 1 argument (2 given)
>>>