Jul 30

支持 SOCKS5 代理的:DNS2SOCKS

http://sourceforge.net/projects/dns2socks/

dns2socks.jpg

支持 HTTPS (HTTP CONNECT)代理的: DESPROXY-DNS

http://desproxy.sourceforge.net/

dns2https.jpg

能用在什么场合,想用的人自然知道,不多说了。 :evil:

Tags: , ,

Aug 12

iptables -N dnsfilter -t mangle
iptables -t mangle -I dnsfilter -p udp -m udp -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0x042442b2,0x0807c62d,0x253d369e,0x2e52ae44,0x3b1803ad,0x402158a1,0x4021632f,0x4042a3fb,0x4168cafc,0x41a0db71" -j DROP
iptables -t mangle -I dnsfilter -p udp -m udp -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0x422dfced,0x480ecd63,0x480ecd68,0x4e10310f,0x5d2e0859,0x80797e8b,0x9f6a794b,0xa9840d67,0xc043c606,0xca6a0102" -j DROP
iptables -t mangle -I dnsfilter -p udp -m udp -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0xcab50755,0xcb620741,0xcba1e6ab,0xcf0c5862,0xd0381f2b,0xd1244921,0xd1913632,0xd1dc1eae,0xd35e4293,0xd5a9fb23" -j DROP
iptables -t mangle -I dnsfilter -p udp -m udp -m u32 --u32 "0&0x0F000000=0x05000000 && 22&0xFFFF@16=0xd8ddbcb6,0xd8eab30d,0xf3b9bb27,0x4a7d7f66,0x4a7d9b66,0x4a7d2771,0x4a7d2766,0xd155e58a" -j DROP
iptables -t mangle -I PREROUTING -m udp -p udp --sport 53 -j dnsfilter

适用于基于 Linux 系统的路由器,Tomato,DD-WRT,OpenWRT 等,把脚本丢到路由器启动脚本里面即可。 :evil:


Dec 04

LiteServe 是一款强大的综合服务器,小小一个软件同时支持充当 Web,FTP,Mail,Telnet 服务器,而且通过 ISAPI 扩展,它的 Web 服务器还可以支持 PHP,MySQL,Perl 等主流的动态编程语言,配搭上内置的动态的域名更新支持,专业的 FTP 支持以及电子邮件,终端操作,LiteServe 简直就是一个虚拟服务器提供商嘛~

Serva 看起来更加强大,1M 左右(32 位的只有 700 多 K)的大小,居然同时支持充当 HTTP,FTP,TFTP,DHCP, proxyDHCP, DNS, SNTP, SYSLOG 服务器!还可以作为 TFTP 客户端使用~!

Serva 是用 C/C++ 编写的多线程程序,可以很好的工作在 Windows 2000 - Windows 7 下,不需要管理员权限,不需要安装,不写注册表。



Nov 21

不多介绍了,又一个可以通过 TCP 来实现 DNS 查询的小软件,作者主页

软件很轻巧,才 10 K,初步测试,速度很不错,晚上再用迅雷和 BT 考验一下它(UnboundPWX-DNS-Proxy 在长期 DNS 重负载查询下都会瘫痪)。

2011.12.2:两天重荷 BT 下依然稳如泰山~

2011.01.11 : 更新 2.0 版本

DNS 转发器
可以将 UDP 形式的 DNS 数据包,以 TCP 形式转发至指定的 DNS 服务器(默认为 Google DNS 8.8.4.4)。
因为听说 TCP 的 DNS 数据包不会被污染,于是做了这么个玩意,省得改系统文件了。

文件列表:
dnsforwarder.exe 主程序文件

使用方法:
直接打开 dnsforwarder.exe,如果没有自动退出,最小化就可以了。然后将系统的 DNS 设置为 127.0.0.1。
可能还需要重新连一下网。

在命令提示符中执行 “nslookup www.google.com 127.0.0.1”可以看到效果。

命令行 : dnsforwarder.exe [参数] [DNS服务器地址].
[参数] 区分大小写,可以为以下零个或多个,不限顺序。
-q 安静模式。不显示任何信息
-t 在本地开启TCP (默认关闭).
-la 指定本地监听IP (默认为 127.0.0.1).
-lp 指定本地监听端口为 (默认为 53).
-sp 指定服务器端口为 (默认为 53).


Tags: , ,

Oct 23

这个脚本功能很简单,如果你有境外 PHP 主机空间,利用这个脚本可以查询到被 DNS 污染的一些站点的真实 IP 。缓存的结果可以直接拷贝到系统 Hosts 文件中使用,也可以转换为 Unbound 的 localzone 格式供 Unbound 调用。hosts.txt 中包含需要查询的站点主机名,一行一个,ipcache.txt 则为查询结果缓存文件,标准的 Windows 系统 Hosts 文件格式。

可以到本站: gethosts 页面体验效果。


