dAmn Interoperability Project — READ-ONLY ARCHIVE

 [FrontPage]

bash scripts

Here's a simple script to send messages into a channel. Uses bash, wget, netcat, awk, sed, mktemp. telnet should work instead of netcat, too. replace mktemp with an emty/not-existent file if you don't have mktemp.


#!/bin/bash

tmp=`mktemp`

echo "........ deviantArt dAmn message ........"
echo -n 'enter username: '
read user
echo "."
echo -n 'enter password: '
read pass
echo "."
echo -n 'enter channel: '
read chan
echo "."
echo 'enter message, close with CTRL+D'
cat > $tmp
echo "."
echo "fetching token......"
token=`wget -O - --user-agent="Mozilla" --post-data="username=${user}&password=${pass}&reusetoken=1&ref=http://chat.deviantart.com/chat/damnhack" http://www.deviantart.com/users/login | \
         grep "Login" | \
         awk '{print $3}' | \
         sed 's,",,g'`


{
        echo -en "dAmnClient 0.2\nagent=BashMessageTool\nmisc=bzed\n\0"
        echo -en "login ${user}\npk=${token}\n\0"
        sleep 1
        echo -en "join chat:${chan}\n\0"
        sleep 1
        echo -en "send chat:${chan}\n\nmsg main\n\n`cat $tmp`\n\0"
        rm -rf $tmp
        echo -en "send chat:${chan}\n\nmsg main\n\n....send with *bzed's dAmnmessage for bash - see :devdamnhack:\n\0"
        sleep 1
        echo -en "part chat:${chan}\n\0"
        sleep 1
        echo -en "logout\n\0"
        exit
} | netcat jasper.deviantart.com 3900



2013-03-28 12:59