1
- import json , math , hashlib , threading , os , subprocess , sys , requests , time , numbers , base64
1
+ import json , math , hashlib , threading , os , subprocess , sys , requests , time , numbers , base64 , binascii
2
2
from psutil import Process
3
3
from datetime import datetime , timezone
4
4
from random import randrange
@@ -484,7 +484,6 @@ def r_goto(self, command):
484
484
except :
485
485
pass
486
486
RuntimeError (self .program , f'There is no label "{ label } "' )
487
- return None
488
487
489
488
def r_gotoPC (self , command ):
490
489
return command ['goto' ]
@@ -499,12 +498,14 @@ def k_gosub(self, command):
499
498
500
499
def r_gosub (self , command ):
501
500
label = command ['gosub' ] + ':'
502
- address = self .symbols [label ]
503
- if address != None :
504
- self .stack .append (self .nextPC ())
505
- return address
506
- RuntimeError (self .program , f'There is no label "{ label + ":" } "' )
507
- return None
501
+ try :
502
+ address = self .symbols [label ]
503
+ if address != None :
504
+ self .stack .append (self .nextPC ())
505
+ return address
506
+ except :
507
+ pass
508
+ RuntimeError (self .program , f'There is no label "{ label } "' )
508
509
509
510
# if <condition> <action> [else <action>]
510
511
def k_if (self , command ):
@@ -1988,6 +1989,10 @@ def v_decode(self, v):
1988
1989
value ['type' ] = 'text'
1989
1990
if self .encoding == 'utf-8' :
1990
1991
value ['content' ] = content .decode ('utf-8' )
1992
+ elif self .encoding == 'hex' :
1993
+ b = content .encode ('utf-8' )
1994
+ mb = binascii .unhexlify (b )
1995
+ value ['content' ] = mb .decode ('utf-8' )
1991
1996
elif self .encoding == 'base64' :
1992
1997
base64_bytes = content .encode ('ascii' )
1993
1998
message_bytes = base64 .b64decode (base64_bytes )
@@ -2031,6 +2036,10 @@ def v_encode(self, v):
2031
2036
value ['type' ] = 'text'
2032
2037
if self .encoding == 'utf-8' :
2033
2038
value ['content' ] = content .encode ('utf-8' )
2039
+ elif self .encoding == 'hex' :
2040
+ b = content .encode ('utf-8' )
2041
+ mb = binascii .hexlify (b )
2042
+ value ['content' ] = mb .decode ('utf-8' )
2034
2043
elif self .encoding == 'base64' :
2035
2044
data_bytes = content .encode ('ascii' )
2036
2045
base64_bytes = base64 .b64encode (data_bytes )
0 commit comments