Re: [Everybuddy] need to send msg from a script to YMsg, AIM
nick <[email protected]> Sun, 28 Dec 2003 15:58:30 -0600
| Newsgroups | gmane.comp.gnome.gaim.devel,gmane.network.everybuddy.user |
|---|---|
| Message-ID | <[email protected]> |
>This can be done from EB-Lite (aka Everybuddy) in much the same way as
>from Gaim, with the exception that eb-lite doesn't need a graphical
>interface running all the time (this is usually neither here nor
>there).
>
>To send a message from eb-lite, first download and install a release
>tarball, and set up your Yahoo/AIM account as normal, with the ebqt
>interface. Then, add the intended recipient of your messages to your
>contact list.
>
>To send a message, execute this command:
>eb-send "<name of your contact>" "<your message>"
>
>EB-Lite is known to work under Cygwin, but not yet under MinGW (Edward's
>working on that, but it's a bit of a struggle from the looks of it).
>
>
>Having said all that, from what you're doing, I'm not altogether sure
>that using a pre-built messenger such as EB or Gaim is the best idea. A
>quick Google indicates that there are already one or two existing
>Yahoo! messenger libraries for Perl (Net::YahooMessenger and Net::YMSG
>for starters), and several for AIM. Honestly speaking, it will probably
>be better for you to use one of those directly than to try to talk to a
>messaging client,
>
Yes, I know that. But Yahoo, the one I am mainly interested in, has
changed the connexion mechanism. I was aware for at least a year, if not
more that there are some YMSG modules on CPAN, available to install in
ActiveState for windows too. But THEY DO NOT WORK anymore. The connexion
fails every time. See the code from inside the gaim, at the end of this
message. Unfortunately, although I do know SOME programming, I have no
idea how to replicate that code, translate it into perl, into a module
or function that I can use.
use Net::YMSG;
my $yahoo = Net::YMSG->new(
id => 'user',
password => 'password',
hostname => 'cs13.msg.dcn.yahoo.com',
pre_login_url =>'http://login.yahoo.com/config/login?.src=pg'
);
$yahoo->login or die "Can't login Yahoo!Messenger";
$yahoo->send('another_user', 'Hello World!');
This fails.
So, i am trying to find a way to rewrite the connexion/login module
myself. But it seems I am not up to it. I cannot understand anything (or
not much) from the code below. The reason i am writing you guys is
because I am trying to figure out how to write that connexion
module/function, plus the sending message function. And since you have
the open source feature, I was hoping to see how it is done. i do have a
sniffer, tcp/ip monitor and I see what the real YMSG client does.
But I do not know how to replicate that from within a script either....
So, I am wondering, can anyone translate the code below, the new yahoo
connexion into a per sub/function ? I contacted the japanese guy that
maintains one of the YSMGR perl modules but he doesn't have time to
research into it and he does not know either how to make the connexion.
>which implements a bunch of stuff you really don't
>want or need.
>
>For more information, search the modules at www.cpan.org
>
>Meredydd
>
>
static void yahoo_process_auth_old(GaimConnection *gc, const char *seed)
{
struct yahoo_packet *pack;
GaimAccount *account = gaim_connection_get_account(gc);
const char *name = gaim_normalize(account,
gaim_account_get_username(account));
const char *pass = gaim_account_get_password(account);
struct yahoo_data *yd = gc->proto_data;
/* So, Yahoo has stopped supporting its older clients in India, and
undoubtedly
* will soon do so in the rest of the world.
*
* The new clients use this authentication method. I warn you in
advance, it's
* bizzare, convoluted, inordinately complicated. It's also no more
secure than
* crypt() was. The only purpose this scheme could serve is to
prevent third
* part clients from connecting to their servers.
*
* Sorry, Yahoo.
*/
md5_byte_t result[16];
md5_state_t ctx;
char *crypt_result;
char password_hash[25];
char crypt_hash[25];
char *hash_string_p = g_malloc(50 + strlen(name));
char *hash_string_c = g_malloc(50 + strlen(name));
char checksum;
int sv;
char result6[25];
char result96[25];
sv = seed[15];
sv = sv % 8;
md5_init(&ctx);
md5_append(&ctx, pass, strlen(pass));
md5_finish(&ctx, result);
to_y64(password_hash, result, 16);
md5_init(&ctx);
crypt_result = yahoo_crypt(pass, "$1$_2S43d5f$");
md5_append(&ctx, crypt_result, strlen(crypt_result));
md5_finish(&ctx, result);
to_y64(crypt_hash, result, 16);
switch (sv) {
case 1:
case 6:
checksum = seed[seed[9] % 16];
g_snprintf(hash_string_p, strlen(name) + 50,
"%c%s%s%s", checksum, name, seed, password_hash);
g_snprintf(hash_string_c, strlen(name) + 50,
"%c%s%s%s", checksum, name, seed, crypt_hash);
break;
case 2:
case 7:
checksum = seed[seed[15] % 16];
g_snprintf(hash_string_p, strlen(name) + 50,
"%c%s%s%s", checksum, seed, password_hash, name);
g_snprintf(hash_string_c, strlen(name) + 50,
"%c%s%s%s", checksum, seed, crypt_hash, name);
break;
case 3:
checksum = seed[seed[1] % 16];
g_snprintf(hash_string_p, strlen(name) + 50,
"%c%s%s%s", checksum, name, password_hash, seed);
g_snprintf(hash_string_c, strlen(name) + 50,
"%c%s%s%s", checksum, name, crypt_hash, seed);
break;
case 4:
checksum = seed[seed[3] % 16];
g_snprintf(hash_string_p, strlen(name) + 50,
"%c%s%s%s", checksum, password_hash, seed, name);
g_snprintf(hash_string_c, strlen(name) + 50,
"%c%s%s%s", checksum, crypt_hash, seed, name);
break;
case 0:
case 5:
checksum = seed[seed[7] % 16];
g_snprintf(hash_string_p, strlen(name) + 50,
"%c%s%s%s", checksum, password_hash,
name, seed);
g_snprintf(hash_string_c, strlen(name) + 50,
"%c%s%s%s", checksum, crypt_hash, name, seed);
break;
}
md5_init(&ctx);
md5_append(&ctx, hash_string_p, strlen(hash_string_p));
md5_finish(&ctx, result);
to_y64(result6, result, 16);
md5_init(&ctx);
md5_append(&ctx, hash_string_c, strlen(hash_string_c));
md5_finish(&ctx, result);
to_y64(result96, result, 16);
pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP,
YAHOO_STATUS_AVAILABLE, 0);
yahoo_packet_hash(pack, 0, name);
yahoo_packet_hash(pack, 6, result6);
yahoo_packet_hash(pack, 96, result96);
yahoo_packet_hash(pack, 1, name);
yahoo_send_packet(yd, pack);
g_free(hash_string_p);
g_free(hash_string_c);
yahoo_packet_free(pack);
}
/* I'm dishing out some uber-mad props to Cerulean Studios for cracking this
* and sending the fix! Thanks guys. */
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click