Nп/п : 77 из 100
 От   : Dmitry Protasoff                    2:5001/100.1      05 мар 24 14:32:42
 К    : Egor Glukhov                                          05 мар 24 17:35:01
 Тема : Пишем парсилку ФТH адресов с помощью ChatGPT
----------------------------------------------------------------------------------
                                                                                 
@MSGID: 2:5001/100.1 65e72d6c
@REPLY: 2:5020/736 65e6e5f3
@CHRS: CP866 2
@TZUTC: 0000
@TID: hpt/lnx 1.9 2023-02-09
Hello, Egor!

Tuesday March 05 2024 12:22, you wrote to Nil A:

 EG> Просил её накодить мейлер binkp`шный - ожидаемо получил "RTFM и кодь
 EG> сам". А говорили, погромисты теперь не нужны будут. ;)

Я не понимаю, кого или чего вы с Hиком спрашиваете?!
 Я вот попросил написать binkp mailer и она мне его написала (я
сказал - на любом языке, был выбран питон):

 Creating a Binkp mailer for the Fidonet network involves
understanding both the Binkp protocol and the structure of Fidonet messages. The
Binkp protocol is a TCP/IP-based protocol designed for transferring FidoNet
mail between systems. It`s a relatively straightforward protocol, and
implementing a basic mailer can be done in various programming languages. For
this example, I`ll use Python due to its readability and the availability
of libraries for network programming.

A simple Binkp mailer will need to handle a few key tasks:

    Establish a TCP connection to a remote Binkp server.
    Authenticate with the server (if necessary).
    Transfer message packets.
    Handle acknowledgments and retries for reliable delivery.
    Close the connection properly.

 Below is a simplified implementation that covers these steps. Note
that this example focuses on establishing a connection and sending a
predefined message packet. It doesn`t cover more advanced features like
encryption, compression, or full session management.

-+-
import socket
import sys

def send_packet(sock, packet):
    """Send a packet over the socket."""
    try:
        sock.sendall(packet)
    except socket.error as e:
        print(f"Socket error: {e}")
        sys.exit(1)

def receive_ack(sock):
    """Wait for an acknowledgment."""
    return sock.recv(1024)

def main(server_ip, server_port, packet_path):
    """Main function to send a Fidonet packet using Binkp."""
    try:
        # Establish a TCP connection
        with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
            sock.connect((server_ip, server_port))

            # Authenticate with the server (simple version, adjust as needed)
            # This step varies greatly depending on server configuration
            send_packet(sock, b"CRAM-MD5")
            if b"OK" not in receive_ack(sock):
                print("Authentication failed.")
                return

            # Send the Fidonet packet
            with open(packet_path, "rb") as f:
                packet = f.read()
                send_packet(sock, packet)

            # Wait for acknowledgment
            if b"ACK" in receive_ack(sock):
                print("Packet sent successfully.")
            else:
                print("Failed to receive acknowledgment.")

    except socket.error as e:
        print(f"Failed to connect or send data: {e}")

if __name__ == "__main__":
    if len(sys.argv) != 4:
        print("Usage: python binkp_mailer.py SERVER_IP SERVER_PORT PACKET_PATH")
        sys.exit(1)

  _server_ip, _server_port, _packet_path = sys.argv[1], int(sys.argv[2]),
sys.argv[3]
    main(_server_ip, _server_port, _packet_path)
-+-

 To use this script, you`ll need to replace SERVER_IP, SERVER_PORT,
and PACKET_PATH with the IP address and port of the Binkp server you`re
connecting to, and the path to the Fidonet packet you wish to send,
respectively.

 This example is highly simplified and designed to illustrate the
basic process. A fully-featured Binkp mailer would need to handle multiple
sessions, encryption, packet assembly, and disassembly, as well as more complex
session management and error handling. For a production environment, it`s
crucial to refer to the Binkp specification and implement all the required
features and security measures.


Best regards,
             dp.

--- GoldED+/LNX 1.1.5-b20230304
 * Origin: All is good in St. John`s Wood (2:5001/100.1)
SEEN-BY: 50/109 104/117 221/6 240/1120 250/25 301/1
341/66 451/31 452/28 166
SEEN-BY: 455/19 463/68 467/888 4500/1 5000/111
5001/3 100 5005/49 5015/42 46
SEEN-BY: 5019/40 400 5020/113 545 620 715 814 828
830 846 848 1042 2992 4441
SEEN-BY: 5020/5480 12000 5022/128 5030/49 115 1081
1474 5036/26 5053/51
SEEN-BY: 5054/8 89 5058/104 5060/900 5061/133
5066/18 5068/45 5083/1 444
SEEN-BY: 6090/1
@PATH: 5001/100 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх