PDA

Bekijk Volledige Versie : Zoek script om msn ledenlijst te mailen



ruty
22/06/07, 22:54
Ik ben op zoek naar een script waarmee ik bezoekers van mijn site een mailtje aan de leden uit de msn ledenlijst kunnen sturen om mijn website aan te prijzen. Wie kan mij aan zo'n script helpen?

dennis0162
22/06/07, 23:07
Ik heb er een gemaakt, hij gaat alleen niet gratis weg. Neem maar contact op als je interesse heb per PM of het onderstaande E-mail adres.

ol4pro
23/06/07, 00:46
Goed zoeken amigo, google is ure friend.

Hoop voorbeelden die jouw kunnen helpen zelf eentje te maken.
Er is uitgebreide documentatie beschikbaar mbt import.

systemdeveloper
23/06/07, 03:45
zoiets ?
http://www.wzdv.nl/msn2/

40 euro

Mikey
23/06/07, 12:26
Deze gaat wel gratis weg, en ik betwijfel of de heren hierboven hetgeen wat ze verkopen daadwerkelijk zelf gemaakt hebben. Het messenger protocol is niet iets wat je 123 uitgeplozen hebt!

msn_contact_grab.class.php

<?php

/*
This class connects to the MSNM service and returns
all the email addresses and screen names in the contact
list of the supplied user.

This is a derivation of a more general purpose php class
available at http://flumpcakes.co.uk/php/msn-messenger.

Unlike the more general purpose class, which can handle
sending and receiving messages, this class solely connects
and the retrieves the contact list.

USAGE
=====

There are two ways of calling the class.

Verbose
-------
Calling each of the functions involved seperately and
then getting the emails from a variable in the class

include('msn_contact_grab.class.php');
$msn->connect('username', 'password');
$msn = new msn;
$msn->rx_data();
$msn->process_emails();
$returned_emails = $msn->email_output;

Quick
-----
Handling everything in just one function

include('msn_contact_grab.class.php');
$msn2 = new msn;
$returned_emails = $msn2->qGrab("username", "password");


*/

