Files
stealthii/scripts/smoke_live.py
T

61 lines
1.9 KiB
Python
Raw Normal View History

2026-09-09 13:49:07 +02:00
# retoor <retoor@molodetz.nl>
import asyncio
from stealthii import Stealthii
async def main():
s = Stealthii()
print('=== get (json) ===')
resp = await s.get('https://httpbin.org/get', params={'a': '1'})
print(resp.status, (await resp.json()).get('args'))
print('=== post (json body) ===')
resp = await s.post('https://httpbin.org/post', json={'hello': 'world'})
data = await resp.json()
print(resp.status, data.get('json'))
print('=== post (form data) ===')
resp = await s.post('https://httpbin.org/post', data={'x': '1', 'y': '2'})
data = await resp.json()
print(resp.status, data.get('form'))
print('=== cookies per-call ===')
resp = await s.get('https://httpbin.org/cookies', cookies={'flavor': 'choc'})
print(resp.status, await resp.json())
print('=== auth ===')
resp = await s.get('https://httpbin.org/basic-auth/user/pass', auth=('user', 'pass'))
print(resp.status, await resp.json())
print('=== download (binary) ===')
png = await s.download('https://httpbin.org/image/png')
print('bytes:', len(png), png[:8])
print('=== render ===')
r = await s.render('https://example.com', collect_links=True)
print(r['status'], r['text'][:60], len(r['links']))
print('=== screenshot (base64) ===')
b64 = await s.screenshot('https://example.com')
print('b64 len:', len(b64))
print('=== screenshot (path) ===')
path = await s.screenshot('https://example.com', path='/tmp/stealthii_shot.png')
print('saved to', path)
print('=== session warm-up (cookie persistence) ===')
await s.get('https://httpbin.org/cookies/set/persisted/yes', session='warm', allow_redirects=True)
resp = await s.get('https://httpbin.org/cookies', session='warm')
print(await resp.json())
print('=== fingerprint_info (ja4 default) ===')
print(await s.fingerprint_info())
await s.shutdown()
print('OK - all smoke checks completed')
asyncio.run(main())