Skip to content

captured messages retrieval should allow onion addresses or peers that are not known tanks #761

@pinheadmz

Description

@pinheadmz

"warnet bitcoin messages tank_a tank_b" expects both tank_a and tank_b to be names of tanks, warnet figures out their IP addresses and then finds the directory in messge_captrue that matches. However, when using Tor there may be messages captured from onion peers, and warnet does not know how to find them. As a one-off I wrote a brutal patch just so I could execute this:

warnet bitcoin messages tank-0001 x76xhrwp6urgosotdfwx37v2qeeklyf32gllgzevj6kevpzfift4lnid.onion_18444

diff --git a/src/warnet/bitcoin.py b/src/warnet/bitcoin.py
index 5b392e22..c58a4949 100644
--- a/src/warnet/bitcoin.py
+++ b/src/warnet/bitcoin.py
@@ -178,20 +178,20 @@ def messages(tank_a: str, tank_b: str, chain: str):
         sys.exit(1)
 
     tank_a, namespace_a = parse_name_and_namespace(tank_a)
-    tank_b, namespace_b = parse_name_and_namespace(tank_b)
+    # tank_b, namespace_b = parse_name_and_namespace(tank_b)
 
     try:
         namespace_a = get_default_namespace_or(namespace_a)
-        namespace_b = get_default_namespace_or(namespace_b)
+        # namespace_b = get_default_namespace_or(namespace_b)
 
         # Get the messages
         messages = get_messages(
-            tank_a, tank_b, chain, namespace_a=namespace_a, namespace_b=namespace_b
+            tank_a, tank_b, chain, namespace_a=namespace_a, namespace_b="default"
         )
 
         if not messages:
             print(
-                f"No messages found between {tank_a} ({namespace_a}) and {tank_b} ({namespace_b})"
+                f"No messages found between {tank_a} ({namespace_a}) and {tank_b} ({'default'})"
             )
             return
 
@@ -225,14 +225,14 @@ def get_messages(tank_a: str, tank_b: str, chain: str, namespace_a: str, namespa
     base_dir = f"/root/.bitcoin/{subdir}message_capture"
 
     # Get the IP of node_b
-    cmd = f"kubectl get pod {tank_b} -o jsonpath='{{.status.podIP}}' --namespace {namespace_b}"
-    tank_b_ip = run_command(cmd).strip()
+    # cmd = f"kubectl get pod {tank_b} -o jsonpath='{{.status.podIP}}' --namespace {namespace_b}"
+    tank_b_ip = tank_b
 
     # Get the service IP of node_b
-    cmd = (
-        f"kubectl get service {tank_b} -o jsonpath='{{.spec.clusterIP}}' --namespace {namespace_b}"
-    )
-    tank_b_service_ip = run_command(cmd).strip()
+    # cmd = (
+    #     f"kubectl get service {tank_b} -o jsonpath='{{.spec.clusterIP}}' --namespace {namespace_b}"
+    # )
+    tank_b_service_ip = tank_b
 
     # List directories in the message capture folder
     cmd = f"kubectl exec {tank_a} --namespace {namespace_a} -- ls {base_dir}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions