Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
timrockefeller committed Jan 6, 2019
0 parents commit 3269bb2
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 0 deletions.
Binary file added Images/app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/preview.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions README.MD
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
86 changes: 86 additions & 0 deletions main.py
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()
12 changes: 12 additions & 0 deletions plugin.json
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"
}

0 comments on commit 3269bb2

Please sign in to comment.