Nmap Development mailing list archives

RE: [PATCH] nmap-service-probes: Misc database corrections, printer additions


From: Aaron Leininger <rilian4 () hotmail com>
Date: Tue, 14 Jul 2009 09:28:40 -0700


Ok. I have attempted to implement all the suggestions I received from the list. Attached is the latest version of the 
script. A big thank you to David Fitfield who helped me out w/ a few parts of this. If I missed something or if you 
have any further suggestions for how I can document this better or anything else, by all means let me know. I am very 
new to NSE and still learning the ropes. 

This script runs rather well on HP laserjets. I have tested against lexmark's and it doesn't run terribly well but it 
also doesn't seem to harm the printer either. No paper comes flying out anyway. I would appreciate feedback on other 
models. 

=================
Script behavior is as follows: 

*Initial Probe sent requesting current display status. If no response, close the socket, inform the user and exit. If 
there is a response, proceed..

*If no script argument is provided, output the current display text and exit. 

*If there is a script argument, set the display to that argument and then re-poll the printer display. Output both what 
was set as the display and what the current reading of the display is. 

some example output:
(no arg)
PORT     STATE SERVICE
9100/tcp open  jetdirect
|_ pjl-ready-message: Current Display: "READY"

(with an argument)
PORT     STATE SERVICE
9100/tcp open  jetdirect
|  pjl-ready-message: "pr1nt3r p0wn3d" was set as the display for printer at printer.ip.addr
|  Re-polling printer to check that message was successful...
|_ Current printer display message: "pr1nt3r p0wn3d"

(no response)
PORT     STATE SERVICE
9100/tcp open  jetdirect
|_ pjl-ready-message: No Response from printer

example commands:
(no args)
nmap -p9100 --script=./pjl-ready-message.nse my.printer.ip

(arg)
nmap -p9100 --script=./pjl-ready-message.nse --script-args='pjl_ready_message="pr1nt3r p0wn3d"' my.printer.ip

=============
I have run into an interesting problem I am hoping for some insight on. 

First off, NSE will set the display message correctly on a 5si but it will not poll it correctly for the current 
display. What makes this interesting is that if I send the same PJL command via ncat, I get a response from the 5si 
almost immediately. I have lengthened the timeout value to as high as 9 seconds in testing and still don't get a 
response. I ran a packet capture and it seems that indeed no response was sent to the NSE probe. At David Fitfield's 
suggestion, I tried sending /n instead of /r/n at the end of the line...response was the same. 

In any event, if anyone has time on their hands and wants to run this against a few laserjets for kicks, give it a 
whirl and let me know. This has been an eventful and very educational process for me to get this script going. Thanks 
again to those of you who have helped me get this far! 

-Aaron

...I think it's
a good idea for the script to do a preliminary @PJL INFO STATUS, and if
it doesn't get a response back, not to send anything more to the port.

David Fifield


_________________________________________________________________
Windows Live™ SkyDrive™: Get 25 GB of free online storage.
http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009

Attachment: pjl-ready-message.nse
Description:


_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org

Current thread: