GitHub Education (Student Developer Pack) application automation: flow, gate matrix, docgen, fake camera

This commit is contained in:
ENI
2026-11-14 23:11:33 +02:00
commit 644159b56c
11 changed files with 805 additions and 0 deletions
+96
View File
@@ -0,0 +1,96 @@
#!/usr/bin/env python3
"""Apply for GitHub Education (student) on a prepared account.
python apply.py --accounts accounts.jsonl --login NAME --school "Southern New Hampshire" \
--geo 42.9956,-71.4548 [--submit]
Without --submit it only walks the form and prints the gates (dry run).
"""
import argparse
import json
import os
import sys
import time
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import edu_lib as L
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--accounts", required=True, help="jsonl/json with login,password,totp")
ap.add_argument("--login", required=True)
ap.add_argument("--school", required=True)
ap.add_argument("--geo", default="", help="lat,lon near the school (enables Share Location spoof)")
ap.add_argument("--role", default="student", choices=["student", "faculty"])
ap.add_argument("--profile-dir", default="")
ap.add_argument("--submit", action="store_true")
ap.add_argument("--email", default="", help="school email to select in the school_email dropdown")
a = ap.parse_args()
accs = L.load_accounts(a.accounts)
if a.login not in accs:
sys.exit("login not present in pool file")
acc = accs[a.login]
geo = None
if a.geo:
lat, lon = [float(x) for x in a.geo.split(",")]
geo = (lat, lon)
profile = a.profile_dir or os.path.join(os.path.expanduser("~"), ".gh_edu_profiles", a.login[:16])
os.makedirs(profile, exist_ok=True)
p, ctx, pg = L.launch(profile, geo=geo)
try:
if not L.login(pg, acc):
sys.exit("login failed")
try:
L.open_application(pg)
except L.AccountFlagged as e:
print("FLAGGED:", e)
sys.exit(2)
L.set_role(pg, a.role)
if geo:
L.share_location(pg)
picked = L.select_school(pg, a.school)
print("SCHOOL_PICKED:", picked)
if not picked:
sys.exit("school autocomplete returned no options")
if a.email:
ok = pg.evaluate("""(em) => {
const s = document.querySelector("select[name='dev_pack_form[school_email]']");
if (!s) return 'NO_SELECT';
const o = [...s.options].find(o => o.value === em);
if (!o) return 'NOT_IN_LIST:' + [...s.options].map(x => x.value).join(',');
s.value = em; s.dispatchEvent(new Event('change', {bubbles: true}));
return 'SET';
}""", a.email)
print("EMAIL_SELECT:", ok)
flags = L.dump_flags(pg)
report = {
"camera_required": flags.get("dev_pack_form[camera_required]"),
"two_factor_required": flags.get("dev_pack_form[two_factor_required]"),
"too_far_from_school": flags.get("dev_pack_form[user_too_far_from_school]"),
"new_school": flags.get("dev_pack_form[new_school]"),
"school_id": flags.get("dev_pack_form[selected_school_id]"),
"location_shared": flags.get("dev_pack_form[location_shared]"),
"email_domains": L.parse_email_domains(flags.get("dev_pack_form[email_domains]", "")),
"email_options": flags.get("dev_pack_form[school_email]"),
}
print(json.dumps(report, ensure_ascii=False, indent=1))
if not a.submit:
print("DRY_RUN: not submitting")
return
verdict = L.submit(pg)
print("VERDICT:", json.dumps(verdict, ensure_ascii=False)[:1200])
finally:
time.sleep(1)
ctx.close()
p.stop()
if __name__ == "__main__":
main()