Hiya,
Whats the code to generate a RAW ICMP packet via VC++ 6? Anyone have the code?
Thanks in advance...
Printable View
Hiya,
Whats the code to generate a RAW ICMP packet via VC++ 6? Anyone have the code?
Thanks in advance...
Do you just want to ping or is there something more you want to do with the packet?
You can't do raw packets I don't think (not portably, you have to be root under a POSIX system, and Administrator for Windows 2000). They're not supported at all by any other Windows except XP which has them enabled for *everyone*...god what a stupid idea...
Why does XP have them for everyone??
No idea. They're almost totally unnecessary and a huge security breach -- just think, DOS using zombie Windows XP computers that have already been compromised. You can forge the outgoing IP address and *nothing* will know where it's come from.
I just wanted to PING. I did hear that "I could create RAW packets" in VC++ under Windows 2000/XP... so if its possible... why not? I just want to experiment around with it ;)
Plus... when I searched for ICMP on MSDN, I did come across a topic that was "ICMP raw (code sample)", but I don't have the 2nd MSDN CD to view it :(
Quote:
Originally posted by Technocrat
Do you just want to ping or is there something more you want to do with the packet?
You could try searching online at:
http://msdn.microsoft.com
I did, the ICMP raw packets no longer seem to exist there.. it must have been removed ;)
Quote:
For obvious reasons... :D
Why supply fodder to hackers who want to break XP?
dude...Im not a hacker :P and I'm not a "packet kiddie". I'm just a University Student doing what hes supposed to be doing, that is, Programming. ;)
using icmp.dll is lame, winsock2 sdk has no examples on advanced icmp programming, the online msdn has taken the articles on advanced icmp off the board.
Quote:
Originally posted by jim mcnamara
For obvious reasons... :D
Why supply fodder to hackers who want to break XP?
The results of the ping to the address "addy", will be in the text file "ret_file". You can then simplay parse what you want out of that =).Code:void ping(char* addy, char* ret_file)
{
char command[256];
sprintf(command, "ping -n 4 %s > %s", addy, ret_file);
system(command);
}
Z.
Not quite what I wanted... but its quite interesting...
system(); -> which header file is that located in?
Quote:
Originally posted by Zaei
The results of the ping to the address "addy", will be in the text file "ret_file". You can then simplay parse what you want out of that =).Code:void ping(char* addy, char* ret_file)
{
char command[256];
sprintf(command, "ping -n 4 %s > %s", addy, ret_file);
system(command);
}
Z.
stdlib.h
Just be caureful with that command, as it sends the string you pass to the system command processor. This can lead to mishaps where on one OS, the command works fine, but on another, the command doesnt exist (example, "ps" would list all running processes on Linux/Unix, but not on a Windows box).
Z.
I still stand by my viewpoint that you have to be a network maniac to need raw packets / sockets ;)Quote:
Originally posted by cyberwarpy
dude...Im not a hacker :P and I'm not a "packet kiddie". I'm just a University Student doing what hes supposed to be doing, that is, Programming. ;)
using icmp.dll is lame, winsock2 sdk has no examples on advanced icmp programming, the online msdn has taken the articles on advanced icmp off the board.
Anyway, I thought you could construct a ping packet without needing raw access (i.e. you can just give it the correct payload). Been a while since I read any RFCs on it though :)
to follow up after Parksie -
Get onto a unix box and type: man socket
You'll see that what you can do with sockets (winsock is just MS answer to coding BSD unix sockets). It is fairly complex.
On your windows box: open socket.h and read thru it. Most All the same socket calls are in there; the unix screen above shows virtually the same ones, with the same structs. There is your docset for raw packets, if you want to go to the trouble.
In the windows world icmp isn't lame.
Are you telling me I would be able to compile a *BSD icmp code in VC++ just by using <winsock.h> ?
Quote:
Originally posted by jim mcnamara
to follow up after Parksie -
Get onto a unix box and type: man socket
You'll see that what you can do with sockets (winsock is just MS answer to coding BSD unix sockets). It is fairly complex.
On your windows box: open socket.h and read thru it. Most All the same socket calls are in there; the unix screen above shows virtually the same ones, with the same structs. There is your docset for raw packets, if you want to go to the trouble.
In the windows world icmp isn't lame.
Mostly, yes. You need to look at WSStartup (or something like that, there's a function you need to call before sockets work in Windows).
I think that the function is "WSAStartup()".
Z.