Skip to main content

flutter_chaoxing 0.4.2 copy "flutter_chaoxing: ^0.4.2" to clipboard
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 / ChaoxingQuizValidation models and fetchVideoQuiz (richvideo/initdatawithviewerV2), validateQuizAnswer (question/quiz-validation) and fetchQuizRightCount (question/quiz-rightcount). The quiz endpoints answer GBK-encoded JSON despite declaring charset=utf-8, so they are decoded with the gbk codec (new charset dependency).
  • Fix: fastforward was always false. 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/clazz wraps 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". chapterFields also omitted name, so node titles came back empty. Both fixed and live-verified against a real session.
  • Fix: node cards and job state. gas/knowledge returns card:{data:[…]} (now unwrapped) and job/myjobsnodesmap answers 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 official Knowledge2/Card beans), ChaoxingChapterData with the parentnodeid-linked, indexorder-sorted tree and the full Course2.calShowStatus lock cascade (a task node with unfinished jobs and openlock == 0 locks every later node until the class is archived/open), and ChaoxingNodeShowStatus.
  • Video study protocol. ChaoxingCourseVideo parses the video-info blob the H5 card page hands the official native player (CLIENT_OPEN_CHAPTER_VIDEO / nativeapi: / getnextknowledgevideo.videoObject — C19427d.m76745c field set), including the resume/headOffset/clip-window rules of CourseViewModel.m76784F/m76820y. ChaoxingVideoReport.buildUri reproduces the multimedia/log heartbeat GET byte-for-byte (InterfaceC19424a.f74485a runtime-dump variant with rt), enc = md5("[clazzId][uid][jobid][objectid] [t*1000][d_yHJ!$pdA~5][duration*1000][clipTime]") — the mobile salt, not the H5 player's d_yHJW$XHF_4SmmD_2M9+dtoken scheme. enc goldens in chaoxing_knowledge_test.dart were produced with Python hashlib.
  • New ChaoxingApiService methods: fetchChapterData (student gas/clazz gear call with the per-user clickcount/finishcount/unfinishcount/openlock/ newchapterrule node fields), fetchKnowledgeNode (per-node card list with contentcard(all)), fetchNodeJobStatus (job/myjobsnodesmap form POST), fetchKnowledgeVideo (knowledge/getnextknowledgevideo), reportVideoProgress (the heartbeat GET), and the pure buildKnowledgeCardPageUrl H5 card-page builder (C32662a.m128670Y0).

0.3.1 #

  • submitFaceSign accepts validate. A 位置+人脸 activity that also has an anti-cheat flag set (openPreventCheatFlag / ifNeedVCode / showVCode) answers the first stuSignajax with the bare token validate, and the caller has to solve the slider and resubmit. The token could not be passed in: the method delegated to submitClassroomSign without forwarding one, so the retry was impossible and the raw validate string typically surfaced to the user as an error message. The combination was never measured — §6.2's matrix covers 4 + openCheckFaceFlag and 0 + ifNeedVCode separately, not together.

    Omitting the argument leaves the request byte-for-byte unchanged (buildClassroomSignParams already drops an empty validate), 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 the ChaoxingActiveInfo flags where they allow it.

