Re: QQGroup Analyzer

From NAT, 5 Years ago, written in Bash, viewed 807 times. This paste is a reply to QQGroup Analyzer from NAT - go back
URL https://code.nat.moe/view/8a544142/diff Embed
Viewing differences between QQGroup Analyzer and Re: QQGroup Analyzer
#!/bin/bash

bkn=""
COOKIE="Cookie: p_skey=...; p_uin=...; pt4_token=...; ts_last=...; ts_refer=...; ts_uid=...; RK=...; pgv_info=ssid=...; pgv_pvid=...; ......"

"
 
# You can get those using brup :)

:)
 
USERS_JSON_URL="http://qun.qq.com/cgi-bin/qun_mgr/search_group_members"
USERS_GET_PAYLOAD="gc=_GID_&st=0&end=1000&sort=0&bkn=$bkn"

USERS_GET_PAYLOAD="gc=_GID_&st=0&end=1000&sort=0&bkn=$bkn"
 
        let thread=0
        for user in $users
        do
                [[ -z $1 || $1 == $user ]] && {
                        echo "[$(date)] Progressing $user..."
                        
echo "User: $(getUsernameByID $user) ($user)"
                        
($user)" > user-$user.txt
                        
echo "-------------------------------------------------------------------------------"
                        
"-------------------------------------------------------------------------------" >> user-$user.txt
                        
local this_joined=$(findJoinedGroupByID $user)
$user) 
                        for this_group in $this_joined
                        do
                                echo "$(getGroupNameByID $this_group) ($this_group) as $(getUsernameInGroupByID $this_group $user)"
$user)" >> user-$user.txt
                        done
                        echo "-------------------------------------------------------------------------------"
                        echo
                }
"-------------------------------------------------------------------------------" >> user-$user.txt
                        echo >> user-$user.txt
                        [[ $MAX_THREAD_GENLIST == $thread ]] && wait && thread=0                        
                        let thread++
                } &
        done
        [[ -z $1 ]] && cat user-*.txt || cat user-$1.txt
}

function getUsernameByID {
        cat group-*.txt | grep $1 | tail -n1 | awk -F "|" '{print $3}' | sed -e 's/ / /g;'
}

function getUsernameInGroupByID {
        local name=$(cat group-$1.txt | grep $2 | awk -F "|" '{print $2}')
        [[ -z $name ]] && name=$(cat group-$1.txt | grep $2 | awk -F "|" '{print $3}')
        echo $name | sed -e 's/ / /g;'
}

function showCommonGroups {
        rm common.txt 2> /dev/null
        for user in $(ls user-*.txt)
        do
                local this_uid=$(echo $user | awk -F"user-|.txt" '{print $2}')
                echo $(getUsernameByID $this_uid) $this_uid: $(cat $user | wc -l | tr -d ' ') >> common.txt
        done
        cat common.txt | sort -k2nr -t":"
}

$*

Reply to "Re: QQGroup Analyzer"

Here you can reply to the paste above

captcha