rejetto forum

Feature request: resolve IP / restric access on provider/city/state

ong · 13 · 8443

0 Members and 1 Guest are viewing this topic.

Offline ong

  • Occasional poster
  • *
    • Posts: 5
  • Team-Noehring
    • View Profile
    • Team-Noehring
Hi

when you use the hostip service (for example with this URL: http://api.hostip.info/get_html.php?ip=213.196.230.56&position=true ) you get Country, City and state information.
Maybe it could be possible to have a button (right click option) to recolve a visitors directly this way. The Result could be requested and displayed in HFS.
Also: The result could be used to define who can access the server: In the example (URL) above: Maybe only people from Cologne an access it....

Similar: Allow/Deny access for people from a certain provider! In my case for example I am using netcologne - which is some information easy to obtain (who is ... my-ip). Great if it was possible to allow/deny access from a certain provider...

Olaf
* together for better software *
* http://www.team-noehring.de *


Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
This service may only be useful in very few cases, as even in europe, does in most cases not return city or coordinates, in some cases it even does not return the courtry!

and more:

1. how do you get information from a webpage to HFS ???

2. To allow or deny access from a provider, you can use bans (in options) and set there the whole or part of the ip-range(s) the provider owns. -> 213.196.0.0 .. 213.196.255.255
your computer has no brain - use your own !


Offline ong

  • Occasional poster
  • *
    • Posts: 5
  • Team-Noehring
    • View Profile
    • Team-Noehring
Hi

well, getting the information (just a few lines from a webpage) should be no problem - just open the http://.. parse the lines, done.
I see the problem with the data not being available, but it would make things a little more secure: I really do not need any chinese IP addresses on my server if I want to publish some pictures for my family.

Olaf
* together for better software *
* http://www.team-noehring.de *


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
if you find germanies' IP ranges, using the ban system is probably the best solution.

anyway, interfacing with that hostip service is an interesting topic.
HFS won't do it by itself, i have no reason to think this service is reliable in efficiency, speed and durability.
but we have a scripting system, and you may decide to program the feature yourself.
the system is very basic, but may be powerful enough for what you need.

having a right click option is not possible at the moment, but it would not be hard for me to make it possible, and it sounds cool. like adding items to the log menu, or the connections menu, etc.

it's already possible to banish by scripting event [request] (or maybe also [connected] ).
you would use {.load.} and {.substring.} to parse the data, and {.disconnection reason.} to prevent access.
but you should someway cache the data, it's mad to to do it every time. you can use {.set table.} and {.from table.} for this.

it's challenging... :)


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2068
    • View Profile
Quote
1. how do you get information from a webpage to HFS

 ??? ?
 It is so easy to realize that the question does not even settle ;)

{.load|http://api.hostip.info/get_html.php?ip=213.196.230.56&position=true.}

 ;D


Offline ong

  • Occasional poster
  • *
    • Posts: 5
  • Team-Noehring
    • View Profile
    • Team-Noehring
HI

this looks nice already. Is it possible insert the IP address of the person I clock on at the appropiate place (for a "newby" to HFS there are a lot of scripting posssibilities, so please excuse this questiuoin if the answer is obvious)?

Olaf
* together for better software *
* http://www.team-noehring.de *


Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
to mars:

Thank you for your information - i thought {.load.} would only work on local stuff.

to ong:

you can insert %ip% (the users ip) where you need it in the template.
-->
{.set|info|{.load|http://api.hostip.info/get_html.php?ip=%ip%position=true.}.}  {.comment| gets the info .}
{.cut|9||{.substring|Country|City|{.^info.}.}.}  {.comment | extracts the country from info .}
{.cut|6||{.substring|City|Latitude|{.^info.}.}.}  {.comment | extracts the city from info .}


your computer has no brain - use your own !


Offline AYEHAN

  • Occasional poster
  • *
    • Posts: 92
    • View Profile
but now a days u can't identify anyone ... i mean where he came from. like in Pakistan we have many ISP's using Satellite link or having Ip Ranges from UK and Sigapore so if you check them u will see that this person is comming from some UK IP Range, and its happening not only in Pakistan its everywhere due to shortage of IPv4 range.


Offline ong

  • Occasional poster
  • *
    • Posts: 5
  • Team-Noehring
    • View Profile
    • Team-Noehring

Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
thank you ong.

thank you for the script bacter.
my little changes are the & you forgot after %ip%, and the use of include=none instead of {.cut.}

Code: [Select]
{.set|info|{.load|http://api.hostip.info/get_html.php?ip=%ip%&position=true.}.}
{.substring|Country: |City|{.^info.}|include=none.}
{.substring|City: |Latitude|{.^info.}|include=none.}

if ong needs only the country, as i think, this will be enough

Code: [Select]
{.substring|Country: |City|{.load|http://api.hostip.info/get_html.php?ip=%ip%&position=true.}|include=none.}

consider my suggestion to cache the value, this is a way to do it

Code: [Select]
{.set|country|{.from table|#countries|%ip%.}.}
{.if not|{.^country.}|{:
{.set|country|{.substring|Country: |City|{.load|http://api.hostip.info/get_html.php?ip=%ip%&position=true.}|include=none.}.}
{.set table|#countries|%ip%={.^country.}.}
:}.}
{.add to log|{.^country.}.}

the last line is not necessary, just an example of how to use the value.

in my opinion, caching values is a must in many contests, so in next build you will have a handy {.cache.} command.


Offline ong

  • Occasional poster
  • *
    • Posts: 5
  • Team-Noehring
    • View Profile
    • Team-Noehring
Hi

well I just thought it would be nice to block/allow certain cities. But of course it's possible to display the location of the person using Google Maps and the tiny script / macro you supplied.

Olaf
* together for better software *
* http://www.team-noehring.de *


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
from next build (236), this will work too

Code: [Select]
[request]
{.add to log|COUNTRY IS {.cache|#countries|%ip%|{:{.trim|
{.substring|Country: |City|{.load|http://api.hostip.info/get_html.php?ip=%ip%&position=true.}|include=none.}
.}:}/cache.}.}

[start]
{.load|country.cache|var=#countries.}

[quit]
{.save|country.cache|var=#countries.}


Offline r][m

  • Tireless poster
  • ****
    • Posts: 347
    • View Profile
This service may only be useful in very few cases, as even in europe, does in most cases not return city or coordinates, in some cases it even does not return the courtry!
My ISP is one of the larger ones in the US and it returns
Country: (Unknown Country?) (XX) City: (Unknown City?) Latitude: Longitude:
for my IP address.  It does return good info on my employer's address, its just a few hundred
kilometers via internal network from where I'm actually at! Ban (or allow) by ip address is most reliable way.


« Last Edit: April 28, 2009, 05:51:30 AM by r][m »