Mercurial > p > roundup > code
view scripts/dump_dbm_sessions_db.py @ 6681:ab2ed11c021e
issue2551205: Add support for specifying valid origins for api: xmlrpc/rest
We now have an allow list to filter the hosts allowed to do api
requests. An element of this allow list must match the http ORIGIN
header exactly or the rest/xmlrpc CORS request will result in an
error.
The tracker host is always allowed to do a request.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Tue, 17 May 2022 17:18:51 -0400 |
| parents | 61481d7bbb07 |
| children | 1188bb423f92 |
line wrap: on
line source
#! /usr/bin/env python3 """Usage: dump_dbm_sessions_db.py [filename] Simple script to dump the otks and sessions dbm databases. Dumps sessions db in current directory if no argument is given. Dump format: key: <timestamp> data where <timestamp> is the human readable __timestamp decoded from the data object. """ import dbm, marshal, sys from datetime import datetime try: file = sys.argv[1] except IndexError: file="sessions" try: db = dbm.open(file) except Exception: print("Unable to open database: %s"%file) exit(1) k = db.firstkey() while k is not None: d = marshal.loads(db[k]) t = datetime.fromtimestamp(d['__timestamp']) print("%s: %s %s"%(k, t, d)) k = db.nextkey(k)