<?php
/**
 * gethosts
 *
 * @link       https://www.quakemachinex.com/gethosts/
 * @copyright  Copyright (c) 2011 AvP
 * @license    MIT Style License
 * @version    1.0
 */

$hostsLock = true; //用户提交的查询数据是否写入 hosts.txt,默认:不写入

$isPost = false;

if (isset($_POST['hosts'])){
    $hosts_txt = $_POST['hosts'];
    $isPost = true;
	if (!$hostsLock) file_put_contents('hosts.txt',$hosts_txt);
} else {
	$hosts_txt = file_get_contents('hosts.txt');
}
$hosts_array = preg_split('/[\s,]+/', $hosts_txt, -1, PREG_SPLIT_NO_EMPTY);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>gethosts</title>
<script src="ZeroClipboard.js" type="text/javascript"></script>
<script type="text/javascript">
//类似 PHP 中的 trim
    function trim(str) {
        var str = str.replace(/^\s\s*/, ''),
            ws = /\s/,
            i = str.length;
        while (ws.test(str.charAt(--i)));
        return str.slice(0, i + 1);
    }
//基于 ZeroClipboard 的跨浏览器复制到剪贴板
    function ctoc() {
        var txt = document.getElementById('hostsMap').value;

        if (window.clipboardData) {
            window.clipboardData.setData("text", txt);
            alert("Copied text to clipboard:\n" + txt);
        } else {
            var clip = new ZeroClipboard.Client();
            clip.glue('clickme');
            clip.setText(txt);
            clip.addEventListener('complete', function(client, text) {
                alert("Copied text to clipboard:\n" + text);
            });
            }
    }
//转换 Hosts 文件格式到 Unbound 的 localzone 格式
    function htol() {
        var i;
        var localz = new Array();
        var hosts = document.getElementById('hostsMap').value;
        var localzs='';
        hostdomain = hosts.split("\n");
        for (i=0;i<hostdomain.length;i++) {
            if (trim(hostdomain[i]) != '') {
                localz[i] = hostdomain[i].split("\t");
                localzs += 'local-data: "'+localz[i][1]+' A '+localz[i][0]+'"\n';
            }
        }
        document.getElementById('hostsMap').value = localzs;
    }
</script>
</head>
<body>
<?php
//判定字符串是否是 IP 地址
function IsIPAdress($value){

    if (preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $value)){
        return true;
    }
    return false;
}
//获取真实 IP,并且缓存,用户提交数据不缓存
function getRealIP(){
    global $hosts_array, $isPost;
    if($isPost) {
        foreach($hosts_array as $hostname){
            $ip = gethostbyname($hostname);
            if (IsIPAdress($ip)) {
                $i = $i + 1;
                echo "$ip\t$hostname";
                echo "\n";
                if ($i > 25) return;
            }
        }
    } else {
        $cache_days = 1; //缓存多少天
        $fz = filesize('ipcache.txt');
        $ipcache_create_time = filectime('ipcache.txt');
        $time_now = date("Y-m-d H:i:s");
        $ipcache_stay_days = (strtotime($time_now)-strtotime(date("Y-m-d H:i:s",$ipcache_create_time)))/86400;
        $ipcache_stay_days = floor($ipcache_stay_days);

        if ($fz && $fz != 0 && $ipcache_stay_days < $cache_days) {
            $ipcache = file_get_contents('ipcache.txt');
            echo $ipcache;
         } else {
            foreach($hosts_array as $hostname){
                $ip = gethostbyname($hostname);
                if (IsIPAdress($ip)) {
                    $ipcacheall .= "$ip\t$hostname\n";
                }
            }
            $local_ipcache = 'ipcache.txt';
            $local_ipcache_actual = fopen($local_ipcache, 'w+');
            fwrite($local_ipcache_actual, $ipcacheall);
            fclose($local_ipcache_actual);
            $ipcache = file_get_contents('ipcache.txt');
            echo $ipcache;
         }
     }
}
?>
    <div style="width:1024px; margin:0 auto;">
        <div style="float:left;margin:0 10px;">
            <h2>Blocked Hostnames</h2>
            <form method="post">
                <button type="submit" style="margin: 5px auto; display: block;">Get Hosts</button>
                <textarea name="hosts" style="width:400px;height:550px;margin:0;padding:3px;display:block;"><?php echo $hosts_txt;?></textarea>
            </form>
        </div>
        <div style="float:left;margin:0 10px;">
            <h2>hosts</h2>
            <div style="margin: 5px auto; display: block;">
            <button type="button" id="clickme" onclick="ctoc();">CopyToClipboard(Click Twice!)</button>
            <button type="button" id="hosttolocal" onclick="htol();">ConventerToLocalzone</button>
            </div>
            <textarea id="hostsMap" onclick="this.focus();this.select()"style="width:500px;height:550px;margin:0;padding:3px;display:block;"><?php getRealIP(); ?></textarea>
        </div>
    </div>
</body>
</html>

ZeroClipboard 可到官方下载。 :!:


[3/5]  < 1 2 3 4 5 >