class msn
{
// messenger.hotmail.com is an exchange server
// using it will redirect to a server with an open slot
// using a known server ip will help connect faster

// commenting out $ssh_login will mean the url to the
// secure login server will be taken from a secure
// session. this will slow down connecting a bit.
// Note: comment out $ssh_login if you experience auth failures

var $server = 'messenger.hotmail.com';
var $port = 1863;

var $nexus = 'https://nexus.passport.com/rdr/pprdr.asp';
var $ssh_login = 'login.live.com/login2.srf';

var $debug = 0;


// curl is used for the secure login, if you don't have
// the php_curl library installed, you can use a curl binary
// instead. $use_curl needs to be set to 1 to enable this.
// set $curl to the path where curl is installed.
// curl can be downloaded here: http://curl.haxx.se/download.html

var $curl_bin = 0;
var $curl = '/usr/local/bin/curl'; // linux
//var $curl = 'c:\curl.exe'; // windows

//Used to prevent the script from hanging
var $count = 0;

//Used to store the email addresses until all have been collected
var $email_input = array();
var $email_processing = array();
var $email_output = array();

/**
*
* desc : Connect to MSN Messenger Network
*
* in : $passport = passport i.e: user@hotmail.com
* $password = password for passport
*
* out : true on success else return false
*
*/

function connect($passport, $password)
{
$this->trID = 1;

if (!$this->fp = @fsockopen($this->server, $this->port, $errno, $errstr, 3)) {

die("Could not connect to messenger service");

} else {
stream_set_timeout($this->fp, 2);

$this->_put("VER $this->trID MSNP9 CVR0\r\n");

while (! feof($this->fp))
{
$data = $this->_get();

switch ($code = substr($data, 0, 3))
{
default:
echo $this->_get_error($code);

return false;
break;
case 'VER':
$this->_put("CVR $this->trID 0x0409 win 4.10 i386 MSNMSGR 7.0.0816 MSMSGS $passport\r\n");
break;
case 'CVR':
$this->_put("USR $this->trID TWN I $passport\r\n");

break;
case 'XFR':
list(, , , $ip) = explode (' ', $data);
list($ip, $port) = explode (':', $ip);

if ($this->fp = @fsockopen($ip, $port, $errno, $errstr, 2))
{
$this->trID = 1;

$this->_put("VER $this->trID MSNP9 CVR0\r\n");
}
else
{
if (! empty($this->debug)) echo 'Unable to connect to msn server (transfer)';

return false;
}
break;
case 'USR':
if (isset($this->authed))
{
return true;
}
else
{
$this->passport = $passport;
$this->password = urlencode($password);

list(,,,, $code) = explode(' ', trim($data));

if ($auth = $this->_ssl_auth($code))
{
$this->_put("USR $this->trID TWN S $auth\r\n");

$this->authed = 1;
}
else
{
if (! empty($this->debug)) echo 'auth failed';

return false;
}
}
break;
}
}
}

}

//Collects the raw data containing the email addresses
function rx_data()
{
$this->_put("SYN $this->trID 0\r\n");

//Supplies the second MSG code which stops
//the script from hanging as it waits for
//more content
$this->_put("CHG $this->trID HDN\r\n");

//the count check prevents the script hanging as it waits for more content
while ((! feof($this->fp)) && (! $stream_info['timed_out']) )
{
$data = $this->_get();
$stream_info = stream_get_meta_data($this->fp);

if ($data)
{
switch($code = substr($data, 0, 3))
{
default:
// uncommenting this line here would probably give a load of "error code not found" messages.
//echo $this->_get_error($code);

break;
case 'LST':
//These are the email addresses
//They need to be collected in email_input

$this->email_input[] = $data;

break;

case 'CHG';
$stream_info['timed_out'] = 1;
break;


}
}
}

}

//This function extracts the emails and screen names from the raw data
//collected by rx_data
function process_emails () {

//Neaten up the emails

//$regex = "|^LST\s(\S+?)\s(\S+?)\s\d+?\s\d+?$|";
foreach($this->email_input as $email_entry) {

//Seperate out the email from the name and other data
$this->email_processing[] = explode(" ", $email_entry);
//print_r($email_entry);
}

//Get rid of the unnecessary data and clean up the name
foreach($this->email_processing as $email_entry){

$this->email_output[] = array(0 => $email_entry['1'], 1 => urldecode($email_entry[2]), 2 => $email_entry['3']);
}
fclose($this->fp);

//var_dump($this->email_processing);
//var_dump($this->email_output);



}

//This is a quick way of calling all the seperate functions
//needed to grab the contact list
function qGrab ($username, $password) {

//Connect to the MSNM service
$this->connect($username, $password);

//Get data
$this->rx_data();
$this->_put('OUT');
//Process emails
$this->process_emails();

//send the email array
return $this->email_output;



}


/*====================================*\
Various private functions
\*====================================*/

function _ssl_auth($auth_string)
{
if (empty($this->ssh_login))
{
if ($this->curl_bin)
{
exec("$this->curl -m 60 -LkI $this->nexus", $header);
$header = implode($header, null);
}
else
{
$ch = curl_init($this->nexus);

curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// curl_setopt($ch, CURLOPT_TIMEOUT, 2);

$header = curl_exec($ch);

curl_close($ch);
}

preg_match ('/DALogin=(.*?),/', $header, $out);

if (isset($out[1]))
{
$slogin = $out[1];
}
else
{
return false;
}
}
else
{
$slogin = $this->ssh_login;
}


if ($this->curl_bin)
{
$header1 = '"Authorization: Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2E com,sign-in='.$this->passport.',pwd='.$this->password.','.$auth_string.'"';

exec("$this->curl -m 60 -LkI -H $header1 https://$slogin", $auth_string);

$header = null;

foreach ($auth_string as $key => $value)
{
if (strstr($value, 'Unauthorized'))
{
echo 'Unauthorised';
return false;
}
elseif (strstr($value, 'Authentication-Info'))
{
$header = $value;
}
}
}
else
{
$ch = curl_init('https://'.$slogin);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2E com,sign-in='.$this->passport.',pwd='.$this->password.','.$auth_string,
'Host: login.passport.com'
));

curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// curl_setopt($ch, CURLOPT_TIMEOUT, 2);

$header = curl_exec($ch);

curl_close($ch);
}

