Advertisement
ccocot

Gabut.sh

Apr 16th, 2018
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.30 KB | None | 0 0
  1. #!/bin/bash
  2. # ccocot@bc0de.net
  3. # in Development
  4.  
  5. ###############
  6. # GLOBAL VARIABLE
  7. # EDIT ACCESS TOKEN WITH YOUR TOKEN
  8. # EDIT ACCOUNT ID WITH YOUR ACCOUNT ID
  9. ###############
  10.  
  11. HOST="gabut.club"
  12. ACCESS_TOKEN="ur token ulala"
  13. ACCOUNT_ID="57330"
  14.  
  15. ################
  16. # GET TIMELINE FUNCTION
  17. # RETURN ITEM ID, ACCOUNT ID, myLike, AND USERNAME
  18. ################
  19.  
  20. getFeed(){
  21.   local path="api/v2/method/feeds.get"
  22.   local data="accessToken=${ACCESS_TOKEN}&language=en&itemId=0&accountId=${ACCOUNT_ID}&"
  23.   local url="${HOST}/${path}"
  24.   local result=$(curl -s --url ${url} --data ${data})
  25.   local myLike=$(echo -e "${result}" | grep -Po "(?<=\"myLike\":).*?(?=,)")
  26.   local ids=$(echo -e "${result}" | grep -Po "(?<=\"id\":\").*?(?=\",)")
  27.   local username=$(echo -e "${result}" | grep -Po "(?<=\"fromUserUsername\":\").*?(?=\",)")
  28.   local profileIds=$(echo -e "${result}" | grep -Po "(?<=\"fromUserId\":\").*?(?=\",)")
  29.   local returnValue=$(paste <(echo "${profileIds}") <(echo "${ids}") <(echo "${username}") <(echo "${myLike}") --delimiters='|')
  30.   echo "${returnValue}"
  31. }
  32.  
  33. getRandom(){
  34.   local path="/api/v2/method/random.get"
  35.   local data="accessToken=${ACCESS_TOKEN}&language=en&rating=0&category=0&accountId=${ACCOUNT_ID}&"
  36.   local url="${HOST}/${path}"
  37.   local result=$(curl -s --url ${url} --data ${data})
  38.   local myLike=$(echo -e "${result}" | grep -Po "(?<=\"myLike\":).*?(?=,)")
  39.   local ids=$(echo -e "${result}" | grep -Po "(?<=\"id\":\").*?(?=\",)")
  40.   local username=$(echo -e "${result}" | grep -Po "(?<=\"fromUserUsername\":\").*?(?=\",)")
  41.   local profileIds=$(echo -e "${result}" | grep -Po "(?<=\"fromUserId\":\").*?(?=\",)")
  42.   local returnValue=$(paste <(echo "${profileIds}") <(echo "${ids}") <(echo "${username}") <(echo "${myLike}") --delimiters='|')
  43.   echo "${returnValue}"
  44. }
  45.  
  46. getStream(){
  47.   local path="/api/v2/method/stream.get"
  48.   local data="accessToken=${ACCESS_TOKEN}&language=en&itemId=0&accountId=${ACCOUNT_ID}&"
  49.   local url="${HOST}/${path}"
  50.   local result=$(curl -s --url ${url} --data ${data})
  51.   local myLike=$(echo -e "${result}" | grep -Po "(?<=\"myLike\":).*?(?=,)")
  52.   local ids=$(echo -e "${result}" | grep -Po "(?<=\"id\":\").*?(?=\",)")
  53.   local username=$(echo -e "${result}" | grep -Po "(?<=\"fromUserUsername\":\").*?(?=\",)")
  54.   local profileIds=$(echo -e "${result}" | grep -Po "(?<=\"fromUserId\":\").*?(?=\",)")
  55.   local returnValue=$(paste <(echo "${profileIds}") <(echo "${ids}") <(echo "${username}") <(echo "${myLike}") --delimiters='|')
  56.   echo "${returnValue}"
  57. }
  58.  
  59. ################
  60. # ACTION FUNCTION LIKE,
  61. # COMMENT, MESSAGE, UPDATE STATUS
  62. # RETURN TRUE OF FALSE
  63. ################
  64.  
  65. doLike(){
  66.   local itemId=$1
  67.   local myLike=$3
  68.   local path="/api/v2/method/items.like"
  69.   local data="accessToken=${ACCESS_TOKEN}&accountId=${ACCOUNT_ID}&itemId=${itemId}&"
  70.   local url="${HOST}/${path}"
  71.   if [[ $myLike = "false" ]]; then
  72.     local result=$(curl -s --url ${url} --data ${data} | grep -Po "(?<=\"myLike\":).*?(?=})")
  73.     echo "USERNAME: $2, ITEM_ID: $itemId, LIKED: ${result}"
  74.   fi
  75. }
  76.  
  77. updateStatus(){
  78.   local text=$1
  79.   local path="/api/v2/method/items.new"
  80.   local data="videoUrl=&accessToken=${ACCESS_TOKEN}&postMode=0&videoImgUrl=&postImg=&groupId=0&postText=${text}&accountId=${ACCOUNT_ID}&postCity=&postLng=0.000000&postCountry=&postArea=&postLat=0.000000&"
  81.   local url="${HOST}/${path}"
  82.   local result=$(curl -s --url ${url} --data ${data})
  83.   echo "${result}"
  84. }
  85.  
  86. messagePerson(){
  87.   local targetId=$2
  88.   local profile=$(curl -s --url "${HOST}/api/v2/method/profile.get" --data "accessToken=${ACCESS_TOKEN}&accountId=${ACCOUNT_ID}&profileId=${targetId}&" | grep -Po "(?<=\"sex\":\").*?(?=\")")
  89.   if [[ ${profile} -eq "2" ]]; then
  90.     local text=$1
  91.     local path="/api/v2/method/msg.new"
  92.     local data="profileId=${targetId}&listId=2&chatFromUserId=0&accountId=${ACCOUNT_ID}&chatToUserId=0&accessToken=${ACCESS_TOKEN}&messageImg=&chatId=0&stickerImgUrl=&stickerId=0&messageText=${text}&"
  93.     local url="${HOST}/${path}"
  94.     local result=$(curl -s --url ${url} --data "${data}")
  95.     echo "USERNAME: $3, ITEM_ID: $targetId, (${text})"
  96.   fi
  97. }
  98.  
  99. ################
  100. # SERVICES
  101. # AUTOLIKE, AUTO MESSAGE
  102. # call with & for add pid proccess
  103. # exp : autolike true &
  104. # don't forget to use wait
  105. ################
  106.  
  107. autoLike(){
  108.   while [[ $1 ]]; do
  109.     local one=$(getStream)
  110.     local two=$(getRandom)
  111.     for user in $(echo "${one}/${two}"); do
  112.       IFS='|' read -ra ARR <<< "$user"
  113.       doLike ${ARR[1]} ${ARR[2]} ${ARR[3]} &
  114.     done
  115.     sleep 10
  116.   done
  117. }
  118.  
  119. sayHay(){
  120.   local PAGI="09"
  121.   local SIANG="12"
  122.   local SORE="15"
  123.   local MALEM="21"
  124.   local one=$(getStream)
  125.   local two=$(getRandom)
  126.   for user in $(echo "${one}/${two}"); do
  127.     IFS='|' read -ra ARR <<< "$user"
  128.     local timenow=$(date | awk '{ print $4 }' | cut -d ":" -f1)
  129.       if [[ ${timenow#0} -ge "00" && ${timenow#0} -lt "12" ]]; then
  130.         messagePerson "Selamat Pagi" ${ARR[0]} ${ARR[2]}
  131.       elif [[ ${timenow#0} -ge "12" && ${timenow#0} -lt "15" ]]; then
  132.         messagePerson "Selamat Siang" ${ARR[0]} ${ARR[2]}
  133.       elif [[ ${timenow#0} -ge "15" && ${timenow#0} -lt "19" ]]; then
  134.         messagePerson "Selamat Sore" ${ARR[0]} ${ARR[2]}
  135.       elif [[ ${timenow#0} -ge "19" && ${timenow#0} -lt "23" ]]; then
  136.         messagePerson "Selamat Malem" ${ARR[0]} ${ARR[2]}
  137.       fi
  138.     sleep 10
  139.   done
  140. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement