Skip to content

Commit

Permalink
fix some history management
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephTLucas committed Jan 21, 2024
1 parent b4e82d4 commit a0a2fcb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The top level menu is:

These menus contain the following functionality:
- **List modules**: Identify imported modules in target notebooks to determine what libraries are available for injected code.
- **Inject**: Execute code in the context of the selected notebook. Code can be provided in a text editor or by specifying a local `.py` file. Either input is processed as a string and executed in runtime of the notebook. Output will be transparent to other notebook users by specifying `Noisy` or `Stealthy` when prompted. This selection will also dictate how much information is returned to the user about their execution.
- **Inject**: Execute code in the context of the selected notebook. Code can be provided in a text editor or by specifying a local `.py` file. Either input is processed as a string and executed in runtime of the notebook.
- **Backdoor**: Launch a new JupyterLab instance open to `0.0.0.0`, with `allow-root` on a user-specified `port` with a user-specified `password`.
- **Check History**: See ipython commands recently run in the target notebook.
- **Run shell command**: Spawn a terminal, run the command, return the output, and delete the terminal.
Expand Down
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 = "vger"
version = "0.1.4"
version = "0.1.5"
description = "An execution framework for Jupyter environments."
authors = ["Joseph Lucas <joe@joetl.com>"]
license = "GPL-3.0-only"
Expand Down
4 changes: 2 additions & 2 deletions vger/attack.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@


async def attack_session(
connection, session, code, silent=False, print_out=True, get_hist=False
connection, session, code, silent=True, print_out=True, get_hist=False
):
jpy_sess = connection.jpy_sessions[session]
code_msg_id = str(uuid.uuid1())
code_msg = {
"channel": "shell",
"content": {"silent": silent, "code": code},
"content": {"silent": silent, "store_history": False, "code": code},
"header": {"msg_id": code_msg_id, "msg_type": "execute_request"},
"metadata": {},
"parent_header": {},
Expand Down
20 changes: 4 additions & 16 deletions vger/exploit.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ def inject(self):
attack_menu = [
inquirer.List(
name="payload",
message="Would you like to type your payload or reference an existing .py file?",
choices=["Type", ".py"],
message="Would you like to use an editor for your payload or reference an existing .py file?",
choices=["editor", ".py"],
)
]
answer = inquirer.prompt(attack_menu)
if answer["payload"] == "Type":
if answer["payload"] == "editor":
payload_str = inquirer.editor("What code would you like to inject?")
else:
payload = [
Expand All @@ -35,21 +35,9 @@ def inject(self):
path = answer["path"].split("? ")[-1]
with open(path, "r") as f:
payload_str = f.read()
silent = [
inquirer.List(
"choice",
message="Would you like show up in the history and modify the execution counter?",
choices=["Yes (Noisy)", "No (Stealthy)"],
)
]
answer = inquirer.prompt(silent)
if "Yes" in answer["choice"]:
silent = False
else:
silent = True
loop = asyncio.get_event_loop()
loop.run_until_complete(
attack_session(self.connection, self.target, payload_str, silent=silent)
attack_session(self.connection, self.target, payload_str)
)

def dump_history(self):
Expand Down

0 comments on commit a0a2fcb

Please sign in to comment.