|
Prev: Brand Watches Tissot Men's T Race Chronograph Watch #T90.4.446.51 Discount, Swiss, Fake
Next: ssh timeout script
From: Dave Farrance on 4 May 2008 09:37 Below is a script that posts a test message via a public newserver and provides a randomly generated title and Message-ID. It uses the "rpost" command, which is included in the "suck" package to post the message. I'd like to add a "suck" command to the script to read the message back from the server, using the specified Message-ID, and to display that message. I guess I'll figure out how to do it eventually, but the "suck" command seems to be far more complex than "rpost" and it requires config files. There's no easy way to do this that I'm missing, is there? #!/bin/bash newsserver=aioe.cjb.net id=$(od -xvAn -N8 < /dev/urandom | tr -cd 0-9a-f) rpost $newsserver <<%end From: scriptpost <script(a)post.invalid> Newsgroups: alt.test Subject: TEST-$id Organization: scriptpost Message-ID: <$id(a)post.invalid> test $id %end
From: Theo v. Werkhoven on 4 May 2008 11:17 The carbonbased lifeform Dave Farrance inspired comp.unix.shell with: > Below is a script that posts a test message via a public newserver and > provides a randomly generated title and Message-ID. It uses the "rpost" > command, which is included in the "suck" package to post the message. > > I'd like to add a "suck" command to the script to read the message back > from the server, using the specified Message-ID, and to display that > message. I guess I'll figure out how to do it eventually, but the "suck" > command seems to be far more complex than "rpost" and it requires config > files. There's no easy way to do this that I'm missing, is there? Sure there is. $telnet news.xs4all.nl 119 Trying 194.109.133.242... Connected to news.xs4all.nl. Escape character is '^]'. 200 news.xs4all.nl NNRP Service Ready (posting ok). article <l3kr14d2fhvghmla9rdh0ia12cupsq2fqs(a)4ax.com> /* my command */ 220 0 <l3kr14d2fhvghmla9rdh0ia12cupsq2fqs(a)4ax.com> article Path: news.xs4all.nl!newsspool.news.xs4all.nl!newsfeed.xs4all.nl!newsfeed2.news. xs4all.nl!xs4all!feeds.phibee-telecom.net!news.mixmin.net!eweka.nl!hq-usenetpeer s.eweka.nl!69.16.177.246.MISMATCH!cyclone03.ams!news.ams.newshosting.com!npeersf 01.ams!newsfe30.ams2.POSTED!53ab2750!not-for-mail From: The Beloved <maybe(a)one.day> Newsgroups: nl.comp.hardware With 'article' you get the post with the requested Message-ID. Now write a little expect script and you're done. Theo -- theo at van-werkhoven.nl ICQ:277217131 SuSE Linux linuxcounter.org: 99872 Jabber:muadib at jabber.xs4all.nl AMD XP3000+ 1024MB "ik _heb_ niets tegen Microsoft, ik heb iets tegen de uitwassen *van* Microsoft"
From: Dave Farrance on 4 May 2008 14:47 "Theo v. Werkhoven" <theo(a)van-werkhoven.nl.invalid> wrote: >Sure there is. >$telnet news.xs4all.nl 119 >Trying 194.109.133.242... >Connected to news.xs4all.nl. >Escape character is '^]'. >200 news.xs4all.nl NNRP Service Ready (posting ok). >article <l3kr14d2fhvghmla9rdh0ia12cupsq2fqs(a)4ax.com> /* my command */ >220 0 <l3kr14d2fhvghmla9rdh0ia12cupsq2fqs(a)4ax.com> article >Path: news.xs4all.nl!newsspool.news.xs4all.nl!newsfeed.xs4all.nl... >... >With 'article' you get the post with the requested Message-ID. >Now write a little expect script and you're done. Thanks for the reply. I've installed tcp and expect, but I find the expect manpage to be hard reading. I've managed to get it to display a post, although I don't really know how to separate the server messages from the post. The "interact" tells it to display everything, and it does exit without user intervention, but I'm sure there's a neater way. #!/usr/bin/expect -f spawn telnet aioe.cjb.net 119 sleep 1 send "article <0123456789abcdef(a)foo.invalid>\r" sleep 1 send "quit\r" interact I might look into trying something similar to the above, but using bash pipes rather than with expect. I also figured how to use "suck" to get a message by its Message-ID. This script reads a message from a public newsserver and saves it as the file "feedback.txt". (It also uses 3 temporary files in the local dir.) #!/bin/bash echo "alt.test -1 0" >sucknewsrc echo "<0123456789abcdef(a)foo.invalid>" >suckothermsgs suck aioe.cjb.net >feedback.txt rm -f sucknewsrc suck.newrc suckothermsgs
From: Kenny McCormack on 4 May 2008 22:01 In article <66vr145h4fub9ks0l6depgs62rnjlfnoar(a)4ax.com>, Dave Farrance <DaveFarrance(a)OMiTTHiSyahooANDTHiS.co.uk> wrote: .... >Thanks for the reply. I've installed tcp [TCL] and expect, but I find the >expect manpage to be hard reading. I've managed to get it to display a >post, although I don't really know how to separate the server messages >from the post. The "interact" tells it to display everything, and it >does exit without user intervention, but I'm sure there's a neater way. Expect is a little hard going, but learning it is absolutely essential if you want to consider yourself a Unix scripting guy. The book "Exploring Expect" (by Don Libes, author of Expect) is absolutely essential.
From: mo on 4 May 2008 23:35 The script below is to get latest posts from a newsgroup via nntp. It uses just bash. If you post a message and run this script after few seconds I think the probability of your message be the last is great. In anyway the value of the var "REPLY" has more info than checked in the script and, message ID, can be present. Perhaps you would prefer get a list instead, sending with the script: se "XOVER $[$LP-5]-$LP" 224 And selecting via the "ID" as said in your post. Try play a bit with this; add echo $REPLY >&2 to see server's answer. I don't have examples with SSL, only this one for plain text. I'm not sure if this is what you wanted. ------------------ #!/bin/bash S=194.177.96.26 # nntp.aioe.org P=119 G=comp.unix.shell e(){ exec 3<&-;exit 1;} se(){ # send $1 expect $2 [ -n "$1" ]&&printf "$1\r\n" >&3 read<&3;[ "${REPLY%% *}" = "$2" ]||e } exec 3<>/dev/tcp/$S/$P||e se '' 200 se "MODE READER" 200 se "GROUP $G" 211 LP=${REPLY% *};LP=${LP##* } # LP = latest post [ -f /tmp/$G ]&&LL=$[`cat /tmp/$G`+1]||LL=$LP # LL = latest local echo -e "LL=$LL\nLP=$LP" >&2 while [ $LP -ge $LL ];do se "ARTICLE $LL" 220 [ -e /tmp/$G.$LL ]||while read -t 3;do [ "$REPLY" = .$'\r' ]&&break echo "$REPLY" #echo "${REPLY%?}" # \x0d cut done <&3 >/tmp/$G.$LL echo /tmp/$G.$LL >&2 echo $LL >/tmp/$G LL=$[$LL+1] done e -------------------- On Sun, 04 May 2008 10:37:18 -0300, Dave Farrance <DaveFarrance(a)OMiTTHiSyahooANDTHiS.co.uk> wrote: > Below is a script that posts a test message via a public newserver and > provides a randomly generated title and Message-ID. It uses the "rpost" > command, which is included in the "suck" package to post the message. > > I'd like to add a "suck" command to the script to read the message back > from the server, using the specified Message-ID, and to display that > message. I guess I'll figure out how to do it eventually, but the "suck" > command seems to be far more complex than "rpost" and it requires config > files. There's no easy way to do this that I'm missing, is there? > > > #!/bin/bash > newsserver=aioe.cjb.net > id=$(od -xvAn -N8 < /dev/urandom | tr -cd 0-9a-f) > rpost $newsserver <<%end > From: scriptpost <script(a)post.invalid> > Newsgroups: alt.test > Subject: TEST-$id > Organization: scriptpost > Message-ID: <$id(a)post.invalid> > > test $id > %end
|
Next
|
Last
Pages: 1 2 3 Prev: Brand Watches Tissot Men's T Race Chronograph Watch #T90.4.446.51 Discount, Swiss, Fake Next: ssh timeout script |