DnsDinamico

Client per il servizio di DNS dinamico di ninux.org

Per utilizzarli:

In bash

Richiede netcat (nc)

# netcat is required to run this script

USERNAME=pippo
PASSWORD=pippo
HOSTNAME=testmachine

ADDRESS=dyndns.ninux.org
PORT=8078

connect() {
        echo -e "$USERNAME\n$PASSWORD\n$HOSTNAME" | nc $ADDRESS $PORT > /tmp/dnsninuxclient
}

if connect; then
        cat /tmp/dnsninuxclient
        if grep "KO" /tmp/dnsninuxclient > /dev/null; then
                echo "Error!"
                /bin/false
        fi
else
        echo "Connection error?"
        /bin/false
fi

In python

   1 #!/usr/bin/env python
   2 
   3 from socket import *
   4 
   5 USERNAME=pippo
   6 PASSWORD=pippo
   7 HOSTNAME=testmachine
   8 
   9 HOST="dyndns.ninux.org"
  10 PORT=8078
  11 
  12 s = socket(AF_INET, SOCK_STREAM)
  13 s.connect((HOST,PORT))
  14 s.send("%s\n%s\n%s\n" % (USERNAME,PASSWORD,HOSTNAME))
  15 recieved = s.recv(2024)
  16 s.close()
  17 print recieved

ipkg

l'ultima modifica รจ del 2008-03-18 17:27:52, fatta da localhost