Article View: news.software.readers
Article #77040Re: Binary detection (was: How do I sto this prompt box? - 1 attachment)
From: Robert Amesz
Date: Thu, 19 Apr 2001 23:26
Date: Thu, 19 Apr 2001 23:26
80 lines
5089 bytes
5089 bytes
J.B. Moreno wrote:
>Robert Amesz <rcameszREMOVETHIS@dds.removethistoo.nl> wrote:
>
>> [Snip]
>>
>> It's a pity NNTP doesn't send the size of the post as well as the
>> line count, otherwise it would be quite easy to distinguish
>> between non- binaries and binaries, because of the high average
>> line length of the latter.
>
>Actually, most newsreaders use XOVER for filtering, XOVER includes
>the total number of bytes used in an article.
Silly me, I looked it up (which I should have done in the first
place) and you're quite right. To atone for my laziness I've taken it
upon myself to do some testing (see below).
>I don't know of any newsreader off hand that allows you to check on
>the average (probably Gnus), but it wouldn't be hard for them to do
>so.
>
>Of course, that isn't sufficient: a very common encoding method will
>result in an average of approximate 40 chars per line, well within
>what you'd expect to find in an average article.
What encoding method is that? Of course, there's no fixed line length
for either base64 or UUENCODE, so it would not be terribly hard to
fool such a heuristic if that's your intention, but every little bit
helps.
But the proof of any pudding is in the eating, so I've compiled the
statistics of a number of long and long-ish posts. I couldn't find
that many binaries, so I took some from a mailing list I'm subscribed
to. For reference, I've included in this list a mail I sent recently,
which contained a one-line message and a UUENCODEd file. ("Afdaling
in de ingewanden.txb"). In the list you can tell the type of message
by the file suffix: .txt = text, .txb = encoded binary, and .txh =
html.
With all that in mind, you can see that the categories seperate
pretty neatly. *None* of the binaries has an average linelength of
below 57.62, and *none* of the plaintext posts exceeds 54.66. Of
course, it's only a small sample, but average linelength seems to be
a reasonable measure to determine if we're dealing with a binary, at
least for longish posts.
So if any Hamster-developers are reading this...
Robert Amesz
- - -
Ave.LL| Lines| Size | Name
-----------------------------------------------------------------------
39.50 = 226 / 8928 2de [komende zondagavond].txh
40.28 = 108 / 4350 Re- RFC 1036 Replacement IETF Draft Available_2.txt
40.28 = 108 / 4350 Re- RFC 1036 Replacement IETF Draft Available_4.txt
42.33 = 163 / 6899 Re- RFC 1036 Replacement IETF Draft Available_1.txt
43.16 = 61 / 2633 Re- RFD- Tekst voor -Gedragscode voor de nl-[...].-.txt
43.62 = 60 / 2617 Announce- Ozum - All-in-One newsreader by Oz Insight.txt
44.18 = 146 / 6450 Re- Stelling 1_1.txt
44.26 = 98 / 4337 PyChecker 0.3 release.txt
44.53 = 131 / 5833 Re- RFC 1036 Replacement IETF Draft Available_0.txt
46.01 = 115 / 5291 Re- I come to praise .join, not to bury it....txt
48.18 = 101 / 4866 Re- Stelling 1_2.txt
49.28 = 155 / 7638 Re- Stelling 1_3.txt
50.53 = 64 / 3234 Re- RFC 1036 Replacement IETF Draft Available.txt
52.32 = 279 / 14596 Vraag 31.txt
53.19 = 135 / 7181 Re- Stelling 1.txt
54.66 = 82 / 4482 Re- [Xnews] Crash bug.txt
-- this is the text/binary divide for this sample --
57.62 = 270 / 15558 Re_ [wxPython] Is there anyone working on a [...] _.txb
60.87 = 266 / 16192 How do I sto this prompt box- - 1 attachment.txb
62.65 = 3666 / 229688 Anja, 20 jaar uit Rotterdam, (was) Ex van Ronald.txb
62.76 = 2779 / 174407 Afdaling in de ingewanden.txb
63.97 = 540 / 34546 http___www.corbijn.co.uk_beefheart.htm.txb
70.69 = 601 / 42483 Re_ [wxPython] Re_ wxPy use double memory of pyGtk.txb
Technical Details
Message-ID:
<Xns9089CC25101Ercamesz@127.0.0.1>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!supernews.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!212.74.64.35!colt.net!dispose.news.demon.net!news.demon.nl!demon!amesz.demon.nl!not-for-mailReferences:
<Xns9085D4460F957pray.the.church.com@198.164.200.20> <Xns9086323BFAF3rcamesz@127.0.0.1> <Xns90865505ADC9Cpray.the.church.com@198.164.200.20> <Xns90872611CD4C4rcamesz@127.0.0.1> <fnord9dq6vl.2hm.neuromancer@HAL-9000.net> <Xns90881BF432E1Drcamesz@127.0.0.1> <1es2yos.1brpxd0ytti12N%planb@newsreaders.com>Show Full Headers
Complete Article Headers
Message-ID: <Xns9089CC25101Ercamesz@127.0.0.1>
Subject: Re: Binary detection (was: How do I sto this prompt box? - 1 attachment)
Date: Thu, 19 Apr 2001 23:26:34 GMT
From: rcameszREMOVETHIS@dds.removethistoo.nl (Robert Amesz)
References: <Xns9085D4460F957pray.the.church.com@198.164.200.20> <Xns9086323BFAF3rcamesz@127.0.0.1> <Xns90865505ADC9Cpray.the.church.com@198.164.200.20> <Xns90872611CD4C4rcamesz@127.0.0.1> <fnord9dq6vl.2hm.neuromancer@HAL-9000.net> <Xns90881BF432E1Drcamesz@127.0.0.1> <1es2yos.1brpxd0ytti12N%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.readers.mbox.zip!supernews.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!212.74.64.35!colt.net!dispose.news.demon.net!news.demon.nl!demon!amesz.demon.nl!not-for-mail
Newsgroups: news.software.readers
Reply-To: rcamesz@dds.nl
NNTP-Posting-Host: amesz.demon.nl
X-NNTP-Posting-Host: amesz.demon.nl:212.238.72.220
X-Trace: news.demon.nl 987722794 pluto:689 NO-IDENT amesz.demon.nl:212.238.72.220
X-Complaints-To: abuse@nl.demon.net
X-Posting-Agent: Hamster/1.3.13.0
User-Agent: Xnews/4.04.09
X-Face: -UyGj#nTl3bP#:3eo0p=:^KBkRfmev~b|A;y;'B2hoq>5k!+MRLTs;rh$F@EFS4B)Lt\FT9j-NR~OCq%#mt(O,M{j^*s
Lines: 79