Advertisement
zerobyte-id

IP Tracker

Feb 22nd, 2018
2,317
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # IP - Tracker
  3. # Coded by ZeroByte.id
  4. # Get api ? https://tools.keycdn.com/
  5.  
  6. getip() {
  7.     wget -q "https://tools.keycdn.com/geo.json?host=$ip" -O track.tmp
  8.     isp=$(cat track.tmp | grep -Po '(?<="isp":")[^",]*')
  9.     ip=$(cat track.tmp | grep -Po '(?<="ip":")[^",]*')
  10.     country=$(cat track.tmp | grep -Po '(?<="country_name":")[^",]*')
  11.     city=$(cat track.tmp | grep -Po '(?<="city":")[^",]*')
  12.     lat=$(cat track.tmp | grep -Po '(?<="latitude":")[^",]*')
  13.     long=$(cat track.tmp | grep -Po '(?<="longitude":")[^",]*')
  14. }
  15. result() {
  16.     echo " ISP         : " $isp;
  17.     echo " IP          : " $ip;
  18.     echo " Country     : " $country;
  19.     echo " City        : " $city;
  20.     echo " Latitude    : " $lat;
  21.     echo " Longitude   : " $long;
  22.     maps=" https://www.google.co.id/maps/search/$lat,+$long"
  23.     echo " GOOGLE MAPS : " $maps
  24. }
  25.  
  26. cat << "banner"
  27. #######################################################
  28. #  ___ ____     _____ ____            _  __    ____   #
  29. # |_ _|  _ \   |_   _|  _ \ __ _  ___| |/ /___|  _ \  #
  30. #  | || |_) |____| | | |_) / _` |/ __| ' // _ \ |_) | #
  31. #  | ||  __/_____| | |  _ < (_| | (__| . \  __/  _ <  #
  32. # |___|_|        |_| |_| \_\__,_|\___|_|\_\___|_| \_\ #
  33. #                                         ZeroByte.id #
  34. #######################################################
  35. banner
  36. echo -n "  MASUKAN IP ADDRESS : "; read ip;
  37. cek=$(curl -s "https://tools.keycdn.com/geo.json?host=$ip");
  38. if [[ $cek =~ '"status":"error"' ]]; then
  39.     echo " MOHON MASUKAN IP ADDRESS";
  40.     exit
  41. elif [[ $cek =~ '400 Bad' ]]; then
  42.     echo " MOHON MASUKAN IP ADDRESS";
  43.     exit
  44. else
  45.     getip
  46.     result
  47. fi
  48. rm track.tmp
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement