1
0
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:
Caleb Stewart 2021-06-02 18:56:39 -04:00
parent 6179d72795
commit d1bb4b0b72
4 changed files with 7 additions and 6 deletions

View File

@ -55,7 +55,6 @@ class Bind(Socket):
finally:
self.server.close()
progress.update(task_id, visible=False)
progress.log(
f"[green]received[/green] connection from [blue]{address[0]}[/blue]:[cyan]{address[1]}[/cyan]"
)

View File

@ -14,6 +14,7 @@ from typing import Optional
from rich.progress import Progress, BarColumn
from pwncat.util import console
from pwncat.channel import Channel, ChannelError, ChannelClosed
from pwncat.channel.socket import Socket
@ -36,12 +37,12 @@ class Connect(Socket):
f"connecting to [blue]{host}[/blue]:[cyan]{port}[/cyan]",
BarColumn(bar_width=None),
transient=True,
console=console,
) as progress:
task_id = progress.add_task("connecting", total=1, start=False)
# Connect to the remote host
client = socket.create_connection((host, port))
progress.update(task_id, visible=False)
progress.log(
f"connection to "
f"[blue]{host}[/blue]:[cyan]{port}[/cyan] [green]established[/green]"

View File

@ -266,15 +266,16 @@ class Session:
task = self._progress.add_task(*args, **kwargs)
yield task
finally:
if task is not None:
# Delete the task
self._progress.remove_task(task)
# If the progress wasn't started when we entered,
# ensure it is stopped before we leave. This allows
# nested tasks.
if not started:
self._progress.stop()
if task is not None:
self._progress.remove_task(task)
self._progress = None
elif task is not None:
self._progress.remove_task(task)
def update_task(self, task, *args, **kwargs):
"""Update an active task"""

View File

@ -12,7 +12,7 @@ dependencies = [
"prompt-toolkit",
"pycryptodome",
"requests",
"rich==9.10.0",
"rich",
"python-rapidjson",
"ZODB",
"zodburi",