DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2008-03-06 04:17:01

msobon
Member
Registered: 2008-03-02
Posts: 6

DNS-323 runing everydns Perl Script?

Hi anyone know how you would run this perlf script:
#!/usr/bin/perl -w
#
#  see usage() or run eDNS.pl with no command line
#  for usage information
#

use strict;
use vars qw($myip $firewall $target $username $password $version);
use vars qw($pass $url $sock @result $result $code $domain);
use Getopt::Long;

GetOptions('u=s' => \$username, 'p=s' => \$password, 'ip=s' => \$myip, 'd=s' => \$domain);

usage() if !$username;
usage() if !$password;

# If you're behind a firewall or HTTP proxy, set this to 1.
# If you're not sure, set it to 1; that's the safer setting anyway.
# If you KNOW you're not behind a firewall or proxy, set to 0.
$firewall = 0;

# Originally written for hn.org by:
#
# (C)2000-2001 David E. Smith <dave@bureau42.com> and released to the
#  public under the terms of the GNU General Public License.
#
# With credits given to:
#
# Modified by Daniel Hagan <dhagan@colltech.com> on 4/2001 to use IO::Socket,
# Syslog, and some error checking.  Now logs all output to daemon facility.
#
# Other changes made/suggested by Aurelien Beaujean <aure@dagobah.eu.org>
# Sorry, but I can't type the accent over the first "e" in Aurelien.
#
# It was then hacked up to work with Everydns.net by Dave Fortunato
# <davidf@everydns.net>

use MIME::Base64;
use IO::Socket;

if ($firewall && !$myip) {
    die "Error: IP required as command line argument when \$firewall is set to true.";
}

$target = "dyn.everydns.net";
$version = "0.1";
$pass = MIME::Base64::encode_base64("$username:$password");

if ($firewall == 1 or $myip) {
    $url = "/index.php?ver=$version&ip=$myip" if !$domain;
    $url = "/index.php?ver=$version&ip=$myip&domain=$domain" if $domain;
} else {
    $url = "/index.php?ver=$version" if !$domain;
    $url = "/index.php?ver=$version&domain=$domain" if $domain;
}

$sock = new IO::Socket::INET(
    PeerAddr => "$target",
    PeerPort => 'http(80)'
);

if (!$sock) {
    print "Connect failed\n\n";
    exit(1);
}

$sock->autoflush(1);

$sock->print("GET $url HTTP/1.0\r\n");
$sock->print("User-Agent: eDNS.pl $version\r\n");
$sock->print("Host: $target\r\n");
$sock->print("Authorization: Basic $pass\r\n\r\n");

@result = $sock->getlines();

undef $sock; #Close the socket

$result = join '', @result;
#print $result; #uncomment for debugging information
$result =~ m/Exit Code: (\d+)/i;
$code = $1;

if ($code eq "0" and $myip) {
    print "Succeeded in setting domain to $myip.\n";
    exit(0);
} elsif ($code eq "0" and !$myip){
    print "Succeeded in setting domain to current ip address\n";
    exit(0);
} else {
    print "Received Exit Code $code, probably failed.\n";
    exit(1);
}

sub usage {
        print "Usage: eDNS.exe -u username -p password -ip IP_Address -d domain\n";
        print "Or   : eDNS.exe -u username -p password -d domain\n";
    print "Or   : eDNS.exe -u username -p password\n";
        exit(1);
}

Under Funplug, I keep getting "/mnt/HD_a2/fun_plug.d/bin/sh: eDNS.pl: not found" I;ve put the script outlined on "/mnt/HD_a2/ edns.pl"

This script is basically to upldate Dynamic Dns Ip to everydns.net.

Any help and pointers would be much appreciated.

Thanks!

Offline

 

#2 2008-03-06 05:42:39

mig
Member
From: Seattle, WA
Registered: 2006-12-21
Posts: 532

Re: DNS-323 runing everydns Perl Script?

The D-Link firmware does not come with a perl interpreter.
You can chroot to Debian and get a per interpreter or
try to cross compile 'perl' for the arm processor.

Serch the archives there has been some work
done with perl before 
http://dns323.kood.org/forum/t1299-Perl.html

Last edited by mig (2008-03-06 05:43:06)


DNS-323 • 2x Seagate Barracuda ES 7200.10 ST3250620NS 250GB SATAII (3.0Gb/s) 7200RPM 16MB • RAID1 • FW1.03 • ext2 
Fonz's v0.3 fun_plug http://www.inreto.de/dns323/fun-plug

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB