论坛: 编程破解 标题: ChinaDNS|ADSLPPP|Dynamic-IPDNS 复制本贴地址    
作者: xiean [xiean]    论坛用户   登录
用于ChinaDNS注册过域名,并拥有MyDNS的用户想在BSD或其它*nix系统上实现动态域名指向的代码

代码:

#!/usr/bin/perl
# ChinaDNS | ADSL PPP | Dynamic-IP DNS.
# File: ./xa-dns
# Author: xiean [2003-06-10]
# OS: FreeBSD 4.x
# PKG: Need for openssl
#               p5-libwww
#               p5-IO-Socket-SSL
# USAGE: modify /etc/ppp/ppp.linkup, add this line.
# [your ppp system]:
#  iface clear
#  !bg /path/to/xa-dns MYADDR
#
# e.g: if you use cmdline 'ppp -ddial -nat pppoe', that's
# pppoe:
#  iface clear
#  !bg /path/to/xa-dns MYADDR


use strict;
use LWP;
use HTTP::Request::Common;

# Domain Login Form.
# [Domain] = Domain, [Suffix] = .net or .com or [...], [Password] = Domain Password
use constant ChinaDNS_Login => 'https://www.paycenter.com.cn/cgi-bin/nEWpAYcENTER/Domain/DomainLogin';

# Get Session, and go to MyDNS page.
use constant ChinaDNS_MyDNS => 'http://www.paycenter.com.cn/cgi-bin/udns?Number=1&';

# Get Domain old IP, mystring, mystring2 and post form to modify url.
# [hostname] = 'soho.xiean.net' or [...], [oldhostip], [newhostip] = $My_ADSL_IP, [action] = 'modifyhost', 
# [DomainName] = 'xiean.net', [mystring], [mystring2]
use constant MyDNS_Modify => 'http://mydns.chinadns.com/cgi-bin/mydnsinfo.cgi';

my $Domain = 'xiean'; # modify this to your domain's name.
my $Suffix = '.net'; # modify this to your domain's suffix. (.com|.net|.org|.com.cn|.....)
my $Domain_Key = '********'; # This is your domain's passwd, you can get it from
                             # http://www.chinadns.com member area. e.g: 'a1b2c3d4'
my @Host = ('soho.xiean.net'); # Put in you want to modify domain.
                               # e.g: @Host = ('xiean.net', 'test1.xiean.net', 'test1.xiean.net', '.....')

my $My_ADSL_IP = shift;

my $ua = LWP::UserAgent->new;
$ua->agent('Mozilla/4.7 [en] (PalmOS)');

# Modify ChinaDNS.com > MyDNS > @Host Dynamic-IP DNS.
# Step 1
my $request = POST(ChinaDNS_Login, Content => [ Domain => $Domain, Suffix => $Suffix,
Password => $xiean_net_Key], Referer => 'http://www.paycenter.com.cn/');

my $response = $ua->request($request);
die $response->message unless $response->is_success;

my $content = $response->content;
$content =~ /(Session=\d+)/g;
my $SessionID = $1;

# Step 2
my $request = GET(ChinaDNS_MyDNS . $SessionID, Referer => 'http://www.paycenter.com.cn/');

my $response = $ua->request($request);
die $response->message unless $response->is_success;

my $content = $response->content;
# modify soho\.xiean\.net to you want to modify domain. e.g: xiean\.20cn\.com
$content =~ /'soho\.xiean\.net'\,'(\d+\.\d+\.\d+\.\d+)'/g;
my $OldIP = $1;
$content =~ /\"mystring\" type=\"hidden\" value=\"(\w+)\">/g;
my $mystring = $1;
$content =~ /\"mystring2\" type=\"hidden\" value=\"(\d+)\">/g;
my $mystring2 = $1;

# Step 3
while(my $Host = shift(@Host)) {
my $request = POST(MyDNS_Modify, Content => [ hostname => $Host, oldhostip => $OldIP,
newhostip => $My_ADSL_IP, action => 'modifyhost', DomainName => $Domain . $Suffix,
mystring => $mystring, mystring2 => $mystring2 ], Referer => 'http://www.paycenter.com.cn/');

my $response = $ua->request($request);
die $response->message unless $response->is_success;

my $content = $response->content;
}


1;



地主 发表时间: 07/06 02:12

回复: xiean [xiean]   论坛用户   登录
这儿换行,还有标题空格过滤了,老大解决一下吧,这样可读性太差

B1层 发表时间: 07/06 02:14

回复: NetDemon [netdemon]   ADMIN   登录
对不起,因为程序没办法判断换行空格等等到底是故意捣蛋,还是正常用途,只好本着宁可错杀一百决不放过一个的原则,统统过滤。如想不用过滤,请投入更大的精力积极参加我国的精神文明建设,提高人民素质

B2层 发表时间: 07/06 22:16

回复: changfeng [changfeng]   论坛用户   登录
虽然我不懂SHELL的编程,但是还是要看看!

B3层 发表时间: 07/10 09:55

论坛: 编程破解

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号