Quantcast
Channel: LUG@USTC
Viewing all articles
Browse latest Browse all 670

USTC 网络通脚本 - [Bash简化版] 添加一个github链接

$
0
0

USTC 网络通脚本

Bash版

来源:http://bbs.ustc.edu.cn/cgi/go?cgi=bbscon&bid=77&fn=M4CAEC63D

wlt.sh
#!/bin/bash  
curl -c/tmp/wlt "http://wlt.ustc.edu.cn/cgi-bin/ip?cmd=login&name=yourname&password=yourpass">/dev/null 
curl -b/tmp/wlt "http://wlt.ustc.edu.cn/cgi-bin/ip?cmd=set&type=6&exp=0">/dev/null 
rm/tmp/wlt 

脚本说明:
其中yourname和yourpass分别是用户名密码,

  type = 
     0 -- 教育网出口 
     1 -- 电信出口 
     2 -- 联通出口 
     3 -- 电信出口2  
     4 -- 联通出口2 
     5 -- 电信出口3 
     6 -- 联通出口3 
     7 -- 教育网出口2
     8 -- 移动测试国际出口
  exp = 
    0     -- 永久 
    120   -- 动态 
    3600  -- 1小时
    14400 -- 4小时
    39600 -- 11小时 
    50400 -- 14小时 
    

Bash简化版

来源:http://bbs.ustc.edu.cn/cgi/bbscon?bn=USTCnet&fn=M52FAC28D

wlt.sh
#!/bin/bash 
curl --data"name=user&password=pass&cmd=set&type=出口&exp=time" \ 
    http://wlt.ustc.edu.cn/cgi-bin/ip

基于以上命令的一个交互式 POSIX Shell Script: https://github.com/hosiet/wlt-script

Perl版

来源:http://bbs.ustc.edu.cn/cgi/go?cgi=bbscon&bid=77&fn=M41770FCB

wlt.pl
#!/usr/bin/perl  
$wget="/usr/bin/wget";$name="xxxx";$password="xxxx";$url="http://wlt.ustc.edu.cn/cgi-bin/ip";$log="/dev/null";$page="/tmp/wlt_state";$cookies="/tmp/wlt_cookies"; 
@type=("教育网出口(国内)","电信网出口(国际,到教育网走教育网,缺省)","网通网出口(国际,到教育网走教育网)","电信网出口2(国际,到教育网免费地址走教育网)","网通网出口2(国际,到教育网免费地址走教育网)","电信网出口3(国际,文献出口)","网通网出口3(国际,到教育网走教育网,到电信走电信)");@exp=(0,120,3600,14400,39600,50400);@expstr=("永久","动态","1小时","4小时, 缺省","11小时","14小时"); 
# 登录网络通,用--keep-session-cookies和--save-cookies得到Cookies $cmd="cmd=login";# 这个输出页面不需要,只需要得到cookies $options="-o $log -O $log --keep-session-cookies --save-cookies $cookies --post-data \"$cmd&name=$name&password=$password\"";$command="$wget $options $url";system$command; 
print"请选择出口:\n";$i=0;foreach(@type){print"\t",$i+1,": $type[$i]\n";$i=$i+1;}print"注:选择出口2、3无法使用的某些电子资源,使用出口4、5、6可能可以正常使用\n";print"[1-7] ";$type=<STDIN>;$type=$type-1;$typestr=$type[$type]; 
print"使用时限:\n";$i=0;foreach(@exp){print"\t",$i+1,": $exp[$i]s, $expstr[$i]\n";$i=$i+1;}print"[1-6] ";$exp=<STDIN>;$exp=$exp-1;$expstr=$expstr[$exp];$exp=$exp[$exp]; 
$cmd="cmd=set";# 利用Cookies选择出口和时限 $options="-o $log -O $page --load-cookies $cookies --post-data \"$cmd&name=$name&password=$password&type=$type&exp=$exp\"";$command="$wget $options $url";#print $command,"\n"; system$command; 
# 输出网络通使用记录 #print "\t\t\t$name 的网络通状态:\n\t$typestr\t$expstr\n"; open PAGE,$page;@page=<PAGE>;close PAGE;foreach$line(grep(/^<tr><td>.*<\/td><\/tr>$/,@page)){chomp$line;$line=~s!<tr><td>!!;$line=~s!</td><td>![!;$line=~s!</td><td>!]!;$line=~s!</td></tr>!!;print$line,"\n";}

Viewing all articles
Browse latest Browse all 670

Trending Articles


Girasoles para colorear


mayabang Quotes, Torpe Quotes, tanga Quotes


Tagalog Quotes About Crush – Tagalog Love Quotes


OFW quotes : Pinoy Tagalog Quotes


Long Distance Relationship Tagalog Love Quotes


Tagalog Quotes To Move on and More Love Love Love Quotes


5 Tagalog Relationship Rules


Best Crush Tagalog Quotes And Sayings 2017


Re:Mutton Pies (lleechef)


FORECLOSURE OF REAL ESTATE MORTGAGE


Sapos para colorear


tagalog love Quotes – Tiwala Quotes


Break up Quotes Tagalog Love Quote – Broken Hearted Quotes Tagalog


Patama Quotes : Tagalog Inspirational Quotes


Pamatay na Banat and Mga Patama Love Quotes


Tagalog Long Distance Relationship Love Quotes


BARKADA TAGALOG QUOTES


“BAHAY KUBO HUGOT”


Vimeo 10.7.0 by Vimeo.com, Inc.


Vimeo 10.7.1 by Vimeo.com, Inc.