0.3.0 #

  • Course homework and exam lists. ChaoxingApiService.fetchCourseTasks merges fetchWorkList (作业) and fetchExamList (考试) for one course/class into a single List<ChaoxingCourseTask>, each best-effort so one WAF-blocked page never drops the whole list. Rows are parsed from the cookie-authed workList/examList H5 pages (parseWorkList/parseExamList) — the native JSON feed gas/taskmsg is WAF-blocked off the official app's network. ChaoxingCourseTask carries the title, the do-task url, the type (work/exam), the server's status text, and a secondary detail line (date for homework, score for exams).

  • Already-signed record. ChaoxingSignRecord.parse decodes a newsign/preSign page'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) — and ChaoxingSignService.fetchSignRecord fetches that page for a mission's url. An unsigned activity returns signed == false (still the submit form), so a headless client can render the same "已签到 + 时间 + 照片/位置" the WebView shows without any HTML.

  • Face enrolment. ChaoxingSignService.enrollFace registers a pan objectId as the account's face template via buildChangeFaceIdUri (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 (see submitFaceSign). Returns true on {"result":1} and throws ChaoxingSignRejected with the server's errorMsg otherwise.

  • Native notice opening. ChaoxingMission.noticeId pulls the noticeId out of extraInfo (matching both the JSON and Map.toString() forms), so a notice activity can open natively via getNotice instead of through the WebView whose 查看 button only fires a URL-less bridge call.

  • Text/icon click captcha. ChaoxingCaptchaChallenge models the fetched challenge — the token to answer with, the two image URLs, and for the textclick/iconclick flavours the glyphs to click (in order) and the prompt context — and the captcha service grows a download helper for the plain, unauthenticated challenge images.

  • Host-scoped session cookies. The auth service now keys its login/SSO cookie jar by host: passport2-api and passport2 both set a JSESSIONID and a route that are different sessions, and sending the API host's pair to the web host makes tengine answer 403, so each request only carries the cookies of its own host.

0.2.2 #

  • New-device SMS verification can be completed. ChaoxingAuthService grows fetchNumericCaptcha, sendDeviceVerificationCode and completeDeviceVerification. The first returns the /num/code JPEG a person has to read, the second asks /num/phonecode to text the code (it also needs a solved textclick captcha token), and the third posts the SMS code to /v11/checkmessage and follows the same SSO hand-off a normal login does. ChaoxingPasswordResetRequired covers 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.build emits the real cryptUserAgent header. It is not a cipher: libsecuritylib.so @ 0x7a9ec wraps the plaintext suffix as "(schild:" + MD5(suffix + salt) + ")" + suffix, and the 32-byte salt (ipL$TkeiEmfy1gTXb2XHrdLN0a@7c^vu) sits in .rodata at 0x53dfb. Verified live against both mobilelearn (full activity list) and passport2-api (extenduserinfo returns 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, then passport2-api…/api/changefaceid?objectid=<id>; any image containing a face is accepted — there is no liveness and no identity check), then this method signs currentFaceId/collectStatus/LiveDetectionStatus with the device sc (ChaoxingSignCrypto.formSignToken, bw/C3026c.m4937b), exchanges that signToken at /pptSign/check-face-result for an enc, and submits it. Measured against a live activeSort=5 activity: {"status":1,"enc":…} then success, and 您已签到过了 on the repeat.
  • ChaoxingSignKind.locationWithFace is now isHeadlessCapable. 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; pass distanceMetres (5, 125, 500) to land at an exact distance with only the bearing randomised. The location JSON is shifted by the same offset, which a 指定地点 QR sign cross-checks.
  • check-face-result needs the sharding hints DB_STRATEGY=PRIMARY_KEY&STRATEGY_PARA=activeId; without them it returns HTTP 500 for every input. Codes: CFR001 unparseable, CFR002 a missing cxcid/cxtime/signToken, CFR003 a bad cxtime, CFR006 a 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.dart used a real captured tocheckmessage body — a genuine uid and the enc/enc2/time challenge 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-captured extenduserinfo enc.

    All are now synthetic. The extenduserinfo vector was recomputed for the synthetic uid, so it still pins the md5(uid + salt) relation. The protocol salts and keys embedded in lib/ 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-house captcha.chaoxing.com captcha, reversed from the obfuscated load.min.js web bundle (a javascript-obfuscator build; the rotating string array was decoded to recover CONFIG and the three jsonp endpoints). Covers captcha/get/conf, captcha/get/verification/image and captcha/check/verification/result, plus the MD5 parameter derivation (captchaKey, token with its 5-minute expiry, and the iv that must be replayed verbatim). solveSlide runs the whole loop and returns the validate string.
  • 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 — the activeSort → flavour table (1 纯普通, 2 防作弊, 3 拍照, 4 位置, 5 位置+人脸, 6/7/8 二维码, 9 签到码), with isHeadlessCapable and usesPost. activeType is 2 for all nine and cannot discriminate.
  • ChaoxingActiveInfo — a model for v2/apis/active/getPPTActiveInfo, replacing the unparsed Map that fetchActiveInfo returned. 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, including isBanned so 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 a tocheckmessage webUrl and no SSO url. Previously this fell through to a misleading SSO did not return an identity network failure.
  • buildClassroomSignParams and the POST submit path, so the 拍照, 签到码, 位置 and 二维码 flavours can be sent in the shape their pages use.

