存档
最近,使用公司虚拟主机的客户老是抱怨网站被挂马,服务器安全方面我认为是没有问题的,问题只有可能出现在ftp上。查看服务器日志,果然没错,近期有大量的ftp登录失败的日志。
原因找到了,看看到底是那些空间出现了问题。于是模仿攻击这的方式,用php写的ftp猜解工具,今天测试了一下,结果让人触目惊心啊。考虑再三,本工具还是一改我往常的作风,不公开源代码了,原因嘛~太危险了,本工具一个小时能检测1800(我测试的服务器机房线路比较好,所以速度很快)个站点左右,出现安全隐患的竟然能达到300个站点左右,出现问题的站点竟然能占到1/6,如果被非法份子利用,跑10个小时,可能就有3000个站点遭殃了。
简单说一下功能,php 5.0开发的,
1、首先载入页面框架,提示输入一个域名
2、得到该服务器上的站点,调用myip.cn上的同服务器站点,返回列表。使用了easytemplate框架。
3、根据2的列表,依次执行猜解工作。每次猜解完一条信息,通过ajax返回工作进度,暂停0.5秒继续猜解。
猜解字典可自定义,一下密码均可被猜出:
同FTP名
域名去掉.(比如域名:www.baidu.com 密码为wwwbaiducom,baiducom)
123,1234,12345,123456,1234567,12345678,123456789,5201314,1314520,987654321,54321,88888888,000,0000,001,002,007,008,10th,1st,2nd,3rd,4th,5th,6th,7th,8th,9th,100,101,108,133,163,166,188,233,266,350,366,450,466,136,137,138,139,158,168,169,192,198,200,222,233,234,258,288,300,301,333,345,388,400,433,456,458,500,555,558,588,600,666,598,668,678,688,888,988,999,1088,1100,1188,1288,1388,1588,1688,1888,1949,1959,1960,1961,1962,1963,1964,1965,1966,1967,1968,1969,1970,1971,1972,1973,1974,1975,1976,1977,1978,1979,1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1997,1999,2000,2001,2002,2088,2100,2188,2345,2588,3000,3721,3888,4567,4728,5555,5678,5888,6666,6688,6789,6888,7788,8888,8899,9988,9999,23456,34567,45678,88888,654321,888888,6666,56789,1234567,12345678,737,777,1111,2222,3333,4321,computer,cpu,memory,disk,soft,y2k,software,cdrom,rom,admin,master,card,pci,lock,ascii,knight,creative,modem,internet,intranet,web,www,isp,unlock,ftp,telnet,ibm,intel,microsoft,dell,compaq,toshiba,acer,info,aol,56k,server,dos,windows,win95,win98,office,word,excel,access,unix,linux,password,file,program,mp3,mpeg,jpeg,gif,bmp,billgates,chip,silicon,sony,link,word97,office97,network,ram,sun,yahoo,excite,hotmail,yeah,sina,pcweek,mac,apple,robot,key,monitor,win2000,office2000,word2000,net,virus,company,tech,technology,print,coolweb,guest,printer,superman,hotpage,enter,myweb,download,cool,coolman,coolboy,coolgirl,netboy,netgirl,log,login,connect,email,hyperlink,url,hotweb,java,cgi,html,htm,home,homepage,icq,mykey,c++,basic,delphi,pascal,anonymous,crack,hack,hacker,chinese,vcd,chat,chatroom,mud,cracker,happy,hello,room,english,user,netizen,frontpage,agp,netwolf,usa,hot,site,address,mail,news,topcool
又好久没有更新日志了,上次谈到将工作用的脚本换成php,现在发现这是一个非常非常明智的选择。
在Linux也可以直接用php当作脚本,处理工作的事情。也算是“跨平台脚本”咯~~~
今天说一下JS压缩,呵呵,这种工具我可写不出来,但是网上牛人已经帮我们写出了相应的类:JavaScriptPacker(http://creativecommons.org/licenses/LGPL/2.1/)
我们直接调用就可以咯,比如将test_resource.js压缩成test.js。
<?php
#demo.php
require_once ‘class.JavaScriptPacker.php’;
$packer = new JavaScriptPacker(file_get_contents("./test_resource.js"), ‘Normal’, true, false);
file_put_contents("./test.js",$packer->pack());
?>
直接 php demo.php
最近准备放弃使用许久的vbscript作为处理工作方面问题,而转向PHP。
应该是ASP转向PHP把,怎么是vbscript转向php?这个我要说一下,处理工作方面问题,比如通过API导个数据…用ASP,PHP在IIS中执行肯定不行,写个VBScript脚本,cscript 脚本名 让他执行吧,别的不用关了。所以用脚本处理些数据转换、导入导出还是不错的选择。
VBScript的致命的缺点是不支持引用文件,对HTTP请求方便不是很强,正则、XML处理起来不方面,JSON作为数据载体时就等着傻眼把。这是后用php作为脚本也是一个不错的选择。扯得有点远了,换成了php,数据库还是Access怎么办?这个简单,直接用com创建adodb实例即可。
现在已经创建好了数据库,只填写了部分域名,要通过php到域名查询接口返回whois信息,并存到Access数据库中,Access字段名已对应返回数组中的索引相同。
<?php
set_time_limit(0);
#因为要链接web,使用我前几天写的myhttp类。
include(‘myhttp.clsss.php’);
#API操作,这里直接忽略,里边有个get_domain_info来获取API返回的数据,并处理成数组。
include(‘api.function.php’);
$conn = new COM("Adodb.Connection");
$conn -> open("provider=microsoft.jet.oledb.4.0;data source=D:\myweb\miaoqiyuan.cn\test\php-linkdb\domain.mdb");
$dlist = new COM("ADODB.Recordset");
$rs = new COM("ADODB.Recordset");
$dlist -> open("select [domain],[did] from [domain] where isupdate=0",$conn,1,1);
while(!$dlist -> eof()){
echo "下载域名数据[".$dlist['domain']."].\n";
$d=get_domain_info($dlist['domain']);
$rs -> open("select * from [domain] where did=".$dlist['did'],$conn,3,2);
foreach($rs -> fields as $k => $v){
if($k >= 6){
$myvalue = [...]
最近一直在写淘宝客的程序,因为网络的原因,file_get_contents经常读取出错,想到了比较稳定的方法,使用fsockopen连接API。fsockopen 函数在网上介绍的还是很多的,但是介绍再多,创建http请求仍然是一件比较麻烦的。
fsockopen调用的方法比较繁琐,要使用得到的数据还要去掉http头,所以冒出了写一个通用的类的方法。今天正好是51假日,在家写了这种的一个类。
<?php
/*
CatSeven myHttp Vesion 0.1
======CopyRight======
Home:http://www.myw3.cn/myDevise/myHttp/
Design:Miao Qiyuan[miaoqiyuan.cn]
Downloads:http://downloads.myw3.cn/file=myDevise/myHttp/0.1
*/
class myHttp{
public $Method,$URI,$SendDate;
public $HttpServerPort,$HttpServer,$HttpServerIP;
public $Err,$ErrStr;
public $timeout;
public $responseText;
public function __construct($uri=’/',$method=’get’,$query=”,$server=’localhost’,$port=’80′,$serverip=”,$timeout=30){
$this->URI=$uri;
$this->Method=$method;
$this->SendDate=$query;
$this->HttpServer=$server;
$this->HttpServerPort=$port;
$this->HttpServerIP=$serverip;
if(is_numeric($timeout))$this->timeout=$timeout;
}
public function send(){
$this->Method=strtoupper($this->Method);
if($this->HttpServerIP=="")$this->HttpServerIP = $this->HttpServer;
if($this->Method=="GET" && strstr($this->URI,"?")==0)$this->URI=$this->URI."?".$this->SendDate;
$sock = fsockopen($this->HttpServerIP,$this->HttpServerPort,$errno,$errstr,$this->timeout);
if(!$sock){
$this->ErrStr=$errstr;
$this->Err=$errno;
die("无法打开".$this->HttpServerIP.":".$this->HttpServerPort);
}
fwrite($sock, $this->Method." ".$this->URI." HTTP/1.0\r\n");
fwrite($sock, "Host: ".$this->HttpServer."\r\n");
if($this->Method=="POST"){
fwrite($sock, "Content-type: application/x-www-form-urlencoded\r\n");
fwrite($sock, "Content-length: ".strlen($this->SendDate) . "\r\n");
fwrite($sock, "Accept: */*\r\n");
fwrite($sock, "\r\n");
fwrite($sock, $this->SendDate."\r\n");
fwrite($sock, "\r\n");
fwrite($sock, "Referer: http://www.myw3.cn/myDevise/myHttp/");
}
fwrite($sock, "Connection: Close\r\n\r\n");
$headers = "";
while ($str = trim(fgets($sock,4096)))
$headers .= "$str\n";
$body = [...]
因为数据库部分我已经写过一篇文章:给dedeims添加在线支付的功能之数据库设置,本文以该文章的数据库为准来写,如果没看过此文的网友,可以通过http://www.miaoqiyuan.cn/p/dedeims-online-pay来查看。
首先在dedeeims的会员面板中添加在线支付的链接。很简单,在menu中添加:
<li>
<h4 class=”sort”><a class=”icon par” href=”../member/pay.php”> < ?php echo GetLang('pay'); ?> </a></h4>
</li>
然后在语言文件/include/lang/下相应的语言文件中添加上对应的文字描述。
因为网银有很多,支付接口也很多,我们用的时候可能要添加多个接口,所以我们要做一个网银配置脚本:bank_config.php
< ?php
$bank_List=Array(
'网银在线'=>‘chinabank’
);
?>
首先来说dedeeims在线支付的前台,很简单。pay.php,一个简单的表单,这里不再详述,代码如下:
<form class="mTB10 mL10 mR10" name="form2" action="bank.php" method="post" target="_blank">
<table cellspacing="1" class="submit">
<tbody>
<tr>
<td style="text-align:right;">支付接口:</td>
[...]
在织梦的论坛上看到好几篇关于自定义dedeeims的路径,不让dedeeims产品页生成静态之类的求助信息。确实,dedeeims的产品路径还带有日期,如果动态的路径,整站到再/plus/下,感觉特别不爽,今天我就给修改一下。
首先让我们感觉不爽的就是/plus/list.php?tid=这种路径作为频道(栏目,分类页),感觉特别不爽,我们就先从它下手。打开include\channelunit.func.php,找到//$reurl = $GLOBALS['cfg_phpurl'].”/list.php?tid=”.$typeid;,直接修改成$reurl = “/class.php?id=”.$typeid;这样,所有的分类页就变成了/class.php?id=…的形式了。在根目录建立一个class.php,内容如下:
< ?php
$tid=$_GET['id'];
require_once(‘plus/list.php’);
?>
很简单吧,下面修改产品展示页路径为product.php,阅读新闻页为news.php。
找到include\channelunit.func.php,function GetFileUrl($aid,$typeid,$timetag,$title,$ismake=0,$rank=0,$namerule=”,$typedir=”, $filename=”),假设产品分类为4,10,新闻分类为3,9。直接添加上如下代码:
< ?php
if($typeid==4||$typeid==10)
return ‘/product.php?product_id=’.$aid;
elseif($typeid==3||$typeid==9)
return ‘/news.php?id=’.$aid;
else
return ‘/plus/view.php?aid=’.$aid;
?>
其他情况就是默认路径了。当然也可以改成/view.php?aid=…
news.php
<?php
$aid=$_GET['id'];
require_once(‘plus/view.php’);
?>
product.php
<?php
$aid=$_GET['product_id'];
require_once(‘plus/view.php’);
?>
现在前台基本就没有问题了,后台预览文件的时候,可能会出现错误,修改admin\archives_do.php代码如下:
function viewArchives()
–>>…
if(strpos($arcurl,’?')==-1)
echo "$lt;script language=’javascript’>location.href=’$arcurl"."?".time()."’;$lt;/script>";
else
echo "$lt;script language=’javascript’>location.href=’$arcurl"."&tme=".time()."’;$lt;/script>";
exit();