Posts Tagged ‘Hack’

关闭wordpress自动保存和Post Revision

Thursday, October 30th, 2008

WP中有自动保存和REVISION,这两项功能用过吗?进入phpmyadmin看着日渐肥大的数据库,实在不忍心。

1.清除post revision 进入phpmyadmin,执行以下面的SQL

DELETE FROM wp_posts WHERE post_type = "revision";

2.禁止post revison
在wp-config.php里增加一行代码

define('WP_POST_REVISIONS', false);

3.禁止自动保存
打开wordpress\wp-admin\post-new.php文件,将

wp_enqueue_script('autosave')

删除或者注释

Google自定义搜索

Sunday, October 26th, 2008


一直在为生活而奔波,博客的更新也是断断续续,想坚持做可以轻易做到的事情亦不容易。时间如海绵里的水,挤挤总会有的,但我们总是找借口为自己偷懒。上个星期把WP升级到2.62,对数据库重新优化,把每篇文章进行编辑和校正,图片全部转移的Picasa,貌似好点。界面是默认,太挑剔的我只能选它了。发现google自定义搜索引擎很不错,也就顺手安装了一个。Zeuscn.net的教程写的很详细,我说一下与改的不同的两点。

Google 自定义搜索提供的“搜索结果代码”中iframe的宽度是不能更改的,不管怎么设计总是width=600,是google的bug一只。解决方法,把“搜索结果代码”代码放在一对div中,用CSS定义样式。

 /*Style for Google Custom Search*/
#searchresult iframe { width: 470px; }
在调用google-searchform.php后发现排版在IE7下效果不是很慢意。在widgets里面直接把google-searchform加进text,还能通过鼠标拖动位置,效果更好。装完好测试一下,因为站点频繁改动结构,所以出现部份死链,等google自己去更新吧!测试一下我的GG搜索

discuz 去掉主题前面的日期

Sunday, April 30th, 2006

论坛的主题按照某人的方法 在发表主题时,前面插入日期,现在看来。这个日期插得还不科学。
详情可以参看我在dz的帖子。
http://www.discuz.net/viewthread.php?tid=281364
为了挽救下自己,于是在dz是处找帖子。
还终于给我找到了。

update cdb_threads set subject=substring(subject,10);

这个,是错误的,你们可不要用啊。不然会将你的所有的帖子。不论前面有没有时间,全部截掉10个字符

下面的才是正确的

update cdb_threads set subject=substring(subject from 11) where position(’[' in subject)=1 and position(']‘ in subject)=10

