-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3269bb2
Showing
5 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## Ustb Login Plugin for Wox | ||
|
||
### What is Wox | ||
|
||
A full-featured launcher, access programs and web contents as you type. Be more productive ever since. | ||
|
||
Wox is free for use and open-sourced at Github, [Try it Now!](http://www.wox.one) | ||
|
||
### Quick Start | ||
|
||
- Install the plugin by dragging it into plugin folder and restart Wox. | ||
- Edit **main.py**, config your own username and password. | ||
- Activate Wox (Alt+Space) and type in **"202"** | ||
|
||
### Screenshots | ||
|
||
![preview](.\Images\preview.gif) | ||
|
||
### Usage | ||
|
||
``` | ||
202 [Username] [Password] | ||
``` | ||
|
||
\[Username] and \[Password] to specific an account. | ||
|
||
### Requirements | ||
|
||
none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from wox import Wox | ||
import http.client as client | ||
from urllib.parse import quote | ||
import time | ||
import sys | ||
import getpass | ||
|
||
############################### | ||
## Edit Here ## | ||
default_Username = "" ## | ||
default_Password = "" ## | ||
############################### | ||
|
||
|
||
## | ||
def get_ip(): | ||
conn = client.HTTPConnection('cippv6.ustb.edu.cn') | ||
conn.request('GET', '/get_ip.php') | ||
res = conn.getresponse() | ||
if (res.status == 200): | ||
ip = res.read().decode('utf-8').split("'")[1] | ||
return ip | ||
return "" | ||
class LOGIN0(Wox): | ||
|
||
|
||
def query(self, query): | ||
results = [] | ||
if(query): | ||
results.append({ | ||
"Title": "老板上机", | ||
"SubTitle": "使用\"账号(空格)密码\"形式", | ||
"IcoPath":"Images/app.ico", | ||
"ContextData": "ctxData", | ||
"JsonRPCAction":{ | ||
"method":"login", | ||
"parameters":query.split(" ",1), | ||
"dontHideAfterAction":False | ||
} | ||
}) | ||
results.append({ | ||
"Title": "董事长上机", | ||
"SubTitle": "使用"+default_Username+"直接登录", | ||
"IcoPath":"Images/app.ico", | ||
"ContextData": "ctxData", | ||
"JsonRPCAction": { | ||
"method":"login", | ||
"parameters":[default_Username,default_Password], | ||
"dontHideAfterAction":False | ||
} | ||
}) | ||
return results | ||
|
||
def context_menu(self, data): | ||
results = [] | ||
results.append({ | ||
"Title": "Context menu entry", | ||
"SubTitle": "Data: {}".format(data), | ||
"IcoPath":"Images/app.ico" | ||
}) | ||
return results | ||
|
||
|
||
|
||
def login(self,un,pw): | ||
# un = un_pw[0] | ||
# pw = un_pw[1] | ||
ip = get_ip() | ||
en_ip = quote(ip, safe='') | ||
en_pwd = quote(pw, safe='') | ||
headers = { | ||
"Cookie":"myusername=%s; username=%s"%(un, un), | ||
"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36", | ||
"Connection": "keep-alive", | ||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" | ||
} | ||
body = "DDDDD=%s&upass=%s&v6ip=%s&0MKKey=123456789" % (un, en_pwd, en_ip) | ||
conn = client.HTTPConnection('202.204.48.66') | ||
conn.request('POST', '/', body, headers) | ||
res = conn.getresponse() | ||
|
||
|
||
if __name__ == "__main__": | ||
LOGIN0() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"ID":"2f4e384e-76ce-45c3-aea2-b16f5e5c328f", | ||
"ActionKeyword":"202", | ||
"Name":"USTB Login", | ||
"Description":"login in 90 s", | ||
"Author":"kitekii", | ||
"Version":"1.0", | ||
"Language":"python", | ||
"Website":"https://kitekii.pw", | ||
"IcoPath":"Images\\app.png", | ||
"ExecuteFileName":"main.py" | ||
} |