Changed #

  • submitClassroomSign gained the per-flavour arguments (signCode, objectId, photoResult, address, ifTiJiao, locationResult, location, enc, vpProbability, vpStrategy, currentFaceId, ifCFP, faceEnc, faceCode), a kind that selects the HTTP verb, and a usePost override. All new parameters are optional, so existing call sites are unaffected. Its latitude/longitude defaults are now -1, matching the pages.
  • ChaoxingClassroomSignResult classifies four more server replies: 您已签到过了 (alreadySigned, and now counted by isSigned), 签到失败,请重新扫描 (rescanRequired), [face]… (faceRequired), and …不在可签到范围内。 (outOfRange).
  • ChaoxingAuthService.login raises ChaoxingSecondaryVerificationRequired for the second-factor case instead of falling through.
  • Added image: ^4.9.1 as 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-api rejects it and demands a new-device SMS second factor, while mobilelearn returns 请用学习通客户端打开活动列表 without it. Log in with a browser UA, then switch to ChaoxingUserAgent.build for the learn APIs.
  • doc/protocol.md was 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 repository and issue_tracker fields from pubspec.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 production backclazzdata envelope is class-centric — channelList[].content is the class (id=classId, name, chatid, bbsid, cpi) and the course sits at content.course.data[] (id=courseId, name, teacherfactor, imageurl). The previous parser expected a course-centric content.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 H5 newsign/preSign page 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 returned success; an anti-cheat 防作弊(验证码) sign returned validate (needs a captcha.chaoxing.com token passed back via the validate parameter, plus the native CLIENT_DEVICE_FLAG deviceCode).
  • Add bbsid to ChaoxingCourse (the discussion-board id, present in the live payload and needed by ChaoxingApiService.fetchTopicList).
  • Confirm device registration end-to-end: a real login returned a 172-char clientId that resolveDeviceIdentity decrypted into a valid cxcid/sc pair, and the server issued it even though cdtype/cdid/mediaDrmId were omitted — so those three fields are optional for clientId issuance.

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 tag 3 (C37365n.f144063a), screen code 264 (C32754f.f129562A via C32316b.m127070g), channel @Kalimdor (C32764p.mo127076e/mo127077f both false), package com.chaoxing.mobile. The native cryptUserAgent wrapper is not reversed, so the plaintext suffix is emitted (server-tolerated; see the class doc).
  • ChaoxingAuthService, ChaoxingSignService, and ChaoxingApiService now take an optional userAgent, defaulting to the previous value.
  • Confirm the device-registration public key: static RE shows getDeviceInfo (encrypt) and decryptDeviceInfo (decrypt) both use the SPKI key at libsecuritylib.so 0x52e19, which is the one already embedded. Document the getDeviceInfo JSON key order and that platform/os_name are "android" and mediaDrmId comes from Settings.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_enc query-signing variants, the cxsign/signToken header scheme, and the webRequestSign RSA-SHA256 bridge used by CLIENT_FORM_SIGN.
  • Device registration helpers (CxDevice.getDeviceInfo / decryptDeviceInfo) with chunked RSA and jsoncpp FastWriter alignment.
  • Login and SSO cookie-harvest client (ChaoxingAuthService).
  • Classroom sign-in client (ChaoxingSignService), including the native Fanya usersign/addsign endpoint and the CLIENT_FORM_SIGN bridge 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, and Clazz schemas, plus the activeType dispatch table.
0
likes
150
points
483
downloads

Documentation

API reference

Publisher

verified publisherwhu.sb

Weekly Downloads

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.

Topics

#chaoxing #xuexitong #sign-in #captcha #education

License

Apache-2.0 (license)

Dependencies

charset, crypto, dio, image, pointycastle

More

Packages that depend on flutter_chaoxing