LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-06-2012, 12:34 AM   #1
pradiptart
Member
 
Registered: Sep 2007
Posts: 102

Rep: Reputation: 12
How to write a Program to get the address of a device by ARP?


Hi,
hello,I have to write a program to get a simple details of a mobile device(cell phone).

That moblile device is having an IP in it by a wi-fi connection with it.The major thing is that i pinged that IP and I am getting connection packets getting back to my pc,means I can communicate with the devices. so can I able to get the details of the device.

details means
1.its name what user sets on it.
2.some address like mac in computers.
3.model name.
4.type of os in it.
etc

I really find this interesting but,no idea how to do but i got something like ARP protocol for getting the mac address but I do not know how to communicate with a phone with this ARP protocol.

can any one have some idea ,kindly tell me,it is very important for my project.

Thanks

Last edited by pradiptart; 07-06-2012 at 12:35 AM.
 
Old 07-06-2012, 03:16 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by pradiptart View Post
I am getting connection packets getting back to my pc,means I can communicate with the devices. so can I able to get the details of the device.
details means
1.its name what user sets on it.
2.some address like mac in computers.
3.model name.
4.type of os in it.
etc

(..) I do not know how to communicate with a phone with this ARP protocol.
MAC-to-IP mappings are a question of eliciting ARP "WHO-HAS" replies, the OS could be done with any active scanner like Nmap (probably crudely and not if nobody donated signatures) or a passive scanner like p0f (requires sigs plus connection, probably even less feasible) but unless a phone provides an interface to query it (I mean like this) you AFAIK won't be able to get user-set name or model over IP.

Last edited by unSpawn; 07-06-2012 at 07:48 PM. Reason: //Close BB tag
 
1 members found this post helpful.
Old 07-06-2012, 07:12 PM   #3
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
I think what unSpawn is trying to say is that just because a device has an IP, it doesn't mean the device is going to provide all the information you want. Unless you know of a certain protocol that does provide what you want, or if the phone has an installed app that does that, I think you'll be out of luck. ARP is always available on IP networks, because at the lowest level, all traffic travels as network datagrams, and the destination address is (normally) expressed in terms of the MAC. On most hosts, ARP data is cached for a short time, and Linux allows you to look at the cache with the command 'arp' (probably in /usr/sbin).

--- rod.
 
1 members found this post helpful.
Old 07-07-2012, 05:37 AM   #4
pradiptart
Member
 
Registered: Sep 2007
Posts: 102

Original Poster
Rep: Reputation: 12
Hi unSpawn and theNbomr,

Yes, I understand this,but I want to communicate to it by a program first,like ping .

I got something like arping one command is there where we can ping to a device which gives you a mac address,means it is getting the mac address of the device with in a network or a WLAN ,so is it a good idea to write a arping program to get the MAC address of the mobile.

Just give a right direction,or is there any other way to do so.

I am trying upon an android phone so can is there any method to create an application which talk with the phone from pc,means can we create a client application which will always sending some information from a mobile and our pc having a server application which will listen to it and get the data.

Thanks
 
Old 07-07-2012, 05:26 PM   #5
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
To get the MAC, make a shell script that pings the host, and then immediately dumps the arp cache. Use grep to locate the desired entry.

If you are able to write applications for Android, it shouldn't be too difficult to write the client/server aspects. I don't know what, if any, API Android might provide for determining host-specific information. You could probably make the Android app an HTTP server, and use any web browser as a client.

--- rod.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Address Resolution Protocol (ARP) problem Ed Eckelmeyer Linux - Newbie 1 08-15-2010 11:05 PM
Difference between ARP and iwgetid -ar MAC addresses? chconnor Linux - Networking 7 04-17-2010 02:21 AM
IP addresses Vs MAC and ARP KinnowGrower Linux - Networking 6 09-15-2008 02:33 PM
ARP (MAC) Authentication in SQUID error farrukhndm Linux - Server 1 04-08-2008 07:27 AM
need your assist regarding mac/arp poison Net_Spy Linux - Security 3 05-12-2007 12:39 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration