@@ -33,38 +33,42 @@ def get_popup_message(is_local, node, app_name, con):
33
33
"""
34
34
app_name = truncate_text (app_name )
35
35
36
- message = "<b>%s </b>" % app_name
36
+ message = "<b>{0} </b>" . format ( app_name )
37
37
if not is_local :
38
- message = QC .translate ("popups" , "<b>Remote</b> process %s running on <b>%s </b>" ) % ( \
38
+ message = QC .translate ("popups" , "<b>Remote</b> process {0} running on <b>{1} </b>" . format (
39
39
message ,
40
40
node .split (':' )[1 ])
41
+ )
41
42
42
- msg_action = QC .translate ("popups" , "is connecting to <b>%s </b> on %s port %d" ) % ( \
43
+ msg_action = QC .translate ("popups" , "is connecting to <b>{0} </b> on {1} port {2}" . format (
43
44
con .dst_host or con .dst_ip ,
44
45
con .protocol .upper (),
45
46
con .dst_port )
47
+ )
46
48
47
49
# icmp port is 0 (i.e.: no port)
48
50
if con .dst_port == 0 :
49
- msg_action = QC .translate ("popups" , "is connecting to <b>%s </b>, %s" ) % ( \
51
+ msg_action = QC .translate ("popups" , "is connecting to <b>{0} </b>, {1}" . format (
50
52
con .dst_host or con .dst_ip ,
51
53
con .protocol .upper () )
54
+ )
52
55
53
56
if con .dst_port == 53 and con .dst_ip != con .dst_host and con .dst_host != "" :
54
- msg_action = QC .translate ("popups" , "is attempting to resolve <b>%s </b> via %s, %s port %d" ) % ( \
57
+ msg_action = QC .translate ("popups" , "is attempting to resolve <b>{0} </b> via {1}, {2} port {3}" . format (
55
58
con .dst_host ,
56
59
con .dst_ip ,
57
60
con .protocol .upper (),
58
61
con .dst_port )
62
+ )
59
63
60
- return "%s %s" % (message , msg_action )
64
+ return "{0} {1}" . format (message , msg_action )
61
65
62
66
def set_app_path (appPathLabel , app_name , app_args , con ):
63
67
# show the binary path if it's not part of the cmdline args:
64
68
# cmdline: telnet 1.1.1.1 (path: /usr/bin/telnet.netkit)
65
69
# cmdline: /usr/bin/telnet.netkit 1.1.1.1 (the binary path is part of the cmdline args, no need to display it)
66
70
if con .process_path != "" and len (con .process_args ) >= 1 and con .process_path not in con .process_args :
67
- appPathLabel .setToolTip ("Process path: %s" % con .process_path )
71
+ appPathLabel .setToolTip ("Process path: {0}" . format ( con .process_path ) )
68
72
if app_name .lower () == app_args :
69
73
set_elide_text (appPathLabel , "%s" % con .process_path )
70
74
else :
@@ -172,10 +176,10 @@ def get_combo_operator(data, comboText, con):
172
176
return Config .RULE_TYPE_SIMPLE , Config .OPERAND_PROCESS_ID , "{0}" .format (con .process_id )
173
177
174
178
elif data == _constants .FIELD_USER_ID :
175
- return Config .RULE_TYPE_SIMPLE , Config .OPERAND_USER_ID , "%s" % con .user_id
179
+ return Config .RULE_TYPE_SIMPLE , Config .OPERAND_USER_ID , "{0}" . format ( con .user_id )
176
180
177
181
elif data == _constants .FIELD_DST_PORT :
178
- return Config .RULE_TYPE_SIMPLE , Config .OPERAND_DEST_PORT , "%s" % con .dst_port
182
+ return Config .RULE_TYPE_SIMPLE , Config .OPERAND_DEST_PORT , "{0}" . format ( con .dst_port )
179
183
180
184
elif data == _constants .FIELD_DST_IP :
181
185
return Config .RULE_TYPE_SIMPLE , Config .OPERAND_DEST_IP , con .dst_ip
0 commit comments