服务器之家:专注于VPS、云服务器配置技术及软件下载分享
分类导航

PHP教程|ASP.NET教程|Java教程|ASP教程|编程技术|正则表达式|C/C++|IOS|C#|Swift|Android|VB|R语言|JavaScript|易语言|vb.net|

服务器之家 - 编程语言 - PHP教程 - PHP实现保存网站用户密码到css文件(通用型)

PHP实现保存网站用户密码到css文件(通用型)

2021-07-14 17:04i春秋学院 PHP教程

这篇文章主要介绍了PHP实现保存网站用户密码到css文件(通用型),的实例代码,非常不错,具有参考借鉴价值,需要的朋友可以参考下

很多时候呢,我们拿到一个shell以后,偶尔会遇到密码解不了的情况,用xss收集cookie吧,感觉不方便;利用xss平台劫持表单吧,感觉麻烦,也会担心自己想要的密码别人也copy了一份等等情况吧,这个时候我们就需要自己想办法来收集想要的pwd……

最简单了,看别人的登陆界面如下:

i春秋的登陆界面,我们可以看到用户和密码的的name属性分别是:“username还有password“,当然针对i春秋这样的cms,你若是巧合的拥有这样类似的网站shell,

PHP实现保存网站用户密码到css文件(通用型)

然后我们再找一个一下thinkphp的登陆界面:

PHP实现保存网站用户密码到css文件(通用型)

其实也是看账户 还有 密码的name属性:“user 还有 password“,其实登陆中的name都差不多,那么我们就可以直接在shell中找到登陆文件 ,然后修改相关内容即可。

那么问题来了,很多人会感觉到登陆的文件很繁琐或者是不好找什么的,那么最好的办法就是我们自己写一个抓取登陆时候post数据的脚本,然后用相关的文件来include它,这样就完成了既保证网站安全运行,又保障了你能够得到你想要的密码。惊喜不惊喜,意外不意外。

再看一下我的网站后台,很简单,直接admin目录,啥也不说了,直接找到我的admin目录,include我们的脚本,就拿到了管理员的密码

我是不是说多了怎么扯犊子到管理员的密码了,我日啊,罪过罪过,我是故意的,你没有听错,我就是故意的,this is bypass ,this is a gold key,when you wonna be get someone else's password .

PHP实现保存网站用户密码到css文件(通用型)

哈哈,你开心了吗,兄弟们

其实,对于那种开始就让你登陆的网站,你可以从它的index.php文件来进行循规蹈矩,看它的require 或者 include等的调用文件,只要和登陆有关系,或者直接可以说成是登陆的过程中会调用到的文件来说直接把咱们研究的文件include其中即可拿到密码。

啰嗦了这么久,上面这句才是重点,让你们失望了,小弟的语言组织能力需要联系,那么就总结一句话吧:凡是登

PHP实现保存网站用户密码到css文件(通用型)

陆的过程有调用到的文件,咱么那就可以include进去,然后就拿到密码了!!

最后上一张我利用的图片,不许激动哦

PHP实现保存网站用户密码到css文件(通用型)

