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 scan on speficic port, example : 9102 #51

Closed VictorUltre closed 2 years ago

VictorUltre commented 2 years ago

By default the program scan on 9100 port. But i have to scan on the 9102 port. Is there a command to do this ?

siovador commented 2 years ago

I was able to solve this by updating the helper.py script and replace port 9100 with whatever you need. If I have time I will update the tool with a port flag and see if the merge gets approved.

siovador commented 2 years ago

Also note you can update the port in lpd scripts manually as well or pass with the port flag if present.

rhergenreder commented 2 years ago

I suggest the following code which allows passing port in the target parameter in the format of addr:port. Just a workaround which should have the fewest changes.

git diff
index fd62ec4..8709271 100644
--- a/helper.py
+++ b/helper.py
@@ -368,7 +368,12 @@ class conn(object):
       and stat.S_ISCHR(os.stat(target).st_mode):
         self._file = os.open(target, os.O_RDWR)
     # treat target as ipv4 socket
-    else: self._sock.connect((target, 9100))
+    else:
+      if ":" in target:
+        target, port = target.split(":")
+      else:
+        port = 9100
+      self._sock.connect((target, int(port)))

   # close connection
   def close(self, *arg):