Skip to main content
GameDev.net gamedev.net
🔒 Locked

How can we implement GPS using C#

Started by Chetanhl Sep 5, 2009 at 3:08 AM 11 replies 7.2k views
Original Post
Chetanhl
Chetanhl
Hi, I have to implement GPS using C# for my college project. I know GPS is Global Positioning System but i don't have to implement it in such large scal it should just work in our college campus. My project should be able to locate people in my college campus. I did some R&D on this and thought about 2 possible ways to do it : - ------------------------------------------------------------------- Idea 1 : - (Use Mobile Phones) To locate people using there mobiles but i don't know how to do this thing. And also i won't be able to detect people using laptops or computers. Advantages : - This concept can be used on large scale to locate people out of campus also. We can use this thing for navtigation and all other things GPS can be used for. If we can get longitude and latitude we can use google earth to show its position on a map. DisAdvantages : - How do we detect people using laptops or pcs? -------------------------------------------------------------------------------- Idea 2 : - (Use Wireless Network) We have Wireless Network in our College Campus constiting of WiFi Access Points connected to switches and so on upto the server. So i was thinking to use these WiFi Access Points to locate people connected to the network. I can make a database of all Wifi Acess Points and there positions recording there ip address , mac address and there position in college campus. Then i can use IP address of UnknownClient to trace nodes in between server and that UnknownClient and then use the position of last known node in the path to display approximate position in the campus. Advantages : - We can use this to locate a particular user on network and can show its approx position also on a 2d top view map (map can be made using directx or using gdi). We can use this to locate any suspecious person on the network. Disadvantages : - We can only trace stationary people or moving people within limited range. We can't use this for navigation as good as in idea1. I made some programs in c# for trace route but it doesn't detects switches or wifi acess points in the networks. that maybe because these things dont have ip address so we might need to detect them by tracing mac address of nodes in path. But i cannot figure out how to do that in c# ? ----------------------------------------------------------------------------- So guyz need suggestions which approach to follow with some links, articles, books or anything to help me out. I wanna give it my best shot but for that i need some proper guidence.
Matt_D
Matt_D
we dont do homework

but, its clear you really dont know what problem your actually trying to solve. do you need to *get* position data? or can you pull that from a device? do you just need to work out where people are locally using data from another device?

focus less on the technology, and more on what problem your actually trying to solve
your never as good as they say you were, never as bad as they say you was.
BLiTZWiNG
BLiTZWiNG
I agree with Matt.

However, to get MAC address data in C# you'll need something like WinPcap and a C# wrapper for it.
Darg
Darg
Chetanhl your project is about GPS you say, neither method you're looking at has anything to do with GPS.

As for #1 you can't locate someone with their mobile phone without a warrant and going through the phone companies so good luck with that one!

And with #2 even if you can pursuade the college IT department to allow you access to their servers to see who is on each wireless network all you will know is that they are within x distance of the wireless point. With a decent point this could be anywhere from 50-200m or more.

GPS uses satellite communication devices to determine their exact location down to 1-2m. I would look into what you were actually supposed to work on. I assume they have GPS devices that you can hook into a computer and gain access to the data they output through C# somehow. Find out the devices they use and look up what API works with them.
Portfolio & Blog:http://scgamedev.tumblr.com/
Chetanhl
Chetanhl
At the time of posting this thread i relly didn't know what i was dealing with.
But i have a decent idea now.

It's not a homework or anything like that. We have to submit a project in this semester till december to be exact. I have many projects with me already that can serve the purpose but i got this idea from some friends and i want to this for learning purposes and to to do something different than other boring website & databse projects.
I just need some refrence to site books or soemthing like that where i can study and work on this thing.
If i wanted a ready made thing i would have bought it from any nearby shops.

Actually what i want to do for now is to locate a person's position in college campus either using mobile phone, any GPS device or using his laptop/pc.
After that i can employ this thing for many other useful things.

And i have to do this in c# so to locate a person using GPS i need windows mobile for this or some GPS device conected to PC/Laptop.
I can make some mobile app for this or use some GPS device to get GPS data but I don't have windows mobile here neither any GPS device.
Am trying to get any of these to work on a real GPS project but till then i need to consider the 3rd and only options feasible for now.