php不太懂,稍微解释下 当你的主题前面有 [06-03-02]格式的日期时,上面的sql是这样执行的。
首页在所有的主题里面寻找,当主题的第一个字符是”["第10个字符是“]” 时,截去这个主题第11位前面的字符.

我的论坛是 [04-17] 所以代码就是

update cdb_threads set subject=substring(subject from 8) where position(’[' in subject)=1 and position(']‘ in subject)=7

126邮箱小偷hack版

Saturday, March 25th, 2006

想了会,还是把这篇文章从落伍转了过来。作者落伍如如何。(以下文字引用落伍如如何)

这个程序最早是天下一号在落伍发布的,是资源共享网络小组的作品,前一段时间126.com做了一些变化导致该程序无法使用,而原作者的一直没有更新程序,因此,如如何不揣冒昧,发布一个hack版,这个版本增加了以下功能:
修正连接问题

  1. 增加多用户支持
  2. 增加负载均衡
  3. 提供如如何美化的模版

授之鱼不若授之渔,虽然以往已经有不少教程介绍如何编写小偷程序,但邮箱小偷还是比较特殊,在此我打算做一下简单讲解,以便大家可以方便的使用这个程序。(不好意思,水平比较烂,配个教程估计就会差不多了)。整个小偷程序反复利用的是这个函数:

function conn($host, $predata, $subdata) {

$text = null;
$data=”user-agent: mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.7.7) gecko/20050414 firefox/1.0.4\r\n”;
$data.=”accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9
,text/plain;q=0.8,image/png,*/*;q=0.5\r\n”;
$data.=”accept-language: en-us,en;q=0.5\r\naccept-encoding: gzip,deflate\r\naccept-charset: iso-8859-1,utf-8;q=0.7,*;q=0.7\r\n”;
$data.=”keep-alive: 300\r\nconnection: close\r\n”;

$alldata = $predata.$data.$subdata;

// print $alldata.”\n”;

$start_time = time();
$fp=@fsockopen($host, 80, $errno, $errstr, 5);
if (!$fp) {
die(”connect timeout.\n”);
} else {
socket_set_blocking($fp, true);
socket_set_timeout($fp, 5);

fputs($fp, $alldata);
while (!feof($fp)) {
$text .= fread($fp, 2000);

$diff = time() - $start_time;
if ($diff > 24) {
die(”timeout!\n”);
}

$status = socket_get_status($fp);
if ($status['timed_out']) {
die(”stream timeout!\n”);
}
}
}
fclose($fp);
return $text;
}

代码不做详细的解释,只要会用这个函数就可以了。以往写小偷一般都是用fopen()函数来打开网页进行字符串操作就可以了,而对于需要登陆的网站就会产生一些问题。因此,学会用conn这个函数对采集那些需要登陆的网站很用处。其实一般的网站也好,论坛也好,邮箱也好,说到底,都离不了http协议,因为http协议本身要求跨平台等诸多特点,所以也就复杂不到哪去,顶多就是些post get什么的。php里的fput()就是基于这个特点设计的,这个时候php就相当于浏览器,如果在加上curl库,估计所有的网站都可以用php来访问,所以不存在偷不了的网站的说法。

我们来看程序的第一部分:

/////// step.1 login ////////////////
$host = “entry.126.com”;
$predata = “post /cgi/login?hid=10010102&language=0&style=11 http/1.1\r\nhost: “.$host.”\r\n”;
$postdata = “domain=126.com&language=0&bcookie=&user=”.$user.”&pass=
“.$password.”&style=11&enter.x=%b5%c7%c2%bc%d3%ca%cf%e4″;
$subdata = “referer: http://www.126.com/\r\ncontent-type: application/x-www-form-urlencoded\r\ncontent-length: “.strlen($postdata).”\r\n\r\ndata found after header end:\r\n\r\n”.$postdata.”\r\n”;

$gettext = conn($host, $predata, $subdata);
preg_match(”/location: http:\/\/(.*?)\.mail\.126\.com.*sid=(.*)\r\n/i”, $gettext, $match1);

/////////
// array
// (
// [0] => location: http://m151.mail.126.com/cgi/ldapapp?funcid=main&sid=wayamyhpwryambzd
// [1] => m151
// [2] => wayamyhpwryambzd
// )
///////////////////////

有人要问上面的代码是什么意思,我也不好解释,你只要用嗅探软件去嗅探一下登陆信箱的过程就明白了,126这次改版主要也就是这个部分的变化,你找到以前的那个风格登陆,然后对照嗅探到的信息更改就可以了。一个网站,不论是利用cookie还是session来管理,只要你伪造这段信息就可以了。http协议没那么聪明,分不出数据是从哪里过来的。

好了,对小偷部分就解释这么多,下面讲如何使用我hack的程序。

1.如果你不需要多用户,负载均衡之类的功能
用editplus2打开程序删除48到67行,40行,44行,46行,将相应信息写好:

$user = “”; // 126.com mailbox username, exp. peter
$password = “1″; // your password.
$fid = “”; //

上传到服务器即可。

2.如果你需要本程序的功能

你确认有一个mysql数据库,假定你可以用phpmyadmin来管理,建立一个数据库,建一个表,然后建立mail,max,user,password,fid这几个列,你可以参照下面这段代码

create table `mail` (
`id` int(10) not null auto_increment,
`max` varchar(100) not null default ”,
`user` varchar(100) not null default ”,
`password` varchar(100) not null default ”,
`fid` varchar(100) not null default ‘0′,
primary key (`id`),
unique key `user` (`user`)
) type=myisam auto_increment=1 ;

解释一下,user是126的信箱名,password是密码,fid是你存放信件的文件夹的id,max表示user的数目减1。比如插入下面一句:

insert into `mail` values (‘’, ‘1′, ‘miez;mz2′, ‘zh313′, ‘1128410070;1134987011′);

这里放了两个帐号miez和mz2,用分号隔开,密码zh313,两个帐号密码一样(必须),文件夹为1128410070和1134987011,这样的话,你访问时可以轮换访问两个帐号,如果你放的下载文件相同的话,就可以实现负载均衡。如果你申请更多的密码相同的邮箱,只要把帐号用;隔开。

注意,程序的55行也要改

$sql = “select user,max,password,fid from mail where id =’”.$id.”‘ “;

mail改为你建的表名.

有人问id有什么用,这就是为实现多用户准备的。每个id对应一个帐号,在访问是加?id=x
可以访问到相应的帐号。找fid的软件可以用wpe 或 wse,都不错
不明白在下面跟贴吧,程序简陋,有待完善,不过基本上个人用是没问题的。请看演示:
http://www.veryhd.com/download/
程序下载  126_veryhd.rar
本站演示 http://www.bearlet.com/126/

作者网站已经不提供演示,本站下载在经过几次转移和换域名后也中断了。
现在重新提供下载(2008-10-6)
http://www.xxlog.com/attach/1/8495138711.rar

网易163相册防盗链破解程序Asp版

Wednesday, March 22nd, 2006

用163相册的都知道,空间无限,速度飞快。但是同时也限制了外部调用图版,比如贴图。在相册里面看是好好的,但是一贴到论坛上或者是别的地方,基本上都是出现一个红叉叉。这个程较好的解决此问题。先来看一张演示。
这是来至163的图片源址,是不是只看到一个红叉叉。

再来看同一个地址经过本程序调用后的演示。

怎么样,看到了图片了吧。
同一张图片,第二张的不同之处是在图片源址前面加上了一个url
http://c.1asphost.com/freeher/1.asp?url=
在所有的163相册的图片前面加上上面的url即可实现照片外部调用。下面是程序的asp代码

<%
‘盗链判断
‘if instr(request.servervariables(”http_referer”),”http://”&request.servervariables(”server_name”)&”") = 0 then
‘response.write “非法链接”
‘response.end
‘end if

dim url, body, mycache

url = request.querystring(”url”)

set mycache = new cache
mycache.name = “picindex”&url
if mycache.valid then
body = mycache.value
else
body = getwebdata(url)
mycache.add body,dateadd(”d”,1,now)
end if

if err.number = 0 then
response.charset = “utf-8″
response.contenttype = “application/octet-stream”
response.binarywrite body
response.flush
else
wscript.echo err.description
end if

‘取得数据
public function getwebdata(byval strurl)
dim curlpath
curlpath = mid(strurl,1,instr(8,strurl,”/”))
dim retrieval
set retrieval = server.createobject(”microsoft.xmlhttp”)
with retrieval
.open “get”, strurl, false,”",”"
.setrequestheader “referer”, curlpath
.send
getwebdata =.responsebody
end with
set retrieval = nothing
end function

‘cache类

class cache
private obj ‘cache内容
private expiretime ‘过期时间
private expiretimename ‘过期时间application名
private cachename ‘cache内容application名
private path ‘url

private sub class_initialize()
path=request.servervariables(”url”)
path=left(path,instrrev(path,”/”))
end sub

private sub class_terminate()
end sub

public property get blempty
‘是否为空
if isempty(obj) then
blempty=true
else
blempty=false
end if
end property

public property get valid
‘是否可用(过期)
if isempty(obj) or not isdate(expiretime) then
valid=false
elseif cdate(expiretime)<now then
valid=false
else
valid=true
end if
end property

public property let name(str)
‘设置cache名
cachename=str & path
obj=application(cachename)
expiretimename=str & “expires” & path
expiretime=application(expiretimename)
end property

public property let expires(tm)
‘重设置过期时间
expiretime=tm
application.lock
application(expiretimename)=expiretime
application.unlock
end property

public sub add(var,expire)
‘赋值
if isempty(var) or not isdate(expire) then
exit sub
end if
obj=var
expiretime=expire
application.lock
application(cachename)=obj
application(expiretimename)=expiretime
application.unlock
end sub

public property get value
‘取值
if isempty(obj) or not isdate(expiretime) then
value=null
elseif cdate(expiretime)<now then
value=null
else
value=obj
end if
end property

public sub makeempty()
‘释放application
application.lock
application(cachename)=empty
application(expiretimename)=empty
application.unlock
obj=empty
expiretime=empty
end sub

public function equal(var2)
‘比较
if typename(obj)<>typename(var2) then
equal=false
elseif typename(obj)=”object” then
if obj is var2 then
equal=true
else
equal=false
end if
elseif typename(obj)=”variant()” then
if join(obj,”^”)=join(var2,”^”) then
equal=true
else
equal=false
end if
else
if obj=var2 then
equal=true
else
equal=false
end if
end if
end function
end class
%>

将上面的文件另存为 showpic.asp,调用图片的时候以
http://www.abc.com/showpic.asp?url=http://img190.photo.163.com/cnparis_008/17601031/528527127.jpg 格式调用。showpic.asp的文件名可以任意更改,调用的时候注意不要用错名字就是了。

目前好像php的还没有公布(听说出来了),只好将就用下asp版的了。没有asp空间自己去网上申请吧。多去新视听找下(myand.com)。我用的是1asphost.com的空间(需要代理申请)