|
Raw sockets: look at ping.c sample in MSDN..
Raw packet capture library: http://www.winpcap.org
The above two will help you detect a SYN pkt from clients.
But you'll be wasting your time trying to code a conventional client-server prog using the above two methods.. you'll have to write the the entire TCP protocol suite yourself at the server end. Why dont you simply use a packet filter firewall at the server?
|
|
|
|
|
I suppose that you have a good level on networking programming
then do this if not just forget about, sorry
Normaly with Socket API it is not possible, because while calling accept() the client get connect.
For that you need to use some firewall in your program for packet filter
here is am easy way to do that:
INTERFACE_HANDLE hInterface; // interface
PFFORWARD_ACTION defaultAction=PF_ACTION_DROP;
// create the interface
// I create the interface. Predefined acctions, forward all.
DWORD errorCode = PfCreateInterface(0,defaultAction,defaultAction,FALSE,TRUE,&hInterface);
if(errorCode != NO_ERROR)
{
return -1;
}
// Bind the Ip Address with the interface
PBYTE lIp = (PBYTE)&ip; //the ip address of your card
errorCode = PfBindInterfaceToIPAddress(hInterface, PF_IPV4, lIp);
if(errorCode != NO_ERROR)
{
PfDeleteInterface(hInterface);
hInterface = NULL;
return -1;
}
/////////////////////////////////////////////////////
now here do with the code
{
DWORD result;
PIP_ADAPTER_INFO pAdapterInfo = NULL, aux;
IP_ADDR_STRING *localIp;
unsigned long len = 0;
GetAdaptersInfo(pAdapterInfo, &len);
pAdapterInfo = (PIP_ADAPTER_INFO) malloc (len);
result = GetAdaptersInfo(pAdapterInfo, &len);
if(result != ERROR_SUCCESS)
{
AfxMessageBox("Error getting adapters info.");
return;
}
// Fill the real filter struct
PF_FILTER_DESCRIPTOR ipFlt;
ipFlt.dwFilterFlags = FD_FLAGS_NOSYN;
ipFlt.dwRule = 0;
ipFlt.pfatType = PF_IPV4;
ipFlt.dwProtocol = protocol; // value is : TCP =6;UDP=17 or ICMP=1
ipFlt.fLateBound = 0;
ipFlt.wSrcPort = srcPort; // source port
ipFlt.wSrcPortHighRange = srcPort; // source port range
ipFlt.wDstPort = dstPort; // destination port
ipFlt.wDstPortHighRange = dstPort; // destination port range
unsigned long lIpSrc = CharToIp(srcIp); //chartoIP convert (*.*.*.*) to long
unsigned long lIpDst = CharToIp(dstIp);
unsigned long lMaskSrc = CharToIp(srcMask);
unsigned long lMaskDst = CharToIp(dstMask);
ipFlt.SrcAddr = (PBYTE) &lIpSrc;
ipFlt.SrcMask = (PBYTE) &lMaskSrc;
ipFlt.DstAddr = (PBYTE) &lIpDst;
ipFlt.DstMask = (PBYTE) &lMaskDst;
DWORD errorCode;
// I add the filter
if(direction == IN_DIRECTION || direction == ANY_DIRECTION)
errorCode = PfAddFiltersToInterface(hInterface,1,&ipFlt,0,NULL,NULL);
if(direction == OUT_DIRECTION || direction == ANY_DIRECTION)
errorCode = PfAddFiltersToInterface(hInterface,0,NULL,1,&ipFlt,NULL);
}
Not that when stopping your server
call PfDeleteInterface(hInterface); to delete your interface
Pierre kande
For serving you
|
|
|
|
|
Hello every one~
I want to get E-Mail account infomation of OutLook( express , XP, 2003... )
for example,
Incomming E-Mail Address( POP3 ) : mail.codeproject.com
Outgoing E-Mail Address( SMTP ) : mail.codeproject.com
User Name : bluebird
E-Mail Address : bluebird@codeproject.com
User ID : bluebird
User PassWd : ********
How to get this Infomation?
I have been saw about MAPI.
but I can't get Information that I want
Help me please.
and sorry for my little English
|
|
|
|
|
Blue-Bird wrote:
I have been saw about MAPI.
but I can't get Information that I want
What about Extended MAPI? Since you are interacting with Outlook, there's also CDO.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I asked about this several times in the C# forum and got no reply. Is there a way to use C# to impliment the solution you're suggesting ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian Graus wrote:
Is there a way to use C# to impliment the solution you're suggesting ?
Yeah I know one interface which enumerate Email,LDAP and news group Account for Outlook Express and that is IImnAccount and IImnAccountManager interface
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Christian Graus wrote:
Is there a way to use C# to impliment the solution you're suggesting ?
I do not know. I've never used C# before.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
um...
Do you give me more informations and sample source and URL?
thanks in advance
|
|
|
|
|
Try these links:
http://www.wischik.com/lu/programmer/mapi_utils.html
http://www.dimastr.com/outspy/default.htm
http://support.microsoft.com/kb/
http://www.softlookup.com/tutorial/vc++/vcu35fi.asp
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
thanks a lot!
Have a good job~
|
|
|
|
|
Wassup pal.. writing a trojan??
Want the code in C ??
|
|
|
|
|
no...
I make a Spam Mail Filter.
I want to get it for user's convenience
|
|
|
|
|
Ok..
read the all reg values under
HKCU\SOFTWARE\Microsoft\Internet Account Manager\Accounts\
All the goodies you want are there...
|
|
|
|
|
um...
I use WinXP.
and
there is no path HKCU\SOFTWARE\Microsoft\Internet Account Manager\Accounts\
check it again.
but
Thanks, have a good job
|
|
|
|
|
HKCU means HKEY_CURRENT_USER..
HKCU\SOFTWARE\Microsoft\Internet Account Manager\Accounts\ key is there in ALL Windoze boxes pal. XP/2003 etc etc. look it up again.
|
|
|
|
|
I know that HKCU means HKEY_CURRENT_USER..
and Checked again
but there's no regsitry...
|
|
|
|
|
I checked it other PC and looked up that
but there's no registry still...
what's wrong my PC?
thanks... for your help.
and
Do you know probleum of my PC
I installed OutLook2003.
and running now.
|
|
|
|
|
So you use Outlook2003.. not Outlook express. I personally don't have Outlook2003. But you may be able to locate the correct key in the registry yourself. Do a Find on the registry using a known E-mail account e.g abc@xyz.com. The key should show up in the find results.
|
|
|
|
|
um...
there is that reg path where othre PC using OutLook 2003.
and I registered 3 account to OutLook 2003 on my PC.
I don't konw what problem
and thanks for your continuous help
|
|
|
|
|
Check HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook
|
|
|
|
|
there is HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\OMI Account Manager\Accounts
but don't have any informations...
just blank key or default values...
|
|
|
|
|
Perhaps you do not have any accounts configured. Is Outlook configured to get e-mail from the Internet (POP3 and SMTP) or Exchange?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
No...
I have 3 mail accounts and I've confitured
|
|
|
|
|
How to use ado to visit the database in C++.
It's better to show me some samples or links.
Thanks!
Zhou YuanXin
|
|
|
|
|
Link[^]
Christian Graus - Microsoft MVP - C++
|
|
|
|