So option left is using laptop/pc,this doesn't involve GPS but can be used to locate people conencted to network. We have WiFi access points in our campus at every 60-100 m of range.
I have full access to college network for this thing.
I can store locations of these acces points and there Mac Address in a database.
So to locate a person with known ip address we need to find to which WiFi access point this Laptop/pc is connected to and then we can use the mac address of that to locate that access point using data in our databse.

So top locate a person with know IP address we need to do the following:-

1)Trace route to that ip address.
2)This way we can find the WiFi access point to which a person is connected.
3)Use mac address of that access point to search for its location in our database.

Uses:-
1) Can be used to locate a person if he's connected to network.
2) Can be used to show the person shortest path to keys points in our campus from his/her current location.
3) Can be used to find location of some malicious activity. Like some people here use some snipeprs and network flodding things we can find there position so can be used against malicious acts on network.

So problem is how to detect WiFi access point to which a particular IP is conencted to and then obtain its Mac Data.

I have tried trace route but it works by IP address which is not useful here as it doesn't detects switches or WiFi access points in path.
I need some way to trace route using mac address (work at lower layers).

I have checked WinCap (applications based on them like wifi hopper etc) before only but it's in c++ is there any way to do this in c# ?

Darg
Darg
I'm not sure but I assume there is some way of polling each wifi access point and receiving a list of IPs currently connected to it. You'll want to match people to MAC addresses not IP addresses though as their IPs will be dynamic.
Portfolio & Blog:http://scgamedev.tumblr.com/
Codeka
Codeka
I should just point out that GPS devices are one-way. That is, the device can know it's own location, but nothing else can "query" for that device's location. One thing that annoys me about CSI-style programs is when they say "we can track him via the GPS in his phone" or whatever... you can't actually do that :-)

Now, as for detecting what WiFi hotspot a particular user is connected to, that again is not possible. Switches are actually "invisible" to the network devices they're attached to. So a computer A with MAC address 1234 will attach to a switch and another computer B with MAC address 4321 connects to the same switch (or a different switch with multiple other switches in between). Computer A sends an ethernet frame with destination MAC address 4321 and the switch automatically knows where to forward that packet so that it reaches computer B. Nether computer knows (or cares) that it's even attached to a switch.

A computer attached to a WiFi hotspot will still communicate with the same MAC address regardless of which hotspot it's connected to.
Nik02
Nik02
Quote:
Original post by Codeka
I should just point out that GPS devices are one-way. That is, the device can know it's own location, but nothing else can "query" for that device's location. One thing that annoys me about CSI-style programs is when they say "we can track him via the GPS in his phone" or whatever... you can't actually do that :-)


Actually you can, if you install a software to the target phone that uploads the GPS info to the attacker's system. Depending on the phone model, this can be done via SMS vulnerabilities. This is a real scenario, I've witnessed one such trace by law enforcement first-hand.

Quote:

Now, as for detecting what WiFi hotspot a particular user is connected to, that again is not possible. Switches are actually "invisible" to the network devices they're attached to. So a computer A with MAC address 1234 will attach to a switch and another computer B with MAC address 4321 connects to the same switch (or a different switch with multiple other switches in between). Computer A sends an ethernet frame with destination MAC address 4321 and the switch automatically knows where to forward that packet so that it reaches computer B. Nether computer knows (or cares) that it's even attached to a switch.

A computer attached to a WiFi hotspot will still communicate with the same MAC address regardless of which hotspot it's connected to.


The network devices, however, are not invisible to the switches and other network infrastructure. You could have a hotspot or a switch with modified firmware that either analyzes the client traffic by itself or sends the traffic data to a machine dedicated for that purpose. If you have a network of these "smart" switches, it is possible to triangulate particular clients by combining network distance metrics, i/o times and MAC addresses.

You don't necessarily directly get the client system info, but a sufficiently powered data mining solution can find a huge volume of data based on the traffic - including heuristics with which to identify the client or its user. For example, most phones include their SIM card's associated phone number in initial HTTP requests, even though you would not even connect via radio packet services. In Europe (at least), it is relatively easy to find out the registered user of a phone number, unless it is explicitly hidden by the operators.
Niko Suni
Yann L
Yann L
Quote:
Original post by Nik02
Quote:
Original post by Codeka
I should just point out that GPS devices are one-way. That is, the device can know it's own location, but nothing else can "query" for that device's location. One thing that annoys me about CSI-style programs is when they say "we can track him via the GPS in his phone" or whatever... you can't actually do that :-)

