Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Need advanced shell scripting help

    Reply
    Page 2 of 2 | Prev |   1   2 |
    GameboyRMH | # 11 | 2010-12-03, 14:01 | Report

    Alright so here is my script! It fetches emails from a Mailinator account.

    Mailinator emails usually disappear after a while, but with this script you can run it hourly or whatever so you can make sure you get your emails.. Plus you can now use obfuscated mailinator addresses so nobody has to know the real name of the account you're checking.

    This would be very handy for, say, the contact email on a Tor server

    Code:
    #! /bin/sh
    
    wget http://www.mailinator.com/rss.jsp?email=YOURMAILBOXNAMEGOESHERE -O /tmp/mailinator-feed #get rss feed
    grep link /tmp/mailinator-feed | grep showmail | sed -e 's/<[^>][^>]*>//g' -e '/^ *$/d'| sed -e 's:&amp;:\&:g' > /tmp/mailinator-links #pick out email links and replace ampersand html entity
    cd /home/user/mailinator-emails/ #mail goes here
    #download emails
    for url in $(cut -f 1 /tmp/mailinator-links); do
        url=`echo -n "${url}" | tr -d '\r'`
        wget -nc "${url}"
    done
    #clean up temp files
    rm /tmp/mailinator-feed
    rm /tmp/mailinator-links
    Your mails will build up with messy filenames, but the point is you can read them at your leisure.

    Thanks for the help everyone!

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by GameboyRMH; 2010-12-03 at 14:15.

     
    lma | # 12 | 2010-12-03, 15:39 | Report

    Aha, I didn't know about mailinator. Looks useful, thanks!

    There's something about unnecessary forks, temp files and long pipelines that bugs me, so here's a shorter version :-)
    Code:
    #!/bin/sh
    cd /home/user/mailinator-emails && \
    wget -qO - http://www.mailinator.com/rss.jsp?email=YOURMAILBOXNAMEGOESHERE | \
    sed -ne 's/&amp;/\&/g' -e 's/^.*\(http:.*showmail.jsp.*\)<.*$/\1/p' | \
    wget -nc -qi -

    Edit | Forward | Quote | Quick Reply | Thanks

     
    GameboyRMH | # 13 | 2010-12-03, 15:42 | Report

    Originally Posted by lma View Post
    Aha, I didn't know about mailinator. Looks useful, thanks!

    There's something about unnecessary forks, temp files and long pipelines that bugs me, so here's a shorter version :-)
    Code:
    #!/bin/sh
    cd /home/user/mailinator-emails && \
    wget -qO - http://www.mailinator.com/rss.jsp?email=YOURMAILBOXNAMEGOESHERE | \
    sed -ne 's/&amp;/\&/g' -e 's/^.*\(http:.*showmail.jsp.*\)<.*$/\1/p' | \
    wget -nc -qi -
    Wow, does that really replicate all the functionality!?

    Edit: Well I sat down and looked through it for a while and I finally understand how you did that...mostly

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by GameboyRMH; 2010-12-03 at 23:36.

     
    Page 2 of 2 | Prev |   1   2 |
vBulletin® Version 3.8.8
Normal Logout