Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception with ssh - AttributeError: 'ssh' object has no attribute 'modules' #443

Closed
dev-fortress opened this issue Oct 11, 2024 · 6 comments · Fixed by #447
Closed

Exception with ssh - AttributeError: 'ssh' object has no attribute 'modules' #443

dev-fortress opened this issue Oct 11, 2024 · 6 comments · Fixed by #447

Comments

@dev-fortress
Copy link

Describe the bug
Exception triggered while connected to an ssh server using a custom.

To Reproduce
Steps to reproduce the behavior i.e.:
Command: nxc ssh 172.26.16.11 -u username -p password -M NewCustomModule
Resulted in:

[22:36:05] ERROR    Exception while calling proto_flow() on target 172.26.16.11: 'ssh' object has no attribute 'modules'                   connection.py:174
                    ╭───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────╮                  
                    │ /usr/lib/python3/dist-packages/nxc/connection.py:166 in __init__                                                    │                  
                    │                                                                                                                     │                  
                    │   163 │   │   self.logger.info(f"Socket info: host={self.host}, hostname={self.hostname},                           │                  
                    │       kerberos={self.kerberos}, ipv6={self.is_ipv6}, link-local                                                     │                  
                    │       ipv6={self.is_link_local_ipv6}")                                                                              │                  
                    │   164 │   │                                                                                                         │                  
                    │   165 │   │   try:                                                                                                  │                  
                    │ ❱ 166 │   │   │   self.proto_flow()                                                                                 │                  
                    │   167 │   │   except Exception as e:                                                                                │                  
                    │   168 │   │   │   if "ERROR_DEPENDENT_SERVICES_RUNNING" in str(e):                                                  │                  
                    │   169 │   │   │   │   self.logger.error(f"Exception while calling proto_flow() on target                            │                  
                    │       {target}: {e}")                                                                                               │                  
                    │                                                                                                                     │                  
                    │ /usr/lib/python3/dist-packages/nxc/protocols/ssh.py:36 in proto_flow                                                │                  
                    │                                                                                                                     │                  
                    │    33 │   │   │   │   return                                                                                        │                  
                    │    34 │   │   │   if self.login():                                                                                  │                  
                    │    35 │   │   │   │   if hasattr(self.args, "module") and self.args.module:                                         │                  
                    │ ❱  36 │   │   │   │   │   self.call_modules()                                                                       │                  
                    │    37 │   │   │   │   else:                                                                                         │                  
                    │    38 │   │   │   │   │   self.call_cmd_args()                                                                      │                  
                    │    39 │   │   │   │   self.conn.close()                                                                             │                  
                    │                                                                                                                     │                  
                    │ /usr/lib/python3/dist-packages/nxc/connection.py:265 in call_modules                                                │                  
                    │                                                                                                                     │                  
                    │   262 │   │   It iterates over the modules specified in the command line arguments.                                 │                  
                    │   263 │   │   For each module, it loads the module and creates a context object, then calls                         │                  
                    │       functions based on the module's attributes.                                                                   │                  
                    │   264 │   │   """                                                                                                   │                  
                    │ ❱ 265 │   │   for module in self.modules:                                                                           │                  
                    │   266 │   │   │   self.logger.debug(f"Loading module {module.name} - {module}")                                     │                  
                    │   267 │   │   │   module_logger = NXCAdapter(                                                                       │                  
                    │   268 │   │   │   │   extra={                                                                                       │                  
                    ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                  
                    AttributeError: 'ssh' object has no attribute 'modules'

Expected behavior
Execute the instructions inside of "NewCustomModule"

NetExec info

  • OS: Kali Linux
  • Version of nxc: 1.2.0
  • Codename: ItsAlwaysDNS
  • Commit : Kali Linux
  • Installed from: apt install netexec
@Adamkadaban
Copy link
Contributor

@dev-fortress I can't seem to recreate this on Kali through apt or otherwise.
Can you try to see if the same thing happens if you run through pipx or poetry? I have a feeling this might be a dependency conflict thing somehow

@dev-fortress
Copy link
Author

Hi @Adamkadaban Same error when installing NetExec with pip
image

@NeffIsBack
Copy link
Contributor

When you created the new module, did you set the protocol parameter of the module to ssh?

@dev-fortress
Copy link
Author

Hi @NeffIsBack , yes I do

image

Some things are comments because I'm trying to figure out if it's something i did wrong or something else

@NeffIsBack
Copy link
Contributor

Ok👍have to test it myself later

@NeffIsBack
Copy link
Contributor

Fixed in #447

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants