We were curious on the possible data we could collect from monitoring traffic of a basic file server.
What it does
An HTTP file server is hosted, and whenever someone accesses files on the server, the IP is logged, and the geolocation of the origin of the IP is written to a file. This file is then read by a back-end service whenever the front-end application requests for it, and places markers on a map based on the longitude and latitude data read.
How we built it
First we had to get the HTTP file server up and running - the sooner we got it up, the sooner we could start trying to collect data. After getting it up and running, we had to modify it to then also track IPs. We used ipinfo.io to extract geographic coordinates from the IPs and write this data to a file. To support this, we have a back-end Flask service that fetches the coordinate data and then returns it as a JSON blob in a GET request. A front-end was built in Angular, with Google Maps providing the map interface. The front-end would send the GET request to the back-end in order to fetch the location data to serve it up on the map.
Challenges we ran into
- We had to remote desktop into an area outside of GMU (one of our houses) in order to actually spin up the file server because GMU's firewall does not allow it.
- The API for ipinfo doesn't work on Windows machines because it depends on using the
curlcommand, so we had to move all of the file server code to a Linux box.
- This was also our first time writing a back-end in Python, so we had trouble making the request return a proper JSON object.
- Angular is very finicky with HTTP requests, so a lot of time was spent trying to get the front-end to properly display information given from the back-end.
Accomplishments that we're proud of
It compiles. :)
The server code has basic error handling and it can be run indefinitely on the remote desktop outside of GMU. We are very proud that we could start with nothing and get a file server up, as well as a full stack Web application alongside it.
What we learned
- We learned how convenient it is to get data over HTTP. It's used with requests to the file server itself, how we pull the geolocation data, and how the information is then served up to the Web application.
- We each worked in areas we were more familiar with, but got to learn from each other about the other's work.
What's next for whereUat
- Tracking the amount of traffic from a given region
- DDoS prevention for our file server
- Refactoring code
- Serve our code on AWS