InternetHealthReport / ihr-website

Vue.js code for IHR website
https://ihr.iijlab.net/ihr/en
GNU General Public License v3.0
65 stars 122 forks source link

Users connected ASN and other information #758

Closed 0xAnon0602 closed 8 months ago

0xAnon0602 commented 9 months ago

I have an idea to implement a feature on the main page of our website that will show details of the users accessing the website, such as ASN, country, and other information. From there, users can navigate directly to that ASN without searching for it.

This feature might help new users initially understand ASNs and other aspects without having to search for them. We might need to use some external APIs to obtain this information.

What are your thoughts on this?

dpgiakatos commented 9 months ago

I think this is similar to the issue https://github.com/InternetHealthReport/ihr-website/issues/446.

0xAnon0602 commented 9 months ago

Yeah seems similar So this is not planned for the website ?

romain-fontugne commented 9 months ago

it could be a nice feature to have but it is not completely straight forward to implement. If you already have something in mind please explain how you would implement that.

0xAnon0602 commented 9 months ago

@romain-fontugne As I said we might need to use external API for collecting this data of user visiting the site, I've a great API in mind for it which is IP-API which has been in market for over 12 years and provides reliable data.

What's your view on it ?

dpgiakatos commented 9 months ago

Please provide a plan with details about the additions, including the APIs you will use, potential issues from the APIs (such as rate limits), and how you plan to implement the UI changes.

0xAnon0602 commented 9 months ago

Using IP-API for Data

UI Enhancements

image

image

What's your view on this ?

dpgiakatos commented 9 months ago

From the IP-API documentation, I want to emphasize the following points:

0xAnon0602 commented 9 months ago

Got it I will try to check if there is any better solution for this :)

0xAnon0602 commented 9 months ago

Hi @dpgiakatos ,

I'm trying to figure out how to use the Internet Yellow Pages (IYP) to find the Autonomous System Number (ASN) of an IP address. Is there a way to do this with just the IP address.

I was able do it with prefix of a IP address but I'm not sure how can I convert IP address to it's prefix. Any advice on the CYPHER Query or any guidance would be appreciated Thanks

dpgiakatos commented 9 months ago

With the following query you can obtain the corresponding AS number from an IP address:

MATCH (i:IP {ip: 'your ip'})-[:PART_OF]->(:Prefix)<-[:ORIGINATE]-(a:AS)
RETURN DISTINCT i.ip AS ip, a.asn AS asn
0xAnon0602 commented 9 months ago

I was querying some IPs with the above CYPHER Query For some IPs it was able to return the ASN and for some IPs it said no record found.

What could be the reason behind it ?

romain-fontugne commented 9 months ago

We don't have all IP addresses in IYP, so it is not that easy to find the prefix that correspond to an IP. I don't know if neo4j/cypher has a mechanism to find the most specific prefix for a given IP (https://networklessons.com/cisco/ccna-200-301/longest-prefix-match-routing).

I see two options:

  1. A hack would be to get from IYP a set of prefixes that starts with the same octets of the IP address and use something like this to find the exact prefix: https://www.npmjs.com/package/longest-prefix-match

  2. Use RIPE's API: https://stat.ripe.net/data/network-info/data.json?resource=140.78.90.50

I don't mind using IP-API. Another way to get the public IP is again with RIPE: https://stat.ripe.net/data/whats-my-ip/data.json

0xAnon0602 commented 9 months ago

So I can think of the following way to get the required data

To get the user IP we can use any of the 2 methods

0xAnon0602 commented 8 months ago

@romain-fontugne

romain-fontugne commented 8 months ago

Sounds good to me, let's use RIPE for both of the two first steps.

0xAnon0602 commented 8 months ago

Can you please assign this issue to me so I can start working on it.

0xAnon0602 commented 8 months ago

@dpgiakatos @romain-fontugne

As I've suggested 2 places above where we can add that User info on the homepage What do you think will be perfect place for it or you can suggest some better place for it ?

dpgiakatos commented 8 months ago

Actually, I think is better to create a new layout which will combine the title, the global report button and this new feature, than having a card in the landing page. For example, we can have the title and bellow, we can have a container with a vertical line separator. On the left we can have the global report button and on the right we can have this new feature.

0xAnon0602 commented 8 months ago

I was able to add the RIPE API + IYP query to retrieve this data and display it on the landing page like this.

image

@dpgiakatos I'm not actually sure what do you mean by creating new layout. Can you please explain me more about it ? Thanks

dpgiakatos commented 8 months ago

By new layout, I mean a card/div something that can combine the information between title, global report and connection information. Also, a horizontal separator between global report and connection information should be better than a vertical one.

0xAnon0602 commented 8 months ago

I'm not sure how that would be different from the layout I sent with the image above The Connection information is on right side and Global report button is on left side (

romain-fontugne commented 8 months ago

Thanks, that looks promising. have you tried to show the information below the main image and before the text 'The Internet Health Report monitors...'? maybe if we make it more horizontal with the information spanning two or three columns

romain-fontugne commented 8 months ago

and for the AS name I would prefer: AS123 - Name rather than: AS123 (Name)

0xAnon0602 commented 8 months ago

Yeah I tried that but there was a lot of empty spaces So I tried it placing on the top and it looked perfect there for desktop view

For the mobile view I've added below the main image

romain-fontugne commented 8 months ago

Another way would be to blend it with the line: 'See latest alarms in the global report and network metrics in network reports.'

It would be nice if you send different examples, so we can decide what we prefer. I feel that the one you sent is a bit too intrusive

0xAnon0602 commented 8 months ago

Sure I'll go through it and see if I can come up with any new idea

Meanwhile I've linked the UI changes I showed above in the #765 Let me know what you think of it