Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 9 of 9

Thread: How to find location of ipaddress using Java

  1. #1
    Junior Member
    Join Date
    Apr 2009
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to find location of ipaddress using Java

    i know the ip address of a hacker then how to find location of hacker using java code ?or any
    suggestions to move forward?


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: finding location of ipaddress

    Hello tej,

    I'm unsure as to how you would do this in Java but there are plenty of websites online that can pinpoint a computers location via the IP address.

    These look really good:

    How to get location of a computer on the world's map? IP Lookup

    IP Country Location
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  3. #3
    Junior Member
    Join Date
    May 2009
    Posts
    25
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: finding location of ipaddress

    Wrong, the IP redirects you to the provider, not the computer/network itself..

    i think XD

  4. #4
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: finding location of ipaddress

    Quote Originally Posted by Koâk View Post
    Wrong, the IP redirects you to the provider, not the computer/network itself..

    i think XD
    Hmm... If that is the case, how come you can connect to your computer remotely using the IP address?

    Sites that try to pinpoint the computers location via the IP normally locates the ISP location rather than the exact location of the PC.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  5. #5
    Junior Member
    Join Date
    May 2009
    Posts
    25
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: finding location of ipaddress

    Quote Originally Posted by JavaPF View Post
    Hmm... If that is the case, how come you can connect to your computer remotely using the IP address?

    Sites that try to pinpoint the computers location via the IP normally locates the ISP location rather than the exact location of the PC.
    ahh ok, yeah I think ur right

  6. #6
    Junior Member
    Join Date
    Jun 2009
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: finding location of ipaddress

    Yeah ur rite admin.
    But have dis.This is a small test program for the IPv6 reverse lookup functionality. IPv4 reverse lookup test:

    # java lookupAndReturn mocha.cs.ucl.ac.uk
    IPv6 reverse lookup test
    # java lookupAndReturn -6 mocha.cs.ucl.ac.uk
    Successful output on IPv6 reverse lookup test:
    The initial hostname is: mocha.cs.ucl.ac.uk
    The IP address is: 2001:630:13:101:2e0:18ff:fe34:150b
    The reverse lookup hostname is: mocha.cs.ucl.ac.uk

    Source Code:

    /* This is a test program -written by Sheng JIANG - UCL
    Febuary 2004
    This program read the hostname from the command line as argument.
    Then translate the IP address into hostname and display on the screen.
    Then using that IP address for reverse lookup and display return hostname.
    The success result will output hostname, rather than IP address.
    */
    import java.net.*;
    public class lookupAndReturn{
    public static void main (String[] args) {
    try{
    String cacheAddress="";
    String cacheHostname="";
    InetAddress cacheInetAddress;
    String usageMsg =
    "Usage: displayHostnames [options]\n" +
    "Where [options] are:\n" +
    "\t -h\t\t\t display this message\n" +
    "\t --help\t\t\t display this message - same with -h\n"+
    "\t -4\t\t\t lookup IPv4address\n" +
    "\t -6\t\t\t lookup into IPv6address\n" +
    "\t by default IPv4 address of the given hostname will be lookup\n";
    for (int i=0; i<args.length;i++) {
    if(args[i].equals("-h")) {
    System.err.println(usageMsg);
    return;
    } else if(args[i].equalsIgnoreCase("-help")) {
    System.err.println(usageMsg);
    return;
    } else if(args[i].equals("-4")) {
    // System.setProperty("java.net.preferIPv4Stack", "true");
    } else if(args[i].equals("-6")) {
    System.setProperty("java.net.preferIPv6Addresses", "true");
    } else {
    cacheHostname=args[i];
    } } if (cacheHostname==""){
    System.err.println("Error: address argument required");
    return;
    }else{
    System.out.println("\tThe initial hostname is:\t"+cacheHostname);
    } cacheInetAddress = InetAddress.getByName (cacheHostname);
    cacheAddress = cacheInetAddress.getHostAddress ().toString();
    System.out.println("\tThe IP address is:\t\t"+cacheAddress);
    cacheInetAddress = InetAddress.getByName (cacheAddress);
    System.out.println("\tThe reverse lookup hostname is:\t"+cacheInetAddress.getHostName());
    }catch (Exception e){
    e.printStackTrace(System.err);
    System.out.println("error:\t"+e);
    } } }

  7. #7
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,895
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: finding location of ipaddress

    But isn't the IP address taken from the proxy (if any)? They could very well be using a proxy service, and all you'd get is the proxy's IP.

  8. #8
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: finding location of ipaddress

    Quote Originally Posted by helloworld922 View Post
    But isn't the IP address taken from the proxy (if any)? They could very well be using a proxy service, and all you'd get is the proxy's IP.
    If they are using a proxy then yes you would get the proxys IP. Basically making it impossible to trace them with these simple methods.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  9. #9
    Junior Member
    Join Date
    Sep 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: finding location of ipaddress

    Quote Originally Posted by tej View Post
    i know the ip address of a hacker then how to find location of hacker using java code ?or any
    suggestions to move forward?
    Hi,
    If you Know the Ip Address you can find the Location,Country,ISP provider,Latitude and Longitude Details of an Ip using the site Ip-Details.com

Similar Threads

  1. Replies: 13
    Last Post: May 6th, 2009, 09:27 AM

Tags for this Thread