Skip to content

Commit 7eae141

Browse files
committed
Improvements for having remote OS after authentication
1 parent 92e4103 commit 7eae141

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

OracleDatabase.py

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,15 +353,41 @@ def getDatabasePlatfromName(self):
353353
It is possible the current user has not privileges on table v$database.
354354
Return "" if an error
355355
"""
356+
platformName = ""
356357
REQ = "SELECT platform_name FROM v$database"
358+
REQ2 = "select dbms_utility.port_string from dual"
357359
response = self.__execQuery__(query=REQ, ld=['platform_name'])
358360
if isinstance(response,Exception):
359-
return ""
361+
logging.debug("Impossible to get remote platform name with v$database")
362+
return self.getDatabasePlatfromNameWithPortString()
360363
else:
361364
if len(response)>0 and isinstance(response[0],dict):
362-
return response[0]['platform_name']
365+
platformName = response[0]['platform_name']
366+
logging.debug("Remote platform name: {0}".format(platformName))
367+
return platformName
363368
else:
364-
return ""
369+
logging.debug("Impossible to get remote platform name with v$database")
370+
return platformName
371+
372+
def getDatabasePlatfromNameWithPortString(self):
373+
"""
374+
Return platform_name string from port_string.
375+
Return "" if an error
376+
"""
377+
platformName = ""
378+
REQ = "select dbms_utility.port_string from dual"
379+
response = self.__execQuery__(query=REQ, ld=['platform_name'])
380+
if isinstance(response,Exception):
381+
logging.debug("Impossible to get remote platform name with port_string")
382+
return platformName
383+
else:
384+
if len(response)>0 and isinstance(response[0],dict):
385+
platformName = response[0]['platform_name']
386+
logging.debug("Remote platform name: {0}".format(platformName))
387+
return platformName
388+
else:
389+
logging.debug("Impossible to get remote platform name with port_string")
390+
return platformName
365391

366392
def getOSFromPortString(self):
367393
"""
@@ -420,7 +446,7 @@ def remoteSystemIsWindows(self):
420446
self.loadInformationRemoteDatabase()
421447
if self.remoteOS == "":
422448
logging.warning("Impossible to known the remote target OS")
423-
if "windows" in self.remoteOS.lower() : return True
449+
if "windows" in self.remoteOS.lower() or "win_nt" in self.remoteOS.lower(): return True
424450
else : return False
425451

426452
def remoteSystemIsLinux(self):

0 commit comments

Comments
 (0)