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
'use strict'; | |
const express = require('express'); | |
const jwt = require('jsonwebtoken'); | |
const app = express(); | |
const PORT = 4000; | |
// 可以fs.readfile... | |
const SECRET_KEY = 'secretkey123'; | |
// 配置,expires:过期时间。 | |
const jwtConfig = {expiresIn: '18s'}; |
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
import * as readline from 'readline'; | |
import * as fs from 'fs'; | |
import * as path from 'path'; | |
function scan(): Promise<void> { | |
return new Promise((resolve, reject) => { | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
output: process.stdout, | |
}); |
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
const net = require('net'); | |
// 客户端 | |
const client = net.connect({port: 8124}, () => { | |
//'connect' listener | |
console.log('connected to server!'); | |
client.write('client send...\n'); | |
}); | |
client.write('world!\r\n'); |
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
'use strict'; | |
const puppeteer = require('puppeteer'); | |
(async () => { | |
const browser = await puppeteer.launch({ | |
// 设置Chromium位置 | |
executablePath: 'D:\\Program Files (x86)\\Yarn\\chrome\\chrome.exe', | |
env: { | |
CHROME_PATH: puppeteer.executablePath(), |
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
import * as puppeteer from "puppeteer"; | |
import { Page } from "puppeteer"; | |
/** | |
* 登录 | |
* @param {string} username | |
* @param {string} password | |
* @returns {Promise<{code: number; data: {balance: string}; info: {}}>} | |
*/ | |
async function login(username: string, password: string) { |
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
import requests | |
from bs4 import BeautifulSoup | |
if __name__ == "__main__": | |
def getData(myInfo): | |
# 首页 | |
homeUrl = "http://uia.whxy.edu.cn/cas/login?service=http%3A%2F%2Fportal.whxy.edu.cn%2Fc%2Fportal%2Flogin" | |
# 登录 | |
loginUrl = homeUrl + "%3Fredirect%3D%252Fweb%252Fguest%252Findex%26p_l_id%3D10213" | |
# 教务登录 |