PHP實現(xiàn)保存網(wǎng)站用戶密碼到css文件(通用型)
很多時候呢,我們拿到一個shell以后,偶爾會遇到密碼解不了的情況,用xss收集cookie吧,感覺不方便;利用xss平臺劫持表單吧,感覺麻煩,也會擔(dān)心自己想要的密碼別人也copy了一份等等情況吧,這個時候我們就需要自己想辦法來收集想要的PWD……
最簡單了,看別人的登陸界面如下:
I春秋的登陸界面,我們可以看到用戶和密碼的的name屬性分別是:“username還有password“,當(dāng)然針對i春秋這樣的cms,你若是巧合的擁有這樣類似的網(wǎng)站shell,

然后我們再找一個一下thinkphp的登陸界面:

其實也是看賬戶 還有 密碼的name屬性:“user 還有 password“,其實登陸中的name都差不多,那么我們就可以直接在shell中找到登陸文件 ,然后修改相關(guān)內(nèi)容即可。
那么問題來了,很多人會感覺到登陸的文件很繁瑣或者是不好找什么的,那么最好的辦法就是我們自己寫一個抓取登陸時候post數(shù)據(jù)的腳本,然后用相關(guān)的文件來include它,這樣就完成了既保證網(wǎng)站安全運行,又保障了你能夠得到你想要的密碼。驚喜不驚喜,意外不意外。
再看一下我的網(wǎng)站后臺,很簡單,直接admin目錄,啥也不說了,直接找到我的admin目錄,include我們的腳本,就拿到了管理員的密碼
我是不是說多了怎么扯犢子到管理員的密碼了,我日啊,罪過罪過,我是故意的,你沒有聽錯,我就是故意的,This is bypass ,this is a gold key,when you wonna be get someone else's password .

哈哈,你開心了嗎,兄弟們
其實,對于那種開始就讓你登陸的網(wǎng)站,你可以從它的index.php文件來進(jìn)行循規(guī)蹈矩,看它的require 或者 include等的調(diào)用文件,只要和登陸有關(guān)系,或者直接可以說成是登陸的過程中會調(diào)用到的文件來說直接把咱們研究的文件include其中即可拿到密碼。
啰嗦了這么久,上面這句才是重點,讓你們失望了,小弟的語言組織能力需要聯(lián)系,那么就總結(jié)一句話吧:凡是登

陸的過程有調(diào)用到的文件,咱么那就可以include進(jìn)去,然后就拿到密碼了??!
最后上一張我利用的圖片,不許激動哦

PS:下面看段實例代碼php使用gzip壓縮傳輸js和css文件的方法
<?php
/**
* 完整調(diào)用示例:
* 1、combine.php?t=j&b=public&fs=jslib.jquery,function
*
* 該例子調(diào)用的是網(wǎng)站根目錄下的public/jslib/jquery.js和public/function.js
*
* 2、combine.php?t=j&fs=jslib.jquery,function
*
* 該例子調(diào)用的是網(wǎng)站根目錄下的jslib/jquery.js和function.js
*
* 3、combine.php?t=c&b=public.css&fs=common,index
*
* 該例子調(diào)用的是網(wǎng)站根目錄下的public/css/common.css和public/css/index.css
*
* 4、combine.php?t=c&fs=css.common
* 該例子調(diào)用的是網(wǎng)站根目錄下的css/common.css
*
* 注:多個文件名之間用,分隔;只有一個文件名最后不要有,
* 用,分隔的多個文件會被壓縮進(jìn)一個文件,一次性傳給瀏覽器
**/
$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文件夾,出發(fā)點是網(wǎng)站根目錄
//基目錄參數(shù)不是必須的,如果有基目錄那么這個基目錄就會附加在文件名之前
$base =isset($_GET['b'])?($doc_root_uri.str_replace('.','/',$_GET['b'])):$doc_root_uri;
//文件名列表,文件名不帶后綴名.比如基目錄是
//文件名的格式是 :基目錄(如果有)+文件包名+文件名
//例如:類型是j,
// 文件名public.js.jquery
// 如果有基路徑且為public,
// 那么轉(zhuǎn)換后的文件名就是/public/public/js/jquery.js
// 如果沒有基路徑
// 那么轉(zhuǎn)換后的文件名就是/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);
}
}
}
總結(jié)
以上所述是小編給大家介紹的PHP實現(xiàn)保存網(wǎng)站用戶密碼到css文件(通用型),希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關(guān)文章
thinkphp路由規(guī)則使用示例詳解和偽靜態(tài)功能實現(xiàn)(apache重寫)
這篇文章主要介紹了thinkphp路由規(guī)則使用示例詳解和偽靜態(tài)功能實現(xiàn)(apache重寫),需要的朋友可以參考下2014-02-02
Zend Framework框架的session會話周期及次數(shù)限制使用示例
這篇文章主要介紹了Zend Framework框架的session會話周期及次數(shù)限制使用示例,需要的朋友可以參考下2014-03-03
關(guān)于php中的json_encode()和json_decode()函數(shù)的一些說明
下面小編就為大家?guī)硪黄P(guān)于php中的json_encode()和json_decode()函數(shù)的一些說明。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2016-11-11
利用php做服務(wù)器和web前端的界面進(jìn)行交互
PHP與Web頁面交互是實現(xiàn)PHP網(wǎng)站與用戶交互的重要手段。本篇文章主要介紹了利用php做服務(wù)器和web前端的界面進(jìn)行交互,具有一定的參考價值,感興趣的小伙伴們可以參考一下。2016-10-10
使用phpstorm和xdebug實現(xiàn)遠(yuǎn)程調(diào)試的方法
vs的斷點調(diào)試功能很強大有木有,能查看所有變量有木有。php調(diào)試很麻煩有木有,echo,var_dump寫得你想吐了有木有。想體驗一下ide調(diào)試的快感嗎?那就來使用xdebug吧2015-12-12

