Capturing TCP/IP packets in (DOS)
-
Hello everyone, First time post here so please be lenient. My question is in regards to a C++ syntax problem. I am trying to make a standard (DOS) program that can capture TCP/IP traffic. This will be an academic project between a friend and I. Question is this; how do we go about getting the program to interface with the Layer 3 (network layer) to capture TCP/IP traffic? We are also trying to figure out how to retrieve device properties and display them in the terminal. Information such as a standard input “ipconfig” to display the network adapter’s information. This entire program will be in C++, using N++ for a editor and Dev++ for a compiler. Please if there is any required reading you would recommend, please include it in your response. Thank you very much in advance, V/R Rob&Big
-
Hello everyone, First time post here so please be lenient. My question is in regards to a C++ syntax problem. I am trying to make a standard (DOS) program that can capture TCP/IP traffic. This will be an academic project between a friend and I. Question is this; how do we go about getting the program to interface with the Layer 3 (network layer) to capture TCP/IP traffic? We are also trying to figure out how to retrieve device properties and display them in the terminal. Information such as a standard input “ipconfig” to display the network adapter’s information. This entire program will be in C++, using N++ for a editor and Dev++ for a compiler. Please if there is any required reading you would recommend, please include it in your response. Thank you very much in advance, V/R Rob&Big
it looks like you're attempting to write a driver/system like this :- http://www.winpcap.org/[^]
rbwest86 wrote:
C++ syntax problem
dont understand what you mean here
rbwest86 wrote:
standard (DOS) program
huh ? do you mean a console-mode executable ? It really depends on what the purpose of the exercise is - you can waste a lot of time writing something as good as winpcap yourselves, and/or its cousin 'WireShark' for viewing the data
rbwest86 wrote:
We are also trying to figure out how to retrieve device properties and display them in the terminal.
c'mon - google for it - there's plenty of examples out there, even some here on CP
-
Hello everyone, First time post here so please be lenient. My question is in regards to a C++ syntax problem. I am trying to make a standard (DOS) program that can capture TCP/IP traffic. This will be an academic project between a friend and I. Question is this; how do we go about getting the program to interface with the Layer 3 (network layer) to capture TCP/IP traffic? We are also trying to figure out how to retrieve device properties and display them in the terminal. Information such as a standard input “ipconfig” to display the network adapter’s information. This entire program will be in C++, using N++ for a editor and Dev++ for a compiler. Please if there is any required reading you would recommend, please include it in your response. Thank you very much in advance, V/R Rob&Big
Welcome to codeproject! To echo Garth a bit: c++ syntax has nothing to do with this. That's things like "How do I make a for loop", not "how do I access hardware to grab TCP/IP data". Next, do you *really* mean DOS? Those installation disks must have been very dusty... If you mean "I'm running windows, but I don't know about messages and things, so I just want a console program", then codeproject can help you. Have a look in: http://www.codeproject.com/KB/IP/[^] I can see three articles in as many seconds, searching for "sniff": Statistic consol sniffer – no driver installation is needed[^] WinSniff :The packet capturing application for Windows[^] Sniffing using Winsock[^] That should keep you going a little while. Other search term you might want to use is: "promiscuous". It's what a network card that's listening to *everything* is called. Good luck, Iain.
In the process of moving to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
-
Welcome to codeproject! To echo Garth a bit: c++ syntax has nothing to do with this. That's things like "How do I make a for loop", not "how do I access hardware to grab TCP/IP data". Next, do you *really* mean DOS? Those installation disks must have been very dusty... If you mean "I'm running windows, but I don't know about messages and things, so I just want a console program", then codeproject can help you. Have a look in: http://www.codeproject.com/KB/IP/[^] I can see three articles in as many seconds, searching for "sniff": Statistic consol sniffer – no driver installation is needed[^] WinSniff :The packet capturing application for Windows[^] Sniffing using Winsock[^] That should keep you going a little while. Other search term you might want to use is: "promiscuous". It's what a network card that's listening to *everything* is called. Good luck, Iain.
In the process of moving to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
Well after reading a lot about this topic, I have found that this covers a different side of programming I am unfamiliar with. I have read countless source codes all using winsock.h and have no idea how to properly use this. Would there be a good tutorial around here explaining C++ programming in conjunction with Networking? I am more familiar with a different aspect of C++. Thank you again for all the help. V/R Rob
-
Well after reading a lot about this topic, I have found that this covers a different side of programming I am unfamiliar with. I have read countless source codes all using winsock.h and have no idea how to properly use this. Would there be a good tutorial around here explaining C++ programming in conjunction with Networking? I am more familiar with a different aspect of C++. Thank you again for all the help. V/R Rob
If you are doing what I think you're doing, and writing an application to look at all network traffic passing your computer, then the subject is just plain difficult. If you are wanting client / server software to talk between computers, then it's a lot easier. Just look in the networking section of codeproject, and there;s a whole range of articles there, from simple chat between 2 pc programs, to full fledged servers. Either way, it's not an easy topic! Good luck, Iain.
In the process of moving to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
-
Hello everyone, First time post here so please be lenient. My question is in regards to a C++ syntax problem. I am trying to make a standard (DOS) program that can capture TCP/IP traffic. This will be an academic project between a friend and I. Question is this; how do we go about getting the program to interface with the Layer 3 (network layer) to capture TCP/IP traffic? We are also trying to figure out how to retrieve device properties and display them in the terminal. Information such as a standard input “ipconfig” to display the network adapter’s information. This entire program will be in C++, using N++ for a editor and Dev++ for a compiler. Please if there is any required reading you would recommend, please include it in your response. Thank you very much in advance, V/R Rob&Big
Ok, so I have done more reading. I have been reading about winsocks. I due have a question. Here is the code I have been piecing together. Can someone please tell me what I am doing wrong? I get a compiling error "using Dev++" on line 105. I know I am new to programming with sockets but I need a little guidance. I am stationed in Iraq and there is no reference other than feedback from this forum. Thank you very much in advance. Errors: Compiler: Default compiler Building Makefile: "C:\Users\mininet\C++\socket programming\Makefile.win" Executing make... make.exe -f "C:\Users\mininet\C++\socket programming\Makefile.win" all g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include" main.cpp:105: error: expected constructor, destructor, or type conversion before '=' token main.cpp:105: error: expected `,' or `;' before '=' token main.cpp:106: error: expected unqualified-id before "if" main.cpp:106: error: expected `,' or `;' before "if" main.cpp:115: error: expected unqualified-id before "if" main.cpp:115: error: expected `,' or `;' before "if" main.cpp:130: error: expected unqualified-id before "if" main.cpp:130: error: expected `,' or `;' before "if" make.exe: *** [main.o] Error 1 Execution terminated ------------------------------------------------------------------------------------ Here is the source I am working with.
= "WindowsApp"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) { HWND hwnd; /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /*