GithubHelp home page GithubHelp logo

ip2location / ip2location-traceroute Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 3.0 18 KB

A traceroute tools that displaying geolocation information using IP2Location database.

License: MIT License

Makefile 1.39% C 98.61%

ip2location-traceroute's People

Contributors

ip2location avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

tc4everus

ip2location-traceroute's Issues

compling problems on cygwin.

how to solve this?

Shadow@F ~/src/ip2trace/ip2location-traceroute-master
$ make
gcc    -c -o src/trace.o src/trace.c
In file included from src/trace.c:1:
src/trace.h:29:31: warning: ‘struct icmphdr’ declared inside parameter list will not be visible outside of this definition or declaration
   29 | void construct_icmphdr(struct icmphdr *header, uint8_t type, uint8_t code, uint16_t id, uint16_t sequence);
      |                               ^~~~~~~
src/trace.c:40:31: warning: ‘struct icmphdr’ declared inside parameter list will not be visible outside of this definition or declaration
   40 | void construct_icmphdr(struct icmphdr *header, uint8_t type, uint8_t code, uint16_t id, uint16_t sequence)
      |                               ^~~~~~~
src/trace.c:40:6: error: conflicting types for ‘construct_icmphdr’; have ‘void(struct icmphdr *, uint8_t,  uint8_t,  uint16_t,  uint16_t)’ {aka ‘void(struct icmphdr *, unsigned char,  unsigned char,  short unsigned int,  short unsigned int)’}
   40 | void construct_icmphdr(struct icmphdr *header, uint8_t type, uint8_t code, uint16_t id, uint16_t sequence)
      |      ^~~~~~~~~~~~~~~~~
In file included from src/trace.c:1:
src/trace.h:29:6: note: previous declaration of ‘construct_icmphdr’ with type ‘void(struct icmphdr *, uint8_t,  uint8_t,  uint16_t,  uint16_t)’ {aka ‘void(struct icmphdr *, unsigned char,  unsigned char,  short unsigned int,  short unsigned int)’}
   29 | void construct_icmphdr(struct icmphdr *header, uint8_t type, uint8_t code, uint16_t id, uint16_t sequence);
      |      ^~~~~~~~~~~~~~~~~
src/trace.c: In function ‘construct_icmphdr’:
src/trace.c:42:15: error: invalid use of undefined type ‘struct icmphdr’
   42 |         header->type = type;
      |               ^~
src/trace.c:43:15: error: invalid use of undefined type ‘struct icmphdr’
   43 |         header->code = code;
      |               ^~
src/trace.c:44:15: error: invalid use of undefined type ‘struct icmphdr’
   44 |         header->un.echo.id = id;
      |               ^~
src/trace.c:45:15: error: invalid use of undefined type ‘struct icmphdr’
   45 |         header->un.echo.sequence = sequence;
      |               ^~
src/trace.c:46:15: error: invalid use of undefined type ‘struct icmphdr’
   46 |         header->checksum = 0;
      |               ^~
src/trace.c:47:15: error: invalid use of undefined type ‘struct icmphdr’
   47 |         header->checksum = compute_icmp_checksum((u_int16_t *)header, sizeof(*header));
      |               ^~
src/trace.c:47:77: error: invalid application of ‘sizeof’ to incomplete type ‘struct icmphdr’
   47 |         header->checksum = compute_icmp_checksum((u_int16_t *)header, sizeof(*header));
      |                                                                             ^
src/trace.c: In function ‘send_probes’:
src/trace.c:60:24: error: storage size of ‘header’ isn’t known
   60 |         struct icmphdr header;
      |                        ^~~~~~
src/trace.c:63:44: error: ‘ICMP_ECHO’ undeclared (first use in this function)
   63 |                 construct_icmphdr(&header, ICMP_ECHO, 0, id, *seq_ptr);
      |                                            ^~~~~~~~~
src/trace.c:63:44: note: each undeclared identifier is reported only once for each function it appears in
src/trace.c: In function ‘send_probes6’:
src/trace.c:82:24: error: storage size of ‘header’ isn’t known
   82 |         struct icmphdr header;
      |                        ^~~~~~
src/trace.c:85:44: error: ‘ICMP_ECHO’ undeclared (first use in this function)
   85 |                 construct_icmphdr(&header, ICMP_ECHO, 0, id, *seq_ptr);
      |                                            ^~~~~~~~~
src/trace.c: In function ‘analize_packet’:
src/trace.c:148:40: error: invalid use of undefined type ‘struct icmphdr’
  148 |         returned_type = returned_icmp_p->type;
      |                                        ^~
