File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -177,6 +177,16 @@ def reflect_tables(self):
177177 self .DpapiBackupkey = Table ("dpapi_backupkey" , self .metadata , autoload_with = self .db_engine )
178178 self .ConfChecksTable = Table ("conf_checks" , self .metadata , autoload_with = self .db_engine )
179179 self .ConfChecksResultsTable = Table ("conf_checks_results" , self .metadata , autoload_with = self .db_engine )
180+
181+ # Check if Database Schema is correct, due to hanging issues reported on discord introduced by https://github.com/Pennyw0rth/NetExec/pull/658
182+ from sqlalchemy .schema import UniqueConstraint
183+ ip_is_unique = False
184+ for constraint in self .HostsTable .constraints :
185+ if isinstance (constraint , UniqueConstraint ) and constraint .columns [0 ].name == "ip" :
186+ ip_is_unique = True
187+ break
188+ if not ip_is_unique :
189+ raise NoSuchTableError ("ip is not unique in hosts table" )
180190 except (NoInspectionAvailable , NoSuchTableError ):
181191 print (
182192 f"""
You can’t perform that action at this time.
0 commit comments