Networking Forums

Networking Forums > Computer Networking > Linux Networking > nc [net-cat] to post to nntp ?

Reply
Thread Tools Display Modes

nc [net-cat] to post to nntp ?

 
 
news@absamail.co.za
Guest
Posts: n/a

 
      09-23-2006, 02:25 PM
Since my ISP is regularly ooo [why should it be down on long
weekends, when there's no horse to water or crank to turn ?!],
I want some light-weight safety facilities.

I love mulinux's minimalist scripts, and have been able to
figure out from them that:
cat <pre-prepared email file> | sendmail -t
will send an email.

Which is nice for brief online sessions, especially when embedded in
a script:--

lynx -dump '<URL1> ' > f1
....
lynx -dump '<URLn> ' > fn
--
The mulinux author uses nc for fetching/posting mail & news.

He's got ash-scripts [to fit all on a single fd0] which eg.:--

if connected && [ -z "$Q_option" ] ; then
nc -v -w 60 -e $SMTP_PRO $host $SMTP_PORT
rc=$?
echo -n " ... sent."
return $rc
---
Where "$SMTP_PRO" is the [inner] script which supplies the data
for nc.

Since I haven't got proper nc with its man, I can't see how this works.
Is "-e $SMTP_PRO" effectively considered as a 'list' of files supplied
by the $SMTP_PRO script ?

So if I replaced it with <Email File>, would I be able to post
one Email ? My ISP is down for testing if mails are received !

How would I post one News Article using 'nc', where I want
to simplify his:
nc -v -w 60 -e $NNTP_PRO $NTPSERVER nntp
by supplying just one NewsArticle-file instead of his "$NNTP_PRO" ?
I can see what $NTPSERVER and nntp resolve to.

Thanks for any info,

== Chris Glur.





 
Reply With Quote
 
 
 
 
Chris Davies
Guest
Posts: n/a

 
      09-25-2006, 12:35 PM
(E-Mail Removed) wrote:
> I love mulinux's minimalist scripts, and have been able to
> figure out from them that:
> cat <pre-prepared email file> | sendmail -t
> will send an email.


If you're into minimalism, just do "sendmail -t < preprepared_file". You
almost never need "cat" if you're referencing a single file.


> nc -v -w 60 -e $SMTP_PRO $host $SMTP_PORT


> Where "$SMTP_PRO" is the [inner] script which supplies the data
> for nc.


> Since I haven't got proper nc with its man, I can't see how this works.
> Is "-e $SMTP_PRO" effectively considered as a 'list' of files supplied
> by the $SMTP_PRO script ?


The "-e" option to nc specifies a filename to exec after the connect
has occurred, which in your example's case is a connection to "$host"
on port $SMTP_PORT (probably 25).


> So if I replaced it with <Email File>, would I be able to post
> one Email?


Of course not; $SMTP_PRO is a script that's executed, not a data file.
You need to look at the contents of SMTP_PRO to determine whether it can
easily be tweaked to send a single email.


> My ISP is down for testing if mails are received !


I have no idea what you mean by that statement.


> How would I post one News Article using 'nc', where I want
> to simplify his:
> nc -v -w 60 -e $NNTP_PRO $NTPSERVER nntp
> by supplying just one NewsArticle-file instead of his "$NNTP_PRO" ?
> I can see what $NTPSERVER and nntp resolve to.


You would need a script referenced by $NNTP_PRO that spoke the NNTP
protocol for you. I suspect in your case this would include parsing
the newsgroup names from one or more articles, and generating local
message-ids.

Chris
 
Reply With Quote
 
news@absamail.co.za
Guest
Posts: n/a

 
      10-02-2006, 08:26 AM
In article <01vku3-(E-Mail Removed)>, Chris Davies <chris-(E-Mail Removed)> wrote:

> (E-Mail Removed) wrote:
> > I love mulinux's minimalist scripts, and have been able to
> > figure out from them that:
> > cat <pre-prepared email file> | sendmail -t
> > will send an email.

>
> If you're into minimalism, just do "sendmail -t < preprepared_file". You
> almost never need "cat" if you're referencing a single file.
>
>

OK, I propably just extracted the 'send' cmnd from his loop.
BTW what means:
cat <fileName> << EOF
and
cat << EOF
?

He writes ash for small size, but I'm guessing it's valid/similar for bash ?

> > nc -v -w 60 -e $SMTP_PRO $host $SMTP_PORT

>
> > Where "$SMTP_PRO" is the [inner] script which supplies the data
> > for nc.

>
> > Since I haven't got proper nc with its man, I can't see how this works.
> > Is "-e $SMTP_PRO" effectively considered as a 'list' of files supplied
> > by the $SMTP_PRO script ?

>
> The "-e" option to nc specifies a filename to exec after the connect
> has occurred, which in your example's case is a connection to "$host"
> on port $SMTP_PORT (probably 25).
>
>
> > So if I replaced it with <Email File>, would I be able to post
> > one Email?

>
> Of course not; $SMTP_PRO is a script that's executed, not a data file.
> You need to look at the contents of SMTP_PRO to determine whether it can
> easily be tweaked to send a single email.
>
>

So can you proposes a one/two line script, to send one email-file ?

So far:
sendmail -t < preparedEmail_file -fname2tst
mails to my other URL, but gives a false
Return-Path: <(E-Mail Removed)>

I have to run as root, to hack this stuff, and I can't see how/where
to set the domain. I tried to set & export 'HOSTNAME' from inside
the script which calls sendmail, but failed.

> > My ISP is down for testing if mails are received !

>
> I have no idea what you mean by that statement.
>
>

My ISP is presently non-functional, for the purpose of me testing if
any mails which I transmit are received by another URL [than the
Txing URL].

> > How would I post one News Article using 'nc', where I want
> > to simplify his:
> > nc -v -w 60 -e $NNTP_PRO $NTPSERVER nntp
> > by supplying just one NewsArticle-file instead of his "$NNTP_PRO" ?
> > I can see what $NTPSERVER and nntp resolve to.

>
> You would need a script referenced by $NNTP_PRO that spoke the NNTP
> protocol for you. I suspect in your case this would include parsing
> the newsgroup names from one or more articles, and generating local
> message-ids.
>

Yes, it looks as if that's what his ash-script does.

I'd like to 'stub it out'.
Ie. use succcessive refinement.
Ie. first just pass one news article and the $NTPSERVER and the protocol
[nntp], instead of a routine to do all this.

There must be basic templates for nc to do:
* send one email,
* send one NewsArticle,
* ...etc.

> Chris
>

Thanks,
== Chris Glur.



 
Reply With Quote
 
Alan Connor
Guest
Posts: n/a

 
      10-02-2006, 10:11 AM
On comp.os.linux.networking, in <(E-Mail Removed)>, "(E-Mail Removed)" wrote:

<snip>

I use nc for a lot of things, like retrieving mail from a pop
server....And writing a basic bash/ash(sh) newsreader wouldn't
be a problem, but you are violating the Netiquette by failing to
use a name in your from header.

So we'll see you around. Study shell scripting. See the FAQ
for comp.unix.shell.

You are obviously out of your depth here.

And I think you want alt.os.linux.slackware.

Alan

--
http://home.earthlink.net/~alanconnor/contact.html
http://home.earthlink.net/~alanconnor/cr.html
http://home.earthlink.net/~alanconnor/publickey.html
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Euro1net and NNTP Joe Soap Broadband 5 08-06-2006 09:37 PM
Why are ISP's dropping NNTP Scared Broadband 54 02-20-2006 10:36 AM
nntp Sam Linux Networking 0 02-05-2005 01:01 PM
NNTP Mirror Buck Turgidson Linux Networking 7 08-13-2004 06:21 PM
nntp proxy? Bill Linux Networking 3 12-04-2003 09:41 AM



1 2 3 4 5 6 7 8 9 10 11