Import Amiga applications and desktop tools

This commit is contained in:
Alberto committed 2026-11-11 16:21:50 +01:00
commit 1c144c9a3c
347 files changed
+423483

No files matched your search

+100
View File
@@ -0,0 +1,100 @@
using System;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Net.Sockets;
using System.Security.Authentication;
using System.Threading;
using System.Threading.Tasks;
internal static class IrcTlsBridge
{
const int LocalPort = 16697;
const string RemoteHost = "irc.tilaro.net";
const int RemotePort = 6697;
static readonly object LogLock = new object();
static readonly string LogPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bridge.log");
static readonly SemaphoreSlim Slots = new SemaphoreSlim(4);
static int ConnectionId;
static void Log(string message)
{
lock (LogLock)
{
try
{
if (File.Exists(LogPath) && new FileInfo(LogPath).Length > 262144)
File.Move(LogPath, LogPath + "." + DateTime.UtcNow.ToString("yyyyMMddHHmmss") + ".old");
File.AppendAllText(LogPath, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss zzz") + " " + message + Environment.NewLine);
}
catch { }
}
}
static void Main()
{
bool created;
using (var mutex = new Mutex(true, "Local\\TilaroIrcTlsBridge16697", out created))
{
if (!created) return;
try { Run().GetAwaiter().GetResult(); }
catch (Exception ex) { Log("STOP " + ex.Message); }
}
}
static async Task Run()
{
var listener = new TcpListener(IPAddress.Loopback, LocalPort);
listener.Start(8);
Log("START 127.0.0.1:" + LocalPort + " -> " + RemoteHost + ":" + RemotePort + " TLS; certificate validation enabled");
try
{
while (true)
{
var client = await listener.AcceptTcpClientAsync();
if (!Slots.Wait(0)) { client.Close(); continue; }
Handle(client);
}
}
finally { listener.Stop(); }
}
static async void Handle(TcpClient client)
{
int id = Interlocked.Increment(ref ConnectionId);
try
{
using (client)
using (var remote = new TcpClient())
{
client.NoDelay = true;
remote.NoDelay = true;
var connect = remote.ConnectAsync(RemoteHost, RemotePort);
if (await Task.WhenAny(connect, Task.Delay(15000)) != connect)
throw new TimeoutException("Remote TCP connection timed out");
await connect;
using (var tls = new SslStream(remote.GetStream(), false))
{
// The default validation checks both trust and the target hostname.
var authenticate = tls.AuthenticateAsClientAsync(RemoteHost, null, SslProtocols.Tls12, true);
if (await Task.WhenAny(authenticate, Task.Delay(20000)) != authenticate)
throw new TimeoutException("TLS handshake timed out");
await authenticate;
Log("CONNECTED #" + id + " TLS=" + tls.SslProtocol + " certificate=" + tls.RemoteCertificate.Subject);
var local = client.GetStream();
var upstream = local.CopyToAsync(tls);
var downstream = tls.CopyToAsync(local);
var finished = await Task.WhenAny(upstream, downstream);
client.Close();
remote.Close();
try { await finished; } catch (IOException) { }
try { await upstream; } catch { }
try { await downstream; } catch { }
}
}
Log("CLOSED #" + id);
}
catch (Exception ex) { Log("ERROR #" + id + " " + ex.GetBaseException().Message); }
finally { client.Dispose(); Slots.Release(); }
}
}
+9
View File
@@ -0,0 +1,9 @@
Ponte IRC per WookieChat
WookieChat: server 127.0.0.1, porta 16697, nel gruppo Alberto.
Destinazione: irc.tilaro.net:6697, TLS 1.2 con verifica del certificato e del nome.
Accetta connessioni solo dal PC locale. Nessuna porta LAN viene aperta.
Avvio automatico: registro utente HKCU\Software\Microsoft\Windows\CurrentVersion\Run, valore TilaroIrcTlsBridge.
Log tecnico: bridge.log, senza contenuti delle chat o password.
Per disattivarlo: rimuovere il valore di avvio automatico e terminare IrcTlsBridge.exe.
Aggiornamento 2026-11-01: avvio tramite attivita pianificata 'Amiga IRC TLS Bridge', al login dell'utente RADIO\tilar con ritardo di 10 secondi. Nessun limite di durata. Riavvio su errore (3 tentativi). Il precedente valore Run resta come avvio di riserva; il mutex impedisce istanze duplicate.