Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

странности с ip2location #34

Open
chipitsine opened this issue Mar 19, 2021 · 3 comments
Open

странности с ip2location #34

chipitsine opened this issue Mar 19, 2021 · 3 comments

Comments

@chipitsine
Copy link

[root@ip2geo ip2geo]# ./ip2geo-linux64 -ip2proxy-token xxx
                | Use output directory                                         [output]
TOR             | Blutmagie Download                                           [FAIL]
TOR             | Torproject Download                                          [OK]
TOR             | Merge                                                        [OK]
TOR             | Write nginx maps                                             [OK]
ip2proxyLite    | Get ZIP                                                      [OK]
ip2proxyLite    | Unpack: zip: not a valid zip file                            [FAIL]
[root@ip2geo ip2geo]# 

это я много-много раз скачал (лимит вроде 6 в час). а потом начинаются странности, качается успешно (но не факт, что там zip), и не распаковывается

может на "Get ZIP" какую ошибку сделать, типа диагностика ситуации "уперлись в лимиты и скачали фигню"

@m-messiah
Copy link
Owner

можно поисследовать.. В коде уже есть проверки на ошибки https://github.com/m-messiah/ip2geo/blob/master/ip2proxy.go#L92 и на статус-код https://github.com/m-messiah/ip2geo/blob/master/ip2proxy.go#L96 и обе в этот момент не срабатывают.
А вот проверка на то, что скаченное является Zip-архивом - есть и она как раз на стадии распаковки (потому что на скачивании всего лишь поток байт и нет никакого желания на этом этапе узнавать, что же с ним не так).

Моё подозрение, что ip2proxy работают не по спецификации и возвращают 200, вместо ошибки.

@chipitsine
Copy link
Author

можно по Content-Type валидировать

[root@ip2geo ip2geo]# wget -S "https://www.ip2location.com/download/?token=xxx&file=DB1LITE"
--2021-03-19 16:18:30--  https://www.ip2location.com/download/?token=xxx&file=DB1LITE
Resolving www.ip2location.com (www.ip2location.com)... 34.224.172.222, 2600:1f18:45b0:5b00:f5d8:4183:7710:ceec
Connecting to www.ip2location.com (www.ip2location.com)|34.224.172.222|:443... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Server: nginx
  Date: Fri, 19 Mar 2021 16:18:30 GMT
  Content-Type: application/zip
  Content-Length: 1722523
  Connection: keep-alive
  Set-Cookie: PHPSESSID=0p28rmacu21iftp0cp5a9j69t4; path=/; HTTPOnly; Secure
  Expires: 0
  Cache-Control: must-revalidate, post-check=0, pre-check=0
  Pragma: public
  Set-Cookie: first_visit=1616170710; expires=Sat, 19-Mar-2022 16:18:30 GMT; Max-Age=31536000
  Cache-Control: private
  Content-Disposition: attachment; filename="IP2LOCATION-LITE-DB1.CSV.ZIP"
  Content-Transfer-Encoding: binary
  X-Frame-Options: SAMEORIGIN
Length: 1722523 (1.6M) [application/zip]
Saving to: ‘index.html?xxx&file=DB1LITE.5’

index.html?token=i95jBwgJ3V0sxDHsmSuqjzLm 100%[====================================================================================>]   1.64M  3.25MB/s    in 0.5s    

2021-03-19 16:18:31 (3.25 MB/s) - ‘index.html?token=ixxxj&file=DB1LITE.5’ saved [1722523/1722523]

[root@ip2geo ip2geo]# wget -S "https://www.ip2location.com/download/?token=xxxj&file=DB1LITE"
--2021-03-19 16:18:32--  https://www.ip2location.com/download/?token=xxx&file=DB1LITE
Resolving www.ip2location.com (www.ip2location.com)... 34.224.172.222, 2600:1f18:45b0:5b00:f5d8:4183:7710:ceec
Connecting to www.ip2location.com (www.ip2location.com)|34.224.172.222|:443... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Server: nginx
  Date: Fri, 19 Mar 2021 16:18:33 GMT
  Content-Type: text/html; charset=UTF-8
  Content-Length: 49
  Connection: keep-alive
  Set-Cookie: PHPSESSID=329ks6sojcu63t9telq5uoova1; path=/; HTTPOnly; Secure
  Expires: Thu, 19 Nov 1981 08:52:00 GMT
  Cache-Control: no-store, no-cache, must-revalidate
  Pragma: no-cache
  Set-Cookie: first_visit=1616170713; expires=Sat, 19-Mar-2022 16:18:33 GMT; Max-Age=31536000
  X-Frame-Options: SAMEORIGIN
Length: 49 [text/html]
Saving to: ‘index.html?token=xxx&file=DB1LITE.6’

index.html?token=xxx 100%[====================================================================================>]      49  --.-KB/s    in 0s      

2021-03-19 16:18:33 (1.40 MB/s) - ‘index.html?token=xxx&file=DB1LITE.6’ saved [49/49]

[root@ip2geo ip2geo]# 

@chipitsine
Copy link
Author

[root@ip2geo ip2geo]# cat 'index.html?token=xxx&file=DB1LITE.6'
THIS FILE CAN ONLY BE DOWNLOADED 5 TIMES PER HOUR[root@ip2geo ip2geo]# 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants