Needed: madCodeHook Expert
-
- Posts: 14
- Joined: Mon Dec 27, 2004 9:38 pm
Needed: madCodeHook Expert
Hello everyone,
A friend of mine (owner of a major Internet software company) has asked me to help him locate a skilled Windows API/Network programmer to do some advanced coding.
I immediately thought to come here, because being a developer myself, I have extreme respect for the people on this board (of course, including madshi himself).
If anyone here believes they can do either one of the following tasks, you're the guy/gal for this job:
a) use madCodeHook (or another method) to trap all outgoing Outlook Express email and modify it before going out
or
b) PREFERRED - use madCodeHook (or another method) to trap all outgoing TCP/IP traffic, and modify all emails (regardless of client) before going out.
The modifications would be as simple as adding or changing text in the message body, as defined a set of simple rules that will be given to you.
This software would need to work on all platforms, from Windows 95 to Windows XP SP2.
The preferred language would be Delphi 6 or 7 (although if you believe you can do this, but would prefer another language, that is fine).
Please rest assured that the use of this code will not be malicious in any way. Unfortunately I can not go into the details any further than this until an NDA has been signed.
They are looking to hire immediately.
Please PM me here on this board, or contact me at garyglaze2496@bluebottle.com if you think you can do this, or you know someone who can. The first qualified person to respond will be hired.
Madshi, you aren't excluded from this by any means
To whoever qualifies, if you do well, I am told there may be a long term programming position available for you (you would be able to work over the Internet).
Looking forward to getting to know some of you better!
Gary
Gary Glaze
A friend of mine (owner of a major Internet software company) has asked me to help him locate a skilled Windows API/Network programmer to do some advanced coding.
I immediately thought to come here, because being a developer myself, I have extreme respect for the people on this board (of course, including madshi himself).
If anyone here believes they can do either one of the following tasks, you're the guy/gal for this job:
a) use madCodeHook (or another method) to trap all outgoing Outlook Express email and modify it before going out
or
b) PREFERRED - use madCodeHook (or another method) to trap all outgoing TCP/IP traffic, and modify all emails (regardless of client) before going out.
The modifications would be as simple as adding or changing text in the message body, as defined a set of simple rules that will be given to you.
This software would need to work on all platforms, from Windows 95 to Windows XP SP2.
The preferred language would be Delphi 6 or 7 (although if you believe you can do this, but would prefer another language, that is fine).
Please rest assured that the use of this code will not be malicious in any way. Unfortunately I can not go into the details any further than this until an NDA has been signed.
They are looking to hire immediately.
Please PM me here on this board, or contact me at garyglaze2496@bluebottle.com if you think you can do this, or you know someone who can. The first qualified person to respond will be hired.
Madshi, you aren't excluded from this by any means
To whoever qualifies, if you do well, I am told there may be a long term programming position available for you (you would be able to work over the Internet).
Looking forward to getting to know some of you better!
Gary
Gary Glaze
Hi Gary,
that shouldn't be too difficult. Look here for a demo app which does already catch mail sending of any mail client:
http://www.blad3.ro/
Changing it to include manipulation of the mail shouldn't be a big problem.
Of course I have to add, that madCodeHook may only be used for legal purposes. So please clarify the situation with the laws in your country.
that shouldn't be too difficult. Look here for a demo app which does already catch mail sending of any mail client:
http://www.blad3.ro/
Changing it to include manipulation of the mail shouldn't be a big problem.
Of course I have to add, that madCodeHook may only be used for legal purposes. So please clarify the situation with the laws in your country.
-
- Posts: 14
- Joined: Mon Dec 27, 2004 9:38 pm
-
- Posts: 14
- Joined: Mon Dec 27, 2004 9:38 pm
Adding something shouldn't be that difficult, I guess.
Try contacting the guy from: http://www.blad3.ro/ . If he doesn't want to do it, I might eventually do it - depending on how much you pay...
Try contacting the guy from: http://www.blad3.ro/ . If he doesn't want to do it, I might eventually do it - depending on how much you pay...
-
- Posts: 380
- Joined: Sat Dec 11, 2004 2:11 am
- Location: San Francisco Bay Area, CA USA
- Contact:
Ahh, you mean like how Google puts the ads at the bottom of gmail?GaryGlaze2496 wrote:Hi,
Desired result is to add something
Perhaps a dumb idea, but are you just appending your data to the same buffer that is being sent out? If so, that buffer may not be big enough. Copy the original data into a new buffer, add your data at the end, then send the new buffer.
-- David
-
- Posts: 14
- Joined: Mon Dec 27, 2004 9:38 pm
Code
Hey guys,
Here is the code that was tried, that does not work
Essentially, it works if we try to replace 'abcd' with 'efgh', but if we try to increase the length, it seems to crash all over the place.
All that's needed I suppose is the code that will enable us to increase the length of the buffer without causing everything to go crazy...
Thanks!
Gary
P.S. As I said earlier, if you help solve this problem...you may very well have the opportunity to be hired for a programming position...if you want, of course.
Here is the code that was tried, that does not work
Essentially, it works if we try to replace 'abcd' with 'efgh', but if we try to increase the length, it seems to crash all over the place.
All that's needed I suppose is the code that will enable us to increase the length of the buffer without causing everything to go crazy...
Thanks!
Gary
P.S. As I said earlier, if you help solve this problem...you may very well have the opportunity to be hired for a programming position...if you want, of course.
Code: Select all
library WSHook;
uses Dialogs, Windows, SysUtils, Winsock, madCodeHook, madStrings;
var
sendNextHook: function(s: Integer; Buf: Pointer; len, flags: Integer): Integer; stdcall;
function sendHookProc(s: Integer; Buf: Pointer; len, flags: Integer): Integer; stdcall;
var
s1: string;
begin
SetString(s1, PChar(Buf), len);
ReplaceStr(s1, 'abcd', 'efghi');
result := sendNextHook(s, pointer(s1), length(s1), flags);
end;
begin
HookAPI('ws2_32.dll', 'send', @sendHookProc, @sendNextHook);
end.
Well, that code looks just fine to me. Are you sure that it doesn't work?
Maybe the sender is using asynchronous sending and the problem is that the string buffer gets freed too early? Can't really imagine that this would be the case, since usually only those WSA*** functions are asynchronous. Not sure, though, am no WinSock expert.
Btw, please do not use Dialogs in a hook dll. It will result in lots of VCL junk being linked into your hook dll! That's quite bad, because the dll size will grow. Also your hook dll will do lots of initialization and finalization work which is not good for a hook dll. A good hook dll should do only as much as absolutely necessary. Also try to get along without SysUtils, if possible. That saves another 20-30kb overhead.
Maybe the sender is using asynchronous sending and the problem is that the string buffer gets freed too early? Can't really imagine that this would be the case, since usually only those WSA*** functions are asynchronous. Not sure, though, am no WinSock expert.
Btw, please do not use Dialogs in a hook dll. It will result in lots of VCL junk being linked into your hook dll! That's quite bad, because the dll size will grow. Also your hook dll will do lots of initialization and finalization work which is not good for a hook dll. A good hook dll should do only as much as absolutely necessary. Also try to get along without SysUtils, if possible. That saves another 20-30kb overhead.
-
- Posts: 14
- Joined: Mon Dec 27, 2004 9:38 pm
Pretty sure ;-)
Hey mashi,
Thanks for your quick reply!
Yes, I'm sure it doesn't work - We compiled it with Delphi7 and the latest madCodeHook, and sending email with "abcd" in it will cause the email to not be sent, and eventually screws up Outlook/Outlook Express, which need to be restarted.
Sending email without "abcd" works fine, as does changing the replace string to something that is the same length.
I know the code probably looks fine to you because we grabbed it from another thread, where you posted almost all of it.
Did you actually compile and test it on your machine?
If so, which version of Delphi did you use, and what outgoing TCP/IP did you test it on?
Thanks!
Gary
Thanks for your quick reply!
Yes, I'm sure it doesn't work - We compiled it with Delphi7 and the latest madCodeHook, and sending email with "abcd" in it will cause the email to not be sent, and eventually screws up Outlook/Outlook Express, which need to be restarted.
Sending email without "abcd" works fine, as does changing the replace string to something that is the same length.
I know the code probably looks fine to you because we grabbed it from another thread, where you posted almost all of it.
Did you actually compile and test it on your machine?
If so, which version of Delphi did you use, and what outgoing TCP/IP did you test it on?
Thanks!
Gary
-
- Posts: 14
- Joined: Mon Dec 27, 2004 9:38 pm
I just had a thought: "send" returns the number of bytes sent. You need to correct that, if you change the length of the data.
Let's say Outlook sends 100 bytes and you manipulate it to 120. Your hook callback function nevertheless should only return 100 bytes, although you really sent 120 bytes. Maybe that fixes the problem?
No, I didn't test any of this.
When needing message boxes for testing please use MessageBox in hook dlls. That is thread safe and doesn't use VCL. I'm using it myself. It makes sure that there are no new problems because of VCL.
Let's say Outlook sends 100 bytes and you manipulate it to 120. Your hook callback function nevertheless should only return 100 bytes, although you really sent 120 bytes. Maybe that fixes the problem?
No, I didn't test any of this.
When needing message boxes for testing please use MessageBox in hook dlls. That is thread safe and doesn't use VCL. I'm using it myself. It makes sure that there are no new problems because of VCL.
-
- Posts: 380
- Joined: Sat Dec 11, 2004 2:11 am
- Location: San Francisco Bay Area, CA USA
- Contact:
Re: Code
How exactly does it crash? Have you got a call stack?GaryGlaze2496 wrote:Hey guys,
Essentially, it works if we try to replace 'abcd' with 'efgh', but if we try to increase the length, it seems to crash all over the place.
The send() documentation says this:
It shouldn't crash, but you could go beyond the size allowed by the socket. In that case, you need to do multiple send() calls, I guess.For message-oriented sockets, care must be taken not to exceed the maximum packet size of the underlying provider, which can be obtained by using getsockopt to retrieve the value of socket option SO_MAX_MSG_SIZE. If the data is too long to pass atomically through the underlying protocol, the error WSAEMSGSIZE is returned, and no data is transmitted.
-- David
-
- Posts: 380
- Joined: Sat Dec 11, 2004 2:11 am
- Location: San Francisco Bay Area, CA USA
- Contact:
madshi wrote:I just had a thought: "send" returns the number of bytes sent. You need to correct that, if you change the length of the data.
Let's say Outlook sends 100 bytes and you manipulate it to 120. Your hook callback function nevertheless should only return 100 bytes, although you really sent 120 bytes. Maybe that fixes the problem?
No, I didn't test any of this.
When needing message boxes for testing please use MessageBox in hook dlls. That is thread safe and doesn't use VCL. I'm using it myself. It makes sure that there are no new problems because of VCL.
Good idea about the return value.
ReplaceStr() probably allocates a new buffer if the string grows. Is the Delphi heap allocator thread-safe? With all that other VCL stuff going on, perhaps the heap is getting corrupted.
Gary, try allocating a big global buffer in DllMain and use that instead of the s1 local variable. Perhaps that will fix the crashes.
Fingers crossed,
David