LPQ on Windows 8 doesn't find my printer - printing

I have enabled the LPD and LPR on a Windows 8.
I want to print some files using the LPR command, but i can't even find the printer with the LPQ.
I can print normally with the printer through (ctrl + p), but i can't find it with the LPQ command.
C:\>lpq -S localhost -P HiTi_P510L
Servidor LPD do WindowsErro: the specified printer doesn't exists.
If i try to run the LPR directly i have the same error saying that the printer doesn't exists.
C:\>lpr -S 127.0.0.1 -P HiTi_P510L camila.jpg
Erro: o servidor de impressão não aceitou a requisição. Trabalho interrompido.
The event log:
LPD refused the job \\127.0.0.1\HiTi_P510L because the specified printer doens't exist on this computer.
net view:
C:\Windows\system32>net view \\myserver
Recursos compartilhados em \\myserver
Nome do compartilhamento Tipo Usado como Comentário
--------------------------------------------------------------
HiTi_P510L Impressão P510L
Comando concluído com êxito.
C:\Windows\system32>
update: port 515 is listening.
C:\>netstat -an
Conexões ativas
Proto Endereço local Endereço externo Estado
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
TCP 0.0.0.0:515 0.0.0.0:0 LISTENING
TCP 0.0.0.0:2869 0.0.0.0:0 LISTENING
TCP 0.0.0.0:49152 0.0.0.0:0 LISTENING
...
I can also telnet localhost 515 which gives me a black screen, and after i press ENTER i have this:
☺
Conexão ao host perdida.
C:\Windows\system32>
Any suggestion?

UPDATE: There are two issues here. The answer to the question regarding LPR/LPD is resolved here while the other issue was relating to the actual print stream is answered at the bottom of this response.
Ensure your firewall is off (or at least allowing 515 to pass through). Also, ensure you are using the IP of your network adapter and not local host as LPD tends to bind to an actual IP address.
If you want to ensure that your data is passed through without modification / encoding then use -o l in the command line. For example:
lpr -S <workstation_ip> -P <printer_share> -o l test.ps
lpr -S 192.168.1.6 -P P510L -o l test.ps
Also ensure the file you are sending is actually supported by the print device. While some printers support graphic formats most are expecting PCL, PS, XPS, PDF etc. Some support TIF and other JPG etc. Ensure the file you are sending is supported by the device.
In the end the issue appears to be the proprietary nature of the device and as such, the requirement is there to push the file through the print driver. One simple way is to use a graphics application that supports command line printing. One option is MS Paint.
mspaint /pt IMG_1234.jpg "Hiti P510L"
The printer name (Hiti P510L) is the name that appears in the devices and printers screen in Windows.

Related

open port 23 but not possible to access it

