@@ -29,13 +29,13 @@ def display_details(routerdata):
2929 stackprofile = stackprofilever & 0x0f
3030 stackver = (stackprofilever & 0xf0 ) >> 4
3131
32- print ("New Network: PANID 0x{0:02X}{1:02X} Source 0x{2:02X}{3:02X}" .format (ord ( spanid [0 ]), ord ( spanid [1 ]), ord ( source [0 ]), ord ( source [1 ]) ))
32+ print ("New Network: PANID 0x{0:02X}{1:02X} Source 0x{2:02X}{3:02X}" .format (spanid [0 ], spanid [1 ], source [0 ], source [1 ]))
3333
3434 try :
3535 extpanidstr = ""
3636 for ind in range (0 ,7 ):
37- extpanidstr += "%02x:" % ord ( extpanid [ind ])
38- extpanidstr += "%02X" % ord ( extpanid [- 1 ])
37+ extpanidstr += "%02x:" % extpanid [ind ]
38+ extpanidstr += "%02X" % extpanid [- 1 ]
3939 sys .stdout .write ("\t Ext PANID: " + extpanidstr )
4040 except IndexError :
4141 sys .stdout .write ("\t Ext PANID: Unknown" )
@@ -57,7 +57,7 @@ def display_details(routerdata):
5757 print (("\t Channel: {0}" .format (channel )))
5858
5959 if args .csvfile is not None :
60- csvfile .write ("0x%02X%02X,0x%02X%02X,%s,%s,%s,%d\n " % (ord ( spanid [0 ]), ord ( spanid [1 ]), ord ( source [0 ]), ord ( source [1 ]) , extpanidstr , stackprofilestr , stackverstr , channel ))
60+ csvfile .write ("0x%02X%02X,0x%02X%02X,%s,%s,%s,%d\n " % (spanid [0 ], spanid [1 ], source [0 ], source [1 ], extpanidstr , stackprofilestr , stackverstr , channel ))
6161
6262
6363def response_handler (stumbled , packet , channel ):
@@ -99,7 +99,7 @@ def response_handler(stumbled, packet, channel):
9999 return value
100100
101101 if args .verbose :
102- print (( "Received frame is not a beacon (FCF={0})." .format (pktdecode [0 ]. encode ( 'utf-8' ). hex ()) ))
102+ print ("Received frame is not a beacon (FCF={0})." .format (pktdecode [0 ]))
103103
104104 return None
105105
@@ -137,7 +137,7 @@ if __name__ == '__main__':
137137 csvfile .write ("panid,source,extpanid,stackprofile,stackversion,channel\n " )
138138
139139 # Beacon frame
140- beacon = "\x03 \x08 \x00 \xff \xff \xff \xff \x07 "
140+ beacon = b "\x03 \x08 \x00 \xff \xff \xff \xff \x07 "
141141 # Immutable strings - split beacon around sequence number field
142142 beaconp1 = beacon [0 :2 ]
143143 beaconp2 = beacon [3 :]
@@ -179,7 +179,7 @@ if __name__ == '__main__':
179179 if args .verbose :
180180 print ("Transmitting beacon request." )
181181
182- beaconinj = '' .join ([beaconp1 , "%c" % seqnum , beaconp2 ])
182+ beaconinj = b '' .join ([beaconp1 , b "%c" % seqnum , beaconp2 ])
183183
184184 # Process packets for arg_delay seconds looking for the beacon
185185 # response frame.
0 commit comments