|
前幾天在問答區提了一下這個問題,所有回答問題的朋友都說不可能通過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 主站蜘蛛池模板: 亚洲免费一| 国产精品无码亚洲精品 | 亚洲综合香蕉在线视频 | 好紧的小嫩嫩17p | 免费视频国产在线观看网站 | ABO成结顶腔锁住 | 亚洲va在线va天堂XX xX | 小776 论坛| 中文国产在线观看 | 后入内射国产一区二区 | 一级片mp4 | 蜜臀AV999无码精品国产 | 樱花动漫成人隐藏入口 | 色婷婷激婷婷深爱五月小蛇 | 久久九九久精品国产尤物 | 精品极品三大极久久久久 | 国产精品无码AV天天爽色欲 | 美女爽到嗷嗷嗷叫 | 色琪琪丁香婷婷综合久久 | 久久这里只有精品国产精品99 | 不卡无线在一二三区 | 麻豆AV无码蜜臀AV色哟 | 亚洲国产亚综合在线区尤物 | 1973性农场未删减版 | 丰满少妇发泄14p | 欧美 日韩 亚洲 在线 | 麻豆天美国产一区在线播放 | YELLOW高清视频免费观看 | 永久午夜福利视频一区在线观看 | 夜里18款禁用的免费B站动漫 | 国产午夜亚洲精品区 | 亚洲色欲色欲WWW在线丝 | 丝瓜影院观看免费高清国际观察 | 91精品乱码一区二区三区 | 免费。色婬网站 | 热久久国产欧美一区二区精品 | 亚洲国产高清在线 | 高清国产免费观看视频在线 | 国产精品路线1路线2路线 | 扒开美女的内衣亲吻漫画 | 亚洲午夜久久久精品电影院 |