Browse Source

add a function

aidmar.wainakh 6 years ago
parent
commit
1396f520c9
1 changed files with 13 additions and 0 deletions
  1. 13 0
      code/ID2TLib/Statistics.py

+ 13 - 0
code/ID2TLib/Statistics.py

@@ -529,6 +529,19 @@ class Statistics:
         else:
             return None
 
+    def get_most_used_ttl(self, ipAddress: str):
+        """
+        :param ipAddress: The IP address whose used TTL should be determined
+        :return: The TTL value used by the IP address, or if the IP addresses never specified a TTL,
+        then None is returned
+        """
+        ttl_value = self.process_db_query(
+            'SELECT ttlValue from ip_ttl WHERE ipAddress="' + ipAddress + '" ORDER BY ttlCount DESC LIMIT 1')
+        if isinstance(ttl_value, int):
+            return ttl_value
+        else:
+            return None
+
 
     def get_statistics_database(self):
         """