Underc0de - Hacking y seguridad informática

Programación General => Java => Mensaje iniciado por: BigBear en Enero 12, 2013, 11:42:49 pm

Título: [Java] LocateIP 0.1
Publicado por: BigBear en Enero 12, 2013, 11:42:49 pm
Un simple programa para buscar la localizacion de una IP.

Código: Java
  1. //LocateIP 0.1
  2. //Coded By Doddy H
  3.  
  4. import java.util.Scanner;
  5. import java.io.*;
  6. import java.net.*;
  7.  
  8. import java.util.regex.Matcher;
  9. import java.util.regex.Pattern;
  10.  
  11. public class Main {
  12.  
  13.     public static void main(You are not allowed to view links. Register or Login[] args) throws You are not allowed to view links. Register or Login {
  14.  
  15.         You are not allowed to view links. Register or Login ip;
  16.         Scanner host = new Scanner(You are not allowed to view links. Register or Login.in);
  17.         You are not allowed to view links. Register or Login.out.println("\n\n-- == LocateIP 0.1 == --\n\n");
  18.         You are not allowed to view links. Register or Login.out.println("[+] IP : ");
  19.         ip = host.nextLine();
  20.  
  21.         You are not allowed to view links. Register or Login code;
  22.  
  23.         code = toma("http://www.melissadata.com/lookups/iplocation.asp?ipaddress=" + ip);
  24.  
  25.         Pattern uno = null;
  26.         Matcher dos = null;
  27.  
  28.         uno = Pattern.compile("City</td><td align=(.*?)><b>(.*?)</b></td>");
  29.         dos = uno.matcher(code);
  30.  
  31.         if (!dos.find()) {
  32.             You are not allowed to view links. Register or Login.out.println("[+] City : Not Found");
  33.         } else {
  34.             You are not allowed to view links. Register or Login.out.println("[+] City : " + dos.group(2));
  35.         }
  36.  
  37.         uno = Pattern.compile("Country</td><td align=(.*?)><b>(.*?)</b></td>");
  38.         dos = uno.matcher(code);
  39.  
  40.         if (!dos.find()) {
  41.             You are not allowed to view links. Register or Login.out.println("[+] Country : Not Found");
  42.         } else {
  43.             You are not allowed to view links. Register or Login.out.println("[+] Country : " + dos.group(2));
  44.         }
  45.  
  46.         uno = Pattern.compile("State or Region</td><td align=(.*?)><b>(.*?)</b></td>");
  47.         dos = uno.matcher(code);
  48.  
  49.         if (!dos.find()) {
  50.             You are not allowed to view links. Register or Login.out.println("[+] State or Region : Not Found");
  51.         } else {
  52.             You are not allowed to view links. Register or Login.out.println("[+] State or Region : " + dos.group(2));
  53.         }
  54.  
  55. //code = toma("http://www.ip-adress.com/reverse_ip/178.33.230.100");
  56.  
  57. //uno = Pattern.compile("/whois/(.*?)\">Whois");
  58. //dos = uno.matcher(code);
  59.  
  60. //while(dos.find()) {
  61. //System.out.println("[+] DNS : "+dos.group(1));
  62. //}
  63.  
  64.         You are not allowed to view links. Register or Login.out.println("\n\n-- == Coded By Doddy H == --");
  65.  
  66.     }
  67.  
  68.     private static You are not allowed to view links. Register or Login toma(You are not allowed to view links. Register or Login urla) throws You are not allowed to view links. Register or Login {
  69.  
  70.         You are not allowed to view links. Register or Login re;
  71.  
  72.         You are not allowed to view links. Register or Login conte = new You are not allowed to view links. Register or Login(40);
  73.  
  74.         You are not allowed to view links. Register or Login url = new You are not allowed to view links. Register or Login(urla);
  75.         You are not allowed to view links. Register or Login hc = url.openConnection();
  76.         hc.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.12) Gecko/20080201Firefox/2.0.0.12");
  77.  
  78.         You are not allowed to view links. Register or Login nave = new You are not allowed to view links. Register or Login(
  79.                 new You are not allowed to view links. Register or Login(hc.getInputStream()));
  80.  
  81.         while ((re = nave.readLine()) != null) {
  82.             conte.append(re);
  83.         }
  84.  
  85.         nave.close();
  86.  
  87.         return conte.toString();
  88.  
  89.     }
  90. }
  91.  
  92. // The End ?
  93.