Advertisement
vic_npc

squid proxy port discovery

Jun 10th, 2023 (edited)
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.40 KB | Cybersecurity | 0 0
  1. #!/usr/bin/python3
  2.  
  3. import sys, signal, requests
  4.  
  5. def def_handler(sig, frame):
  6.     print("\n\n[!] Saliendo..\n")
  7.     sys.exit(1)
  8.  
  9. # Ctrl+C
  10. signal.signal(signal.SIGINT, def_handler)
  11.  
  12. #127.0.0.1 seria lo mismo que utilizar la ip 192.168.139.131 ya que la solicitud seria mediante el squid proxie que para el seria lo mismo que hacer la solicitud a si mismo)
  13. main_url = "http://127.0.0.1"
  14.  
  15. squid_proxy = {'http': 'http://192.168.139.131:3128'}
  16.  
  17. def portDiscovery():
  18.  
  19.     # Conjunto de puertos TCP comunes a escanear
  20.     common_tcp_ports = {
  21.         20,    # FTP - File Transfer Protocol (Data)
  22.         21,    # FTP - File Transfer Protocol (Control)
  23.         22,    # SSH - Secure Shell
  24.         23,    # Telnet
  25.         25,    # SMTP - Simple Mail Transfer Protocol
  26.         53,    # DNS - Domain Name System
  27.         80,    # HTTP - Hypertext Transfer Protocol
  28.         110,   # POP3 - Post Office Protocol version 3
  29.         115,   # SFTP - Simple File Transfer Protocol
  30.         119,   # NNTP - Network News Transfer Protocol
  31.         123,   # NTP - Network Time Protocol
  32.         143,   # IMAP - Internet Message Access Protocol
  33.         161,   # SNMP - Simple Network Management Protocol
  34.         194,   # IRC - Internet Relay Chat
  35.         443,   # HTTPS - Hypertext Transfer Protocol Secure
  36.         993,   # IMAPS - Internet Message Access Protocol over SSL/TLS
  37.         995,   # POP3S - Post Office Protocol version 3 over SSL/TLS
  38.         1080,  # Socks - Proxy
  39.         1433,  # MSSQL - Microsoft SQL Server
  40.         1521,  # Oracle database default listener
  41.         1723,  # PPTP - Point-to-Point Tunneling Protocol
  42.         3306,  # MySQL database system
  43.         3389,  # RDP - Remote Desktop Protocol
  44.         5432,  # PostgreSQL database system
  45.         5900,  # VNC - Virtual Network Computing
  46.         8080,  # HTTP Proxy
  47.         8443,  # HTTPS-alt - Alternative HTTP Secure
  48.         9100,  # Printer
  49.         27017, # MongoDB database system
  50.         27018, # MongoDB database system
  51.         27019, # MongoDB database system
  52.         28017, # MongoDB database system (Web Interface)
  53.         50000, # SAP - Systems, Applications, and Products in Data Processing
  54.         50070, # Hadoop HDFS NameNode default port
  55.         50075, # Hadoop HDFS DataNode default port
  56.         54321, # Pentaho Report Designer
  57.         5500,  # VNC remote desktop protocol (RFB)
  58.         5501,  # Hotline tracker server connection
  59.         5672,  # RabbitMQ messaging system
  60.         6379,  # Redis key-value store
  61.         7001,  # WebLogic Server (SSL)
  62.         8086,  # InfluxDB database
  63.         8089,  # Splunk
  64.         8888,  # Jupyter Notebook
  65.         9000,  # Elasticsearch
  66.         9042,  # Cassandra database
  67.         9160,  # Cassandra database
  68.         9200,  # Elasticsearch RESTful API
  69.         9300,  # Elasticsearch transport
  70.         10000, # Webmin - web-based system administration tool
  71.         11211, # Memcached
  72.         27015, # Valve Steam servers
  73.     }
  74.  
  75.     for tcp_port in common_tcp_ports:
  76.        
  77.         # Realizar una solicitud GET a cada puerto en el servidor especificado
  78.         r = requests.get(main_url + ':' + str(tcp_port), proxies=squid_proxy)
  79.  
  80.         if r.status_code != 503:
  81.             # Si el código de estado de la respuesta no es 503 (Servicio no disponible), el puerto se considera abierto
  82.             print("\n[+] Port " + str(tcp_port) + " - OPEN")
  83.  
  84. if _name_ == "_main_":
  85.    
  86.     portDiscovery()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement