🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #56475

Re: [yenc] - the story goes on

#56475
From: J.B. Moreno
Date: Wed, 13 Feb 2002 01:02
55 lines
2663 bytes
In article <471417c6.0202120735.7a508e73@posting.google.com>,
  Mike Harrison <harrisonm7@home.com> wrote:

> Are there any Perl modules for yEnc yet? If so, where would I find one?

Not that I know of, but here's a quick and dirty decoder for single
parts (no error checking, not the best way for large files)...


$article=$ARGV[0];
open (IN, "<$article") || die "cannot open file: $!\n";

undef $/;
$thebody= <IN>;  # slurp it all in
close IN;   # don't need the file any more


$qpbound='=ybegin ';

$thebody =~ s/(.*)($qpbound.+?\n)(.+)\n=yend.+/$3/is;
$qpbound=$2;
print $qpbound;

$filename=$1 if ($qpbound=~ m/name=(.+)$/m);
print "$filename\n";

open (OTHER2, ">$filename") || die;

binmode OTHER2;

@thebody = split /\n/, $thebody;

foreach $theline (@thebody){
@theline = reverse split //, $theline;  # split line into array of
characters

while (@theline) {
$thechar = ord (pop @theline); # coerce to integer value

# if this char is equal sign, get the next character and subtract 64 
$thechar= (ord (pop @theline))-64 if (chr $thechar eq '=');

# do some fancy math because perl doesn't have unsigned bytes
# $thechar = (($thechar-42) % 256);

# another way of doing the fancy math
$thechar = (int +($thechar-42) & 255);

print OTHER2 chr($thechar);  # write to disk.
}

}

close OTHER2;
Technical Details
Message-ID: <120220022002034111%planb@newsreaders.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!jfk3-feed1.news.digex.net!dca6-feed2.news.digex.net!intermedia!newsfeed1.cidera.com!Cidera!feed1.newsreader.com!news2.newsreader.com!flame.newsreader.com!planb
References: <3041a.a12202@archiver.winews.net> <umov3u8ho1bsd6g1n64t57qvdmj8egbcir@news-01.easynews.com> <35129.e12203@archiver.winews.net> <01b54uch34hbp8ld34nc6fl1ue2k4mkvsp@news-01.easynews.com> <1939a.f12201@archiver.winews.net> <v0qa4uc7fih18ss3jk1865h9pmmr3n6scl@news.easynews.com> <20289.l12200@archiver.winews.net> <471417c6.0202120735.7a508e73@posting.google.com>

Show Full Headers
Complete Article Headers
Message-ID: <120220022002034111%planb@newsreaders.com>
Subject: Re: [yenc] - the story goes on
Date: Tue, 12 Feb 2002 20:02:03 -0500
From: "J.B. Moreno" <planb@newsreaders.com>
References: <3041a.a12202@archiver.winews.net> <umov3u8ho1bsd6g1n64t57qvdmj8egbcir@news-01.easynews.com> <35129.e12203@archiver.winews.net> <01b54uch34hbp8ld34nc6fl1ue2k4mkvsp@news-01.easynews.com> <1939a.f12201@archiver.winews.net> <v0qa4uc7fih18ss3jk1865h9pmmr3n6scl@news.easynews.com> <20289.l12200@archiver.winews.net> <471417c6.0202120735.7a508e73@posting.google.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!jfk3-feed1.news.digex.net!dca6-feed2.news.digex.net!intermedia!newsfeed1.cidera.com!Cidera!feed1.newsreader.com!news2.newsreader.com!flame.newsreader.com!planb
Newsgroups: news.software.nntp
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-transfer-encoding: 8bit
User-Agent: Thoth/1.5.0 (Carbon/OS X)
X-Trace: flame.newsreader.com /9Bib/d2.+Y/Q9+9+LR@pf,Blu-wPi+wx5M5-RSg_maLNsJ3Rx
Lines: 54