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
+7
View File
@@ -0,0 +1,7 @@
accounts.jsonl
*.y4m
*.png
!docs/*.png
profiles/
.gh_edu_profiles/
__pycache__/
+76
View File
@@ -0,0 +1,76 @@
# GATES — GitHub Education application, measured on a live account
Account used for probing: an aged, non-flagged account from a purchased pool. Farm accounts
(created days ago, 0-1 repos) are flagged and never reach the form.
## 1. Account flag
| Account | "Start an application" | Modal | Support portal |
|---|---|---|---|
| farmed account (created 2026-10) | `<a href="/pricing">` | never opens | `contact/two-factor-verification-required` → *"As your account has been flagged"* |
| same account after enabling 2FA + fresh login | `<a href="/pricing">` | never opens | same page |
| aged account (2023-2024, DE) | `<button>` | opens, loads `developer_pack_applications/new` | form reachable |
Conclusion: the redirect to `/pricing` is not a UI bug and not a missing 2FA - it is the flag.
Enabling TOTP on a flagged account does **not** unlock support or the application.
## 2. Hidden fields = the real requirements
They arrive with the modal and change as soon as a school is picked from the autocomplete:
```
dev_pack_form[selected_school_id] 4226 (Pennsylvania State University)
dev_pack_form[email_domains] [["psu.edu",false,"MIXED_USE","ALLOWLISTED"], ...]
dev_pack_form[camera_required] true
dev_pack_form[two_factor_required] false
dev_pack_form[user_too_far_from_school] true
dev_pack_form[location_shared] (empty until "Share Location")
dev_pack_form[latitude] / [longitude] 42.9956 / -71.4548 after Share Location
```
`email_domains` entry format: `[domain, required_flag, "MIXED_USE", "ALLOWLISTED"|"DENYLISTED"]`.
`ALLOWLISTED` = GitHub accepts and requires that domain; `DENYLISTED` = not accepted.
## 3. School matrix (probe run)
| Query | id | camera | 2FA | too_far | allowlisted domain |
|---|---|---|---|---|---|
| Pennsylvania State | 4226 | true | false | true | `psu.edu` |
| Arizona State University | 4949 | true | true | true | (all denylisted in sample) |
| Southern New Hampshire | 9509 | true | false | false | `snhu.edu` |
| Western Governors | 4763 | true | true | false | `wgu.edu`, `my.wgu.edu` |
| University of Phoenix | 3679 | true | true | false | `email.phoenix.edu` |
| Purdue | 4418 | true | false | true | (all denylisted in sample) |
| Liberty | 4447 | true | true | true | `liberty.edu` |
- `camera_required=true` everywhere: there is no upload control any more
(the same complaint as community discussion #190385). Document must appear in a live camera stream.
- `too_far_from_school` flips to `false` after `Share Location` with spoofed coordinates, so the
distance gate is client-side.
- `email_domains` is shipped to the browser, so the whole per-school policy is enumerable without
submitting anything.
## 4. Submit verdict
`POST https://github.com/settings/education/developer_pack_applications` (button `name=continue`,
`disabled` until a school is selected).
With SNHU + a non-school email:
```
There was an error creating the discount request. Errors: There was a problem
You can't perform that action at this time.
```
No request record is created → the attempt is not consumed. The most likely cause is the school
email: `snhu.edu` is `ALLOWLISTED`, and the `school_email` dropdown only lists the account's own
addresses, none of which match.
## 5. What still needs solving
1. A mailbox on an `ALLOWLISTED` domain of the chosen school, added and verified on the account
(`/settings/emails`) before the application.
2. The camera step itself: Chrome fake device
(`--use-fake-device-for-media-stream --use-file-for-fake-video-capture=card.y4m`).
`scripts/fakecam.py` builds the Y4M from a still and launches Chrome with the device active;
whether GitHub's capture UI accepts it end-to-end is not yet verified in this repo.
+104
View File
@@ -0,0 +1,104 @@
# github-edu-apply
Automation + reverse-engineering notes for the **GitHub Education (Student Developer Pack)** application.
GitHub Education is **not** SheerID. Verification is GitHub's own system, the form lives in
`github.com/settings/education/benefits`, and there is no API token route: everything is a React modal
that POSTs to `/settings/education/developer_pack_applications`.
This repo contains the working part of that flow (login → modal → school → hidden-gate dump → submit),
the per-school gate matrix, a dated schedule-screenshot generator and a fake-camera rig for the
camera-only document step.
## What the flow actually is
```
login (password + TOTP)
└─ GET /settings/education/benefits
└─ "Start an application" <- <button> on clean accounts, <a href="/pricing"> on flagged
└─ GET /settings/education/developer_pack_applications/new
└─ modal "Education Benefits Application"
├─ role: teacher | student
├─ school autocomplete -> GET .../developer_pack_applications/schools?q=...
│ sets hidden: selected_school_id, email_domains, camera_required,
│ two_factor_required, user_too_far_from_school
├─ school email (dropdown of the account's emails)
└─ POST /settings/education/developer_pack_applications (button name=continue)
```
## Install
```bash
pip install -r requirements.txt
python -m playwright install chromium
```
Real Chrome is used for login (`executable_path`), Playwright's chromium only for rendering.
## Usage
Accounts file (`.jsonl`, one per line, never commit it):
```json
{"login": "name", "password": "...", "totp": "BASE32SECRET"}
```
Dry run - walks the form, prints every gate, submits nothing:
```bash
python scripts/apply.py --accounts accounts.jsonl --login NAME \
--school "Southern New Hampshire" --geo 42.9956,-71.4548
```
Submit:
```bash
python scripts/apply.py --accounts accounts.jsonl --login NAME \
--school "Southern New Hampshire" --geo 42.9956,-71.4548 \
--email student@snhu.edu --submit
```
Gate matrix for a list of schools (no submission, safe to re-run):
```bash
python scripts/school_probe.py --accounts accounts.jsonl --login NAME \
--schools "Pennsylvania State,Arizona State University,Southern New Hampshire" \
--geo 42.9956,-71.4548 --out findings/school_matrix.json
```
Dated schedule screenshot:
```bash
python scripts/docgen.py --first Ivan --last Petrov --out schedule.png
```
Fake camera for the `camera_required=true` step:
```bash
python scripts/fakecam.py build --image schedule.png --out cam.y4m --seconds 8
python scripts/fakecam.py launch --y4m cam.y4m --profile ~/.gh_edu_profiles/NAME \
--url https://github.com/settings/education/benefits --geo 42.9956,-71.4548
```
## Status per gate (measured 2026-11)
| Gate | State | Bypass |
|---|---|---|
| account flag | flagged accounts get `<a href="/pricing">`, no modal at all | use a clean/aged account; enabling 2FA does not lift it |
| `camera_required` | `true` on every school probed | fake camera (`scripts/fakecam.py`) |
| `email_domains` | per-school allow/deny table shipped to the client | a real mailbox on an `ALLOWLISTED` domain |
| `user_too_far_from_school` | distance check against the account/geo | `Share Location` + Playwright `geolocation` |
| `two_factor_required` | `true` on ASU / WGU / Phoenix / Liberty | TOTP already on the account |
Details and the exact server responses: [GATES.md](GATES.md).
## Blocker that is not solved here
`POST /settings/education/developer_pack_applications` returns, in the modal,
`There was an error creating the discount request. Errors: There was a problem`
when the selected school demands an `ALLOWLISTED` email domain and the account has no such address.
The request is not created, so the attempt is not consumed - safe to retry with the right mailbox.
## Disclaimer
Research/automation code for account flows we control. Do not run it against accounts that are not yours.
+1
View File
@@ -0,0 +1 @@
{"login": "your_login", "password": "your_password", "totp": "BASE32SECRET_OR_EMPTY"}
+72
View File
@@ -0,0 +1,72 @@
[
{
"q": "Pennsylvania State",
"opt": "Pennsylvania State University",
"camera": "true",
"too_far": "true",
"2fa": "false",
"school_id": "4226",
"new_school": "false",
"email_domains_raw": "[[\"hmc.psu.edu\",false,\"MIXED_USE\",\"DENYLISTED\"],[\"essc.psu.edu\",false,\"MIXED_USE\",\"DENYLISTED\"],[\"ems.psu.edu\",false,\"MIXED_USE\",\"DENYLISTED\"],[\"engr.psu.edu\",f"
},
{
"q": "Arizona State University",
"opt": "Arizona State University",
"camera": "true",
"too_far": "true",
"2fa": "true",
"school_id": "4949",
"new_school": "false",
"email_domains_raw": "[[\"mars.asu.edu\",false,\"MIXED_USE\",\"DENYLISTED\"],[\"tbird.asu.edu\",false,\"MIXED_USE\",\"DENYLISTED\"],[\"email.asu.edu\",false,\"MIXED_USE\",\"DENYLISTED\"],[\"mainex1.asu"
},
{
"q": "Southern New Hampshire",
"opt": "Southern New Hampshire University",
"camera": "true",
"too_far": "false",
"2fa": "false",
"school_id": "9509",
"new_school": "false",
"email_domains_raw": "[[\"snhu.edu\",true,\"MIXED_USE\",\"ALLOWLISTED\"]]"
},
{
"q": "Western Governors",
"opt": "Western Governors University",
"camera": "true",
"too_far": "false",
"2fa": "true",
"school_id": "4763",
"new_school": "false",
"email_domains_raw": "[[\"student.wgu.edu\",true,\"MIXED_USE\",\"DENYLISTED\"],[\"my.wgu.edu\",true,\"MIXED_USE\",\"ALLOWLISTED\"],[\"wgu.edu\",true,\"MIXED_USE\",\"ALLOWLISTED\"]]"
},
{
"q": "University of Phoenix",
"opt": "University of Phoenix",
"camera": "true",
"too_far": "false",
"2fa": "true",
"school_id": "3679",
"new_school": "false",
"email_domains_raw": "[[\"phoenix.edu\",true,\"MIXED_USE\",\"DENYLISTED\"],[\"email.phoenix.edu\",true,\"MIXED_USE\",\"ALLOWLISTED\"]]"
},
{
"q": "Purdue",
"opt": "Purdue University",
"camera": "true",
"too_far": "true",
"2fa": "false",
"school_id": "4418",
"new_school": "false",
"email_domains_raw": "[[\"cs.purdue.edu\",false,\"MIXED_USE\",\"DENYLISTED\"],[\"alumni.purdue.edu\",false,\"MIXED_USE\",\"DENYLISTED\"],[\"purduecal.edu\",false,\"MIXED_USE\",\"DENYLISTED\"],[\"ecn.pu"
},
{
"q": "Liberty University",
"opt": "Liberty University",
"camera": "true",
"too_far": "true",
"2fa": "true",
"school_id": "4447",
"new_school": "false",
"email_domains_raw": "[[\"liberty.edu\",false,\"MIXED_USE\",\"ALLOWLISTED\"]]"
}
]
+2
View File
@@ -0,0 +1,2 @@
playwright>=1.40
pyotp>=2.9
+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()
+102
View File
@@ -0,0 +1,102 @@
#!/usr/bin/env python3
"""Render a dated class-schedule screenshot (default: Penn State LionPATH look).
python docgen.py --first Nikita --last Reformov --out schedule.png
The term label and copyright year are derived from the current date so the
document never carries a stale semester (the first thing a reviewer flags).
"""
import argparse
import os
import random
import sys
from datetime import datetime
MAJORS = ["Mechanical Engineering (BS)", "Computer Science (BS)",
"Information Sciences and Technology (BS)", "Electrical Engineering (BS)"]
COURSES = [
("14920", "CMPSC 465", "Data Structures and Algorithms", "MoWeFr 10:10AM - 11:00AM", "Willard 062", "3.00"),
("18233", "MATH 230", "Calculus and Vector Analysis", "TuTh 1:35PM - 2:50PM", "Thomas 102", "4.00"),
("20491", "CMPSC 473", "Operating Systems Design", "MoWe 2:30PM - 3:45PM", "Westgate E201", "3.00"),
("11029", "ENGL 202C", "Technical Writing", "Fr 1:25PM - 2:15PM", "Boucke 304", "3.00"),
("15502", "STAT 318", "Elementary Probability", "TuTh 9:05AM - 10:20AM", "Osmond 112", "3.00"),
]
def term():
now = datetime.now()
if now.month >= 8:
return f"Fall {now.year}", "Aug 24 - Dec 11"
if now.month >= 5:
return f"Summer {now.year}", "May 18 - Aug 7"
return f"Spring {now.year}", "Jan 12 - May 1"
def build_html(first, last, school_name="Penn State", psu_id=None):
now = datetime.now()
t_label, t_span = term()
psu_id = psu_id or f"9{random.randint(10000000, 99999999)}"
major = random.choice(MAJORS)
rows = "".join(
f"<tr><td>{a}</td><td>{b}</td><td>{c}</td><td>{d}</td><td>{e}</td><td>{f}</td></tr>"
for a, b, c, d, e, f in COURSES)
return f"""<!DOCTYPE html><html><head><meta charset="utf-8"><style>
body{{font-family:Roboto,Helvetica,Arial,sans-serif;margin:0;background:#f4f5f7;color:#1f2933}}
.top{{background:#041e42;color:#fff;padding:14px 24px;display:flex;justify-content:space-between;font-size:15px}}
.tabs{{display:flex;gap:22px;background:#fff;padding:12px 24px;border-bottom:1px solid #dbe0e6;font-size:14px}}
.tab.active{{color:#041e42;font-weight:700;border-bottom:2px solid #041e42;padding-bottom:8px}}
.wrap{{padding:24px}}
h1{{font-size:22px;margin:0 0 6px}}
.term{{color:#5b6b7c;font-size:13px;margin-bottom:18px}}
.card{{background:#fff;border:1px solid #dbe0e6;border-radius:6px;padding:18px;display:flex;gap:48px;margin-bottom:18px}}
.lbl{{font-size:11px;text-transform:uppercase;color:#77848f;margin-bottom:4px}}
.val{{font-size:15px;font-weight:700}}
table{{width:100%;border-collapse:collapse;background:#fff;border:1px solid #dbe0e6;font-size:13px}}
th{{background:#eef1f5;text-align:left;padding:9px 10px;font-size:11px;text-transform:uppercase;color:#5b6b7c}}
td{{padding:9px 10px;border-top:1px solid #eef1f5}}
.foot{{margin-top:18px;font-size:11px;color:#77848f}}
</style></head><body>
<div class="top"><div>{school_name} | LionPATH</div><div>Welcome, {first} {last} &nbsp;|&nbsp; Sign Out</div></div>
<div class="tabs"><div class="tab">Student Home</div><div class="tab active">My Class Schedule</div>
<div class="tab">Academics</div><div class="tab">Finances</div><div class="tab">Campus Life</div></div>
<div class="wrap">
<h1>My Class Schedule</h1>
<div class="term">Term: <strong>{t_label}</strong> ({t_span})</div>
<div class="card">
<div><div class="lbl">Student name</div><div class="val">{first} {last}</div></div>
<div><div class="lbl">PSU ID</div><div class="val">{psu_id}</div></div>
<div><div class="lbl">Academic program</div><div class="val">{major}</div></div>
<div><div class="lbl">Enrollment status</div><div class="val">Enrolled</div></div>
<div><div class="lbl">Data retrieved</div><div class="val">{now.strftime('%m/%d/%Y, %I:%M:%S %p')}</div></div>
</div>
<table><thead><tr><th>Class Nbr</th><th>Course</th><th>Title</th><th>Days &amp; Times</th><th>Room</th><th>Units</th></tr></thead>
<tbody>{rows}</tbody></table>
<div class="foot">&copy; {now.year} The Pennsylvania State University. All rights reserved.<br>
LionPATH is the student information system for Penn State.</div>
</div></body></html>"""
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--first", required=True)
ap.add_argument("--last", required=True)
ap.add_argument("--out", default="schedule.png")
ap.add_argument("--html", default="", help="also dump the html")
a = ap.parse_args()
html = build_html(a.first, a.last)
if a.html:
open(a.html, "w", encoding="utf-8").write(html)
from playwright.sync_api import sync_playwright
with sync_playwright() as p:
b = p.chromium.launch(headless=True)
pg = b.new_page(viewport={"width": 1200, "height": 900})
pg.set_content(html, wait_until="load")
pg.wait_for_timeout(400)
pg.screenshot(path=a.out, type="png", full_page=True)
b.close()
print("WROTE", a.out, os.path.getsize(a.out), "bytes")
if __name__ == "__main__":
main()
+175
View File
@@ -0,0 +1,175 @@
"""Core helpers for the GitHub Education (Student Developer Pack) application flow.
Everything here was derived from a live account: the form is a React modal that
POSTs to /settings/education/developer_pack_applications. Required gates are in
the hidden fields of that form (see GATES.md).
"""
import json
import os
import time
from playwright.sync_api import sync_playwright
import pyotp
CHROME_CANDIDATES = [
r"C:\Program Files\Google\Chrome\Application\chrome.exe",
r"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe",
os.path.expandvars(r"%LOCALAPPDATA%\Google\Chrome\Application\chrome.exe"),
]
BENEFITS = "https://github.com/settings/education/benefits"
def chrome_path():
for p in CHROME_CANDIDATES:
if os.path.exists(p):
return p
raise RuntimeError("Chrome not found; install Chrome or pass executable_path")
def load_accounts(path):
"""Accepts .jsonl or .json with login/password/totp records."""
if path.endswith(".jsonl"):
rows = [json.loads(l) for l in open(path, encoding="utf-8") if l.strip()]
else:
rows = json.load(open(path, encoding="utf-8"))
return {r["login"]: r for r in rows if r.get("login")}
def launch(profile_dir, geo=None, headless=False, extra_args=None):
args = ["--disable-blink-features=AutomationControlled"]
args += extra_args or []
kw = dict(user_data_dir=profile_dir, executable_path=chrome_path(), headless=headless,
args=args, viewport={"width": 1300, "height": 950}, locale="en-US")
if geo:
kw["geolocation"] = {"latitude": geo[0], "longitude": geo[1]}
kw["permissions"] = ["geolocation"]
p = sync_playwright().start()
ctx = p.chromium.launch_persistent_context(**kw)
pg = ctx.pages[0] if ctx.pages else ctx.new_page()
return p, ctx, pg
def login(pg, acc, timeout=60000):
"""Logs in if the session is gone. Returns True when authenticated."""
pg.goto(BENEFITS, wait_until="domcontentloaded", timeout=timeout)
time.sleep(2)
if "/login" not in pg.url and not pg.query_selector("#login_field"):
return True
pg.goto("https://github.com/login", wait_until="domcontentloaded", timeout=timeout)
time.sleep(1.5)
pg.fill("#login_field", acc["login"])
pg.fill("#password", acc["password"])
pg.click("input[type=submit][name=commit]")
pg.wait_for_load_state("domcontentloaded", timeout=timeout)
time.sleep(2.5)
if "two-factor" in pg.url or pg.query_selector("#app_totp"):
secret = (acc.get("totp") or "").strip()
if not secret:
raise RuntimeError("2FA required but no totp secret for " + acc["login"])
pg.fill("#app_totp" if pg.query_selector("#app_totp") else "input[name=app_otp]",
pyotp.TOTP(secret).now())
pg.keyboard.press("Enter")
pg.wait_for_load_state("domcontentloaded", timeout=timeout)
time.sleep(2.5)
pg.goto(BENEFITS, wait_until="domcontentloaded", timeout=timeout)
time.sleep(2)
return "/login" not in pg.url
def open_application(pg):
"""Opens the 'Education Benefits Application' modal.
Raises AccountFlagged when the button is an <a href="/pricing">: GitHub hides
the application for flagged accounts and that anchor is the signature.
"""
marker = pg.evaluate("""() => {
const els = [...document.querySelectorAll('a,button')]
.filter(e => /start an application/i.test(e.innerText || ''));
if (!els.length) return {found: false};
const e = els[0];
return {found: true, tag: e.tagName, href: e.getAttribute('href'),
text: (e.innerText || '').trim()};
}""")
if not marker.get("found"):
raise RuntimeError("no 'Start an application' control (unexpected page state)")
if marker["tag"] == "A" and marker.get("href") == "/pricing":
raise AccountFlagged("button is <a href='/pricing'> - account is flagged for education")
pg.evaluate("""() => {
const e = [...document.querySelectorAll('button')]
.find(x => /start an application/i.test(x.innerText || ''));
e && e.click();
}""")
time.sleep(5)
if not pg.query_selector("dialog"):
raise RuntimeError("application modal did not open")
class AccountFlagged(RuntimeError):
pass
def set_role(pg, role="student"):
pg.check(f"input[name='dev_pack_form[application_type]'][value={role}]")
def share_location(pg):
pg.evaluate("""() => {
const b = [...document.querySelectorAll('button,a')]
.find(e => /share location/i.test(e.innerText || ''));
b && b.click();
}""")
time.sleep(3)
def select_school(pg, query, timeout=4.0):
"""School autocomplete only reacts to real keystrokes, not to value=... ."""
pg.evaluate("""() => {
const i = [...document.querySelectorAll("input[name='dev_pack_form[school_name]']")][0];
i.scrollIntoView(); i.focus(); i.value = '';
}""")
pg.keyboard.press("Control+A")
pg.keyboard.press("Backspace")
pg.keyboard.type(query, delay=60)
time.sleep(timeout)
picked = pg.evaluate("""() => {
const o = document.querySelector('[role=option]');
if (!o) return null;
const t = o.innerText; o.click(); return t;
}""")
time.sleep(2)
return picked
def dump_flags(pg):
"""Hidden fields of the application form = the real gates."""
return pg.evaluate("""() => {
const out = {};
document.querySelectorAll('dialog input[type=hidden], dialog select').forEach(e => {
if (!e.name) return;
out[e.name] = e.tagName === 'SELECT' ? [...e.options].map(o => o.value) : e.value;
});
return out;
}""")
def parse_email_domains(raw):
try:
rows = json.loads(raw or "[]")
except Exception:
return []
return [{"domain": r[0], "required": bool(r[1]) if len(r) > 1 else None,
"class": r[2] if len(r) > 2 else None, "status": r[3] if len(r) > 3 else None}
for r in rows if r]
def submit(pg):
"""Submits the form and returns the server verdict shown in the modal."""
pg.evaluate("""() => { const f = document.querySelector('dialog form'); f && f.requestSubmit(); }""")
time.sleep(10)
return pg.evaluate("""() => {
const d = [...document.querySelectorAll('dialog')].filter(x => x.open);
const err = [...document.querySelectorAll('.flash-error,.FormControl-inlineValidation,[role=alert]')]
.map(e => e.innerText.trim()).filter(Boolean).slice(0, 4);
return {dialogs: d.map(x => x.innerText.slice(0, 600)), errors: err};
}""")
+98
View File
@@ -0,0 +1,98 @@
#!/usr/bin/env python3
"""Feed a still image to Chrome as a live camera.
GitHub's education application sets dev_pack_form[camera_required]=true on every
school checked (2026-11), so there is no file upload - the document must appear
in a live camera stream. Chrome can stream a video file as a fake webcam:
--use-fake-device-for-media-stream
--use-file-for-fake-video-capture=<file.y4m>
This script converts an image (or a still-turned-video) into a looping Y4M and
optionally launches Chrome with that device already active.
python fakecam.py build --image schedule.png --out cam.y4m [--seconds 8] [--width 1280]
python fakecam.py launch --y4m cam.y4m --profile DIR [--url https://github.com/settings/education/benefits]
Needs ffmpeg: %LOCALAPPDATA%\\ms-playwright\\ffmpeg-*\\ffmpeg-win64.exe or ffmpeg on PATH.
"""
import argparse
import glob
import os
import subprocess
import sys
def find_ffmpeg():
if os.name == "nt":
base = os.path.expandvars(r"%LOCALAPPDATA%\ms-playwright")
hits = glob.glob(os.path.join(base, "ffmpeg-*", "ffmpeg-win64.exe"))
if hits:
return hits[0]
from shutil import which
return which("ffmpeg")
def build(image, out, seconds=8, width=1280, fps=15):
ff = find_ffmpeg()
if not ff:
sys.exit("ffmpeg not found")
h = int(width * 3 / 4)
cmd = [ff, "-y", "-loop", "1", "-i", image, "-t", str(seconds),
"-vf", f"scale={width}:{h}:force_original_aspect_ratio=decrease,"
f"pad={width}:{h}:(ow-iw)/2:(oh-ih)/2,format=yuv420p",
"-r", str(fps), "-f", "yuv4mpegpipe", out]
subprocess.run(cmd, check=True)
print("WROTE", out, os.path.getsize(out), "bytes")
def launch(y4m, profile, url=None, geo=None):
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import edu_lib as L
import time
extra = ["--use-fake-ui-for-media-stream",
"--use-fake-device-for-media-stream",
f"--use-file-for-fake-video-capture={os.path.abspath(y4m)}"]
p, ctx, pg = L.launch(profile, geo=geo, extra_args=extra)
try:
if url:
pg.goto(url, wait_until="domcontentloaded", timeout=60000)
print("CAM_DEVICES", pg.evaluate("""async () => {
try {
const d = await navigator.mediaDevices.enumerateDevices();
return d.filter(x => x.kind === 'videoinput').map(x => x.label || 'unnamed');
} catch (e) { return 'ERR ' + e.message; }
}"""))
print("URL", pg.url)
input("camera is live, press Enter to close …")
finally:
ctx.close()
p.stop()
def main():
ap = argparse.ArgumentParser()
sub = ap.add_subparsers(dest="cmd", required=True)
b = sub.add_parser("build")
b.add_argument("--image", required=True)
b.add_argument("--out", default="cam.y4m")
b.add_argument("--seconds", type=int, default=8)
b.add_argument("--width", type=int, default=1280)
l = sub.add_parser("launch")
l.add_argument("--y4m", required=True)
l.add_argument("--profile", required=True)
l.add_argument("--url", default="")
l.add_argument("--geo", default="")
a = ap.parse_args()
if a.cmd == "build":
build(a.image, a.out, a.seconds, a.width)
else:
geo = None
if a.geo:
lat, lon = [float(x) for x in a.geo.split(",")]
geo = (lat, lon)
launch(a.y4m, a.profile, a.url or None, geo)
if __name__ == "__main__":
main()
+72
View File
@@ -0,0 +1,72 @@
#!/usr/bin/env python3
"""Enumerate the per-school gates from the application form (no submission).
python school_probe.py --accounts accounts.jsonl --login NAME \
--schools "Pennsylvania State,Arizona State University,Southern New Hampshire"
Prints, per school: camera_required, two_factor_required, distance flag,
school id and the email-domain allow/deny table GitHub ships to the client.
"""
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)
ap.add_argument("--login", required=True)
ap.add_argument("--schools", required=True, help="comma separated queries")
ap.add_argument("--geo", default="")
ap.add_argument("--out", default="findings/school_matrix.json")
a = ap.parse_args()
accs = L.load_accounts(a.accounts)
acc = accs[a.login]
geo = None
if a.geo:
lat, lon = [float(x) for x in a.geo.split(",")]
geo = (lat, lon)
profile = 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)
rows = []
try:
if not L.login(pg, acc):
sys.exit("login failed")
L.open_application(pg)
L.set_role(pg, "student")
if geo:
L.share_location(pg)
for q in [s.strip() for s in a.schools.split(",") if s.strip()]:
try:
picked = L.select_school(pg, q)
f = L.dump_flags(pg)
rows.append({
"query": q, "picked": picked,
"school_id": f.get("dev_pack_form[selected_school_id]"),
"camera_required": f.get("dev_pack_form[camera_required]"),
"two_factor_required": f.get("dev_pack_form[two_factor_required]"),
"too_far_from_school": f.get("dev_pack_form[user_too_far_from_school]"),
"new_school": f.get("dev_pack_form[new_school]"),
"email_domains": L.parse_email_domains(f.get("dev_pack_form[email_domains]", "")),
})
print(json.dumps(rows[-1], ensure_ascii=False), flush=True)
except Exception as e:
print("ERR", q, type(e).__name__, str(e)[:80], flush=True)
os.makedirs(os.path.dirname(a.out) or ".", exist_ok=True)
json.dump(rows, open(a.out, "w", encoding="utf-8"), ensure_ascii=False, indent=1)
print("WROTE", a.out, len(rows))
finally:
ctx.close()
p.stop()
if __name__ == "__main__":
main()