view lib/dcc @ 2651:4c617ce2bbe1

<Jafet> echo -e \'\\x7fELF\\x02\\x01\\x01\\0\\0\\0\\0\\0\\0\\0\\0\\0\\x02\\0>\\0\\x01\\0\\0\\0x\\0@\\0\\0\\0\\0\\0@\\0\\0\\0\\0\\0\\0\\0\\xb0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0@\\08\\0\\x01\\0@\\0\\x03\\0\\x02\\0\\x01\\0\\0\\0\\x05\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0@\\0\\0\\0\\0\\0\\0\\0@\\0\\0\\0\\0\\0\\x9a\\0\\0\\0\\0\\0\\0\\0\\x9a\\0\\0\\0\\0\\0\\0\\0\\0\\0 \\0\\0\\0\\0\\0H\\xc7\\xc7\\x01\\0\\0\\0H\\xc7\\xc6\\x98\\0@\\0H\\xc7\\xc2\\x02\\0\\0\\0H\\xc7\\xc0\\x01\\0\\0\\0\\x0f\\x05\\xeb\\xf5y\' > bin/y && chmod +x bin/y
author HackBot
date Sat, 13 Apr 2013 22:29:43 +0000
parents 859f9b4339e6
children
line wrap: on
line source

#!/bin/bash

# Configuration:

# IP of the host, must be in the stupid long integer form
DCC_IP="1077849409"

# Port range
DCC_PORT_MIN="10000"
DCC_PORT_RANGE="100"

# Library:

# Get a DCC port
dcc_port() {
    echo $(( DCC_PORT_MIN + (RANDOM % DCC_PORT_RANGE) ))
}

# Start a DCC chat to $1
dcc_chat() {
    DCC_PORT=`dcc_port`
    (
        sleep 1
        echo -e 'PRIVMSG '$1' :\x01DCC CHAT chat '$DCC_IP' '$DCC_PORT'\x01' |
            socat STDIN UNIX-SENDTO:$IRC_SOCK
    ) &
    socat -T30 - TCP4-LISTEN:$DCC_PORT,crnl
}

# Start a DCC SEND of $2 to $1
dcc_send() {
    DCC_PORT=`dcc_port`
    (
        sleep 1
        echo -e 'PRIVMSG '$1' :\x01DCC SEND '$2' '$DCC_IP' '$DCC_PORT'\x01' |
            socat STDIN UNIX-SENDTO:$IRC_SOCK
    ) &
    socat -T30 - TCP4-LISTEN:$DCC_PORT
}