Donnerstag, 9. Februar 2006

Aus eMail Anhang extrahieren

mail(s) aus einem Postfach per IMAP abholen.
Attachments auspacken, *.pdf kopieren

hier am beispiel eines speiseplans fuer das Intranet




file: get_mail

#!/bin/bash
#
# abholen von speiseplan.pdf aus Postfach speiseplan@domain.tld
#

/usr/bin/fetchmail -a -u speiseplan
/usr/local/bin/uudeview /var/spool/mail/speiseplan -i -c


/usr/bin/fetchmail -a -u speiseplan
/usr/local/bin/uudeview /var/spool/mail/speiseplan -i -c

mv *.pdf speiseplan.pdf
mv *.PDF speiseplan.pdf

/bin/cp -f speiseplan.pdf /var/www/webdata/speiseplan/speiseplan.pdf

/bin/rm -f *.pdf
touch /var/spool/mail/speiseplan
chown speiseplan /var/spool/mail/speiseplan
chgrp speiseplan /var/spool/mail/speiseplan
#
#
# needed: uudeview, fetchmail, .fetchmail, cp, rm
#
#




file: .fetchmailrc

poll "MAILSERVER"
protocol imap
localdomains domain.tld
username "speiseplan"
password "password"
to speiseplan





wenn mehrere Postfacher abgefragt werden sollen,
muessen mehrere .fetchmailrc files angelegt werden z.B. so:


file: get_mail2

#!/bin/bash
#
# abholen von aktion.pdf aus Postfach aktion@domain.tld
#

/usr/bin/fetchmail -f /root/.fetchmailrc2 -a -u aktion
/usr/local/bin/uudeview /var/spool/mail/aktion -i -c


#/usr/bin/fetchmail -a -u aktion
#/usr/local/bin/uudeview /var/spool/mail/aktion -i -c

/bin/mv *.pdf aktion.pdf
/bin/mv *.PDF aktion.pdf

/bin/cp -f sbaraktion.pdf /var/www/webdata/speiseplan/aktion.pdf

/bin/rm -f *.pdf
/bin/touch /var/spool/mail/aktion
/bin/chown sbaraktion /var/spool/mail/aktion
/bin/chgrp sbaraktion /var/spool/mail/aktion
#
#
# needed: uudeview, fetchmail, .fetchmail, cp, rm
#


file: .fetchmailrc2


poll "MAILSERVER"
protocol imap
localdomains domain.tld
username "aktion"
password "password"
to aktion

DNS-Server: bind

bind
----




NameServer finden:

dig redhat.com ns

dig heise.de ns

dig suse.de ns






Reverse aufloesen:

host -l -v -t any 50.232.187.66.in-addr.arpa. ns2.redhat.com.


host -l -v -t any 76.98.193.in-addr.arpa. dns.pemic.net.


host -l -v -t any 3.220.135.195.in-addr.arpa. ns.suse.de







Abfragen von bind Version des Nameservers


dig @NAMESERVER txt chaos version.bind

z.B:


dig @ns2.vkn.de txt chaos version.bind




Verhindern des Versionausgabe mit:


in der named.conf


version "Go away!!!";




Wem gehoert eine DOMAIN:


whois -h whois.networksolutions.com heller-machines.com