flakes / mirc_fish_10

"FiSH 10" - a blowfish encryption script for mIRC 7, compatible to previous FiSH scripts and other clients! Come visit us in #fish10 on EFNet!
https://syndicode.org/fish_10/
86 stars 16 forks source link

PRIVMSG / CPRIVMSG ?! #65

Closed fred0r closed 3 years ago

fred0r commented 4 years ago

https://www.mirc.com/versions.txt

29/11/2018 - mIRC v7.53

21.Added support for CPRIVMSG and CNOTICE. If listed in numeric 005,
   PRIVMSG and NOTICE will be automatically upgraded for most
   outgoing messages if you are an op/voice on a channel and message
   a user on the same channel.

The KeyExchange works fine on both Sides (ECB+CBC) and the mirc_fish10 is able to read encrypted Chat, but it sends uncrypted Text.

When running ZNC with raw-Module enabled, it looks like this on the mirc_fish10-side:

<*raw> IRC -> [:fred!fred@host PRIVMSG JOHN_DOE :+OK *JeqX+JEKjlUFweuYkx7ojA==]
<*raw> YOU -> [CPRIVMSG fred #chan :man müßte mal gucken was PRIVMSG vs CPRIVMSG is]

JOHN_DOE and me had a lot channels in common and it seems to only happen on voiced/oped users, since i was op and he had voice on #chan After removing JOHN_DOEs voice on #chan, query was instantly encrypted on both sides.

fred0r commented 4 years ago

All the upper is tested on EFnet. Some ppl report, that this doesnt happen on Linknet or on a private Unrealircd-Server.

silv3rr commented 4 years ago

Quick & dirty workaround:

Add to top of fish_10.mrc (before on *:START)

on *:PARSELINE:out:CPRIVMSG *:{
  if ($len($dll(%FiSH_dll,FiSH_GetKey10,$network $gettok($parseline,2,32))) > 1) {
    noop $regsubex(pl,$parseline, /^CPRIVMSG ([^ ]+) #[^ ]+ (:.+)/,PRIVMSG \1 \2, &pl)
    if ($bvar(&pl,0) > 11) {
      .parseline -ob &pl
    }
    unset &pl
  }
}

added check so it applies only to nicks with key

This will just always replace CPRIVMSG by PRIVMSG before the command gets send to server.

LinkNet, Unreal and ngIRCd &c do not support CPRIVMSG so it's not an issue there. Sending VERSION command to sever can be used to check for support.

silv3rr commented 4 years ago

Oh and ofcourse the permanent solution would be adding CPRIVMSG to _OnOutgoingIRCLine function in fish-main.cpp

https://github.com/flakes/mirc_fish_10/blob/8b61aaf4dbea5ae5825f1e56dc03cca6bebbd716/fish_10/src/fish-main.cpp#L433 and lines below

fred0r commented 4 years ago

@silv3rr Nice - can you please create a Pull Request for the Perm-Fix?

ghost commented 3 years ago

@fred0r @silv3rr Hello, is there a way to verify that it only works fine with mIRC after the patch is applied?

Thx! 👍

flakes commented 3 years ago

Looks like I fixed this, but forgot to make a release? LOL

flakes commented 3 years ago

New version released today, including a fix for this issue, please test, and open a new issue if required 😝