src/trace.c:150:30: error: ‘ICMP_TIME_EXCEEDED’ undeclared (first use in this function)
  150 |         if (returned_type == ICMP_TIME_EXCEEDED) {
      |                              ^~~~~~~~~~~~~~~~~~
src/trace.c:152:41: error: invalid use of undefined type ‘struct icmphdr’
  152 |                 returned_id = old_icmp_p->un.echo.id;
      |                                         ^~
src/trace.c:153:42: error: invalid use of undefined type ‘struct icmphdr’
  153 |                 returned_seq = old_icmp_p->un.echo.sequence;
      |                                          ^~
src/trace.c:155:46: error: invalid use of undefined type ‘struct icmphdr’
  155 |                 returned_id = returned_icmp_p->un.echo.id;
      |                                              ^~
src/trace.c:156:47: error: invalid use of undefined type ‘struct icmphdr’
  156 |                 returned_seq = returned_icmp_p->un.echo.sequence;
      |                                               ^~
src/trace.c: In function ‘receive_packets’:
src/trace.c:185:87: error: ‘ICMP_ECHOREPLY’ undeclared (first use in this function)
  185 |                         if (returned_seq / probes_per_turn == ttl || returned_type == ICMP_ECHOREPLY) {
      |                                                                                       ^~~~~~~~~~~~~~
src/trace.c: In function ‘trace’:
src/trace.c:389:24: error: storage size of ‘header’ isn’t known
  389 |         struct icmphdr header;
      |                        ^~~~~~
src/trace.c:390:36: error: ‘ICMP_ECHO’ undeclared (first use in this function)
  390 |         construct_icmphdr(&header, ICMP_ECHO, 0, mypid, 0);
      |                                    ^~~~~~~~~
src/trace.c: In function ‘trace6’:
src/trace.c:433:24: error: storage size of ‘header’ isn’t known
  433 |         struct icmphdr header;
      |                        ^~~~~~
src/trace.c:434:36: error: ‘ICMP_ECHO’ undeclared (first use in this function)
  434 |         construct_icmphdr(&header, ICMP_ECHO, 0, mypid, 0);
      |                                    ^~~~~~~~~
make: *** [<builtin>: src/trace.o] Error 1

Shadow@F ~/src/ip2trace/ip2location-traceroute-master

Works flaky under Windows

Th README.md doesn't mention if Windows is supported. Since the use or the POSIX headers in the code, one would assume
it won't work under Windows at all.

But creating a small Makefile for Cygwin32, it kinda works. Except I get only a result for the final IP (the -p address):

ip2trace.exe -d %APPDATA%/IP2LOCATION-LITE-DB11.IPV6.BIN -p www.cnn.com
IP2Location Geolocation Traceroute (ip2trace) Version 8.0.0
Copyright (c) 2021 IP2Location.com [MIT License]
https://www.ip2location.com/free/traceroute-application

1.  *
2.  *
3.  *
4.  *
5.  *
6.  *
7.  *
8.  151.101.1.67 0.0000 ms ["US","United States of America","California","San Francisco","37.775700","-122.395203","94107","-08:00"]

I don't think that's the intention. For reference, my own version of a Watt-32 tracert (using IP2Location), shows:

Resolving www.cnn.com...CNAME turner-tls.map.fastly.net 151.101.237.67
ICMP traceroute to www.cnn.com (151.101.237.67), 30 hops max, 42 byte packets
 1  router                         (10.0.0.1)          34 ms  14 ms  priv
 2  ti0040q160-gw.ti.telenor.net   (88.95.101.1)       29 ms  30 ms, Norway / Oslo
 3  ti0040a400.ti.telenor.net      (146.172.70.112)    28 ms  30 ms, Norway / Nesoddtangen
 4  ti0020c360-ae14-0.ti.telenor.net (146.172.18.49)   45 ms  46 ms, Norway / Nesoddtangen
 5  ti0016c360-ae18-0.ti.telenor.net (146.172.23.133)  44 ms  46 ms, Norway / Nesoddtangen
 6  ti0001b400-ae0-0.ti.telenor.net (146.172.105.49)   45 ms  46 ms, Norway / Nesoddtangen
 7  * *
 8  151.101.237.67                 (151.101.237.67)    29 ms  44 ms, United States / San Francisco

Seems to be an issue with either setsockopt(sockfd, IPPROTO_IP,..) or (mis-)handling of SOCK_RAW sockets under Windows.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.