Actually you can, if you install a software to the target phone that uploads the GPS info to the attacker's system. Depending on the phone model, this can be done via SMS vulnerabilities. This is a real scenario, I've witnessed one such trace by law enforcement first-hand.

[conspiracy mode]
There were some rumors some time ago, that smart phone manufacturers (were required to ?) build in some undocumented API to access the GPS receiver without the users knowledge, so to be used by law enforcement. Or just some conveniently placed 'vulnerability'.
[/conspiracy mode]

Quote:

As for #1 you can't locate someone with their mobile phone without a warrant and going through the phone companies so good luck with that one!

Actually yes, you can do that without the info from the phone company, with every phone, even one without a GPS chip. It basically involves setting up one or more (more give more precision on the location) temporary GSM/CDMA cells (probably from a car) that override the cell phone operators signals. The victims phone will then log into your cells instead of the operator ones. While forwarding his call to the real network, you have full access to all telemetry data (eg. signal roundtrip times) needed to triangulate his position. Oh, and you can also tap into his calls, redirect them, fake them, etc, without him knowing.

Of course the equipment to do that is quite expensive, and doing this is obviously completely illegal. But it can be done (and it's probably done).

[/OT]
Codeka
Codeka
Quote:
Original post by Nik02
Actually you can, if you install a software to the target phone that uploads the GPS info to the attacker's system. Depending on the phone model, this can be done via SMS vulnerabilities. This is a real scenario, I've witnessed one such trace by law enforcement first-hand.

...

The network devices, however, are not invisible to the switches and other network infrastructure. You could have a hotspot or a switch with modified firmware that either analyzes the client traffic by itself or sends the traffic data to a machine dedicated for that purpose. If you have a network of these "smart" switches, it is possible to triangulate particular clients by combining network distance metrics, i/o times and MAC addresses.
This is true, but given that the OP wants a solution that he can code in C#, I don't think these solutions will work... in particular, I don't think he wants to have to install (with or without the user's knowledge) anything on their devices.
Oxidda
Oxidda
Doesn't the GPS have COM which can be used to get data from the GPS?
Then you could make it work on the PC first. Afaik smartphones required a valid ceritficate to run on the phone. And since your using .NET it has to be a Windows mobile phone.

Using a Phone Mast can be used to track people, I've seen people make that kind of application. It however does not pinpoint the persons position, you can see to which mast a person is connected, thus showing only a radius in which the person is.

Also, trace routing isn't quite exact for tracking, it gives a certain area where on can be. But no exact location, also someone can 'fake' his/her IP in numerous ways, so I don't think you'll get it to a sort of result that you want.
Yann L
Yann L
Quote:
Original post by Oxidda
Using a Phone Mast can be used to track people, I've seen people make that kind of application. It however does not pinpoint the persons position, you can see to which mast a person is connected, thus showing only a radius in which the person is.

That is incorrect. Every node has metrics that define the distance of the user to the transceiver by means such as measuring signal trip times, signal strength, doppler shift, interference, etc. These metrics are used in various legitimate ways, such as relaying users to other nearby masts in case of saturation, QoS, geo-localization of non-GPS phones with the users authorization, etc. Once you get the distance of the user to two or more masts, you can pinpoint his position within a certain range of precision by simple triangulation. Under ideal circumstances (no external signal reflections/interference), this localization can be surprisingly precise.
Chetanhl
Chetanhl
thnx for reply guyz.

Actually i have already dropped the idea of using mobile phones or gps devices
as i don't have any windows mobile here or any other gps device.


As far as trace detecting through WiFi is concerned i know i won't be able to
get exact location of the user but i will be showing a region in which user can be found using a 2d top view of my campus.
Area of this region can be reduced further by detecting signal strength and developing some kinda based on reduction of signal strength as we move away from a WiFi access point or mutliple acess points.
But thats something kinda addition to project once we done detecting approx area based on WiFi access point's Mac Address only.

For now i just need to detect the WiFi access point to which a particular Node with given IP is connected to.
Once i am done with this thing then i can easily improve my program to perform better by storing mac address of cleints also, etc.

A trace route program can't work here as i can't detect WiFi access points.
I thinking to manually gather data (like mac address,its location,etc) about each WiFi acces point in our college and store it to database. Then after detecting acess point i can query databse for positional data.

I have alot of other things in my mind but first i need to do this basic thing
"How to detect the Wifi Access point to which a particular User is connected to (given its ip address) ?"

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.