1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Port logging via twitter from openwrt do tomato, possible?

Discussion in 'Tomato Firmware' started by gijs73, Oct 21, 2009.

  1. gijs73

    gijs73 LI Guru Member

    Is this possible to do in tomato? :confused:

    # Create an account on twitter.
    # Create a Basic authentication string with
    Code:
    echo -n "$username:$password" | base64
    Use the following shell script, substituting $base64string with the string obtained in previous step:
    Code:
    #!/bin/sh
    
    TWEET="status=$*"
    
    CONTENT_LENGTH=`echo -n $TWEET | wc -c`
    
    MESSAGE="
    POST /statuses/update.xml HTTP/1.1
    Host: twitter.com
    User-Agent: OpenWRT Twitter
    Accept: application/json, text/javascript, */*
    Accept-Language: en-us,en;q=0.5
    Content-Type: application/x-www-form-urlencoded; charset=UTF-8
    Content-Length: $CONTENT_LENGTH
    Authorization: Basic $base64string
    
    $TWEET"
    
    echo "$MESSAGE" | telnet twitter.com 80 > /dev/null 2>/dev/null
    
    # Save it as /usr/bin/tweet and start using it right away.
    # Set up some cron job, make it log something and... follow your router :)

    source:
    http://blog.rtg.in.ua/2009/08/openwrt-logging-via-twitter.html
     
  2. SgtPepperKSU

    SgtPepperKSU Network Guru Member

    Busybox's telnet can't accept input from a pipe, so replace telnet with nc, and you'd be good to go. That, and the executable will have to be on jffs2, cifs, or /tmp rather than /usr/bin.
     

Share This Page