Article View: news.software.nntp
Article #70047Re: NNTP server test script
From: Conrad J. Sabatier
Date: Sat, 02 Oct 2004 00:44
Date: Sat, 02 Oct 2004 00:44
67 lines
2772 bytes
2772 bytes
In article <hTJRc.8593$_C6.863@cyclops.nntpserver.com>,
John Kenickney <spam.trap@bigfoot.com> wrote:
>
>
>I want to test free nntp servers that I find on the internet. Mostly the
>reports are not correct; they don't exist anymore or they don't allow
>posting anymore... It's a time consuming job to do that by hand with an
>ordinary news reader. Is there a script or program that tests whether a
>server allows posting or at least tries to post a test message?
You can do this with the bash shell, using its i/o redirection facilities to
create a tcp connection to the server. Here's an example "post" script:
#!/usr/local/bin/bash
#
# usage: post article server
#
# where "article" is the filename of the article to be posted
# should contain, at a minimum, Newsgroups:, Subject: and From: header lines
#
# server is, of course, the address of the server to post to
article=$1
server=$2
# avoid any line-splitting of server's replies
IFS=""
# loop until a connection is established
while true
do
exec < /dev/tcp/${server}/nntp && read -r && [ "${REPLY%% *}" == "200" ] && break
done
#send post command, check server's reply
echo -e "post\r" >&0
read -r
if [ "${REPLY%% *}" != "340" ]
then
# echo the server's reply and exit if not OK to post
echo -E $REPLY >&2
echo -e "quit\r" >&0
read -r
exit 1
fi
# send the article
cat $article >&0
echo -e "\r\n.\r" >&0
# check the server's reply
read -r
if [ "${REPLY%% *}" != "240" ]
then
# echo the server's reply and exit if not "article posted"
echo -E $REPLY >&2
echo -e "quit\r" >&0
read -r
exit 1
fi
# do a clean exit
echo -e "quit\r" >&0
read -r
exit 0
--
Conrad J. Sabatier <conrads@cox.net> -- "In Unix veritas"
Technical Details
Message-ID:
<2Sm7d.12534$Hz.12393@fed1read04>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!number1.nntp.dca.giganews.com!internal1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!peer01.cox.net!cox.net!p01!fed1read04.POSTED!53ab2750!not-for-mailReferences:
<hTJRc.8593$_C6.863@cyclops.nntpserver.com>Show Full Headers
Complete Article Headers
Message-ID: <2Sm7d.12534$Hz.12393@fed1read04> Subject: Re: NNTP server test script Date: Sat, 02 Oct 2004 00:44:46 GMT From: conrads@cox.net (Conrad J. Sabatier) References: <hTJRc.8593$_C6.863@cyclops.nntpserver.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.20140818.mbox.gz!number1.nntp.dca.giganews.com!internal1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!peer01.cox.net!cox.net!p01!fed1read04.POSTED!53ab2750!not-for-mail Newsgroups: news.software.nntp X-Newsreader: trn 4.0-test76 (Apr 2, 2001) Originator: conrads@cox.net (Conrad J. Sabatier) Lines: 67 NNTP-Posting-Host: 68.11.71.51 X-Complaints-To: abuse@cox.net X-Trace: fed1read04 1096677886 68.11.71.51 (Fri, 01 Oct 2004 20:44:46 EDT) NNTP-Posting-Date: Fri, 01 Oct 2004 20:44:46 EDT Organization: Cox Communications