Posted by amxku on 2008-11-09, 23:38 . 技术相关
- <?php
- /******************************************************************
- Check MD5(md5sum for php)
- 2008-11-09
- amxku.net
-
- 校验文件的准确性.
- 在网站被入侵后,检查文件的准确性。
-
- *UIX下可以用md5sum * >md5sum 来得到所有文件的md5值,然后把两次得到的
- MD5值来进行对比。
-
- 在代码检查方面那么有一丁点用处,别的没什么用。
- ******************************************************************/
- echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>';
- echo '<title>Check MD5(md5sum for php)</title>';
- check_md5(".");
-
- function check_md5($directory){
- $check_md5_dir = @opendir($directory);
- echo '<ul>';
- while ($file = @readdir($check_md5_dir)) {
- if ($file != "." && $file != "..") {
- if(is_dir("$directory/$file")){
- echo '<li><strong>'.$file.'</strong></li>';
- tree("$directory/$file");
- }else{
- echo '<li>'.$file.' ==> '.md5_file("$directory/$file").'</li>';
- }
- }
- }
- echo '</ul>';
- closedir($check_md5_dir);
- }
- ?>
Tags: php, 安全, 审计, 代码
4 Comments | 430 Views
Posted by amxku on 2008-08-02, 23:56 . 技术相关
Tags: msn, 跨站, 代码, xss, bug, 漏洞
5 Comments | 1444 Views
Posted by amxku on 2005-11-10, 08:04 . 技术相关
统计PHP代码行数的小bat程序
放到一个PHP文件夹下面,点他,就会自动统计当前目录下面的PHP文件了。
如果用记事本打开,还可以设置是否统计子目录的;也可以设置统计其它类型的代码!
统计的标准是非回车空行!
@echo off
:config()
:{
set count_type=0
:# 0:表示只统计当前目录
:# 1:表示只统计当前目录,包括子目录
set count_ext=.php
:# 表示统计文件的后缀名称
:}
:main()
:{
if %count_type%==0 (set count_info=当前目录)
if %count_type%==1 (set count_info=当前目录,包括子目录)
echo 代码文件数与行数统计(HonestQiao 2006-5-20 0:14)
echo 统计方式:%count_info%
echo 文件后缀:%count_ext%
set /P PauseKey=开始统计(回车开始,Q退出)
if "%PauseKey%" == "Q" goto :EOF
if "%PauseKey%" == "q" goto :EOF
echo.
cd "%CD%"
set counts=0
set count=0
set tmp_list=%RANDOM%.tmp
copy /Y NUL %tmp_list% >nul 2>nul
if %count_type%==0 (dir/b | findstr "%count_ext%\>" > %tmp_list%)
if %count_type%==1 (dir/b/s | findstr "%count_ext%\>" > %tmp_list%)
call :function_files_count %tmp_list%
echo 文件总数:%counts%
echo 行数总计:%count%
del /Q %tmp_list%
echo.
set /P PauseKey=回车退出
@echo on
@goto :EOF
:}
:function_files_count
:{
set counts_tmp=0
for /F %%l in ('type %1') do (call :function_files_add "%%l")
set /A counts=%counts%+%counts_tmp%
goto :EOF
:}
:function_files_add
:{
set /A counts_tmp=%counts_tmp%+1
call :function_file_count %1
goto :EOF
:}
:function_file_count
:{
echo 第%counts_tmp%个文件:%1
set count_tmp=0
for /F %%l in ('type %1') do (call :function_file_add %1)
set /A count=%count%+%count_tmp%
echo 小计行数:%count_tmp%
echo.
goto :EOF
:}
:function_file_add
:{
set /A count_tmp=%count_tmp%+1
goto :EOF
:}
Tags: 技术, 代码, bat
0 Comments | 2456 Views