preg_match ("/from-PP='(.*?)'/", $header, $out);

return (isset($out[1])) ? $out[1] : false;
}


function _get()
{
if ($data = @fgets($this->fp, 4096))
{


if ($this->debug) echo "<div class=\"r\">&lt;&lt;&lt; $data</div>\n";

return $data;
}
else
{
return false;
}
}


function _put($data)
{
fwrite($this->fp, $data);

$this->trID++;

if ($this->debug) echo "<div class=\"g\">&gt;&gt;&gt; $data</div>";
}


function _get_error($code)
{
switch ($code)
{
case 201:
return 'Error: 201 Invalid parameter';
break;
case 217:
return 'Error: 217 Principal not on-line';
break;
case 500:
return 'Error: 500 Internal server error';
break;
case 540:
return 'Error: 540 Challenge response failed';
break;
case 601:
return 'Error: 601 Server is unavailable';
break;
case 710:
return 'Error: 710 Bad CVR parameters sent';
break;
case 713:
return 'Error: 713 Calling too rapidly';
break;
case 731:
return 'Error: 731 Not expected';
break;
case 800:
return 'Error: 800 Changing too rapidly';
break;
case 910:
case 921:
return 'Error: 910/921 Server too busy';
break;
case 911:
return 'Error: 911 Authentication failed';
break;
case 923:
return 'Error: 923 Kids Passport without parental consent';
break;
case 928:
return 'Error: 928 Bad ticket';
break;
default:
return 'Error code '.$code.' not found';
break;
}
}




}






?>


Je post de gebruikersnaam en wachtwoord (let op in voorbeeld zit totaal geen controlle



include('/msn_contact_grab.class.php');

$msn2 = new msn;
$msn2->qGrab('username', 'password');


Heb even zitten kijken, maar kan het stuk wat ik gebruik om de gebruikers aan te vinken niet 1234 eruit pluizen.

Wij zelf tonen alleen naar users die een status 11 en 13 hebben, dit zijn mensen waarbij je zelf in de lijst staat, en diegene waar jij in de lijst staat maar die je zelf geblocked hebt !

Succes !

// Ergens hebben wij een kleine modificatie uitgevoerd om na het onvangen van de contact list gelijk een sigh command erachter aan te sturen. Anders blijft je connectie open totdat je timeout op treed. Leg het origineel er langs om te zien waar dat zit, ik durf het je in ieder geval niet meer te zeggen :)

systemdeveloper
23/06/07, 13:32
Deze gaat wel gratis weg, en ik betwijfel of de heren hierboven hetgeen wat ze verkopen daadwerkelijk zelf gemaakt hebben. Het messenger protocol is niet iets wat je 123 uitgeplozen hebt!

Dat hoef je echt niet in twijfel te trekken want elke programmeur kan dit :)

Mikey
24/06/07, 10:36
Dat hoef je echt niet in twijfel te trekken want elke programmeur kan dit :)

het hergebruiken van iemand anders zijn class, naam erboven zetten en weder verkopen ? 100% mee eens !

systemdeveloper
24/06/07, 12:09
het hergebruiken van iemand anders zijn class, naam erboven zetten en weder verkopen ? 100% mee eens !
msn implementaties kan je overigens echt overal als opensource, licentievrij etc. downloaden, dus daar zou ik me niet zo druk over maken.
Er komt ook nog een script omheen natuurlijk anders heb je alleen... mja... een array met emailadressen, joepie...
In dat script zal je toch al je creativiteit wel kwijt kunnen? :)

Arieh
24/06/07, 12:20
msn implementaties kan je overigens echt overal als opensource, licentievrij etc. downloaden, dus daar zou ik me niet zo druk over maken.
Er komt ook nog een script omheen natuurlijk anders heb je alleen... mja... een array met emailadressen, joepie...
In dat script zal je toch al je creativiteit wel kwijt kunnen? :)Dat verkrijgen van een array met email adressen is natuurlijk het allermoeilijkste, een loopje over die array met een mail() erop is enkele regels?

