AttributeError: ‘Ntlmrelayxconfig’ Object Has No Attribute ‘SetAddComputerSMB’ | Fix That Works

This ntlmrelayx error means your Impacket script and library don’t match; install matching versions or reinstall cleanly to restore setAddComputerSMB.

Scope & safety: Use these steps only in labs or with written authorization. NTLM relaying is offensive tooling and must be used ethically. See Impacket’s official repo for context on the tool and options.

Overview Of The Error And What It Means

Quick context: When you run ntlmrelayx.py (or impacket-ntlmrelayx), the script builds a configuration object named NTLMRelayxConfig. Newer script revisions call a method named setAddComputerSMB() during startup. If your local NTLMRelayxConfig class doesn’t include that method, Python throws the AttributeError you’re seeing. Multiple users report this exact traceback when the script and library come from different releases.

Why this happens: you likely have a mixed install (partly from your OS package manager and partly from pip/pipx), or script files from one version are paired with a different Impacket library on your PYTHONPATH. A common tell is paths like /usr/share/doc/python3-impacket/examples/ntlmrelayx.py calling methods that don’t exist in the NTLMRelayxConfig class that your interpreter actually imports.

Quick Fix Summary

  • Pick One Install Path — Use either your distro package (e.g., Kali’s impacket-scripts) or a clean pip install from the GitHub source. Don’t mix both.
  • Remove Conflicts — Purge any old OS packages or pipx copies that shadow each other. Then reinstall one way.
  • Confirm The Method Exists — Open the current ntlmrelayx.py on GitHub and note the c.setAddComputerSMB(...) call; your local library must match that interface.
  • Re-run With Matching Binaries — After cleanup, your error should vanish and the tool will load all protocol clients and attacks again.

Why You See AttributeError: ‘Ntlmrelayxconfig’ Object Has No Attribute ‘SetAddComputerSMB’

Mismatched versions: The ntlmrelayx.py in one package revision expects setAddComputerSMB(), but the installed Impacket library was built before that method existed. Users hit this when they upgrade only the script (or only the library).

Mixed install sources: OS packages (e.g., Debian/Kali python3-impacket) and pip wheels can both be present. Python then imports classes from one path while executing a different script path, creating interface drift. A public post shows this exact error after breaking system packages by mixing /usr/local and distro files.

Stale Windows copies: On Windows, local clones of examples with older libraries are a common cause, producing the same setAddComputerSMB missing method.

Step-By-Step Fixes

Clean Up Conflicting Installs

  • Find The Script In Use — Run which impacket-ntlmrelayx or on Windows check where you’re calling ntlmrelayx.py. If it points into /usr/share/doc, you’re likely using a distro copy.
  • Show The Library Path — Run python3 -c "import impacket,inspect;print(impacket.__version__,inspect.getfile(impacket))". If the path and version don’t align with the script source, you’ve found the mismatch.
  • Remove Shadowed Packages — If you installed with your package manager and pip/pipx, remove one. The Impacket issue tracker calls out version drift as a root cause.

Option A — Use Your Distro’s Matching Packages (Kali/Debian)

  • Purge Old Bitssudo apt purge python3-impacket impacket-scripts then sudo apt autoremove.
  • Reinstall Cleansudo apt update && sudo apt install impacket-scripts. This package places the example scripts on your path to match the packaged library.
  • Verify — Run impacket-ntlmrelayx -h. Load messages should list all protocol clients without the AttributeError.

Option B — Install From GitHub Source (One True Copy)

  • Uninstall Conflictspython3 -m pip uninstall -y impacket and remove any pipx environment that holds Impacket.
  • Install From Sourcegit clone https://github.com/fortra/impacket, then cd impacket && python3 -m pip install . This ensures the examples and the library come from the same commit.
  • Confirm The Interface — Open the freshly installed examples/ntlmrelayx.py and see c.setAddComputerSMB(options.add_computer) in start_servers(); the matching NTLMRelayxConfig now exposes that method.

Option C — Align A Local Clone On Windows

  • Pin A Single Source — Keep both the examples folder and the library installed from the same cloned repo. Don’t pair an old pip wheel with a new example script.
  • Reinstall — From the clone root, run py -3 -m pip install .. If you vendor scripts elsewhere, update those copies too. Users who did this stopped seeing the AttributeError.

Verification Steps

Sanity check: Run a harmless command-only flow against a test target to verify initialization works:

python3 -m impacket.examples.ntlmrelayx -t smb://127.0.0.1 -c "whoami" -smb2support -debug

If servers start and protocol clients load without an immediate traceback, your interface alignment is fixed. The official example shows these clients (SMB/HTTP/LDAP/…); that banner confirms a healthy startup.

Common Pitfalls To Avoid

  • Mixing Package Sources — Don’t keep both /usr/local and distro copies. One blog shows this exact path clash leading to the same AttributeError. Clean one side.
  • Stale Shell PATH — If which impacket-ntlmrelayx still points to an old path, refresh your shell or remove stale symlinks left by prior installs.
  • Random File Copies — Don’t copy ntlmrelayx.py out of its repo and leave the library untouched. The script evolves; the class interface must evolve with it. The master file shows current calls, including setAddComputerSMB.

When The Error Persists

Print the imports: Add this at the top of ntlmrelayx.py during testing:

import impacket, inspect
print("Using impacket:", impacket.__version__, inspect.getfile(impacket))
from impacket.examples.ntlmrelayx.utils import config
print("Using config.py:", inspect.getfile(config))

If the library path doesn’t live under the same tree as your script, fix your install layout. The Impacket issue tracker has multiple threads where aligning versions resolved the error.

NTLM Relaying Context And Safer Defaults

Know what the tool does: ntlmrelayx.py spins up servers and relays incoming NTLM authentication to target protocols like SMB or LDAP. Many public write-ups walk through lab usage and defenses; reading them helps you set safe test targets and understand expected logs.

  • Use In A Lab — Practice against a controlled AD environment only.
  • Review Attack Options — Flags like --add-computer, --delegate-access, --dump-laps, and ADCS features change fast; always check the current help output.

Mini Troubleshooting Table

Symptom Likely Cause Fix
AttributeError on setAddComputerSMB at startup Script & library versions don’t match Remove conflicts; install from one source; confirm method exists in current repo
Help prints but attack flags behave oddly Old helper scripts with new library or vice versa Reinstall from the same commit; avoid manual file copies
Imports point to mixed paths /usr/local vs. distro site-packages clash Purge one side; follow Kali’s impacket-scripts package or pure pip install

Use The Exact Error Text Inside Your Notes

For tracking and search, paste the error in lowercase once in your runbook: attributeerror: 'ntlmrelayxconfig' object has no attribute 'setaddcomputersmb'. That string helps you find the right fix threads fast.

Close Variation Keyword Used Naturally

Quick check: If you’re fixing taking an ntlmrelayx add computer over smb error on a fresh Kali box, prefer the distro’s matched scripts first. If you build from source, keep everything from one commit to avoid this attribute mismatch again.