animetosho / Nyuu

Flexible usenet binary posting tool
215 stars 30 forks source link

Error: Article length mismatch encountered #121

Open Sonic3R opened 9 months ago

Sonic3R commented 9 months ago

Hi,

I changed the article.js for better obfuscation as following:

filename = require('crypto').randomBytes(Math.floor(Math.random() * 11) + 25).toString('hex');
var yiPre = ' total='+this.parts+' line='+this.line_size+' size='+size+' name=', yiSuf = '\r\n=ypart begin=';
this.yInfo = (Buffer.allocUnsafe || Buffer)(Buffer.byteLength(yiPre + yiSuf, this.encoding) + MAX_NAME_LENGTH);
var p = this.yInfo.write(yiPre, 0, this.yInfo.length, this.encoding);
p += this.yInfo.write(filename, p, MAX_NAME_LENGTH, this.encoding);
p += this.yInfo.write(yiSuf, p, this.yInfo.length-p, this.encoding);
this.yInfo = bufferSlice.call(this.yInfo, 0, p);
this.maxPostSize = y.maxSize(articleSize, this.line_size)
        + 75 /* size of fixed strings (incl final CRC) assuming ASCII or similar encoding */
        + this.yInfo.length
        + ((this.parts+'').length *2)
        + ((size+'').length *3);

and

bufPos += this.buf.write(' total='+this.parent.parts+' line='+this.parent.line_size+' size='+this.parent.size+' name='+filename+'\r\n=ypart begin=', bufPos, this.parent.encoding);
this.bufs.push(
        toBuffer('=ybegin part='+this.part, this.parent.encoding),
        this.parent.yInfo,
        toBuffer(' total='+this.parent.parts+' line='+this.parent.line_size+' size='+this.parent.size+' name='+filename+'\r\n=ypart begin=', this.parent.encoding),
        toBuffer(( this.pos+1 )+' end='+(this.pos + data.length)+'\r\n', this.parent.encoding),
        y.encode(data, this.parent.line_size),
        toBuffer('\r\n=yend size='+data.length+' part='+this.part+this.crcFrag+'\r\n.\r\n', this.parent.encoding)

I randomly get error Error: Article length mismatch encountered and I can't figure out why. Can take a look maybe you have better insight than me.

animetosho commented 9 months ago

I can't exactly tell from the info supplied, but generally the size of articles are not allowed to change once they have been generated.
I'm guessing your attempt to randomise the filename length is causing the article size to vary, triggering the error.

Last0n commented 9 months ago

I am facing similar errors when using Nyuu-obfuscated fork.

is there a better way to implement this? I tried using --yenc-name parameter present in nyuu's original repo with rand(n) but it keeps the same yenc name for all articles from a particular file.

The reason behind going such lengths is that easynews search can deobfuscate if all the articles related to a file have same yenc name

animetosho commented 9 months ago

You should probably report the issue in that fork.

Modifications which alter an article's length (without appropriate changes) will not work correctly in Nyuu.
If the cause is the same as above, ensuring that the length of the filename is constant, may solve the issue.

Last0n commented 9 months ago

Thanks for the tip!

Would it be possible to have something like that implemented in main nyuu repo?

Sonic3R commented 9 months ago

Here is diff https://diffy.org/diff/6563ea7790c28 between original nyuu repo and my repo

animetosho commented 9 months ago

Would it be possible to have something like that implemented in main nyuu repo?

If you're asking for something to allow the filename to vary between across articles, then highly unlikely.
It's not intentional behaviour, violates yEnc spec, and I have little interest in supporting every crazy idea someone comes up with.

Last0n commented 9 months ago

Would it be possible to have something like that implemented in main nyuu repo?

If you're asking for something to allow the filename to vary between across articles, then highly unlikely. It's not intentional behaviour, violates yEnc spec, and I have little interest in supporting every crazy idea someone comes up with.

Oh, That's alright. Thanks for the help, keeping the length of the filenames same has solved this issue.

Cheers

Sonic3R commented 9 months ago

@Last0n can give me a point how to do that ?