|
前幾天在問答區提了一下這個問題,所有回答問題的朋友都說不可能通過php實現,碰巧我的實習負責人幫我找到了一個方法,貌似是通過NTLM來實現的,我是新手,對具體原理也知之不詳,只是自己測試了一下,很好用.
所以趕快拿出來與大家分享.這是一個法國人寫的,所以編碼中的注釋都是法語,如果有朋友很想了解某行的注釋含義,請回帖說明,我可以試著翻譯一下.
<?php/************************************************************************************************************************************************* php NTLM GET LOGIN * Version 0.2.1 * Copyright (c) 2004 Nicolas GOLLET ( Nicolas (dot) gollet (at) secusquad (dot) com )* Copyright (c) 2004 Flextronics Saint-Etienne** This program is free software. You can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License. ************************************************************************/session_start();$headers = apache_request_headers(); // 獲取用戶頭if (@$_SERVER['HTTP_VIA'] != NULL){ // 確認是否使用了代理(proxy),因為ntlm驗證不能穿過代理.echo "Proxy bypass!";}elseif($headers['Authorization'] == NULL){ //si l'entete autorisation est inexistante如果許可頭不存在 header( "HTTP/1.0 401 Unauthorized" ); //envoi au client le mode d'identification header( "WWW-Authenticate: NTLM" ); //dans notre cas le NTLM exit; //on quitte}if(isset($headers['Authorization'])) //dans le cas d'une authorisation (identification){ if(substr($headers['Authorization'],0,5) == 'NTLM '){ // 確認client是否在ntlm下 $chaine=$headers['Authorization']; $chaine=substr($chaine, 5); // 獲取 base64-encoded type1 信息 $chained64=base64_decode($chaine); // 解碼 base64 到 $chained64 if(ord($chained64{8}) == 1){ // |_ byte signifiant l'etape du processus d'identification (etape 3) // verification du drapeau NTLM "0xb2" ?l'offset 13 dans le message type-1-message (comp ie 5.5+) : if (ord($chained64[13]) != 178){ echo "NTLM Flag error!"; exit; } $retAuth = "NTLMSSP".chr(000).chr(002).chr(000).chr(000).chr(000).chr(000).chr(000).chr(000); $retAuth .= chr(000).chr(040).chr(000).chr(000).chr(000).chr(001).chr(130).chr(000).chr(000); $retAuth .= chr(000).chr(002).chr(002).chr(002).chr(000).chr(000).chr(000).chr(000).chr(000); $retAuth .= chr(000).chr(000).chr(000).chr(000).chr(000).chr(000).chr(000); $retAuth64 =base64_encode($retAuth); // encode en base64 $retAuth64 = trim($retAuth64); // enleve les espaces de debut et de fin header( "HTTP/1.0 401 Unauthorized" ); // envoi le nouveau header header( "WWW-Authenticate: NTLM $retAuth64" ); // avec l'identification suppl 主站蜘蛛池模板: 国产精品视频免费视频 | 美女扒开尿孔 | 亚洲影院在线播放 | 日本大片免a费观看视频 | 毛片免费观看的视频在线 | 最近中文字幕高清中文 | 亚洲大码熟女在线 | 亚洲一区二区免费看 | 草草久久久无码国产专区全集观看 | 超碰97超碰在线视频哦 | 色mimi| 在线看免费毛片 | 国产精品亚洲专一区二区三区 | 国产婷婷色综合AV蜜臀AV | 在线免费观看视频a | 国产又色又爽又刺激在线播放 | 伊人影院中文字幕 | 国产成人亚洲精品午夜国产馆 | 99久久久久精品国产免费麻豆 | 一级毛片皇帝 宫女 | 揉抓捏打抽插射免费视频 | 黄桃AV无码免费一区二区三区 | 欲香欲色天天综合和网 | 国产成人综合在线观看网站 | 精品AV国产一区二区三区 | 精品午夜中文字幕熟女人妻在线 | 最近更新2019中文字幕免费 | 精品一成人岛国片在线观看 | 精品国产在线国语视频 | 欧美黑人巨大性极品hd欧 | 一本到2019线观看 | 久色乳综合思思在线视频 | 国产精亚洲视频综合区 | 能看的黄页最新网站 | 吻嘴胸全身好爽床大全 | 18禁无遮遮挡羞漫画免费阅读 | 吃奶吸咪咪动态图 | 国产女高清在线看免费观看 | 漂亮的保姆3集电影免费观看中文 | 国产精品第八页 | 欧美精品一区二区三区视频 |