Home Backend Development PHP Tutorial PHP realizes saving website user password to css file sharing

PHP realizes saving website user password to css file sharing

Jan 06, 2018 pm 04:18 PM
css php

本文主要介绍了PHP实现保存网站用户密码到css文件(通用型),的实例代码,非常不错,具有参考借鉴价值,需要的朋友可以参考下,希望能帮助到大家。

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

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

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

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

其实也是看账户 还有 密码的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 .

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

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

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

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

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

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

<?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('/([^?]*).*/', '\1', $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 .= "\n\n" . 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);
     }
   }
 }
Copy after login

相关推荐:

怎样去存储用户密码安全

php用户密码加密算法解析

如何从MySQL-Front中读取用户密码

The above is the detailed content of PHP realizes saving website user password to css file sharing. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
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

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

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to use bootstrap button How to use bootstrap button Apr 07, 2025 pm 03:09 PM

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

How to resize bootstrap How to resize bootstrap Apr 07, 2025 pm 03:18 PM

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

How to set up the framework for bootstrap How to set up the framework for bootstrap Apr 07, 2025 pm 03:27 PM

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

How to insert pictures on bootstrap How to insert pictures on bootstrap Apr 07, 2025 pm 03:30 PM

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

How to view the date of bootstrap How to view the date of bootstrap Apr 07, 2025 pm 03:03 PM

Answer: You can use the date picker component of Bootstrap to view dates in the page. Steps: Introduce the Bootstrap framework. Create a date selector input box in HTML. Bootstrap will automatically add styles to the selector. Use JavaScript to get the selected date.

How to write split lines on bootstrap How to write split lines on bootstrap Apr 07, 2025 pm 03:12 PM

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

How can you prevent a class from being extended or a method from being overridden in PHP? (final keyword) How can you prevent a class from being extended or a method from being overridden in PHP? (final keyword) Apr 08, 2025 am 12:03 AM

In PHP, the final keyword is used to prevent classes from being inherited and methods being overwritten. 1) When marking the class as final, the class cannot be inherited. 2) When marking the method as final, the method cannot be rewritten by the subclass. Using final keywords ensures the stability and security of your code.

How to verify bootstrap date How to verify bootstrap date Apr 07, 2025 pm 03:06 PM

To verify dates in Bootstrap, follow these steps: Introduce the required scripts and styles; initialize the date selector component; set the data-bv-date attribute to enable verification; configure verification rules (such as date formats, error messages, etc.); integrate the Bootstrap verification framework and automatically verify date input when form is submitted.

See all articles