Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump urllib3 from 2.2.1 to 2.2.2 #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docker: Output build log while building
I'm impatient.
  • Loading branch information
zhuyifei1999 authored and Feyorsh committed Jun 9, 2024
commit ee155c3be7d6f61fb16483e181d072e5ac7f96e1
25 changes: 25 additions & 0 deletions rcds/challenge/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,31 @@
from .challenge import Challenge


def monkey_patch():
from docker.models.images import ImageCollection

func = ImageCollection.build
hookname = 'uiuctf_rctf_patched_json_stream'
oldnames = func.__code__.co_names
if 'json_stream' in oldnames:
new_names = tuple(name if name != 'json_stream' else hookname
for name in oldnames)
func.__code__ = func.__code__.replace(co_names=new_names)

hooked = func.__globals__['json_stream']

def hook(*args, **kwargs):
for chunk in hooked(*args, **kwargs):
if 'stream' in chunk:
print(chunk['stream'], end='')
yield chunk

func.__globals__[hookname] = hook


monkey_patch()


def flatten(i: Iterable[Union[str, Iterable[str]]]) -> Iterable[str]:
for x in i:
if isinstance(x, collections.abc.Iterable) and not isinstance(x, str):
Expand Down