Advertisement
Batchonline2

SachaDee's Past - IP2MAP.BAT

Jan 8th, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. ::IP File2MAP
  2. ::By SachaDee © 2015
  3.  
  4. @echo off
  5. call:make
  6.  
  7. setlocal enabledelayedexpansion
  8. set "$var=1"
  9. set "$Liste="
  10. set "$StaticUrl=https://maps.googleapis.com/maps/api/staticmap?center=0,0&zoom=1&size=500x300&maptype=satellite"
  11.  
  12. (
  13. echo ^<!DOCTYPE html^>
  14. echo ^<html^>
  15. echo ^<head^>
  16. echo ^<meta name="viewport" content="initial-scale=1.0, user-scalable=no"^>
  17. echo ^<meta charset="utf-8"^>
  18. echo ^<title^>Votre Localisation^</title^>
  19. echo ^<style^>
  20. echo html, body, #map-canvas {
  21. echo height: 100%%;
  22. echo margin: 0px;
  23. echo padding: 0px
  24. echo }
  25. echo ^</style^>
  26. echo ^<script src="https://maps.googleapis.com/maps/api/js?v=3.exp^&signed_in=true"^>^</script^>
  27. echo ^<script^>
  28. echo function initialize(^) {
  29. echo var myLatlng = new google.maps.LatLng(0,0^);
  30. )>carte.html
  31.  
  32. for /f "tokens=1,2 delims==" %%x in (Ip_liste.txt) do (
  33. set "$Nom=%%x"
  34. set "$Ip=%%y"
  35. for /f "tokens=6,7 delims=," %%a in ('cscript.exe getcount.vbs http://ip-api.com/json/!$Ip!') do (
  36. for /f "tokens=2 delims=:" %%i in ('echo %%a') do set $lat=%%i
  37. for /f "tokens=2 delims=:" %%i in ('echo %%b') do set $lon=%%i
  38. echo Traitement IP -^> [!$IP!]
  39. echo Lattitude -^> [!$Lat!]
  40. echo Longitude -^> [!$Lon!]
  41. echo ---
  42. echo var myLatlng!$var! = new google.maps.LatLng(!$Lat!,!$Lon!^);>>carte.html
  43. set $StaticUrl=!$StaticUrl!^&markers=color:blue%%7Clabel:S%%7C!$Lat!,!$Lon!
  44. set /a $var+=1
  45. set $Liste=!$Liste! !$nom!
  46. )
  47. )
  48.  
  49. (echo var mapOptions = {
  50. echo zoom: 2,
  51. echo center: myLatlng
  52. echo }
  53. echo var map = new google.maps.Map(document.getElementById('map-canvas'^), mapOptions^);
  54. )>>carte.html
  55.  
  56. set /a $var-=1
  57.  
  58. for /l %%a in (1,1,!$var!) do (
  59. set $c=1
  60. for %%x in (!$liste!) do (
  61. if "!$c!"=="%%a" (
  62. (echo var marker = new google.maps.Marker({
  63. echo position: myLatlng%%a,
  64. echo map: map,
  65. echo title: '%%x'
  66. echo }^);)>>carte.html
  67. )
  68. set /a $c+=1
  69. )
  70. )
  71.  
  72. (echo }
  73. echo google.maps.event.addDomListener(window, 'load', initialize^);
  74. echo ^</script^>
  75. echo ^</head^>
  76. echo ^<body^>
  77. echo ^<div id="map-canvas"^>^</div^>
  78. echo ^</body^>
  79. echo ^</html^>
  80. )>>carte.html
  81.  
  82.  
  83. start carte.html
  84. start !$StaticUrl!
  85.  
  86. del GetCount.vbs 2>nul
  87. exit/b
  88.  
  89. :make
  90. If not exist Getcount.vbs ((
  91. echo Dim o
  92. echo Var1=Wscript.Arguments(0^)
  93. echo Set o = CreateObject("MSXML2.XMLHTTP"^)
  94. echo o.open "GET", var1, False
  95. echo o.send
  96. echo wscript.echo o.responseText
  97. )>GetCount.vbs
  98. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement