Advertisement
Lizard1003

[macOS] Yota Mobile Access DBG v1.0

May 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 9.40 KB | None | 0 0
  1. #!/bin/sh
  2. #by Lizard, from osxpc.ru team
  3. #Yota Mobile Access.sh
  4. #Version: "1.0 dbg"
  5.  
  6. #Value for you edit:
  7. macttl=64  #macOS     (recovery default value)
  8. iosttl=65  #iOS       (for Instant hotspot, Wi-Fi hotspot and USB connection)
  9. andttl=65  #Android   (for Wi-Fi hotspot and USB connection)
  10. wphttl=129 #Win Phone (for Wi-Fi hotspot)
  11. #All done.
  12.  
  13. #Dosen't change code below this comment.
  14. sw0=$(sw_vers -productName)
  15. sw1=$(sw_vers -productVersion)
  16. sw2=$(sw_vers -buildVersion)
  17. reset
  18. echo =========================================================
  19. echo Yota Mobile Access.sh
  20. echo =========================================================
  21. echo
  22. echo Version     : "1.0 dbg"
  23. echo Supported   : "macOS, iOS, Android, Windows Phone, and custom value."
  24. echo System      : "$sw0 $sw1 $sw2"
  25. echo
  26. echo Description : "If your provider blocked Wi-Fi or USB hotspot on device, you can try this soliution."
  27. echo "This script increase TTL value for your device, and Internet provider doesn't understand that connection is going outside the device."
  28. echo
  29. echo =======================================================
  30. echo
  31. echo "Enable debug mode? [y/n]: \c"
  32. read DBG
  33. if [ $DBG = 'y' ]; then
  34.     echo "DBG: dbug — Debug mode is enabled"
  35.     log=~/Desktop/YMA.log
  36.     #workaround "No such file or directory"
  37.     date=$(date) #
  38.     echo "DBG: date — $date" > $log #
  39.     sleep .5
  40.     rm $log #
  41.     #workaround "No such file or directory"
  42.     sleep 1
  43.     echo "DBG: file — Log file created (or refreshed) in ~/Desktop/YMA.log"
  44.     echo "DBG: file — Yota Mobile Access.sh" > $log
  45.     echo "DBG: date — $date" >> $log
  46.     echo "DBG: dbug — $DBG" >> $log
  47.     echo "DBG: mosx — $sw0 $sw1 $sw2" >> $log
  48. fi
  49. if [ $DBG != 'y' ]; then
  50.     echo "Debug mode is disabled"
  51. fi
  52. echo
  53. echo =======================================================
  54. echo
  55. ttl0=$(sysctl net.inet.ip.ttl | cut -c 18-)
  56. if [ $ttl0 = '64' ]; then
  57.         echo "Current TTL = 64. This TTL value is default value for macOS."
  58.         if [ $DBG = 'y' ]; then
  59.             echo "DBG: ttl0 – $ttl0" >> $log
  60.         fi
  61. fi
  62. if [ $ttl0 = '65' ]; then
  63.         echo "Current TTL = 65. This TTL value is a good choice for iOS and Android."
  64.         if [ $DBG = 'y' ]; then
  65.             echo "DBG: ttl0 – $ttl0" >> $log
  66.         fi
  67.         echo "Do you want continue anyway? [y/n]: \c"
  68.         read anyway
  69.         if [ $anyway = 'y' ]; then
  70.             if [ $DBG = 'y' ]; then
  71.                     echo "DBG: anyw – $anyway" >> $log
  72.             fi
  73.         fi
  74.         if [ $anyway = 'n' ]; then
  75.             echo
  76.             echo Aborting...
  77.             if [ $DBG = 'y' ]; then
  78.                 echo "DBG: anyw – $anyway" >> $log
  79.                 echo "DBG: ttl1 — $ttl0" >> $log
  80.                 echo "DBG: exit – aborted" >> $log
  81.             fi
  82.             echo
  83.             sleep 1.5
  84.             echo =========================================================
  85.             echo All done. Have a nice day!
  86.             echo
  87.             echo Always for you, osxpc.ru team.
  88.             echo =========================================================
  89.             echo
  90.             echo "Close this session in 10 seconds..."
  91.             sleep 10
  92.             echo
  93.             exit
  94.         fi
  95. fi
  96. if [ $ttl0 = '129' ]; then
  97.         echo "Current TTL = 129. This TTL value is a good choice for Windows Phone."
  98.         if [ $DBG = 'y' ]; then
  99.             echo "DBG: ttl0 – $ttl0" >> $log
  100.         fi
  101.         echo "Do you want continue anyway? [y/n]: \c"
  102.         read anyway
  103.         if [ $anyway = 'y' ]; then
  104.             if [ $DBG = 'y' ]; then
  105.                 echo "DBG: anyw – $anyway" >> $log
  106.             fi
  107.         fi
  108.         if [ $anyway = 'n' ]; then
  109.             echo
  110.             echo Aborting...
  111.             if [ $DBG = 'y' ]; then
  112.                 echo "DBG: anyw – $anyway" >> $log
  113.                 echo "DBG: ttl1 — $ttl0" >> $log
  114.                 echo "DBG: exit – aborted" >> $log
  115.             fi
  116.             echo
  117.             sleep 1.5
  118.             echo =========================================================
  119.             echo All done. Have a nice day!
  120.             echo
  121.             echo Always for you, osxpc.ru team.
  122.             echo =========================================================
  123.             echo
  124.             echo "Close this session in 10 seconds..."
  125.             sleep 10
  126.             echo
  127.             exit
  128.         fi
  129. fi
  130. if [ $ttl0 != '64' ]; then
  131.     if [ $ttl0 != '65' ]; then
  132.         if [ $ttl0 != '129' ]; then
  133.             if [ $ttl0 -lt 64 ]; then
  134.                 if [ $DBG = 'y' ]; then
  135.                     echo "DBG: ttl0 – !!! $ttl0 !!!" >> $log
  136.                 fi
  137.                 echo "!!!"
  138.                 echo "Current TTL = $ttl0. This TTL value has nothing to do with anything, but it needs to be increased minimal to 64 (and greater)."
  139.                 echo "!!!"
  140.             fi
  141.             if [ $ttl0 -gt 64 ]; then
  142.                 echo "Current TTL = $ttl0. This TTL value has nothing to do with anything, but it does not require any changes."
  143.                 if [ $DBG = 'y' ]; then
  144.                     echo "DBG: ttl0 – $ttl0" >> $log
  145.                 fi
  146.                 echo "Do you want continue anyway? [y/n]: \c"
  147.                 read anyway
  148.                 if [ $anyway = 'y' ]; then
  149.                     if [ $DBG = 'y' ]; then
  150.                         echo "DBG: anyw – $anyway" >> $log
  151.                     fi
  152.                 fi
  153.                 if [ $anyway = 'n' ]; then
  154.                     echo
  155.                     echo Aborting...
  156.                     if [ $DBG = 'y' ]; then
  157.                         echo "DBG: anyw – $anyway" >> $log
  158.                         echo "DBG: ttl1 — $ttl0" >> $log
  159.                         echo "DBG: exit – aborted" >> $log
  160.                     fi
  161.                     echo
  162.                     sleep 1.5
  163.                     echo =========================================================
  164.                     echo All done. Have a nice day!
  165.                     echo
  166.                     echo Always for you, osxpc.ru team.
  167.                     echo =========================================================
  168.                     echo
  169.                     echo "Close this session in 10 seconds..."
  170.                     sleep 10
  171.                     echo
  172.                     exit
  173.                 fi
  174.             fi
  175.            
  176.         fi
  177.     fi
  178. fi
  179. echo
  180. echo =======================================================
  181. echo
  182. echo "Supported Platforms:"
  183. echo
  184. echo "0 — macOS       (recovery default value)"
  185. echo "1 — iOS         (for Instant hotspot, Wi-Fi hotspot and USB connection)"
  186. echo "2 — Android     (for Wi-Fi hotspot and USB connection)"
  187. echo "3 — Win Phone   (for Wi-Fi hotspot)"
  188. echo "4 — Custom TTL  (for technical specialists or test)"
  189. echo "5 — Abort       (just aborted executing this script)"
  190. echo
  191. echo "Enter number platform: \c"
  192. read platform
  193. if [ $DBG = 'y' ]; then
  194.     echo "DBG: plfm – $platform" >> $log
  195. fi
  196. if [ $platform = '0' ]; then
  197.     echo Changed platform: macOS
  198. fi
  199. if [ $platform = '1' ]; then
  200.     echo Changed platform: iOS
  201. fi
  202. if [ $platform = '2' ]; then
  203.     echo Changed platform: Android
  204. fi
  205. if [ $platform = '3' ]; then
  206.     echo Changed platform: Windows Phone
  207. fi
  208. if [ $platform = '4' ]; then
  209.     echo Changed platform: Custom TTL
  210. fi
  211. if [ $platform = '5' ]; then
  212.     echo
  213.     echo Aborting...
  214.     if [ $DBG = 'y' ]; then
  215.     echo "DBG: ttl1 — $ttl0" >> $log
  216.     echo "DBG: exit — aborted" >> $log
  217.     fi
  218.     echo
  219.     sleep 1.5
  220.     echo =========================================================
  221.     echo All done. Have a nice day!
  222.     echo Reconnect your device and get Internet!
  223.     echo
  224.     echo Always for you, osxpc.ru team.
  225.     echo =========================================================
  226.     echo
  227.     echo "Close this session in 10 seconds..."
  228.     sleep 10
  229.     echo
  230.     exit
  231. fi
  232. echo
  233. echo =========================================================
  234. echo
  235. if [ $platform = '0' ]; then
  236.     echo "Set TTL value for macOS"
  237.     if [ $DBG = 'y' ]; then
  238.         echo "DBG: exec – sysctl net.inet.ip.ttl=$macttl" >> $log
  239.         sudo sysctl net.inet.ip.ttl=$macttl >> $log
  240.     fi
  241.     sudo sysctl net.inet.ip.ttl=$macttl | cut -c 30-
  242.     ttl1=$(sysctl net.inet.ip.ttl | cut -c 18-)
  243.     if [ $ttl1 = $macttl ]; then
  244.             echo "Success! Now TTL = $ttl1"
  245.         else
  246.             echo "Error. TTL doesn't changed."
  247.     fi
  248. fi
  249. if [ $platform = '1' ]; then
  250.     echo "Set TTL value for iOS"
  251.     if [ $DBG = 'y' ]; then
  252.         echo "DBG: exec – sysctl net.inet.ip.ttl=$macttl" >> $log
  253.         sudo sysctl net.inet.ip.ttl=$iosttl >> $log
  254.     fi
  255.     sudo sysctl net.inet.ip.ttl=$iosttl | cut -c 30-
  256.     ttl1=$(sysctl net.inet.ip.ttl | cut -c 18-)
  257.     if [ $ttl1 = $iosttl ];
  258.         then
  259.             echo "Success! Now TTL = $ttl1"
  260.         else
  261.             echo "Error. TTL doesn't changed."
  262.     fi
  263. fi
  264. if [ $platform = '2' ]; then
  265.     echo "Set TTL value for Android"
  266.     if [ $DBG = 'y' ]; then
  267.         echo "DBG: exec – sysctl net.inet.ip.ttl=$macttl" >> $log
  268.         sudo sysctl net.inet.ip.ttl=$andttl >> $log
  269.     fi
  270.     sudo sysctl net.inet.ip.ttl=$andttl | cut -c 30-
  271.     ttl1=$(sysctl net.inet.ip.ttl | cut -c 18-)
  272.     if [ $ttl1 = $andttl ];
  273.         then
  274.             echo "Success! Now TTL = $ttl1"
  275.         else
  276.             echo "Error. TTL doesn't changed."
  277.     fi
  278. fi
  279. if [ $platform = '3' ]; then
  280.     echo "Set TTL value for Windows Phone"
  281.     if [ $DBG = 'y' ]; then
  282.         echo "DBG: exec – sysctl net.inet.ip.ttl=$macttl" >> $log
  283.         sudo sysctl net.inet.ip.ttl=$wphttl >> $log
  284.     fi
  285.     sudo sysctl net.inet.ip.ttl=$wphttl | cut -c 30-
  286.     ttl1=$(sysctl net.inet.ip.ttl | cut -c 18-)
  287.     if [ $ttl1 = $wphttl ];
  288.         then
  289.             echo "Success! Now TTL = $ttl1"
  290.         else
  291.             echo "Error. TTL doesn't changed."
  292.     fi
  293. fi
  294. if [ $platform = '4' ]; then
  295.     echo "What TTL value need assigning?"
  296.     echo "Set TTL value = \c"
  297.     read customttl
  298.     if [ $DBG = 'y' ]; then
  299.         echo "DBG: exec – sysctl net.inet.ip.ttl=$macttl" >> $log
  300.         sudo sysctl net.inet.ip.ttl=$customttl >> $log
  301.     fi
  302.     sudo sysctl net.inet.ip.ttl=$customttl | cut -c 30-
  303.     ttl1=$(sysctl net.inet.ip.ttl | cut -c 18-)
  304.     if [ $ttl1 = $customttl ];
  305.         then
  306.             echo "Success! Now TTL = $ttl1"
  307.         else
  308.             echo "Error. TTL doesn't changed."
  309.     fi
  310. fi
  311. echo
  312. echo =========================================================
  313. echo All done. Have a nice day!
  314. echo Reconnect your device and get Internet!
  315. if [ $DBG = 'y' ]; then
  316.     echo
  317.     echo "DBG: ttl1 — $ttl1" >> $log
  318.     echo "DBG: exit — end of script" >> $log
  319.     echo "DBG: Do you want open ~/Desktop/YMA.log? [y/n]: \c"
  320.     echo
  321.     read openlog
  322.     if [ $openlog = 'y' ]; then
  323.         open $log
  324.     fi
  325. fi
  326. echo Always for you, osxpc.ru team.
  327. echo =========================================================
  328. echo
  329. echo "Close this session in 10 seconds..."
  330. sleep 10
  331. echo
  332. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement