authorize{ update control { Auth-Type := `/usr/bin/php -f /etc/raddb/yourscript.php '%{User-Name}' '%{User-Password}'` }
$authSuccessful = False; $user = $argv[1]; $password = $argv[2]; $url = 'https://intranet.of.the.company.accessible.from.internet/pkmslogin.form'; $fields_string= "username=".$user."&password=".$password."&login-form-type=pwd&submit=Login"; //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); curl_setopt($ch,CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE); curl_setopt($ch,CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($ch,CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_POSTREDIR, 0); curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); //execute post $result = curl_exec($ch); curl_close($ch); if (strpos($result,'Your login was successful') !== false) $authSuccessful = True; if ($authSuccessful == True) echo "Accept\n"; else echo "Reject\n";
$authSuccessful = False; $user = $argv[1]; $password = $argv[2]; //WebInterface 5.4.x $url = 'https://the.web.interface.of.citrix.xenapp/Citrix/XenApp/auth/login.aspx'; $fields_string= "user=".$user."&password=".$password."&LoginType=Explicit"; //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); curl_setopt($ch,CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE); curl_setopt($ch,CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($ch,CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_POSTREDIR, 0); curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); //execute post $result = curl_exec($ch); //close connection curl_close($ch); if (strpos($result,'default.aspx') !== false) { $authSuccessful = True; } if ($authSuccessful == True) echo "Accept\n"; else echo "Reject\n";
$authSuccessful = False; $user = $argv[1]; $password = $argv[2]; $url = 'https://intranet.of.the.company.accessible.from.internet/pkmslogin.form'; $fields_string= "username=".$user."&password=".$password."&login-form-type=pwd&submit=Login"; //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); curl_setopt($ch,CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE); curl_setopt($ch,CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($ch,CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_POSTREDIR, 0); curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); //execute post $result = curl_exec($ch); curl_close($ch); if (strpos($result,'Your login was successful') !== false) $authSuccessful = True; if ($authSuccessful == False) { //WebInterface 5.4.x $url = 'https://the.web.interface.of.citrix.xenapp/Citrix/XenApp/auth/login.aspx'; $fields_string= "user=".$user."&password=".$password."&LoginType=Explicit"; //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); curl_setopt($ch,CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_COOKIESESSION, TRUE); curl_setopt($ch,CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($ch,CURLOPT_COOKIEFILE, "cookie.txt"); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); curl_setopt($ch, CURLOPT_POSTREDIR, 0); curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); //execute post $result = curl_exec($ch); //close connection curl_close($ch); if (strpos($result,'default.aspx') !== false) { $authSuccessful = True; } } if ($authSuccessful == True) echo "Accept\n"; else echo "Reject\n";
Source: https://habr.com/ru/post/190156/
All Articles