Skip to content

Commit

Permalink
Fix error while writing command to shell on windows 10 (#24)
Browse files Browse the repository at this point in the history
- Parse response to int only if the response is digit and not a random
string
  • Loading branch information
SadParad1se authored Jun 28, 2024
1 parent e1ea0f9 commit 726f013
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
22 changes: 11 additions & 11 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "snek-sploit"
version = "0.8.1"
version = "0.8.2"
description = "Python RPC client for Metasploit Framework"
authors = [
"Jiří Rája <[email protected]>"
Expand Down
4 changes: 2 additions & 2 deletions snek_sploit/lib/rpc/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def shell_write(self, session_id: int, data: str) -> int:

response = self._context.call(self.SHELL_WRITE, [session_id, data])

return int(response[constants.B_WRITE_COUNT])
return int(response[constants.B_WRITE_COUNT]) if response.isdigit() else -1

def shell_upgrade(self, session_id: int, local_host: str, local_port: int) -> bool:
"""
Expand Down Expand Up @@ -379,7 +379,7 @@ def ring_put(self, session_id: int, data: str) -> int:
"""
response = self._context.call(self.RING_PUT, [session_id, data])

return int(response[constants.B_WRITE_COUNT])
return int(response[constants.B_WRITE_COUNT]) if response.isdigit() else -1

def ring_last(self, session_id: int) -> int:
"""
Expand Down

0 comments on commit 726f013

Please sign in to comment.