dimaslanjaka

ping.sh

Feb 15th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.43 KB | None | 0 0
  1. #!/system/bin/sh
  2. echo "#####################"
  3. echo "#    SSH VPN PING TOOL     #"
  4. echo "#           By :  L3n4r0x             #"
  5. echo "#           Version: 1.0b.            #"
  6. echo "#####################"
  7. echo
  8. echo "*** Persyaratan ***"
  9. echo "Primary: Koneksi Internet Terhubung"
  10. echo "1. Busybox Sudah Terinstall"
  11. echo "2. cURL binary sudah terinstall."
  12. echo "   Bila tidak terinstall maka"
  13. echo "   akan otomatis menginstall cURL di Device Anda."
  14. echo "   NOTE: INTERNET CONNECTION Required"
  15. echo
  16. echo "Masukkan domain tujuan yang akan di ping (misal google.me):"
  17.  
  18. read h
  19.  
  20. clear
  21. if [ -e /system/xbin/curl ]; then
  22. echo "Masukkan Tiap Berapa detik ping Berjalan (angka):"
  23. echo "recommended: 1"
  24. echo "masukkan angkanya:"
  25.  
  26. read sx
  27.  
  28. echo "Masukkan Berapa Kali Ping Berjalan:"
  29. echo " Misal 1000, maka ping akan berjalan 1000 kali"
  30. echo "Masukkan AngkaNya:"
  31.  
  32. read tx
  33.  
  34. clear
  35. echo "Host: $h"
  36. echo "Ping $sx/seconds"
  37. echo "Ping $tx time"
  38. echo "Pinging $h...."
  39. echo
  40. count=0
  41. total="$tx"
  42. start=`date +%s`
  43.  
  44. while [ $count -lt $total ]; do
  45.   sleep $sx # this is work
  46.   cur=`date +%s`
  47.   count=$(( $count + 1 ))
  48.   pd=$(( $count * 73 / $total ))
  49.   runtime=$(( $cur-$start ))
  50.   estremain=$(( ($runtime * $total / $count)-$runtime ))
  51.   printf "\r%d.%d%% complete ($count of $total) - est %d:%0.2d remaining\e[K" $(( $count*100/$total )) $(( ($count*1000/$total)%10)) $(( $estremain/60 )) $(( $estremain%60 ))
  52. done
  53. printf "\ndone\n"
  54. echo "pinging $h done..."
  55. for i in `seq $sx $tx`; do curl -s http://$h > /dev/null; done
  56. else
  57.     if [ -e /system/bin/curl ]; then
  58.     echo "ALL Files Is OK!"
  59.     echo
  60.    
  61.     clear
  62.     echo "This is a ping tool program."
  63.     echo "by L3n4r0x"
  64.     echo
  65.     echo "Masukkan Tiap Berapa detik ping Berjalan (angka):"
  66.     echo "recommended: 1"
  67.     echo "masukkan angkanya:"
  68.    
  69.     read ss
  70.    
  71.     echo "Masukkan Berapa Kali Ping Berjalan:"
  72.     echo " Misal 1000, maka ping akan berjalan 1000 kali"
  73.     echo "Masukkan AngkaNya:"
  74.    
  75.     read ts
  76.    
  77.     clear
  78.     echo "Host: $h"
  79.     echo "Ping $ss/seconds"
  80.     echo "Ping $ts time"
  81.     echo "Pinging $h...."
  82.     echo
  83.     count=0
  84.     total="$ts"
  85.     start=`date +%s`
  86.    
  87.     while [ $count -lt $total ]; do
  88.       sleep $ss # this is work
  89.       cur=`date +%s`
  90.       count=$(( $count + 1 ))
  91.       pd=$(( $count * 73 / $total ))
  92.       runtime=$(( $cur-$start ))
  93.       estremain=$(( ($runtime * $total / $count)-$runtime ))
  94.       printf "\r%d.%d%% complete ($count of $total) - est %d:%0.2d remaining\e[K" $(( $count*100/$total )) $(( ($count*1000/$total)%10)) $(( $estremain/60 )) $(( $estremain%60 ))
  95.     done
  96.     printf "\ndone\n"
  97.     echo "pinging $h done..."
  98.     for i in `seq $ss $ts`; do curl -s http://$h > /dev/null; done
  99.     else
  100.             if [ -e /data/local/bin/curl ]; then
  101.             echo "This is a ping tool program."
  102.             echo "by L3n4r0x"
  103.             echo
  104.             echo "Masukkan Tiap Berapa detik ping Berjalan (angka):"
  105.             echo "recommended: 1"
  106.             echo "Masukkan Angkanya:"
  107.        
  108.             read sl
  109.            
  110.             echo "Masukkan Berapa Kali Ping Berjalan:"
  111.             echo " Misal 1000, maka ping akan berjalan 1000 kali"
  112.             echo "Masukkan angkanya:"
  113.             read tl
  114.            
  115.             clear
  116.             echo "Host: $h"
  117.             echo "Ping $sl/seconds"
  118.             echo "Ping $tl time"
  119.             echo "Pinging $h...."
  120.             echo
  121.             count=0
  122.             total="$tl"
  123.             start=`date +%s`
  124.            
  125.             while [ $count -lt $total ]; do
  126.               sleep $sl # this is work
  127.               cur=`date +%s`
  128.               count=$(( $count + 1 ))
  129.               pd=$(( $count * 73 / $total ))
  130.               runtime=$(( $cur-$start ))
  131.               estremain=$(( ($runtime * $total / $count)-$runtime ))
  132.               printf "\r%d.%d%% complete ($count of $total) - est %d:%0.2d remaining\e[K" $(( $count*100/$total )) $(( ($count*1000/$total)%10)) $(( $estremain/60 )) $(( $estremain%60 ))
  133.             done
  134.             printf "\ndone\n"
  135.             echo "pinging $h done..."
  136.             for i in `seq $sl $tl`; do ./data/local/bin/curl -s http://$h > /dev/null ; done
  137.             echo "Ping $h Stopped..."
  138.             else
  139.                 echo "cURL Binary Not Found, checking requirement..."
  140.                 sleep 1
  141.                 echo "Mounting Data.."
  142.                 mount -o remount,rw rootfs /
  143.                 mount -o rw,remount rootfs
  144.                 mount -o rw,remount /data
  145.                 mount -o remount,rw /data
  146.                 sleep 1
  147.                 echo "installing files..."
  148.                 echo
  149.                 cd /
  150.                 wget -O http://dimas.nh-zone.nu/data.zip
  151.                 unzip data.zip
  152.                 chmod 755 /data/local/bin/*
  153.                 chmod 755 /data/local/ssl/*
  154.                 echo
  155.                 echo "ALL Requirement Have Installed."
  156.                 echo
  157.                 echo "This is a ping tool program."
  158.                 echo "by L3n4r0x"
  159.                 echo
  160.                 echo "Masukkan Tiap Berapa detik ping Berjalan (angka):"
  161.                 echo "recommended: 1"
  162.                 echo "Masukkan Angkanya:"
  163.            
  164.                 read sn
  165.                
  166.                 echo "Masukkan Berapa Kali Ping Berjalan:"
  167.                 echo " Misal 1000, maka ping akan berjalan 1000 kali"
  168.                 echo "Masukkan angkanya:"
  169.                 read tn
  170.                
  171.                 echo "Congratulations: Ping Is Running..."
  172.                 echo
  173.                 clear
  174.                 echo "Host: $h"
  175.                 echo "Ping $sn/seconds"
  176.                 echo "Ping $tn time"
  177.                 echo "Pinging $h...."
  178.                 echo
  179.                 count=0
  180.                 total="$tn"
  181.                 start=`date +%s`
  182.                
  183.                 while [ $count -lt $total ]; do
  184.                   sleep $sn # this is work
  185.                   cur=`date +%s`
  186.                   count=$(( $count + 1 ))
  187.                   pd=$(( $count * 73 / $total ))
  188.                   runtime=$(( $cur-$start ))
  189.                   estremain=$(( ($runtime * $total / $count)-$runtime ))
  190.                   printf "\r%d.%d%% complete ($count of $total) - est %d:%0.2d remaining\e[K" $(( $count*100/$total )) $(( ($count*1000/$total)%10)) $(( $estremain/60 )) $(( $estremain%60 ))
  191.                 done
  192.                 printf "\ndone\n"
  193.                 for i in `seq $sn $tn`; do ./data/local/bin/curl -s http://$h > /dev/null ; done
  194.                 echo "Ping $h stopped..."
  195.         fi
  196.     fi
  197. fi
Advertisement
Add Comment
Please, Sign In to add comment