Hi!
I'm working for an anti-virus/security company, and a friend of mine wants to write a paper on DNS cache poisoning. So as to have some real data to give as exemple in his paper, he wants to run an attack on tests DNS servers. As he's not easy with C coding he asked me to do the job for him

So... i used libnet to send my forged DNS packets.
The root of the idea is to send my forged DNS answers before the real server answers... so I've got to be pretty quick. Here's some stats concerning the soft i wrote:
Code:
Program: ./dns-poisoner-ethernet
lun oct 31 17:10:52 GMT 2005
Domain name to spoof: www.test.test
IP address to inject in the cache: 172.16.0.1
IP address of the DNS server to poison: 192.168.0.79
IP address of the DNS forwarder the victim's calling: 192.168.1.254
IP address used to send the query to the DNS to poison: 192.168.0.80
Number of threads used: 10
Number of runs: 6
Durations (usec): 809551 801194 811995 783936 785022 887929
Average: 65536 packets sent in 813271 usec
12 usec / packet
80583 packet / sec
7082 kB/s
so, I'm sending the data at 7082 kB/s... quick enough to use on internet, as i don't even think that i have 7MB/s upload at the office, but still i would like to do some testing on a LAN (well... i wont attack any server on internet, that would be very professional).
Anybody has an idea why my soft do not manage do send packets at almost 100MB/s?
My friend proposed to use multi-threading, which i did, and indeed it improved my results... but still, I'm far from the 100mB/s.
I used libnet in LIBNET_LINK mode as it's supposed to be more efficient (and it is).
I wont post my code, as i don't want it to be used to perform real attacks, but i don't see how i could improve it... the issue really comes from libnet (libnet_write_link), since as soon as i comment this line (which makes the program useless) it runs 1000 times quicker.
Any idea on how i could improve all this?
Do you think i must give special options to gcc so that it optimizes the compilation? I must say that i'm not too bad at coding, but it never was my job, so i don't know much about gcc except that after running it i have an executable program (that's a beginning).
I read about using kernel mode to run my soft. Does anybody know where to find basic info on how to create a module for my program? Would it make my soft running a hundred times as fast?
[edit]
my machine is not a 4-processor server, just a simple AMD Athlon(tm) XP 2200+ with 514792 kB of RAM, but when my soft runs, it only uses smtg like 0.7% CPU and 0.1% RAM...