What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Plug-Ins » Tool to encrypt or decrypt log files

Pages: (9): « First « 5 6 7 8 [ 9 ] Last »
Tool to encrypt or decrypt log files
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Tool to encrypt or decrypt log files
Have you tried calling GetLastError to see what the error is?
03-09-2011 06:11 PM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Tool to encrypt or decrypt log files
There are many things wrong though. If that is your entire code, it will never work properly. Instead post everything, including declarations.

Either way, with such an 'old' and dirty code style debugging is very difficult. Determining why that last API fails is the least of your worries.

Start by at least properly declaring and initializing all your variables! Especially if you are using Windows APIs it is essential you use proper code style and don't rely on defaults and the Variant types. Also note that there is no 'decimal' type in VB.

Second, you need to know the difference between unicode and ansi strings and how VB handles them, and thus how to implement it properly. For example, your password is not send as unicode to the APIs to begin with. Also learn what byte arrays are and the proper way to handle them and how they relate to ansi and unicode strings.

Third, the routines (cryptogrpahic provider and context) for decrypting a Messenger Plus! log might have changed since that first post in this thread, so using those might only work for old logs.

Fourth, you can't simply use the entire contents of the encrypted log file like that! It has a specific format with a header, data, contents, etc.

---

So, in a nutshell, there is so much wrong with that code that correcting it would simply result in giving you a complete working code. It is not a matter of just fixing a line or two, it needs a complete rewrite from scratch. Hence my next question and comments:

Have you programmed in VB before or is this one of your first things you've programmed? Because that entire code looks like it has been made by a first-time programmer, no offense though (everybody needs to start somewhere). But if it is one of your first programs, I strongly suggest to first learn a few things (eg: proper ansi/unicode handling and how VB handles it internally, proper binary file reading, etc) and first make easier things you completely understand, before copy/pasting and trying to make your own logfile decrypter.

This post was edited on 03-10-2011 at 12:21 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
03-09-2011 11:58 PM
Profile PM Find Quote Report
willy469
New Member
*


Posts: 3
Joined: Mar 2011
RE: Tool to encrypt or decrypt log files
I have pasted just the part of the code I thought that was wrong.
I have declared  apis and variables , but I understand that it was not necesary to paste that..
The code is like that becuase I was just trying to verify if the MsgPlus encryption and decryption worked that way, so I wrote something quick.
You are right, I need to learn a lot before trying with this stuff.
Thanks anyway.
Willy
03-10-2011 01:38 AM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Tool to encrypt or decrypt log files
Ah, I see.
Forgive me for being a bit blunt in my previous post though.

But, yes, the encryption works in that way, sort of. That is, the cryptographic provider and context strings might have change, just as the key values, since the time the first post in this thread has been made. Also the file format of encrypted logs has changed. But the prinicple is just the same. Deltailed pseudo-code to read a version 1 encrypted log can be seen in that first post in this thread.

If you're interested in using the Cryptography APIs in VB I can suggest two very good books: http://www.amazon.com/gp/product/0672318369 and http://www.amazon.com/gp/product/0471381896
But they are not exactly aimed for the novice user though. Also see http://www.cryptovb.com/

As for the VB code itself: yes declarations of variables and APIs are very important and must always be included. A wrong type declaration of a variable can make or break an entire code.

This post was edited on 03-10-2011 at 08:06 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
03-10-2011 08:00 AM
Profile PM Find Quote Report
willy469
New Member
*


Posts: 3
Joined: Mar 2011
RE: Tool to encrypt or decrypt log files
thank you so much for the information!

Best..

Willy
03-12-2011 01:55 AM
Profile E-Mail PM Find Quote Report
Pages: (9): « First « 5 6 7 8 [ 9 ] Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On