Forums before death by AOL, social media and spammers... "We can't have nice things"
|    sci.physics    |    Physical laws, properties, etc.    |    178,769 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 178,549 of 178,769    |
|    The Starmaker to starmaker@ix.netcom.com    |
|    Re: Everything You Wanted To Know About     |
|    22 Dec 25 23:05:07    |
   
   XPost: sci.physics.relativity   
   From: starmaker@ix.netcom.com   
      
   I'm curently working on a UDP, implementeing proper article   
   cancellation logic, by teaching Ai to learn How To   
   perform actual cancellations by bypassings NNTP server permissions.   
   GODMODE! You will only be able to post on Usenet if... 'I ALLOW it'.   
      
      
   import nntplib   
   import tkinter as tk   
   from nntplib import NNTP   
   from time import strftime, time, localtime   
      
   class CancelArticlesApp(tk.Tk):   
    def __init__(self, *args, **kwargs):   
    super().__init__(*args, **kwargs)   
      
    # Initialize the message_id variable   
    self.message_id = ""   
      
    # Create the UI elements   
    self.server_label = tk.Label(self, text='NNTP Server:')   
    self.server_entry = tk.Entry(self)   
    self.username_label = tk.Label(self, text='Username:')   
    self.username_entry = tk.Entry(self)   
    self.password_label = tk.Label(self, text='Password:')   
    self.password_entry = tk.Entry(self, show='*')   
    self.newsgroup_label = tk.Label(self, text='Newsgroup:')   
    self.newsgroup_entry = tk.Entry(self)   
    self.message_id_label = tk.Label(self, text='Message ID:')   
    self.message_id_entry = tk.Entry(self) # Changed from   
   self.message_id to self.message_id_entry   
    self.cancel_button = tk.Button(self, text='Cancel Articles',   
   command=self.cancel_articles)   
      
    # Place the UI elements on the window   
    self.server_label.grid(row=0, column=0, sticky='W')   
    self.server_entry.grid(row=0, column=1, sticky='W')   
    self.username_label.grid(row=1, column=0, sticky='W')   
    self.username_entry.grid(row=1, column=1, sticky='W')   
    self.password_label.grid(row=2, column=0, sticky='W')   
    self.password_entry.grid(row=2, column=1, sticky='W')   
    self.newsgroup_label.grid(row=3, column=0, sticky='W')   
    self.newsgroup_entry.grid(row=3, column=1, sticky='W')   
    self.message_id_label.grid(row=4, column=0, sticky='W')   
    self.message_id_entry.grid(row=4, column=1, sticky='W')   
    self.cancel_button.grid(row=5, column=0, columnspan=2, pady=5)   
      
    def cancel_articles(self):   
    try:   
    # Connect to the NNTP server   
    server = NNTP(self.server_entry.get())   
      
    # Authenticate if username and password are provided   
    username = self.username_entry.get()   
    password = self.password_entry.get()   
    if username and password:   
    server.login(username, password)   
      
    # Select the newsgroup   
    resp, count, first, last, name =   
   server.group(self.newsgroup_entry.get())   
      
    # Get the message ID from entry   
    message_id = self.message_id_entry.get()   
      
    if message_id:   
    # If specific message ID is provided, cancel that   
   article   
    try:   
    # Get article info   
    resp, info = server.stat(message_id)   
    # Post cancellation message (Note: actual   
   cancellation requires proper authorization)   
    server.post(f"cancel   
   {message_id}".encode('utf-8'))   
    print(f"Attempted to cancel article:   
   {message_id}")   
    except nntplib.NNTPTemporaryError as e:   
    print(f"Error cancelling article: {e}")   
    else:   
    # If no specific message ID, loop through articles   
    for article_id in range(max(first, last-10), last +   
   1): # Limiting to last 10 articles for safety   
    try:   
    resp, info = server.stat(article_id)   
    message_id = info.message_id   
    server.post(f"cancel   
   {message_id}".encode('utf-8'))   
    print(f"Attempted to cancel article:   
   {message_id}")   
    except nntplib.NNTPTemporaryError as e:   
    print(f"Error cancelling article {article_id}:   
   {e}")   
      
    # Close the connection   
    server.quit()   
      
    except nntplib.NNTPError as e:   
    print(f"NNTP Error: {e}")   
    except Exception as e:   
    print(f"Error: {e}")   
      
   if __name__ == '__main__':   
    # Initial NNTP test code   
    day = 24 * 60 * 60   
    window = 7   
    yesterday = localtime(time() - window * day)   
    date = strftime('%y%m%d', yesterday)   
    time_str = strftime('%H%M%S', yesterday)   
      
    # Test connection   
    servername = 'nntp.aioe.org'   
    groupname = 'alt.test'   
      
    try:   
    s = NNTP(servername)   
    resp, count, first, last, name = s.group(groupname)   
      
    resp, overviews = s.over((last-1, last))   
    for num, over in overviews:   
    sj = over.get('subject')   
    dt = over.get('date')   
    print(f"Date: {dt}")   
    print(f"Subject: {sj}")   
    print('-' * (len(sj) if sj else 0))   
      
    s.quit()   
    except nntplib.NNTPError as e:   
    print(f"Test connection error: {e}")   
      
    # Start the GUI   
    app = CancelArticlesApp()   
    app.mainloop()   
      
      
      
   On Sun, 21 Dec 2025 11:11:36 -0800, The Starmaker   
   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca