- WordPress core y plugins - Tema Twenty Twenty-Four configurado - Plugin allow-unfiltered-html.php simplificado - .gitignore configurado para excluir wp-config.php y uploads 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
280 lines
7.2 KiB
PHP
Executable File
280 lines
7.2 KiB
PHP
Executable File
<?php
|
|
/* BotCurl Created by HANANE Abdelfettah
|
|
rajawi9999@yahoo.fr
|
|
BotCurl Version 1.2012
|
|
|
|
|
|
*/
|
|
class cURL {
|
|
public $_useragent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.112 Safari/534.30';
|
|
|
|
protected $_url;
|
|
protected $_followlocation;
|
|
protected $headers;
|
|
public $_timeout=100;
|
|
protected $_maxRedirects=10;
|
|
|
|
protected $_debugFileLocation;
|
|
protected $_post;
|
|
protected $_postFields;
|
|
protected $_referer ="http://google.com/";
|
|
|
|
protected $_session;
|
|
protected $_webpage;
|
|
protected $_includeHeader=false;
|
|
protected $_noBody=false;
|
|
protected $_status;
|
|
protected $_binaryTransfer=false;
|
|
public $authentication = 0;
|
|
public $auth_name = '';
|
|
public $auth_pass = '';
|
|
public $s;
|
|
public $login;
|
|
public $password;
|
|
public $path_to_cookies="";
|
|
public $debug=0;
|
|
public $proxy="";
|
|
public $use_cookies=true;
|
|
public $warning="";
|
|
public $error="";
|
|
public $message="";
|
|
public $useFlashMessages=false;
|
|
public $prg_match;
|
|
public $uploaded=0;
|
|
public $failled=0;
|
|
public $proxies=array();
|
|
public $current_proxy=0;
|
|
public $valid_proxies=0;
|
|
public $HTTPPROXYTUNNEL=1;
|
|
public $email="";
|
|
public $name="";
|
|
public $prox_connect=15;
|
|
public $url;
|
|
|
|
public function __construct($cookies="",$browser="",$proxy="",$referrer="")
|
|
{
|
|
|
|
if($cookies!="")
|
|
$this->path_to_cookies=$cookies;
|
|
if($browser!="")
|
|
$this->_useragent=$browser;
|
|
if($referrer!="")
|
|
$this->_referer=$referrer;
|
|
|
|
|
|
|
|
$this->headers[] = "Accept: */*";
|
|
$this->headers[] = "Cache-Control: no-cache, must-revalidate";
|
|
$this->headers[] = "Cache-Control: max-age=0";
|
|
$this->headers[] = "Connection: keep-alive";
|
|
$this->headers[] = "Accept-Charset: utf-8";
|
|
$this->headers[] = "Accept-Language: en";
|
|
$this->init_curl();
|
|
|
|
|
|
}
|
|
|
|
|
|
public function init_curl()
|
|
{
|
|
//$fp=fopen($this->_debugFileLocation,"w");
|
|
|
|
$this->s = curl_init();
|
|
curl_setopt($this->s, CURLOPT_HTTPHEADER, $this->headers);
|
|
|
|
curl_setopt($this->s,CURLOPT_URL,$this->_url);
|
|
|
|
curl_setopt($this->s, CURLOPT_CONNECTTIMEOUT, 100);
|
|
curl_setopt($this->s,CURLOPT_TIMEOUT,$this->_timeout);
|
|
|
|
curl_setopt($this->s,CURLOPT_MAXREDIRS,$this->_maxRedirects);
|
|
curl_setopt($this->s, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($this->s, CURLOPT_FRESH_CONNECT, true);
|
|
curl_setopt($this->s, CURLOPT_COOKIESESSION, true);
|
|
curl_setopt($this->s, CURLOPT_FOLLOWLOCATION, true);
|
|
// curl_setopt($this->s, CURLOPT_AUTOREFERER, true);
|
|
//curl_setopt($this->s, CURLOPT_FAILONERROR, false);
|
|
curl_setopt($this->s, CURLOPT_SSL_VERIFYPEER, FALSE);
|
|
curl_setopt($this->s, CURLOPT_SSL_VERIFYHOST, 0);
|
|
curl_setopt($this->s, CURLOPT_HEADER, true); // Display headers
|
|
curl_setopt($this->s, CURLOPT_VERBOSE, true); // Display communication with server
|
|
|
|
curl_setopt($this->s,CURLOPT_USERAGENT,$this->_useragent);
|
|
curl_setopt($this->s,CURLOPT_REFERER,$this->_referer);
|
|
|
|
$this->setCookiFileLocation();
|
|
|
|
if($this->authentication == 1){
|
|
curl_setopt($this->s, CURLOPT_USERPWD, $this->auth_name.':'.$this->auth_pass);
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
public function createCurl($url = 'nul')
|
|
{
|
|
|
|
try
|
|
{
|
|
$result=$this->exec__();
|
|
|
|
if ($result['curl_error']) throw new Exception($result['curl_error']);
|
|
if (($result['http_code']!='') &&($result['http_code']!='0') &&($result['http_code']!='200') && ($result['http_code']!='500') && ($result['http_code']!='302') && ($result['http_code']!='400') && ($result['http_code']!='403')) throw new Exception("HTTP Code = ".$result['http_code']);
|
|
// if (!$result['body']) throw new Exception("Body of file is empty");
|
|
|
|
}
|
|
catch (Exception $e)
|
|
{
|
|
$result['curl_error']="Curl Error: ".$e->getMessage()."<br>".$this->_url."<br>";
|
|
|
|
}
|
|
|
|
|
|
|
|
curl_setopt($this->s,CURLOPT_POST,false);
|
|
return $result;
|
|
|
|
}
|
|
|
|
public function exec__()
|
|
{
|
|
$response = curl_exec($this->s);
|
|
$error = curl_error($this->s);
|
|
$result = array( 'header' => '',
|
|
'body' => '',
|
|
'curl_error' => '',
|
|
'http_code' => '',
|
|
'last_url' => '');
|
|
if ( $error != "" )
|
|
{
|
|
$result['curl_error'] = $error;
|
|
|
|
}
|
|
|
|
$header_size = curl_getinfo($this->s,CURLINFO_HEADER_SIZE);
|
|
$result['header'] = substr($response, 0, $header_size);
|
|
$result['body'] = substr( $response, $header_size );
|
|
$result['http_code'] = curl_getinfo($this->s,CURLINFO_HTTP_CODE);
|
|
$result['last_url'] = curl_getinfo($this->s,CURLINFO_EFFECTIVE_URL);
|
|
|
|
|
|
if($this->debug==1)
|
|
{
|
|
echo "<br><br><br>----------------------------Curl Results -----------------------<br>";
|
|
echo "Curl header:".$result['header']."<br>";
|
|
|
|
echo "Curl http_code:".$result['http_code']."<br>";
|
|
echo "Curl last_url:".$result['last_url']."<br>";
|
|
echo "<br><br>Curl body:";
|
|
display_html_content($result['body']);
|
|
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
|
|
public function close()
|
|
{
|
|
|
|
curl_close($this->s);
|
|
|
|
}
|
|
public function useAuth($use){
|
|
$this->authentication = 0;
|
|
if($use == true) $this->authentication = 1;
|
|
}
|
|
|
|
|
|
public function set_proxy($proxy="")
|
|
{
|
|
if($proxy!="")
|
|
$this->proxy=$proxy;
|
|
if($this->proxy!="")
|
|
{
|
|
//curl_setopt($this->s, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
|
|
if($this->HTTPPROXYTUNNEL==1)
|
|
curl_setopt($this->s, CURLOPT_HTTPPROXYTUNNEL, $this->HTTPPROXYTUNNEL);
|
|
curl_setopt($this->s, CURLOPT_PROXY, $this->proxy);
|
|
if($this->debug>=1)
|
|
echo "proxy: ". $this->proxy."<br>";
|
|
}
|
|
else
|
|
curl_setopt($this->s, CURLOPT_HTTPPROXYTUNNEL, 0);
|
|
|
|
}
|
|
|
|
public function setTimeOut($time){
|
|
curl_setopt($this->s, CURLOPT_CONNECTTIMEOUT, $time);
|
|
curl_setopt($this->s,CURLOPT_TIMEOUT,$time * 3);
|
|
|
|
}
|
|
public function setReferer($referer){
|
|
curl_setopt($this->s,CURLOPT_REFERER,$referer);
|
|
$this->_referer=$referer;
|
|
}
|
|
|
|
public function setCookiFileLocation($path="")
|
|
{
|
|
|
|
if($path!="")
|
|
$this->path_to_cookies=$path;
|
|
if($this->path_to_cookies!="")
|
|
{
|
|
/*curl_setopt($this->s, CURLOPT_FRESH_CONNECT, 1);
|
|
curl_setopt($this->s, CURLOPT_COOKIESESSION, 1);*/
|
|
curl_setopt($this->s, CURLOPT_COOKIEJAR, $this->path_to_cookies);
|
|
curl_setopt($this->s, CURLOPT_COOKIEFILE, $this->path_to_cookies);
|
|
|
|
//curl_setopt($this->s, CURLOPT_COOKIE, file_get_contents($this->path_to_cookies));
|
|
}
|
|
|
|
}
|
|
public function setUrl($url)
|
|
{
|
|
|
|
curl_setopt($this->s,CURLOPT_URL,$url);
|
|
$this->_url=$url;
|
|
}
|
|
public function setPost ($postFields)
|
|
{
|
|
if($postFields=="")
|
|
{
|
|
|
|
curl_setopt($this->s,CURLOPT_POST,false);
|
|
|
|
}
|
|
else
|
|
{
|
|
/*$tabl=split("&",$postFields);
|
|
foreach($tabl as $one)
|
|
{
|
|
$tab2=split("=",$one);
|
|
$id=$tab2[0];
|
|
$listFields[$id]=$tab2[1];
|
|
}*/
|
|
curl_setopt($this->s,CURLOPT_POST,1);
|
|
curl_setopt($this->s,CURLOPT_POSTFIELDS,$postFields);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
public function setUserAgent($userAgent)
|
|
{
|
|
curl_setopt($this->s,CURLOPT_USERAGENT,$userAgent);
|
|
}
|
|
|
|
|
|
public function getHttpStatus()
|
|
{
|
|
return $this->_status;
|
|
}
|
|
|
|
public function __tostring(){
|
|
return $this->_webpage;
|
|
}
|
|
|
|
|
|
|
|
} |