Article View: alt.free.newsservers
Article #164191Re: SOLVED: What is a quick Linux bash test of a free public newsserver on VPN?
From: VPN user
Date: Thu, 31 Mar 2016 15:00
Date: Thu, 31 Mar 2016 15:00
52 lines
2637 bytes
2637 bytes
Here's a more robust script which actually posts a message,
and then checks if that message was posted.
#!/usr/bin/expect -f
# Test nntp connection using "vpnexpect nntp.aioe.org 119".
# See also: autoexpect telnet nntp.aioe.org 119, where you can interact & read results easily.
# See also: Expect home page at http://expect.sourceforge.net
set timeout 10
set _ip [lindex $argv 0]
set _port [lindex $argv 1]
send_user "Connecting to ${_ip}:${_port} now\n"
# interact
spawn telnet $_ip $_port
sleep 1
send_user "Checking for connection-refused or for posting-ok condition...\n"
expect {
"200 nntp.aioe.org InterNetNews NNRP server INN 2.5.4 ready (posting ok)"
{
send_user "Posting is ok, so trying a test post...\n"
send "post\r"
send "From: foo@example.com\r"
send "Newsgroups: alt.test\r"
send "Subject: This is my test post\r"
send "\r"
send "This is my test post\r"
send ".\r"
# 240 Article received <ndevt2$s8d$1@gioia.aioe.org>
# expect -re "^240 Article received \<\.*\>$"
expect -re "\<\.*\>"
# send_user "The expect_out buffer 2 is: $expect_out(buffer)\n"
# send_user "The expect_out string 2 is: $expect_out(0,string)\n"
set _id [lindex $expect_out(0,string)\n]
send_user "The message-id string is: $_id\n"
send "group alt.test\r"
expect "alt.test"
send "article $_id\r"
expect "Organization: Aioe.org NNTP Server"
send_user "Sleeping for 5 seconds.\n"
sleep 5
send "quit\r";
expect "205 Bye!"
}
"Connection refused"
{
send_user "Oops: The connection was refused to ${_ip}:${_port}"
exit
}
}
expect eof
Technical Details
Message-ID:
<ndje1g$ork$1@news.mixmin.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!news.usenet.farm!..!..!not-for-mailReferences:
<nda1rf$65o$1@news.mixmin.net> <ndboei$tur$2@news.mixmin.net>Show Full Headers
Complete Article Headers
Message-ID: <ndje1g$ork$1@news.mixmin.net> Subject: Re: SOLVED: What is a quick Linux bash test of a free public newsserver on VPN? Date: Thu, 31 Mar 2016 15:00:01 +0000 From: VPN user <vpnuser@example.com> References: <nda1rf$65o$1@news.mixmin.net> <ndboei$tur$2@news.mixmin.net> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!news.usenet.farm!..!..!not-for-mail Newsgroups: alt.free.newsservers Organization: Mixmin Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Thu, 31 Mar 2016 15:00:01 -0000 (UTC) Injection-Info: news.mixmin.net; posting-host="13c1e94b6469c07ed8da14e140e600df0503a233"; Lines: 51