Foro de elhacker.net

Programación => Scripting => Mensaje iniciado por: BigBear en 19 Agosto 2013, 20:19 pm



Título: [Python-Android] LocateIP 0.1
Publicado por: BigBear en 19 Agosto 2013, 20:19 pm
El primer script que hice en python para android.

El codigo :

Código
  1. # !usr/bin/python
  2. # LocateIP 0.1 (C) Doddy Hackman 2013
  3. # Android Version
  4.  
  5. import android,urllib2,re,socket
  6.  
  7. aplicacion = android.Android()
  8.  
  9. nave = urllib2.build_opener()
  10. nave.add_header = [('User-Agent','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5')]
  11.  
  12. def toma(web) :
  13. nave = urllib2.Request(web)
  14. nave.add_header('User-Agent','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5');
  15. op = urllib2.build_opener()
  16. return op.open(nave).read()
  17.  
  18. def search(pagina):
  19.  
  20. respuesta = ""
  21.  
  22. ip = socket.gethostbyname(str(pagina))
  23. code = toma("http://www.melissadata.com/lookups/iplocation.asp?ipaddress="+ip)
  24.  
  25. respuesta = respuesta + "[++] IP Address Location\n"
  26.  
  27. if (re.findall("City<\/td><td align=(.*)><b>(.*)<\/b><\/td>",code)):
  28.  rex = re.findall("City<\/td><td align=(.*)><b>(.*)<\/b><\/td>",code)
  29.  city = rex[0][1]
  30.  respuesta = respuesta + "\n[++] City : "+city
  31. else:
  32.  respuesta = respuesta + "\n[++] City : Not Found"
  33.  
  34. if (re.findall("Country<\/td><td align=(.*)><b>(.*)<\/b><\/td>",code)):
  35.  rex = re.findall("Country<\/td><td align=(.*)><b>(.*)<\/b><\/td>",code)
  36.  country = rex[0][1]
  37.  respuesta = respuesta + "\n[++] Country : "+country
  38. else:
  39.  respuesta = respuesta + "\n[++] Country : Not Found"
  40.  
  41. if (re.findall("State or Region<\/td><td align=(.*)><b>(.*)<\/b><\/td>",code)):
  42.  rex = re.findall("State or Region<\/td><td align=(.*)><b>(.*)<\/b><\/td>",code)
  43.  state = rex[0][1]
  44.  respuesta = respuesta + "\n[++] State : "+state
  45. else:
  46.  respuesta = respuesta + "\n[++] State : Not Found"
  47.  
  48.  
  49. code = toma("http://www.ip-adress.com/reverse_ip/"+ip)
  50.  
  51. if (re.findall("whois\/(.*?)\">Whois",code)):
  52.  rex = re.findall("whois\/(.*?)\">Whois",code)
  53.  respuesta = respuesta + "\n\n[++] DNS Founds\n"
  54.  for dns in rex:
  55.   respuesta = respuesta + "\n[+] "+dns
  56.  
  57. return respuesta
  58.  
  59. def menu():
  60.  
  61. aplicacion.dialogCreateAlert("LocateIP 0.1")
  62. aplicacion.dialogSetItems(["Search","About","Exit"])
  63. aplicacion.dialogShow()
  64. re = aplicacion.dialogGetResponse().result
  65.  
  66. re2 = re["item"]
  67.  
  68. if re2==0:
  69.  
  70.  red = aplicacion.dialogGetInput("LocateIP 0.1","Target")
  71.  ref = str(red[1])
  72.  
  73.  aplicacion.dialogCreateSpinnerProgress("LocateIP 0.1","Searching ...")
  74.  aplicacion.dialogShow()
  75.  
  76.  don = search(ref)
  77.  
  78.  aplicacion.dialogDismiss()
  79.  
  80.  aplicacion.dialogCreateAlert("LocateIP 0.1",don)
  81.  aplicacion.dialogSetPositiveButtonText("Done")
  82.  aplicacion.dialogShow()
  83.  
  84.  op = aplicacion.dialogGetResponse().result
  85.  
  86.  if op["which"] == "positive" :
  87.  
  88.   menu()
  89.  
  90. if re2==1 :
  91.  
  92.  aplicacion.dialogCreateAlert("LocateIP 0.1","(C) Doddy Hackman 2013")
  93.  aplicacion.dialogSetPositiveButtonText("Done")
  94.  aplicacion.dialogShow()
  95.  re3 = aplicacion.dialogGetResponse().result
  96.  
  97.  if re3["which"] == "positive" :
  98.  
  99.   menu()
  100.  
  101.  if re3==2:
  102.  
  103.   aplicacion.exit()
  104.  
  105. menu()
  106.  
  107. # The End ?
  108.  

Les dejo unas imagenes de como funciona en mi tablet argos.

(http://doddyhackman.webcindario.com/images/a1.png)

(http://doddyhackman.webcindario.com/images/b1.png)

(http://doddyhackman.webcindario.com/images/c1.png)

Eso es todo.