Skip to content

Instantly share code, notes, and snippets.

@AMSTKO
Last active April 27, 2018 13:43
Show Gist options
  • Save AMSTKO/7186422 to your computer and use it in GitHub Desktop.
Save AMSTKO/7186422 to your computer and use it in GitHub Desktop.
booster et aspirateur de profils pour adopte un mec
<?php
set_time_limit(0);
class Adopteunmec {
public $sql,
$mail,
$passwd,
$proxy = false,
$search = array();
function __construct($proxy = false, $search = array()) {
echo "\n\nbot adopteunmec v1.5\n\n";
$this->proxy = $proxy;
$this->search = $search;
/*$options = array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
);*/
//$this->sql = new PDO('mysql:host=localhost;dbname=tropub;port=3606', 'node', 'tulipesql', $options);
//$this->sql->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_OBJ);
}
function curl($url) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
if($this->proxy) {
curl_setopt($curl, CURLOPT_PROXY, $this->proxy);
}
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($curl, CURLOPT_USERPWD, $this->mail . ':' . $this->passwd);
$return = curl_exec($curl);
curl_close($curl);
$data = json_decode($return);
if(isset($data)) {
$data = $data;
return $data;
}
elseif(!preg_match('/Cette utilisatrice/i', $return)) {
$this->debug($return);
} else {
return false;
}
}
function debug($return) {
echo "\n\n\n _" . $return . "_ \n\n\n";
echo 'error curl wait 20sec.'."\n";
sleep(20);
$this->connexion($this->mail, $this->passwd);
$this->algo_1();
}
function connexion($mail, $passwd) {
$this->mail = $mail;
$this->passwd = $passwd;
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://www.adopteunmec.com/api/home');
if($this->proxy) {
curl_setopt($curl, CURLOPT_PROXY, 'x:[email protected]:59212');
}
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($curl, CURLOPT_USERPWD, $this->mail . ':' . $this->passwd);
$return = curl_exec($curl);
curl_close($curl);
}
function member_add($data) {
$rqt = $this->sql->prepare('SELECT id FROM aum_users WHERE aumpid = :aumpid LIMIT 1');
$rqt->execute(array(
'aumpid' => $data['aumpid']
));
if(!$rqt->fetch()) {
$rqt_1 = $this->sql->prepare('INSERT INTO aum_users SET aumpid = :aumpid,
pseudo = :pseudo,
about1 = :about1,
about1_strlen = :about1_strlen,
about2 = :about2,
admin = :admin,
first_cnx = :first_cnx,
last_cnx = :last_cnx,
title = :title,
sex = :sex,
birthday = :birthday,
city = :city,
country = :country,
path = :path,
job = :job,
hobbies = :hobbies,
popu = :popu,
visites = :visites,
contacts = :contacts,
mails = :mails');
$rqt_1->execute(array(
'aumpid' => $data['aumpid'],
'pseudo' => $data['pseudo'],
'about1' => $data['about1'],
'about1_strlen' => strlen($data['about1']),
'about2' => $data['about2'],
'admin' => $data['admin'],
'first_cnx' => $data['first_cnx'],
'last_cnx' => $data['last_cnx'],
'title' => $data['title'],
'sex' => $data['sex'],
'birthday' => $data['birthday'],
'city' => $data['city'],
'country' => $data['country'],
'path' => $data['path'],
'job' => $data['job'],
'hobbies' => $data['hobbies'],
'popu' => $data['popu'],
'visites' => $data['visites'],
'contacts' => $data['contacts'],
'mails' => $data['mails']
));
}
}
function member_exist($aumpid) {
$rqt = $this->sql->prepare('SELECT id FROM aum_users WHERE aumpid = :aumpid LIMIT 1');
$rqt->execute(array(
'aumpid' => $aumpid
));
if($rqt->fetch()) {
return true;
}
else {
return false;
}
}
function search($index, $limit) {
echo "\n search " . json_encode($this->search);
$data = $this->curl('http://www.adopteunmec.com/api/users?count=' . $limit . '&offset=' . $index . '&age[min]=' . $this->search['ageMin'] . '&age[max]=' . $this->search['ageMax'] . '&country=fr&region=' . $this->search['region'] . '&subregion=' . $this->search['subregion']);
return $data->results;
}
public function member_view($aumpid) {
sleep(4);
$data = $this->curl('http://www.adopteunmec.com/api/users/' . $aumpid);
return $data;
}
function algo_1() {
echo "\n\n nouvelle liste algo_1, ";
$search_data = $this->search(0, 250);
$this->member_view(17221337);
foreach($search_data as $k=>$r) {
// if(!$this->member_exist($r->id)) {
$member_data = $this->member_view($r->id);
/*$this->member_add(array(
'aumpid' => $member_data->member->id,
'pseudo' => $member_data->member->pseudo,
'about1' => $member_data->member->about1,
'about2' => $member_data->member->about2,
'admin' => $member_data->member->admin,
'first_cnx' => $member_data->member->first_cnx,
'last_cnx' => $member_data->member->last_cnx,
'title' => $member_data->member->title,
'sex' => $member_data->member->sex,
'birthday' => $member_data->member->birthday,
'city' => $member_data->member->city,
'country' => $member_data->member->country,
'path' => $member_data->member->path,
'job' => $member_data->member->job,
'hobbies' => $member_data->member->hobbies,
'popu' => $member_data->member->popu->popu,
'visites' => $member_data->member->popu->visites,
'contacts' => $member_data->member->popu->contacts,
'mails' => $member_data->member->popu->mails,
));*/
if ($member_data) {
echo "\n get visit ok " . $member_data->pseudo;
} else {
echo "\n quitté...";
}
//}
//else {
// echo "\n get already for " . $r->pseudo;
//}
}
sleep(20);
$this->algo_1();
}
}
<?php
include 'aum.php';
$search = array(
'sex' => 1,
'region' => 18, // paris 11, angers 18
'subregion' => 50, // paris 76, angers 50
'country' => 'fr',
'ageMax' => 34,
'ageMin' => 18
);
$aum = new Adopteunmec(false, $search);
$aum->connexion('[email protected]', 'xy');
$aum->algo_1();
@benjion
Copy link

benjion commented May 6, 2016

code pas commenté = fessée ! ^^ sinon good job

@doliprane1987
Copy link

Quelqu'un sait comment exécuter ce code, j'ai lancer http://localhost/adopte/bot.php et changé login et mot de passe mais ça a l'air de tourné jusqua l infinis sans rien

@xsadg
Copy link

xsadg commented Dec 30, 2016

Bonjour,

je ne sais pas comment utiliser ces scripts, pouvez vous m'expliquer ?

Merci

@Notprepared25
Copy link

Plop,

Ca fonctionnait niquel il y a quelques mois puis en réessayant ces jours-ci j'ai ce message qui apparaît en boucle :

search {"sex":1,"region":11,"subregion":76,"country":"fr","ageMax":29,"ageMin":24} _Le paramètre 'count' est absent ou invalide. _ error curl wait 20sec. nouvelle liste algo_1, search {"sex":1,"region":11,"subregion":76,"country":"fr","ageMax":29,"ageMin":24} _Le paramètre 'count' est absent ou invalide. _ error curl wait 20sec.

Savez-vous à quoi c'est du ?

Merci!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment