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

DceRpc fix register_dcerpc_interface duplication #4672

Merged
merged 1 commit into from
Feb 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 12 additions & 16 deletions scapy/layers/dcerpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1205,15 +1205,9 @@ def register_dcerpc_interface(name, uuid, version, opnums):
# Interface is already registered.
interface = DCE_RPC_INTERFACES[(uuid, if_version)]
if interface.name == name:
if interface.if_version == if_version and set(opnums) - set(
interface.opnums
):
if set(opnums) - set(interface.opnums):
# Interface is an extension of a previous interface
interface.opnums.update(opnums)
return
elif interface.if_version != if_version:
# Interface has a different version
pass
else:
log_runtime.warning(
"This interface is already registered: %s. Skip" % interface
Expand All @@ -1223,15 +1217,17 @@ def register_dcerpc_interface(name, uuid, version, opnums):
raise ValueError(
"An interface with the same UUID is already registered: %s" % interface
)
DCE_RPC_INTERFACES_NAMES[uuid] = name
DCE_RPC_INTERFACES_NAMES_rev[name.lower()] = uuid
DCE_RPC_INTERFACES[(uuid, if_version)] = DceRpcInterface(
name,
uuid,
version_tuple,
if_version,
opnums,
)
else:
# New interface
DCE_RPC_INTERFACES_NAMES[uuid] = name
DCE_RPC_INTERFACES_NAMES_rev[name.lower()] = uuid
DCE_RPC_INTERFACES[(uuid, if_version)] = DceRpcInterface(
name,
uuid,
version_tuple,
if_version,
opnums,
)
# bind for build
for opnum, operations in opnums.items():
bind_top_down(DceRpc5Request, operations.request, opnum=opnum)
Expand Down
Loading