找回密码
 立即注册
搜索
查看: 3686|回复: 13

[网络] 蹭网不用死全家了

[复制链接]
     
发表于 2013-4-24 09:32 | 显示全部楼层 |阅读模式





IPtables is Fun!

Suddenly everything is kittens! It's kitten net.
/sbin/iptables -A PREROUTING -s 192.168.0.0/255.255.255.0 -p tcp -j DNAT --to-destination 64.111.96.38

For the uninitiated, this redirects all traffic to kittenwar.

For more fun, we set iptables to forward everything to a transparent squid proxy running on port 80 on the machine.
/sbin/iptables -A PREROUTING -s 192.168.0.0/255.255.255.0 -p tcp -m tcp --dport 80 -j DNAT --to-destination 192.168.0.1

That machine runs squid with a trivial redirector that downloads images, uses mogrify to turn them upside down and serves them out of its local webserver.
The redirection script
#!/usr/bin/perl
$|=1;
$count = 0;
$pid = $$;
while (<>) {
        chomp $_;
        if ($_ =~ /(.*\.jpg)/i) {
                $url = $1;
                system("/usr/bin/wget", "-q", "-O","/space/WebPages/images/$pid-$count.jpg", "$url");
                system("/usr/bin/mogrify", "-flip","/space/WebPages/images/$pid-$count.jpg");
                print "http://127.0.0.1/images/$pid-$count.jpg\n";
        }
        elsif ($_ =~ /(.*\.gif)/i) {
                $url = $1;
                system("/usr/bin/wget", "-q", "-O","/space/WebPages/images/$pid-$count.gif", "$url");
                system("/usr/bin/mogrify", "-flip","/space/WebPages/images/$pid-$count.gif");
                print "http://127.0.0.1/images/$pid-$count.gif\n";

        }
        else {
                print "$_\n";;
        }
        $count++;
}

Then the internet looks like this!


太高端了
回复

使用道具 举报

头像被屏蔽
发表于 2013-4-24 09:50 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

发表于 2013-4-24 10:31 | 显示全部楼层
全s1只有我不是码农系列

----发送自 STAGE1 App for Android.
回复

使用道具 举报

发表于 2013-4-24 10:33 | 显示全部楼层
看到图了,不过现在的显卡不是都带画面旋转功能吗,设个快捷键反转过来看完了再转回去不就行了

----发送自 STAGE1 App for Android.
回复

使用道具 举报

头像被屏蔽
     
发表于 2013-4-24 18:28 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

     
发表于 2013-4-24 18:35 | 显示全部楼层
咋一看像C仔细一看不是。。。
这是啥?

----发送自 STAGE1 App for Android.
回复

使用道具 举报

发表于 2013-4-24 19:20 | 显示全部楼层
引用第4楼ramiel1于2013-04-24 18:28发表的  :
人家蹭网只是下崽用的
那就限制速度到5k
回复

使用道具 举报

     
发表于 2013-4-24 19:42 | 显示全部楼层
flickr这界面有年头了吧
回复

使用道具 举报

     
发表于 2013-4-24 20:04 | 显示全部楼层
引用第5楼帕米克楠波特于2013-04-24 18:35发表的  :
咋一看像C仔细一看不是。。。
这是啥?

----发送自 STAGE1 App for Android.
#!/usr/bin/perl
回复

使用道具 举报

头像被屏蔽
     
发表于 2013-4-24 20:35 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

     
发表于 2013-4-25 03:19 | 显示全部楼层
是不是要个高端路由才行?
回复

使用道具 举报

     
发表于 2013-4-25 09:29 | 显示全部楼层
用iptables的NAT转发,那岂不是要求这linux充当软路由?
回复

使用道具 举报

发表于 2013-4-25 09:46 | 显示全部楼层
squid是个好东西
回复

使用道具 举报

     
发表于 2013-4-25 09:58 | 显示全部楼层
引用第11楼xinxinran于2013-04-25 09:29发表的  :
用iptables的NAT转发,那岂不是要求这linux充当软路由?
很多能刷wrt固件的路由
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|上海互联网违法和不良信息举报中心|网上有害信息举报专区|962110 反电信诈骗|举报电话 021-62035905|Stage1st ( 沪ICP备13020230号-1|沪公网安备 31010702007642号 )

GMT+8, 2025-9-11 21:09 , Processed in 0.121636 second(s), 7 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表