@@ -53,8 +53,7 @@ def get_connections_data():
5353 offset = 0
5454 limit = 1000
5555 resp = api .search_connections (
56- connection_params = {"type" : ["SSH" ]},
57- offset = offset , limit = limit
56+ connection_params = {"type" : ["SSH" ]}, offset = offset , limit = limit
5857 )
5958 if resp .ok :
6059 data_load = resp .data
@@ -63,8 +62,7 @@ def get_connections_data():
6362 while count > 0 :
6463 offset = offset + limit
6564 resp = api .search_connections (
66- connection_params = {"type" : ["SSH" ]},
67- offset = offset , limit = limit
65+ connection_params = {"type" : ["SSH" ]}, offset = offset , limit = limit
6866 )
6967 if resp .ok :
7068 data_load = resp .data
@@ -73,7 +71,7 @@ def get_connections_data():
7371 audited_data_items = []
7472 for data in data_items :
7573 if data .get ("audit_enabled" ):
76- audited_data_items .append (data ['id' ])
74+ audited_data_items .append (data ["id" ])
7775 return audited_data_items
7876 else :
7977 error = "Get users Connection data operation failed:"
@@ -122,7 +120,7 @@ def process_connections(connections, SEARCH_STRING):
122120 for connection in connections :
123121 if "channels" in connection .get ("trail" , "" ):
124122 for channel in connection ["trail" ]["channels" ]:
125- channel_status = channel ["protocol_file" ][' status' ]
123+ channel_status = channel ["protocol_file" ][" status" ]
126124 if channel ["type" ] == "shell" and channel_status != "UNCLEAN_CLOSE" :
127125 # Get a session ID for trail download
128126 session = create_trail_session (connection ["id" ], channel ["id" ])
@@ -132,8 +130,11 @@ def process_connections(connections, SEARCH_STRING):
132130 )
133131 # Parse the trail
134132 details = (
135- "\r \n stdin conn " + connection ["id" ]
136- + " chan " + channel ["id" ] + " : "
133+ "\r \n stdin conn "
134+ + connection ["id" ]
135+ + " chan "
136+ + channel ["id" ]
137+ + " : "
137138 )
138139 print_trail (trail_log , SEARCH_STRING , details )
139140
@@ -158,13 +159,12 @@ def process_error(messages):
158159def main ():
159160 SEARCH_STRING = False
160161 CONNECTION_ID = False
161- if ( len (sys .argv ) > 5 or len (sys .argv ) == 4 or len (sys .argv ) == 1 ) :
162+ if len (sys .argv ) > 5 or len (sys .argv ) == 4 or len (sys .argv ) == 1 :
162163 usage ()
163164 sys .exit (2 )
164165 try :
165166 opts , args = getopt .getopt (
166- sys .argv [1 :], "hc:s:" ,
167- ["help" , "connection-id=" , "search-string=" ]
167+ sys .argv [1 :], "hc:s:" , ["help" , "connection-id=" , "search-string=" ]
168168 )
169169 except getopt .GetoptError :
170170 usage ()
0 commit comments