开发者

Help me get started (traffic manipulation)

开发者 https://www.devze.com 2023-02-19 17:38 出处:网络
My main goal is to create an advanced program for manipulating the packets that route within my network via the router. Let my program have total control over the router. Set the download/upload speed

My main goal is to create an advanced program for manipulating the packets that route within my network via the router. Let my program have total control over the router. Set the download/upload speeds to my inputs, apply the effect to certain devices within in my network. Block upload or download traffic. Set second delay for either the upload or download speed. Specify % of loss packets, and the list goes on.

The problem is that I don't know where to start. I know most languages at the very most basic level. I'd like to create this program in either C, C++ or C# but I don't know yet. What els开发者_开发问答e do I need to know before creating this program? Winsock or something? Winpcap APIs?

This goal is my motivation to learn programming to the extreme, and I'm really looking forward to it.

Thanks in advance!


Hmmm I guess you would want to look at pcap(?): pcap


Check out:

http://beej.us/guide/bgnet/html/multi/index.html

'Beej's Guide to Network Programming Using Internet Sockets'

All you could possibly need to know about programming sockets for capture and manipulation.

If I were you I'd write it in C, I'm writing a similar project at the moment in C++ and it's hell but too late to stop and start again.

Hope that helps.


Bear in mind that you either need a router that you can re-program or you need to use your PC as a router to do this.

Either way you want to look into how IPTABLES are implemented.


I've never seen Desktop Windows used as a router only Windows Server, though it may still be possible. libpcap is for packet capture, but not interception as I understand it. Programs like Wireshark use it to monitor copies of packets, but not to modify them. If you want to attempt this, my impression has been that there is a lot more documentation and tools for doing something like this with NetFilter/IPTables on Linux. You can even install something like OpenWRT on a compatible router and get a small, cheap Linux router, though having Desktop Linux will probably help for development. The NetFilter QUEUE library can be used with some IPTables firewall rules to redirects specific (or all) packets to a regular user program. That program can then read the packet and modify it or even request it to be dropped.

http://www.netfilter.org/projects/libnetfilter_queue/


If you want to manipulate network traffic on a Windows machine (as you mentioned), you will need some extra software. This operating system wont give you the full control over itself, which is fine for some reasons.

I think what you want to do, should be done with either winpcap or win10pcap if you are using Win10. These packages contains a windows driver and the libpcap user space library.

0

精彩评论

暂无评论...
验证码 换一张
取 消