need help in input/output operations!!

Discussion of programming on Linux, including shell scripting, perl, python, c/c++, mono, java. Whatever tickles your fancy.
Post Reply
cppkid
Lance Naik
Posts: 17
Joined: Wed Aug 04, 2004 6:03 pm
Location: Islamabad
Contact:

need help in input/output operations!!

Post by cppkid »

I am writing a program to see someone's chat messeges of msn messenger, if on same network. same ISP, or same LAN, When i run compile and run it from as a root, it works fine, but when i run my program from a non-root account it won't work as it use iopl() adn ioperm() calls to gain access for direct IO.
Do anybody knows an alternative to iopl() and ioperm(), or some other way to wirte data to port??? I am currently using inp() and outp() .
I need it urgent...!
Thanks in advance..
Praise the sea, But stay on Land
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Re: need help in input/output operations!!

Post by lambda »

why do you need to write data to the port to read someone's msn messages? and why not just use libpcap?
cppkid
Lance Naik
Posts: 17
Joined: Wed Aug 04, 2004 6:03 pm
Location: Islamabad
Contact:

Post by cppkid »

Almost all of the networks use switches and you all know it well that switch use the mac address table and only send the related data to a client, unlike a hub, so if you want to grab somone's msn chat, its only possible if you are recieving his data too. So a simple solution to this is that, just don't let the switch to get your true MAC address, so either you have to rewite the MAC address layer protocol or the thing what i am doing.
Praise the sea, But stay on Land
irfanhamid
Cadet
Posts: 4
Joined: Tue Jun 01, 2004 12:38 am
Location: Paris, France

Not sure it can be done

Post by irfanhamid »

I think whether you use libpcap or the iopl() interface, it will require you to be root to allow you to send or capture raw data from the net interface.
There are 10 types of people in this world.
Those who know binary, and those who don't.
zeenix
Naik
Posts: 67
Joined: Wed Apr 23, 2003 4:01 am
Location: Finland
Contact:

Post by zeenix »

Hello,

1. libpcap and libnet are your best friends if you want to handle low-level packets (ethernet or otherwise) in APPLICATION layer. There is no need to go that much low-level for this, even if you do so in the kernel-space.

2. NEVER trust inb/oub and friends in the user-space. You'll get the problem of missing bytes. I had learnt this lesson from practical experience. The reason is that you app. MAY get scheduled while it is in the middle of an input/output operation.
"I think therefore I am" --- Rene Descartes
Post Reply