ps:下面看段实例代码php使用gzip压缩传输js和css文件的方法

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php
 /**
  * 完整调用示例:
  * 1、combine.php?t=j&b=public&fs=jslib.jquery,function
  *
  * 该例子调用的是网站根目录下的public/jslib/jquery.js和public/function.js
  *
  * 2、combine.php?t=j&fs=jslib.jquery,function
  *
  * 该例子调用的是网站根目录下的jslib/jquery.js和function.js
  *
  * 3、combine.php?t=c&b=public.css&fs=common,index
  *
  * 该例子调用的是网站根目录下的public/css/common.css和public/css/index.css
  *
  * 4、combine.php?t=c&fs=css.common
  * 该例子调用的是网站根目录下的css/common.css
  *
  * 注:多个文件名之间用,分隔;只有一个文件名最后不要有,
  *  用,分隔的多个文件会被压缩进一个文件,一次性传给浏览器
  **/
 $is_bad_request=false;
 $cache = true;
 $doc_root_uri=$_server['document_root'].'/';
 $cachedir = $doc_root_uri . 'public/cache';
 //文件类型,j为js,c为css
 $type=isset($_get['t'])?($_get['t']=='j'||$_get['t']=='c'?$_get['t']:''):'';
 //存放js和css文件的基目录, 例如:?b=public.js 代表的是/public/js文件夹,出发点是网站根目录
 //基目录参数不是必须的,如果有基目录那么这个基目录就会附加在文件名之前
 $base =isset($_get['b'])?($doc_root_uri.str_replace('.','/',$_get['b'])):$doc_root_uri;
 //文件名列表,文件名不带后缀名.比如基目录是
 //文件名的格式是 :基目录(如果有)+文件包名+文件名
 //例如:类型是j,
 //  文件名public.js.jquery
 //  如果有基路径且为public,
 //  那么转换后的文件名就是/public/public/js/jquery.js
 //  如果没有基路径
 //  那么转换后的文件名就是/public/js/jquery.js
 //多个文件名之间用,分隔
 $fs=isset($_get['fs'])?str_replace('.','/',$_get['fs']):'';
 $fs=str_replace(',','.'.($type=='j'?'js,':'css,'),$fs);
 $fs=$fs.($type=='j'?'.js':'.css');
 if($type==''||$fs==''){$is_bad_request=true;}
 //die($base);
 if($is_bad_request){header ("http/1.0 503 not implemented");}
 $file_type=$type=='j'?'javascript':'css';
 $elements = explode(',',preg_replace('/([^?]*).*/', '', $fs));
 // determine last modification date of the files
 $lastmodified = 0;
 while (list(,$element) = each($elements)) {
   $path =$base . '/' . $element;
   if (($type == 'j' && substr($path, -3) != '.js') ||
     ($type == 'c' && substr($path, -4) != '.css')) {
     header ("http/1.0 403 forbidden");
     exit;
   }
   if (substr($path, 0, strlen($base)) != $base || !file_exists($path)) {
     header ("http/1.0 404 not found");
     exit;
   }
   $lastmodified = max($lastmodified, filemtime($path));
 }
 // send etag hash
 $hash = $lastmodified . '-' . md5($fs);
 header ("etag: "" . $hash . """);
 if (isset($_server['http_if_none_match']) &&
   stripslashes($_server['http_if_none_match']) == '"' . $hash . '"')
 {
   // return visit and no modifications, so do not send anything
   header ("http/1.0 304 not modified");
   header ("content-type: text/" . $file_type);
   header ('content-length: 0');
 }
 else
 {
   // first time visit or files were modified
   if ($cache)
   {
     // determine supported compression method
     $gzip = strstr($_server['http_accept_encoding'], 'gzip');
     $deflate = strstr($_server['http_accept_encoding'], 'deflate');
     // determine used compression method
     $encoding = $gzip ? 'gzip' : ($deflate ? 'deflate' : 'none');
     // check for buggy versions of internet explorer
     if (!strstr($_server['http_user_agent'], 'opera') &&
       preg_match('/^mozilla/4.0 (compatible; msie ([0-9].[0-9])/i', $_server['http_user_agent'], $matches)) {
       $version = floatval($matches[1]);
       if ($version < 6)
         $encoding = 'none';
       if ($version == 6 && !strstr($_server['http_user_agent'], 'ev1'))
         $encoding = 'none';
     }
     // try the cache first to see if the combined files were already generated
     $cachefile = 'cache-' . $hash . '.' . $file_type . ($encoding != 'none' ? '.' . $encoding : '');
     if (file_exists($cachedir . '/' . $cachefile)) {
       if ($fp = fopen($cachedir . '/' . $cachefile, 'rb')) {
         if ($encoding != 'none') {
           header ("content-encoding: " . $encoding);
         }
         header ("content-type: text/" . $file_type);
         header ("content-length: " . filesize($cachedir . '/' . $cachefile));
         fpassthru($fp);
         fclose($fp);
         exit;
       }
     }
   }
   // get contents of the files
   $contents = '';
   reset($elements);
   while (list(,$element) = each($elements)) {
     $path = $base . '/' . $element;
     $contents .= " " . file_get_contents($path);
   }
   // send content-type
   header ("content-type: text/" . $file_type);
   if (isset($encoding) && $encoding != 'none')
   {
     // send compressed contents
     $contents = gzencode($contents, 9, $gzip ? force_gzip : force_deflate);
     header ("content-encoding: " . $encoding);
     header ('content-length: ' . strlen($contents));
     echo $contents;
   }
   else
   {
     // send regular contents
     header ('content-length: ' . strlen($contents));
     echo $contents;
   }
   // store cache
   if ($cache) {
     if ($fp = fopen($cachedir . '/' . $cachefile, 'wb')) {
       fwrite($fp, $contents);
       fclose($fp);
     }
   }
 }

总结

以上所述是小编给大家介绍的php实现保存网站用户密码到css文件(通用型),希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对服务器之家网站的支持!

原文链接:http://www.ijiandao.com/safe/cto/76861.html?utm_source=tuicool&utm_medium=referral

延伸 · 阅读

精彩推荐