okay I just did a scan on the xiaomi repeater extender using nmap
and output like this:
nmap 192.168.90.8 -Pn -sV
Starting Nmap 7.92 ( https://nmap.org ) at 2022-01-19 15:08 WIB
Nmap scan report for 192.168.90.8
Host is up (0.048s latency).
Not shown: 999 closed tcp ports (conn-refused)
PORT STATE SERVICE VERSION
23/tcp open telnet?
1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
SF-Port23-TCP:V=7.92%I=7%D=1/19%Time=61E7C71F%P=x86_64-pc-linux-gnu%r(NULL
SF:,9,"Login\x20as:")%r(GenericLines,41,"Login\x20as:Invalid\x20User\x20Na
SF:me\r\nLogin\x20as:Invalid\x20User\x20Name\r\nLogin\x20as:")%r(tn3270,18
SF:,"Login\x20as:\xff\xfd\x18\xff\xfd\x19\xff\xfb\x19\xff\xfd\0\xff\xfb\0"
SF:)%r(GetRequest,41,"Login\x20as:Invalid\x20User\x20Name\r\nLogin\x20as:I
SF:nvalid\x20User\x20Name\r\nLogin\x20as:")%r(HTTPOptions,41,"Login\x20as:
SF:Invalid\x20User\x20Name\r\nLogin\x20as:Invalid\x20User\x20Name\r\nLogin
SF:\x20as:")%r(RTSPRequest,41,"Login\x20as:Invalid\x20User\x20Name\r\nLogi
SF:n\x20as:Invalid\x20User\x20Name\r\nLogin\x20as:")%r(RPCCheck,9,"Login\x
SF:20as:")%r(DNSVersionBindReqTCP,9,"Login\x20as:")%r(DNSStatusRequestTCP,
SF:9,"Login\x20as:")%r(Help,25,"Login\x20as:Invalid\x20User\x20Name\r\nLog
SF:in\x20as:")%r(SSLSessionReq,9,"Login\x20as:")%r(TerminalServerCookie,9,
SF:"Login\x20as:")%r(TLSSessionReq,9,"Login\x20as:")%r(Kerberos,9,"Login\x
SF:20as:")%r(SMBProgNeg,9,"Login\x20as:")%r(X11Probe,9,"Login\x20as:")%r(F
SF:ourOhFourRequest,41,"Login\x20as:Invalid\x20User\x20Name\r\nLogin\x20as
SF::Invalid\x20User\x20Name\r\nLogin\x20as:")%r(LPDString,25,"Login\x20as:
SF:Invalid\x20User\x20Name\r\nLogin\x20as:")%r(LDAPSearchReq,41,"Login\x20
SF:as:Invalid\x20User\x20Name\r\nLogin\x20as:Invalid\x20User\x20Name\r\nLo
SF:gin\x20as:")%r(LDAPBindReq,9,"Login\x20as:")%r(SIPOptions,13D,"Login\x2
SF:0as:Invalid\x20User\x20Name\r\nLogin\x20as:Invalid\x20User\x20Name\r\nL
SF:ogin\x20as:Invalid\x20User\x20Name\r\nLogin\x20as:Invalid\x20User\x20Na
SF:me\r\nLogin\x20as:Invalid\x20User\x20Name\r\nLogin\x20as:Invalid\x20Use
SF:r\x20Name\r\nLogin\x20as:Invalid\x20User\x20Name\r\nLogin\x20as:Invalid
SF:\x20User\x20Name\r\nLogin\x20as:Invalid\x20User\x20Name\r\nLogin\x20as:
SF:Invalid\x20User\x20Name\r\nLogin\x20as:Invalid\x20User\x20Name\r\nLogin
SF:\x20as:")%r(LANDesk-RC,9,"Login\x20as:")%r(TerminalServer,9,"Login\x20a
SF:s:")%r(NCP,9,"Login\x20as:")%r(NotesRPC,9,"Login\x20as:")%r(JavaRMI,9,"
SF:Login\x20as:")%r(WMSRequest,9,"Login\x20as:")%r(oracle-tns,9,"Login\x20
SF:as:")%r(ms-sql-s,9,"Login\x20as:")%r(afp,9,"Login\x20as:")%r(giop,9,"Lo
SF:gin\x20as:");
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 120.76 seconds
then when I want to access the open port, which is port 23/telnet I can't press enter in the login field, and this is what I get:
telnet 192.168.90.8
Trying 192.168.90.8...
Connected to 192.168.90.8.
Escape character is '^]'.
Login as:admin^M
you can see above that I tried to press the enter key after filling in the admin login, but instead it came out
^M
is there something wrong with the scan?
Or is that port not accessible?
use python
Python 3.9.10 (main, Jan 15 2022, 11:40:36)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from telnetlib import Telnet
>>> Telnet('192.168.90.8',23).interact()

How to debug Oracle 11g packages/procedures in docker with SQL Developer?

I'm running an Oracle 11g image (https://hub.docker.com/r/oracleinanutshell/oracle-xe-11g) on a docker container.
I'm creating the container with the debug option as explained:
docker run --name oracle-xe-11g -idt -p 1521:1521 -p 49161:8080 -e ORACLE_ALLOW_REMOTE=true oracleinanutshell/oracle-xe-11g /bin/bash
After that I logged in the container as sudo, configured the listener.ora with the correct hostname, everything following this guide (it's in pt-Br, but the commands are easy to understand)
http://loredata.com.br/2017/08/31/rodando-o-oracle-no-docker/
I can connect with SQL Developer and with my main application running in a Wildfly server, but for support purposes I need to debug some package and stored procedures.
I compiled all my packages and procedures to allow debugging, gave the debug permissions to the user, but when I try to debug a procedure in a package using the SQL Developer default debug options I get the following error:
Conectando ao banco de dados SFW_DOCKER.
Executando PL/SQL: ALTER SESSION SET PLSQL_DEBUG=TRUE
Executando PL/SQL: CALL DBMS_DEBUG_JDWP.CONNECT_TCP( '127.0.0.1', '20587' )
ORA-30683: falha ao estabelecer conexão com o depurador
ORA-12541: TNS:não há listener
ORA-06512: em "SYS.DBMS_DEBUG_JDWP", line 68
ORA-06512: em line 1
Processo encerrado.
Desconectando do banco de dados SFW_DOCKER.
It says there's no listener, but I'm sure everything is running fine.
I also tried to run in ports 4000-4999 exposing them in the create container command and forcing SQL Developer to use them, but I get the same error.
Anyone can help me with this question?
To solve try:
Use IPv4 from your local machine
Set 'Debugging Port Range' from 4000 to 4000
Check the option 'Prompt for Debugger Host for Database Debugging'
SQL Developer -> Tools -> Preferences -> Debugger
Debugger configuration
I solved it by setting DatabaseDebuggerDisableJDWP=true in ide.properties. On linux this can be done with this:
find ~/.sqldeveloper/ -name ide.properties -type f -exec sh -c "echo 'DatabaseDebuggerDisableJDWP=true' >> {}" \;

Will my AirPrint Code connect to an IPv6-only Printer?

Below is my code to connect to an IPv4 Printer. Everything is OK.
NSString *printerURL = #"ipp://192.168.1.3:631/ipp/print" //IPv4 : OK
UIPrinter *myPrint = [UIPrinter printerWithURL:[NSURL URLWithString:printerURL]];
[myPrint contactPrinter:^(BOOL available) {
if(!available){
// Show error
}
[printInteraction printToPrinter:myPrint completionHandler:^(UIPrintInteractionController * _Nonnull printInteractionController, BOOL completed, NSError * _Nullable error) {
// Print
}];
}];
Because I do not have the IpV6 printer, I do not know what will happen with the code below:
NSString *printerURL = #"ipp://FE80::FE3F:DBFF:FE51:6BA:631/ipp/print" //IPv6 : ????
Will it connect to an IPv6 printer?
I don't have an IPv6 printer neither, nor an AirPrint-capable device.
But I have a suggestion for you, how you could test if your code works for IPv6 connections:
Use a MacBook to fake an environment which makes a iOS device in your LAN/WLAN think that they "see" and can connect to an AirPrint device.
Here are the detailed steps:
Make sure an IPv6 address is assigned to your MacBook. (How you do that is beyond the scope of this answer.)
Make sure that your MacBook's CUPS services is allowing only IPv6 connections by adding a line to cupsd.conf:
Listen [xxxx::xxxx:xxxx:xxxx:xxxx]:631
Listen /private/var/run/cupsd
# Port 631
Make sure that your cupsd.conf has also this line:
DefaultAuthType None
This makes sure you'll not need to debug Authentication or Authorization problems on top of your IPv6 and AirPrint functionality. (You can change that back later, once your current problem is solved.)
Create a shared print queue on your MacBook and name it, say, abcd. The queue does not need to connect to an AirPrint device -- any other printer will be "good enough". Also, the printer can also be IPv4-only, or USB, or Bluetooth -- as long as your MacBook can connect to it. (How you do that is beyond the scope of this answer.)
Test your printer: make sure your MacBook prints to it, and make sure that other clients are able to print to the shared queue.
Your Mac clients will now be able to "see" and use your abcd print queue -- but your iOS clients will not (yet) see an AirPrint device.
Now use the dns-sd utility to announce a fake AirPrint device to your local network, pointing to the real print queue named abcd. The general syntax for the command is this:
dns-sd -P <Name> <Type> <Domain> <Port> <Hostname> <IP> [<TXT>...]
Now to run the real command, open a Terminal.app window and type this:
dns-sd \
-P AirPrint-abcd \
_ipp._tcp,_universal \
local. \
631 \
mymacbook.local. \
xxxx::xxxx:xxxx:xxxx:xxxx \
pdl="application/pdf,image/urf" \
kind="document" \
priority="1" \
product="Model Name of my Printer" \
rp="printers/abcd" \
URF="DM3" \
Duplex="T" \
Color="T" \
note="Testing AirPrint on MacBook" \
txtvers="1" \
qtotal="1" \
printer-type="0x0480FFFC" \
printer-state="3" \
air="none" \
UUID="54321abc-1234-1234-abcd-ffa8e4bdcbf8"
Here,
xxxx::xxxx:xxxx:xxxx:xxxx is the IPv6 address of your MacBook
mymacbook is the hostname of your MacBook
Now your iOS client should be able to see and use an AirPrint device named AirPrint-abcd. The service announcement also tells them that the connection path to this AirPrinter is the IPv6 address of your MacBook and the port to use is 631.
Additional Explanation:
The -P parameter to the dns-sd utility will make a Bonjour "proxy announcement" to your local LAN/WLAN. For details about this utility see man dns-sd. For more background, see dns-sd.org and these other answers.

How to get Serial number or Mac address of Airprint printer from iOS application programatically

I implemented printing functionality in my iOS app. My iPad is connected to AirPrint Printer on same wi-fi. Is it possible to get Serial number or Mac address of printer in iOS application before giving print command?
You could use a two stage approach:
Query for the IP address of the printer, using standard Bonjour methods.
Find the MAC address of the printer using arp.
I cannot provide you the code... but the command line utility dns-sd will do to demo the first step.
Whatever info this command line can return to you, the dns-sd library API can also do. See /usr/include/dns_sd.h for more details....
The following outlines the steps to follow for the first stage.
1a.
Assuming that you want to find out the instance names for all AirPrint-capable devices in domain dns-sd.org....
You'd then use:
dns-sd -B _ipp._tcp.,_universal dns-sd.org.
Browsing for _ipp._tcp.,_universal.dns-sd.org.
DATE: ---Sat 02 Jul 2016---
14:20:07.190 ...STARTING...
Timestamp A/R Flags if Domain Service Type Instance Name
14:20:07.626 Add 2 0 dns-sd.org. _ipp._tcp. Stuart's Home AirPrint Printer
^C
(Note the ,_universal suffix [requesting the AirPrint subset] to the standard query of _ipp._tcp. which requests the list of all generic IPP-capable print devices...)
You've now found one instance with the name "Stuart's Home AirPrint Printer".
1b.
You can now query for the hostname of the network node which is hosting service instance "Stuart's Home AirPrint Printer":
dns-sd -L "Stuart's Home AirPrint Printer" _ipp._tcp. dns-sd.org.
Lookup Stuart's Home AirPrint Printer._ipp._tcp..dns-sd.org.
DATE: ---Sat 02 Jul 2016---
14:37:44.436 ...STARTING...
14:37:44.813 Stuart's\032Home\032AirPrint\032Printer._ipp._tcp.dns-sd.org. can be reached at airprint.dns-sd.org.:631 (interface 0)
txtvers=1 \
qtotal=1 \
pdl=application/postscript,application/vnd.hp-PCL,application/vnd.hp-PCLXL,application/pdf,image/urf \
rp=ipp/printer \
URF=CP99,W8,OB10,PQ3-4-5,ADOBERGB24,DEVRGB24,DEVW8,SRGB24,IS1-2-4,MT1-2-3-5-12,MT1-2-3-5-12,RS600 \
ty=HP\ LaserJet\ 400\ color\ M451nw \
product=\(HP\ LaserJet\ 400\ color\ M451nw\) \
priority=10 \
adminurl=http://www.dns-sd.org/ServerStaticSetup.html \
note=At\ Stuart\'s\ house \
Color=T \
Duplex=F \
Scan=F
^C
Note the line "...can be reached at airprint.dns-sd.org.:631". This gives you the hostname you are looking for.
1c.
You can now ask for the IP addresses (IPv4 as well as IPv6) where this AirPrint instance is hosted:
dns-sd -Gv4v6 airprint.dns-sd.org.
DATE: ---Sat 02 Jul 2016---
14:19:12.040 ...STARTING...
Timestamp A/R Flags if Hostname Address TTL
14:19:12.426 Add 2 0 airprint.dns-sd.org. 50.197.138.101 75
14:19:12.544 Add 2 0 airprint.dns-sd.org. 0000:0000:0000:0000:0000:0000:0000:0000% 77 No Such Record
^C
So this AirPrinter does have an IPv4 (50.197.138.101) but no IPv6 address.
2.
To find the respective MAC address, just use ARP.

Plot RTT histogram using wireshark or other tool

I have a little office network and I'm experiencing a huge internet link latency. We have a simple network topology: a computer configured as router running ubuntu server 10.10, 2 network cards (one to internet link, other to office network) and a switch connecting 20 computers. I have a huge tcpdump log collected at the router and I would like to plot a histogram with the RTT time of all TCP streams to try to find out the best solution to this latency problem. So, could somebody tell me how to do it using wireshark or other tool?
Wireshark or tshark can give you the TCP RTT for each received ACK packet using tcp.analysis.ack_rtt which measures the time delta between capturing a TCP packet and the ACK for that packet.
You need to be careful with this as most of your ACK packets will be from your office machines ACKing packets received from the internet, so you will be measuring the RTT between your router seeing the packet from the internet and seeing the ACK from your office machine.
To measure your internet RTT you need to look for ACKS from the internet (ACKing data sent from your network). Assuming your office machines have IP addresses like 192.168.1.x and you have logged all the data on the LAN port of your router you could use a display filter like so:
tcp.analysis.ack_rtt and ip.dst==192.168.1.255/24
To dump the RTTs into a .csv for analysis you could use a tshark command like so;
tshark -r router.pcap -Y "tcp.analysis.ack_rtt and ip.dst==192.168.1.255/24" -e tcp.analysis.ack_rtt -T fields -E separator=, -E quote=d > rtt.csv
The -r option tells tshark to read from your .pcap file
The -Y option specifies the display filter to use (-R without -2 is deprecated)
The -e option specifies the field to output
The -T options specify the output formatting
You can use the mergecap utility to merge all your pcap files into one one file before running this command. Turning this output into a histogram should be easy!
Here's the 5-min perlscript inspired by rupello's answer:
#!/usr/bin/perl
# For a live histogram of rtt latencies, save this file as /tmp/hist.pl and chmod +x /tmp/hist.pl, then run:
# tshark -i wlp2s0 -Y "tcp.analysis.ack_rtt and ip.dst==192.168.0.0/16" -e tcp.analysis.ack_rtt -T fields -E separator=, -E quote=d | /tmp/hist.pl
# Don't forget to update the interface "wlp2s0" and "and ip.dst==..." bits as appropriate, type "ip addr" to get those.
#t[$m=0]=20;
#t[++$m]=10;
#t[++$m]=5;
#t[++$m]=2;
#t[++$m]=1;
#t[++$m]=0.9;
#t[++$m]=0.8;
#t[++$m]=0.7;
#t[++$m]=0.6;
#t[++$m]=0.5;
#t[++$m]=0.4;
#t[++$m]=0.3;
#t[++$m]=0.2;
#t[++$m]=0.1;
#t[++$m]=0.05;
#t[++$m]=0.04;
#t[++$m]=0.03;
#t[++$m]=0.02;
#t[++$m]=0.01;
#t[++$m]=0.005;
#t[++$m]=0.001;
#t[++$m]=0;
#h[0]=0;
while (<>) {
s/\"//g; $n=$_; chomp($n); $o++;
for ($i=$m;$i>=0;$i--) { if ($n<=$t[$i]) { $h[$i]++; $i=-1; }; };
if ($i==-1) { $h[0]++; };
print "\033c";
for (0..$m) { printf "%6s %6s %8s\n",$t[$_],sprintf("%3.2f",$h[$_]/$o*100),$h[$_]; };
}
The newer versions of tshark seem to work better with a "stdbuf -i0 -o0 -e0 " in front of the "tshark".
PS Does anyone know if wireshark has DNS and ICMP rtt stats built in or how to easily get those?
2018 Update: See https://github.com/dagelf/pping

Resources