Giter Club home page Giter Club logo

Comments (3)

MegaManSec avatar MegaManSec commented on May 29, 2024

There's a fundamental issue with doing this: if a host does not have bash installed or some error is encountered, it's going to print the IP address of the host because that's all the calling host knows (A->B, if B fails for some reason, A will print the ip address used to connect to B) -- see all of the "exceptional" errors here: https://github.com/MegaManSec/SSH-Snake/blob/main/OUTPUT.md

However, if you do really want to do this, you can either:

  1. Change https://github.com/MegaManSec/SSH-Snake/blob/main/Snake.sh#L732 to hostnames_chain="$hostnames_chain${hostnames_chain:+->}$user@("$(hostname"))"
  2. Use custom_cmds to print the values.custom_cmds=('echo "$hostnames_chain${hostnames_chain:+->}$user@("$(hostname)")"') may work (untested, but if it does work, please let me know). You'd then have to filter out these values from the output and run the python script with just those values.

from ssh-snake.

MegaManSec avatar MegaManSec commented on May 29, 2024

custom_cmds=('echo "$hostnames_chain${hostnames_chain:+->}$user@("$(hostname)")"') works, but then you need to modify the python script:

diff --git a/tools/generate-graph.py b/tools/generate-graph.py
index 48d4480..c969ff5 100755
--- a/tools/generate-graph.py
+++ b/tools/generate-graph.py
@@ -19,10 +19,10 @@ def build_lookup_table(input_lines, ignore_dest_user, dot):
         line = line.strip()
         line = re.sub(r"^\[?\d+\]?\s*", "", line)
 
-        if ": " in line or "]->" not in line or not line[-2].isdigit() or not line[-1] == ')':
+        if ": " in line or "]->" not in line or not line[-1] == ')':
             continue
 
-        pattern = re.compile(r"(\w+)@\(([\d\.:]+)\)(\[[^\]]+\])->(?=(\w+)@\(([\d\.:]+)\))")
+        pattern = re.compile(r"(\w+)@\(([a-zA-Z0-9_-]+)\)(\[[^\]]+\])->(?=(\w+)@\(([a-zA-Z0-9_-]+)\))")
         matches = re.finditer(pattern, line)
         previous_dest_host = None

from ssh-snake.

MegaManSec avatar MegaManSec commented on May 29, 2024

Closing since I think this is answered.

from ssh-snake.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.