flutter_chaoxing 0.4.2
flutter_chaoxing: ^0.4.2 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.4.2 #
- Video pop-quiz (弹题) protocol. New
ChaoxingVideoQuiz/ChaoxingQuizQuestion/ChaoxingQuizOption/ChaoxingQuizEvent/ChaoxingQuizValidationmodels andfetchVideoQuiz(richvideo/initdatawithviewerV2),validateQuizAnswer(question/quiz-validation) andfetchQuizRightCount(question/quiz-rightcount). The quiz endpoints answer GBK-encoded JSON despite declaringcharset=utf-8, so they are decoded with thegbkcodec (newcharsetdependency). - Fix:
fastforwardwas alwaysfalse. The wire carries it as a JSON string"true"/"false"(also 0/1), but the parser only accepted a real boolean, so every video was treated as forbid-fast-forward. Now parsed via_asBool. - Clarify
rt. It is the required viewing ratio for the 任务点 to count as finished (0.7= watch 70%), echoed verbatim into the report, not a playback rate.
0.4.1 #
- Fix: the chapter tree never parsed live gear responses.
gas/clazzwraps every gear record in a one-element list (data:[clazz],course.data:[course],knowledge.data:[nodes]); the parser only accepted map envelopes and silently produced an empty tree — every course showed "no chapters".chapterFieldsalso omittedname, so node titles came back empty. Both fixed and live-verified against a real session. - Fix: node cards and job state.
gas/knowledgereturnscard:{data:[…]}(now unwrapped) andjob/myjobsnodesmapanswers an object keyed by node id instead of a list (now handled).
0.4.0 #
- Chapter / knowledge-point study surface. New
chaoxing_knowledge_models.dart(exported):ChaoxingKnowledgeNode+ChaoxingKnowledgeCard(ports of the officialKnowledge2/Cardbeans),ChaoxingChapterDatawith theparentnodeid-linked,indexorder-sorted tree and the fullCourse2.calShowStatuslock cascade (atasknode with unfinished jobs andopenlock == 0locks every later node until the class is archived/open), andChaoxingNodeShowStatus. - Video study protocol.
ChaoxingCourseVideoparses the video-info blob the H5 card page hands the official native player (CLIENT_OPEN_CHAPTER_VIDEO/nativeapi:/getnextknowledgevideo.videoObject—C19427d.m76745cfield set), including the resume/headOffset/clip-window rules ofCourseViewModel.m76784F/m76820y.ChaoxingVideoReport.buildUrireproduces themultimedia/logheartbeat GET byte-for-byte (InterfaceC19424a.f74485aruntime-dump variant withrt),enc = md5("[clazzId][uid][jobid][objectid] [t*1000][d_yHJ!$pdA~5][duration*1000][clipTime]")— the mobile salt, not the H5 player'sd_yHJW$XHF_4SmmD_2M9+dtoken scheme.encgoldens inchaoxing_knowledge_test.dartwere produced with Pythonhashlib. - New
ChaoxingApiServicemethods:fetchChapterData(studentgas/clazzgear call with the per-userclickcount/finishcount/unfinishcount/openlock/ newchapterrulenode fields),fetchKnowledgeNode(per-node card list withcontentcard(all)),fetchNodeJobStatus(job/myjobsnodesmapform POST),fetchKnowledgeVideo(knowledge/getnextknowledgevideo),reportVideoProgress(the heartbeat GET), and the purebuildKnowledgeCardPageUrlH5 card-page builder (C32662a.m128670Y0).
0.3.1 #
-
submitFaceSignacceptsvalidate. A 位置+人脸 activity that also has an anti-cheat flag set (openPreventCheatFlag/ifNeedVCode/showVCode) answers the firststuSignajaxwith the bare tokenvalidate, and the caller has to solve the slider and resubmit. The token could not be passed in: the method delegated tosubmitClassroomSignwithout forwarding one, so the retry was impossible and the rawvalidatestring typically surfaced to the user as an error message. The combination was never measured — §6.2's matrix covers4 + openCheckFaceFlagand0 + ifNeedVCodeseparately, not together.Omitting the argument leaves the request byte-for-byte unchanged (
buildClassroomSignParamsalready drops an emptyvalidate), so this is additive. Note the retry re-runs/pptSign/check-face-result; nothing in that request suggests it is one-shot, but it has not been measured against a live anti-cheat face activity, so prefer pre-solving from theChaoxingActiveInfoflags where they allow it.
0.3.0 #
-
Course homework and exam lists.
ChaoxingApiService.fetchCourseTasksmergesfetchWorkList(作业) andfetchExamList(考试) for one course/class into a singleList<ChaoxingCourseTask>, each best-effort so one WAF-blocked page never drops the whole list. Rows are parsed from the cookie-authedworkList/examListH5 pages (parseWorkList/parseExamList) — the native JSON feedgas/taskmsgis WAF-blocked off the official app's network.ChaoxingCourseTaskcarries the title, the do-taskurl, thetype(work/exam), the server's status text, and a secondary detail line (date for homework, score for exams). -
Already-signed record.
ChaoxingSignRecord.parsedecodes anewsign/preSignpage's terminal state — the verdict text,.signtime, the submitted photo (zsign_photo, thumbnail URL + pan objectId) and the recorded location (#latitude/#longitude/#address, BD-09) — andChaoxingSignService.fetchSignRecordfetches that page for a mission'surl. An unsigned activity returnssigned == false(still the submit form), so a headless client can render the same "已签到 + 时间 + 照片/位置" the WebView shows without any HTML. -
Face enrolment.
ChaoxingSignService.enrollFaceregisters a panobjectIdas the account's face template viabuildChangeFaceIdUri(passport2-api/api/changefaceid?objectid=…). Enrolment only checks that the image contains a face — no liveness, no identity check — so any still photo with a face enrols; the per-sign liveness gate is separate (seesubmitFaceSign). Returns true on{"result":1}and throwsChaoxingSignRejectedwith the server'serrorMsgotherwise. -
Native notice opening.
ChaoxingMission.noticeIdpulls thenoticeIdout ofextraInfo(matching both the JSON andMap.toString()forms), so a notice activity can open natively viagetNoticeinstead of through the WebView whose 查看 button only fires a URL-less bridge call. -
Text/icon click captcha.
ChaoxingCaptchaChallengemodels the fetched challenge — the token to answer with, the two image URLs, and for thetextclick/iconclickflavours the glyphs to click (in order) and the promptcontext— and the captcha service grows adownloadhelper for the plain, unauthenticated challenge images. -
Host-scoped session cookies. The auth service now keys its login/SSO cookie jar by host:
passport2-apiandpassport2both set aJSESSIONIDand aroutethat are different sessions, and sending the API host's pair to the web host makes tengine answer403, so each request only carries the cookies of its own host.
0.2.2 #
- New-device SMS verification can be completed.
ChaoxingAuthServicegrowsfetchNumericCaptcha,sendDeviceVerificationCodeandcompleteDeviceVerification. The first returns the/num/codeJPEG a person has to read, the second asks/num/phonecodeto text the code (it also needs a solvedtextclickcaptcha token), and the third posts the SMS code to/v11/checkmessageand follows the same SSO hand-off a normal login does.ChaoxingPasswordResetRequiredcovers the case where the code is right but the server insists on a password reset first. The numeric image and the SMS still need a person; only the plumbing is headless.
0.2.1 #
ChaoxingUserAgent.buildemits the realcryptUserAgentheader. It is not a cipher:libsecuritylib.so@0x7a9ecwraps the plaintext suffix as"(schild:" + MD5(suffix + salt) + ")" + suffix, and the 32-byte salt (ipL$TkeiEmfy1gTXb2XHrdLN0a@7c^vu) sits in.rodataat0x53dfb. Verified live against bothmobilelearn(full activity list) andpassport2-api(extenduserinforeturns the account), so the plaintext-versus-browser UA split is no longer needed. One UA now serves login and the learn APIs.
0.2.0 #
ChaoxingSignService.submitFaceSign— the 位置+人脸 flavour, headless. Enrol a still photo (uploadPhoto, thenpassport2-api…/api/changefaceid?objectid=<id>; any image containing a face is accepted — there is no liveness and no identity check), then this method signscurrentFaceId/collectStatus/LiveDetectionStatuswith the devicesc(ChaoxingSignCrypto.formSignToken,bw/C3026c.m4937b), exchanges thatsignTokenat/pptSign/check-face-resultfor anenc, and submits it. Measured against a liveactiveSort=5activity:{"status":1,"enc":…}thensuccess, and您已签到过了on the repeat.ChaoxingSignKind.locationWithFaceis nowisHeadlessCapable. Only the three QR flavours remain blocked.ChaoxingSignService.jitterLocation— shifts a geocoded point before a location sign. The server stores the submitted coordinates verbatim, and geocoding an address returns the same point every time, so an unjittered run of signs is one identical coordinate repeated. By default the offset is random within 40 m; passdistanceMetres(5, 125, 500) to land at an exact distance with only the bearing randomised. ThelocationJSON is shifted by the same offset, which a 指定地点 QR sign cross-checks.check-face-resultneeds the sharding hintsDB_STRATEGY=PRIMARY_KEY&STRATEGY_PARA=activeId; without them it returns HTTP 500 for every input. Codes:CFR001unparseable,CFR002a missingcxcid/cxtime/signToken,CFR003a badcxtime,CFR006a bad digest.
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.