@@ -159,17 +159,20 @@ def main():
159159 # with the new nxc/config.py this can be eventually removed, as it can be imported anywhere
160160 protocol_object .config = nxc_config
161161
162- if args .module or args .list_modules :
162+ if args .module or args .list_modules is not None :
163163 loader = ModuleLoader (args , db , nxc_logger )
164164 modules = loader .list_modules ()
165165
166- if args .list_modules :
166+ if args .list_modules is not None :
167167 low_privilege_modules = {m : props for m , props in modules .items () if args .protocol in props ["supported_protocols" ] and not props ["requires_admin" ]}
168168 high_privilege_modules = {m : props for m , props in modules .items () if args .protocol in props ["supported_protocols" ] and props ["requires_admin" ]}
169169
170170 # List low privilege modules
171171 nxc_logger .highlight ("LOW PRIVILEGE MODULES" )
172172 for category , color in {CATEGORY .ENUMERATION : "green" , CATEGORY .CREDENTIAL_DUMPING : "cyan" , CATEGORY .PRIVILEGE_ESCALATION : "magenta" }.items ():
173+ # Add category filter for module listing
174+ if args .list_modules and args .list_modules .lower () != category .name .lower ():
175+ continue
173176 if len ([module for module in low_privilege_modules .values () if module ["category" ] == category ]) > 0 :
174177 nxc_logger .highlight (colored (f"{ category .name } " , color , attrs = ["bold" ]))
175178 for name , props in sorted (low_privilege_modules .items ()):
@@ -179,6 +182,9 @@ def main():
179182 # List high privilege modules
180183 nxc_logger .highlight ("\n HIGH PRIVILEGE MODULES (requires admin privs)" )
181184 for category , color in {CATEGORY .ENUMERATION : "green" , CATEGORY .CREDENTIAL_DUMPING : "cyan" , CATEGORY .PRIVILEGE_ESCALATION : "magenta" }.items ():
185+ # Add category filter for module listing
186+ if args .list_modules and args .list_modules .lower () != category .name .lower ():
187+ continue
182188 if len ([module for module in high_privilege_modules .values () if module ["category" ] == category ]) > 0 :
183189 nxc_logger .highlight (colored (f"{ category .name } " , color , attrs = ["bold" ]))
184190 for name , props in sorted (high_privilege_modules .items ()):
0 commit comments