mirror of
https://github.com/calebstewart/pwncat.git
synced 2024-11-27 19:04:15 +01:00
Fixed rich progress so we can remove version lock
This commit is contained in:
parent
6179d72795
commit
d1bb4b0b72
@ -55,7 +55,6 @@ class Bind(Socket):
|
|||||||
finally:
|
finally:
|
||||||
self.server.close()
|
self.server.close()
|
||||||
|
|
||||||
progress.update(task_id, visible=False)
|
|
||||||
progress.log(
|
progress.log(
|
||||||
f"[green]received[/green] connection from [blue]{address[0]}[/blue]:[cyan]{address[1]}[/cyan]"
|
f"[green]received[/green] connection from [blue]{address[0]}[/blue]:[cyan]{address[1]}[/cyan]"
|
||||||
)
|
)
|
||||||
|
@ -14,6 +14,7 @@ from typing import Optional
|
|||||||
|
|
||||||
from rich.progress import Progress, BarColumn
|
from rich.progress import Progress, BarColumn
|
||||||
|
|
||||||
|
from pwncat.util import console
|
||||||
from pwncat.channel import Channel, ChannelError, ChannelClosed
|
from pwncat.channel import Channel, ChannelError, ChannelClosed
|
||||||
from pwncat.channel.socket import Socket
|
from pwncat.channel.socket import Socket
|
||||||
|
|
||||||
@ -36,12 +37,12 @@ class Connect(Socket):
|
|||||||
f"connecting to [blue]{host}[/blue]:[cyan]{port}[/cyan]",
|
f"connecting to [blue]{host}[/blue]:[cyan]{port}[/cyan]",
|
||||||
BarColumn(bar_width=None),
|
BarColumn(bar_width=None),
|
||||||
transient=True,
|
transient=True,
|
||||||
|
console=console,
|
||||||
) as progress:
|
) as progress:
|
||||||
task_id = progress.add_task("connecting", total=1, start=False)
|
task_id = progress.add_task("connecting", total=1, start=False)
|
||||||
# Connect to the remote host
|
# Connect to the remote host
|
||||||
client = socket.create_connection((host, port))
|
client = socket.create_connection((host, port))
|
||||||
|
|
||||||
progress.update(task_id, visible=False)
|
|
||||||
progress.log(
|
progress.log(
|
||||||
f"connection to "
|
f"connection to "
|
||||||
f"[blue]{host}[/blue]:[cyan]{port}[/cyan] [green]established[/green]"
|
f"[blue]{host}[/blue]:[cyan]{port}[/cyan] [green]established[/green]"
|
||||||
|
@ -266,15 +266,16 @@ class Session:
|
|||||||
task = self._progress.add_task(*args, **kwargs)
|
task = self._progress.add_task(*args, **kwargs)
|
||||||
yield task
|
yield task
|
||||||
finally:
|
finally:
|
||||||
if task is not None:
|
|
||||||
# Delete the task
|
|
||||||
self._progress.remove_task(task)
|
|
||||||
# If the progress wasn't started when we entered,
|
# If the progress wasn't started when we entered,
|
||||||
# ensure it is stopped before we leave. This allows
|
# ensure it is stopped before we leave. This allows
|
||||||
# nested tasks.
|
# nested tasks.
|
||||||
if not started:
|
if not started:
|
||||||
self._progress.stop()
|
self._progress.stop()
|
||||||
|
if task is not None:
|
||||||
|
self._progress.remove_task(task)
|
||||||
self._progress = None
|
self._progress = None
|
||||||
|
elif task is not None:
|
||||||
|
self._progress.remove_task(task)
|
||||||
|
|
||||||
def update_task(self, task, *args, **kwargs):
|
def update_task(self, task, *args, **kwargs):
|
||||||
"""Update an active task"""
|
"""Update an active task"""
|
||||||
|
Loading…
Reference in New Issue
Block a user