systemdeveloper
24/06/07, 12:29
Dat verkrijgen van een array met email adressen is natuurlijk het allermoeilijkste, een loopje over die array met een mail() erop is enkele regels?
Dan google eens op 'phplistgrab' en moet je mij eens vertellen hoe 'moeilijk' dat is? Maar misschien ben ik bevooroordeeld; ik heb veel minder moeite met de technische dingen dan met de designkant om het ook nog allemaal (enigzins) fatsoenlijk uit te laten zien :)

Arieh
24/06/07, 12:58
Goed het zal allemaal wel.. dat was m'n punt helemaal niet.

Ik heb trouwens dat scriptje geprobeerd van Mikey, en ik krijg alleen een lege array terug.


$msn2 = new msn;
$returned_emails = $msn2->qGrab("xxx", "xxx");
print_r($returned_emails);

Dit is wat er gebeurt (heb de $data geprint)


VER 1 MSNP9 CVR0
CVR 2 7.0.0816 7.0.0816 7.0.0777 http://msgr.dlservice.microsoft.com/download/4/b/c/4bc83bb2-18dd-486f-943f-332a9b3e01dc/Install_MSN_Messenger_DL.exe http://messenger.msn.com
XFR 3 NS 207.46.111.27:1863 0 65.54.239.140:1863
VER 1 MSNP9 CVR0
CVR 2 7.0.0816 7.0.0816 7.0.0777 http://msgr.dlservice.microsoft.com/download/4/b/c/4bc83bb2-18dd-486f-943f-332a9b3e01dc/Install_MSN_Messenger_DL.exe http://messenger.msn.com
USR 3 TWN S lc=1033,id=507,tw=40,ru=http%3A%2F%2Fmessenger%2Em sn%2Ecom,ct=1182678589,kpp=1,kv=9,ver=2.1.6000.1,r n=NEMSLt!7,tpf=127a63acfdf55c481f1afb6540fb99c5
USR 4 OK blala@asd blala@asd 1 0
Array
(
)

Had ook even de origiene versie gepakt en die komt een stuk verder. Die heeft alleen niet de email catcher ;]

Kenneth
24/06/07, 13:13
Goed het zal allemaal wel.. dat was m'n punt helemaal niet.

Ik heb trouwens dat scriptje geprobeerd van Mikey, en ik krijg alleen een lege array terug.


$msn2 = new msn;
$returned_emails = $msn2->qGrab("xxx", "xxx");
print_r($returned_emails);

Dit is wat er gebeurt (heb de $data geprint)


VER 1 MSNP9 CVR0
CVR 2 7.0.0816 7.0.0816 7.0.0777 http://msgr.dlservice.microsoft.com/download/4/b/c/4bc83bb2-18dd-486f-943f-332a9b3e01dc/Install_MSN_Messenger_DL.exe http://messenger.msn.com
XFR 3 NS 207.46.111.27:1863 0 65.54.239.140:1863
VER 1 MSNP9 CVR0
CVR 2 7.0.0816 7.0.0816 7.0.0777 http://msgr.dlservice.microsoft.com/download/4/b/c/4bc83bb2-18dd-486f-943f-332a9b3e01dc/Install_MSN_Messenger_DL.exe http://messenger.msn.com
USR 3 TWN S lc=1033,id=507,tw=40,ru=http%3A%2F%2Fmessenger%2Em sn%2Ecom,ct=1182678589,kpp=1,kv=9,ver=2.1.6000.1,r n=NEMSLt!7,tpf=127a63acfdf55c481f1afb6540fb99c5
USR 4 OK blala@asd blala@asd 1 0
Array
(
)

Had ook even de origiene versie gepakt en die komt een stuk verder. Die heeft alleen niet de email catcher ;]

volgens mij (Correct me if I'm wrong) laat MSN je er niet door omdat je een te oude versie van MSN protocol stuurt.. (zie reply van server op 'VER 1 MSNP9 CVR0')

Heb zelf ook ooit met MSN protocol zitten spelen, basics zijn niet zo moeilijk, maar kost wel even wat puzzel tijd. Het moeilijkste is dan nog het openen van chats en downloaden/verzenden van bestanden.