flutter_chaoxing 0.1.4
flutter_chaoxing: ^0.1.4 copied to clipboard
Typed Chaoxing (学习通) protocol clients for Dart: request signing, device registration, passport2 login, classroom sign-in across all nine sign flavours, and a solver for the captcha.chaoxing.com slider captcha.
Changelog #
0.1.4 #
Hygiene release. No functional change from 0.1.3.
-
Sanitized test fixtures. Two problems, both found by scanning the package before release:
chaoxing_auth_service_test.dartused a real capturedtocheckmessagebody — a genuineuidand theenc/enc2/timechallenge tokens from a live new-device verification attempt. Those values are inert (single-use, time-bound, and the flow also requires an SMS code only the account owner can read), but captured challenge state has no business in a published fixture.- Several tests used real identifiers from a live account and course (
uid,courseId,classId,activeId) and a live-capturedextenduserinfoenc.
All are now synthetic. The
extenduserinfovector was recomputed for the synthetic uid, so it still pins themd5(uid + salt)relation. The protocol salts and keys embedded inlib/are untouched — they ship inside the APK and the package cannot work without them. -
Avoid 0.1.3. It is the only version that shipped the captured challenge tokens and is being removed from pub.dev. Use this version.
0.1.3 #
Live-verified against the production server (2026-09-24) with a real account and a course that had all nine sign flavours published at once. Five were signed end-to-end from Dart with no WebView.
Added #
ChaoxingCaptchaService— 超星's in-housecaptcha.chaoxing.comcaptcha, reversed from the obfuscatedload.min.jsweb bundle (a javascript-obfuscator build; the rotating string array was decoded to recoverCONFIGand the three jsonp endpoints). Coverscaptcha/get/conf,captcha/get/verification/imageandcaptcha/check/verification/result, plus the MD5 parameter derivation (captchaKey,tokenwith its 5-minute expiry, and theivthat must be replayed verbatim).solveSlideruns the whole loop and returns thevalidatestring.ChaoxingCaptchaDetector— four-cue slide-gap detection (contour gradient, normalised cross-correlation, surround darkness, colour SAD), min-max normalised over the interior band and fused, with an edge/NCC consensus shortcut. Measured 6/6 against the live service.ChaoxingSignKind— theactiveSort→ flavour table (1 纯普通, 2 防作弊, 3 拍照, 4 位置, 5 位置+人脸, 6/7/8 二维码, 9 签到码), withisHeadlessCapableandusesPost.activeTypeis2for all nine and cannot discriminate.ChaoxingActiveInfo— a model forv2/apis/active/getPPTActiveInfo, replacing the unparsedMapthatfetchActiveInforeturned. Documents what the server discloses (locationText,locationRange,numberCount, the anti-cheat and face flags) and what it withholds (signCode, and the target's coordinates).ChaoxingSignCodeCheck—widget/sign/pcStuSignController/checkSignCode, includingisBannedso a caller stops instead of brute-forcing a code the server has already locked.ChaoxingSecondaryVerificationRequired— thrown when passport2 accepts the password (status:true) but returns atocheckmessagewebUrland no SSO url. Previously this fell through to a misleadingSSO did not return an identitynetwork failure.buildClassroomSignParamsand thePOSTsubmit path, so the 拍照, 签到码, 位置 and 二维码 flavours can be sent in the shape their pages use.
Changed #
submitClassroomSigngained the per-flavour arguments (signCode,objectId,photoResult,address,ifTiJiao,locationResult,location,enc,vpProbability,vpStrategy,currentFaceId,ifCFP,faceEnc,faceCode), akindthat selects the HTTP verb, and ausePostoverride. All new parameters are optional, so existing call sites are unaffected. Itslatitude/longitudedefaults are now-1, matching the pages.ChaoxingClassroomSignResultclassifies four more server replies:您已签到过了(alreadySigned, and now counted byisSigned),签到失败,请重新扫描(rescanRequired),[face]…(faceRequired), and…不在可签到范围内。(outOfRange).ChaoxingAuthService.loginraisesChaoxingSecondaryVerificationRequiredfor the second-factor case instead of falling through.- Added
image: ^4.9.1as a dependency (pure Dart) for captcha image decoding.
Documentation #
- The plaintext official User-Agent is not universally tolerated — this
reverses a 0.1.1 claim. Measured:
passport2-apirejects it and demands a new-device SMS second factor, whilemobilelearnreturns请用学习通客户端打开活动列表without it. Log in with a browser UA, then switch toChaoxingUserAgent.buildfor the learn APIs. doc/protocol.mdwas rewritten as a consumer-facing reference: hosts and which signing scheme each uses, the three schemes' wire contracts, device registration, login outcomes, the endpoint table, all nine sign flavours with their verbs and response tokens, the CXCaptcha protocol and detector, and a consolidated known-limits table. It now carries an explicit evidence-grading convention ([measured]/[reported]/[inferred]/[unverified]) so a caller can tell a live-verified fact from a claim inherited from write-ups about 4.0.1–6.7.x clients.- Removed the reverse-engineering archaeology from the published package —
decompiled class/line citations in prose, native offsets, and the
anti-analysis notes. Source comments in
lib/src/keep their per-constant provenance so the port stays auditable.
License #
- MIT → Apache-2.0, for an explicit patent grant. Code already taken under MIT (0.1.0–0.1.2) may continue to be used under those terms.
- Dropped the
repositoryandissue_trackerfields frompubspec.yaml.
Not solved, by design #
位置+人脸识别 needs a CLIENT_FACE_RECOGNITION_BLINK liveness capture, and the
three 二维码 flavours need an enc that only exists inside the teacher's live QR
code. Both refusals come from the server, not from missing protocol knowledge.
Non-slide captcha flavours (textclick, iconclick, rotate, obstacle)
remain unsolved.
0.1.2 #
Live-verified against the production server (2026-09-23) with a real account.
- Fix
parseCourses: the productionbackclazzdataenvelope is class-centric —channelList[].contentis the class (id=classId,name,chatid,bbsid,cpi) and the course sits atcontent.course.data[](id=courseId,name,teacherfactor,imageurl). The previous parser expected a course-centriccontent.clazz[]and returned zero courses. The legacy shape is kept as a fallback. - Add the classroom sign submit
pptSign/stuSignajax(buildClassroomSignUri/submitClassroomSign/ChaoxingClassroomSignResult). This is the endpoint the H5newsign/preSignpage calls — the official Android client never invokes it natively (it drives the WebView), but it is a plain cookie-authenticated GET, so plain signs now work headlessly. Captured live: a纯普通sign returnedsuccess; an anti-cheat防作弊(验证码)sign returnedvalidate(needs acaptcha.chaoxing.comtoken passed back via thevalidateparameter, plus the nativeCLIENT_DEVICE_FLAGdeviceCode). - Add
bbsidtoChaoxingCourse(the discussion-board id, present in the live payload and needed byChaoxingApiService.fetchTopicList). - Confirm device registration end-to-end: a real login returned a 172-char
clientIdthatresolveDeviceIdentitydecrypted into a validcxcid/scpair, and the server issued it even thoughcdtype/cdid/mediaDrmIdwere omitted — so those three fields are optional forclientIdissuance.
0.1.1 #
- Add
ChaoxingUserAgent, reproducing the official 7.0.2 User-Agent structure (p482ej/C30158f.java). Every constant is read from the decompiled source, not guessed: protocol tag3(C37365n.f144063a), screen code264(C32754f.f129562AviaC32316b.m127070g), channel@Kalimdor(C32764p.mo127076e/mo127077fboth false), packagecom.chaoxing.mobile. The nativecryptUserAgentwrapper is not reversed, so the plaintext suffix is emitted (server-tolerated; see the class doc). ChaoxingAuthService,ChaoxingSignService, andChaoxingApiServicenow take an optionaluserAgent, defaulting to the previous value.- Confirm the device-registration public key: static RE shows
getDeviceInfo(encrypt) anddecryptDeviceInfo(decrypt) both use the SPKI key atlibsecuritylib.so0x52e19, which is the one already embedded. Document thegetDeviceInfoJSON key order and thatplatform/os_nameare"android"andmediaDrmIdcomes fromSettings.Secure.getString.
0.1.0 #
- Initial public preview extracted from the Luotopia app.
- Byte-exact ports of the Chaoxing 7.0.2 request-signing primitives: the two
inf_encquery-signing variants, thecxsign/signTokenheader scheme, and thewebRequestSignRSA-SHA256 bridge used byCLIENT_FORM_SIGN. - Device registration helpers (
CxDevice.getDeviceInfo/decryptDeviceInfo) with chunked RSA and jsoncppFastWriteralignment. - Login and SSO cookie-harvest client (
ChaoxingAuthService). - Classroom sign-in client (
ChaoxingSignService), including the native Fanyausersign/addsignendpoint and theCLIENT_FORM_SIGNbridge implementation. - Student-facing API client (
ChaoxingApiService): notices, grades, homework feed, live classes, course content, timetable, messages, and discussions. - Typed domain models mirroring the official
StudentMission,Course, andClazzschemas, plus theactiveTypedispatch table.