Skip to content

Instantly share code, notes, and snippets.

@mcnemesis
Created February 17, 2025 19:25
Show Gist options
  • Save mcnemesis/3ad5345cb0ed8aa39193f777878545ab to your computer and use it in GitHub Desktop.
Save mcnemesis/3ad5345cb0ed8aa39193f777878545ab to your computer and use it in GitHub Desktop.
A TEA DEBUGGER trace dump of running box_text_wprompt_stats-injection.tea
Reading CODE from: box_text_wprompt_stats-injection.tea
INPUT:
Hello World
CODE:
#!/usr/bin/tttt -fc
# ----------------------
# This version also displays some statistics:
# how many characters were found in the
# user provided text as "N CHARS"
# ----------------------
f!:^$:lNOPROMPT:lPROMPT
l:lPROMPT
i!:Enter some text: |i:
l:lNOPROMPT
v:vIN
r*!:vIN:.:-
x:--|x!:--
v:vBTOP
v:vSTART:
v:vBLR:{|}
g*:{ }:vBLR:vIN:vBLR
v:vIN
# draw the text in box
g*:{_ }:vSTART:vBTOP:vIN:vBTOP
# draw the box with stats
v:vTXTBOX
v!:"ABCDEFG" #test hypothesis: inject dummy of 7 CHARS
x!:{ CHARS}
v:vIN_STATS
g*:{_ }:vIN_STATS:vBTOP
v:vIN_STATS_BOX
# draw both..
g*:{_ }:vTXTBOX:vIN_STATS_BOX
# orig: end...
h!:_
r!:_:|
---------[ IN TEA RUNTIME ]
#66 of ['', '', '', '', '', '', '', '', '', '', '', '', 'f!:^$:lNOPROMPT:lPROMPT', '', 'l:lPROMPT', '', 'i!:Enter some text: ', 'i:', '', 'l:lNOPROMPT', '', 'v:vIN', '', 'r*!:vIN:.:-', '', 'x:--', 'x!:--', '', 'v:vBTOP', '', 'v:vSTART:', '', 'v:vBLR:{=TID=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=TID=}', '', 'g*:{ }:vBLR:vIN:vBLR', '', 'v:vIN', '', '', '', 'g*:{_ }:vSTART:vBTOP:vIN:vBTOP', '', '', '', 'v:vTXTBOX', '', 'v!:"ABCDEFG" ', '', 'x!:{ CHARS}', '', 'v:vIN_STATS', '', 'g*:{_ }:vIN_STATS:vBTOP', '', 'v:vIN_STATS_BOX', '', '', '', 'g*:{_ }:vTXTBOX:vIN_STATS_BOX', '', '', '', 'h!:_', '', 'r!:_:', '']
##24 of ['f!:^$:lNOPROMPT:lPROMPT', 'l:lPROMPT', 'i!:Enter some text: ', 'i:', 'l:lNOPROMPT', 'v:vIN', 'r*!:vIN:.:-', 'x:--', 'x!:--', 'v:vBTOP', 'v:vSTART:', 'v:vBLR:{|}', 'g*:{ }:vBLR:vIN:vBLR', 'v:vIN', 'g*:{_ }:vSTART:vBTOP:vIN:vBTOP', 'v:vTXTBOX', 'v!:"ABCDEFG" ', 'x!:{ CHARS}', 'v:vIN_STATS', 'g*:{_ }:vIN_STATS:vBTOP', 'v:vIN_STATS_BOX', 'g*:{_ }:vTXTBOX:vIN_STATS_BOX', 'h!:_', 'r!:_:']
CLEAN TEA CODE TO PROCESS:
f!:^$:lNOPROMPT:lPROMPT
l:lPROMPT
i!:Enter some text:
i:
l:lNOPROMPT
v:vIN
r*!:vIN:.:-
x:--
x!:--
v:vBTOP
v:vSTART:
v:vBLR:{=TID=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=TID=}
g*:{ }:vBLR:vIN:vBLR
v:vIN
g*:{_ }:vSTART:vBTOP:vIN:vBTOP
v:vTXTBOX
v!:"ABCDEFG"
x!:{ CHARS}
v:vIN_STATS
g*:{_ }:vIN_STATS:vBTOP
v:vIN_STATS_BOX
g*:{_ }:vTXTBOX:vIN_STATS_BOX
h!:_
r!:_:
---<< EXTRACTED TEA LABEL BLOCKS:
{'lPROMPT': 2, 'lNOPROMPT': 5}
Executing Instruction#0 (out of 24)
Processing Instruction: f!:^$:lNOPROMPT:lPROMPT
PRIOR MEMORY STATE: (=Hello World, VAULTS:{})
RESULTANT MEMORY STATE: (=Hello World, VAULTS:{})
Executing Instruction#5 (out of 24)
Processing Instruction: v:vIN
PRIOR MEMORY STATE: (=Hello World, VAULTS:{})
-- [INFO] Wrote VAULT[vIN = [Hello World]]
RESULTANT MEMORY STATE: (=Hello World, VAULTS:{'vIN': 'Hello World'})
Executing Instruction#6 (out of 24)
Processing Instruction: r*!:vIN:.:-
PRIOR MEMORY STATE: (=Hello World, VAULTS:{'vIN': 'Hello World'})
-- [INFO] Reading VAULT[vIN]
RESULTANT MEMORY STATE: (=-----------, VAULTS:{'vIN': 'Hello World'})
Executing Instruction#7 (out of 24)
Processing Instruction: x:--
PRIOR MEMORY STATE: (=-----------, VAULTS:{'vIN': 'Hello World'})
RESULTANT MEMORY STATE: (=-------------, VAULTS:{'vIN': 'Hello World'})
Executing Instruction#8 (out of 24)
Processing Instruction: x!:--
PRIOR MEMORY STATE: (=-------------, VAULTS:{'vIN': 'Hello World'})
RESULTANT MEMORY STATE: (=---------------, VAULTS:{'vIN': 'Hello World'})
Executing Instruction#9 (out of 24)
Processing Instruction: v:vBTOP
PRIOR MEMORY STATE: (=---------------, VAULTS:{'vIN': 'Hello World'})
-- [INFO] Wrote VAULT[vBTOP = [---------------]]
RESULTANT MEMORY STATE: (=---------------, VAULTS:{'vIN': 'Hello World', 'vBTOP': '---------------'})
Executing Instruction#10 (out of 24)
Processing Instruction: v:vSTART:
PRIOR MEMORY STATE: (=---------------, VAULTS:{'vIN': 'Hello World', 'vBTOP': '---------------'})
-- [INFO] Wrote VAULT[vSTART = []]
RESULTANT MEMORY STATE: (=---------------, VAULTS:{'vIN': 'Hello World', 'vBTOP': '---------------', 'vSTART': ''})
Executing Instruction#11 (out of 24)
Processing Instruction: v:vBLR:{=TID=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=TID=}
PRIOR MEMORY STATE: (=---------------, VAULTS:{'vIN': 'Hello World', 'vBTOP': '---------------', 'vSTART': ''})
-- [INFO] Wrote VAULT[vBLR = [|]]
RESULTANT MEMORY STATE: (=---------------, VAULTS:{'vIN': 'Hello World', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|'})
Executing Instruction#12 (out of 24)
Processing Instruction: g*:{ }:vBLR:vIN:vBLR
PRIOR MEMORY STATE: (=---------------, VAULTS:{'vIN': 'Hello World', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|'})
-- [INFO] Reading VAULT[vBLR]
-- [INFO] Reading VAULT[vIN]
-- [INFO] Reading VAULT[vBLR]
RESULTANT MEMORY STATE: (=| Hello World |, VAULTS:{'vIN': 'Hello World', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|'})
Executing Instruction#13 (out of 24)
Processing Instruction: v:vIN
PRIOR MEMORY STATE: (=| Hello World |, VAULTS:{'vIN': 'Hello World', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|'})
-- [INFO] Wrote VAULT[vIN = [| Hello World |]]
RESULTANT MEMORY STATE: (=| Hello World |, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|'})
Executing Instruction#14 (out of 24)
Processing Instruction: g*:{_ }:vSTART:vBTOP:vIN:vBTOP
PRIOR MEMORY STATE: (=| Hello World |, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|'})
-- [INFO] Reading VAULT[vSTART]
-- [INFO] Reading VAULT[vBTOP]
-- [INFO] Reading VAULT[vIN]
-- [INFO] Reading VAULT[vBTOP]
RESULTANT MEMORY STATE: (=_ ---------------_ | Hello World |_ ---------------, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|'})
Executing Instruction#15 (out of 24)
Processing Instruction: v:vTXTBOX
PRIOR MEMORY STATE: (=_ ---------------_ | Hello World |_ ---------------, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|'})
-- [INFO] Wrote VAULT[vTXTBOX = [_ ---------------_ | Hello World |_ ---------------]]
RESULTANT MEMORY STATE: (=_ ---------------_ | Hello World |_ ---------------, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|', 'vTXTBOX': '_ ---------------_ | Hello World |_ ---------------'})
Executing Instruction#16 (out of 24)
Processing Instruction: v!:"ABCDEFG"
PRIOR MEMORY STATE: (=_ ---------------_ | Hello World |_ ---------------, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|', 'vTXTBOX': '_ ---------------_ | Hello World |_ ---------------'})
[INFO] Returning Length of string [ABCDEFG]
RESULTANT MEMORY STATE: (=7, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|', 'vTXTBOX': '_ ---------------_ | Hello World |_ ---------------'})
Executing Instruction#17 (out of 24)
Processing Instruction: x!:{ CHARS}
PRIOR MEMORY STATE: (=7, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|', 'vTXTBOX': '_ ---------------_ | Hello World |_ ---------------'})
RESULTANT MEMORY STATE: (=7 CHARS, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|', 'vTXTBOX': '_ ---------------_ | Hello World |_ ---------------'})
Executing Instruction#18 (out of 24)
Processing Instruction: v:vIN_STATS
PRIOR MEMORY STATE: (=7 CHARS, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|', 'vTXTBOX': '_ ---------------_ | Hello World |_ ---------------'})
-- [INFO] Wrote VAULT[vIN_STATS = [7 CHARS]]
RESULTANT MEMORY STATE: (=7 CHARS, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|', 'vTXTBOX': '_ ---------------_ | Hello World |_ ---------------', 'vIN_STATS': '7 CHARS'})
Executing Instruction#19 (out of 24)
Processing Instruction: g*:{_ }:vIN_STATS:vBTOP
PRIOR MEMORY STATE: (=7 CHARS, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|', 'vTXTBOX': '_ ---------------_ | Hello World |_ ---------------', 'vIN_STATS': '7 CHARS'})
-- [INFO] Reading VAULT[vIN_STATS]
-- [INFO] Reading VAULT[vBTOP]
RESULTANT MEMORY STATE: (=7 CHARS_ ---------------, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|', 'vTXTBOX': '_ ---------------_ | Hello World |_ ---------------', 'vIN_STATS': '7 CHARS'})
Executing Instruction#20 (out of 24)
Processing Instruction: v:vIN_STATS_BOX
PRIOR MEMORY STATE: (=7 CHARS_ ---------------, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|', 'vTXTBOX': '_ ---------------_ | Hello World |_ ---------------', 'vIN_STATS': '7 CHARS'})
-- [INFO] Wrote VAULT[vIN_STATS_BOX = [7 CHARS_ ---------------]]
RESULTANT MEMORY STATE: (=7 CHARS_ ---------------, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|', 'vTXTBOX': '_ ---------------_ | Hello World |_ ---------------', 'vIN_STATS': '7 CHARS', 'vIN_STATS_BOX': '7 CHARS_ ---------------'})
Executing Instruction#21 (out of 24)
Processing Instruction: g*:{_ }:vTXTBOX:vIN_STATS_BOX
PRIOR MEMORY STATE: (=7 CHARS_ ---------------, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|', 'vTXTBOX': '_ ---------------_ | Hello World |_ ---------------', 'vIN_STATS': '7 CHARS', 'vIN_STATS_BOX': '7 CHARS_ ---------------'})
-- [INFO] Reading VAULT[vTXTBOX]
-- [INFO] Reading VAULT[vIN_STATS_BOX]
RESULTANT MEMORY STATE: (=_ ---------------_ | Hello World |_ ---------------_ 7 CHARS_ ---------------, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|', 'vTXTBOX': '_ ---------------_ | Hello World |_ ---------------', 'vIN_STATS': '7 CHARS', 'vIN_STATS_BOX': '7 CHARS_ ---------------'})
Executing Instruction#22 (out of 24)
Processing Instruction: h!:_
PRIOR MEMORY STATE: (=_ ---------------_ | Hello World |_ ---------------_ 7 CHARS_ ---------------, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|', 'vTXTBOX': '_ ---------------_ | Hello World |_ ---------------', 'vIN_STATS': '7 CHARS', 'vIN_STATS_BOX': '7 CHARS_ ---------------'})
RESULTANT MEMORY STATE: (=
_ ---------------
_ | Hello World |
_ ---------------
_ 7 CHARS
_ ---------------, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|', 'vTXTBOX': '_ ---------------_ | Hello World |_ ---------------', 'vIN_STATS': '7 CHARS', 'vIN_STATS_BOX': '7 CHARS_ ---------------'})
Executing Instruction#23 (out of 24)
Processing Instruction: r!:_:
PRIOR MEMORY STATE: (=
_ ---------------
_ | Hello World |
_ ---------------
_ 7 CHARS
_ ---------------, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|', 'vTXTBOX': '_ ---------------_ | Hello World |_ ---------------', 'vIN_STATS': '7 CHARS', 'vIN_STATS_BOX': '7 CHARS_ ---------------'})
RESULTANT MEMORY STATE: (=
---------------
| Hello World |
---------------
7 CHARS
---------------, VAULTS:{'vIN': '| Hello World |', 'vBTOP': '---------------', 'vSTART': '', 'vBLR': '|', 'vTXTBOX': '_ ---------------_ | Hello World |_ ---------------', 'vIN_STATS': '7 CHARS', 'vIN_STATS_BOX': '7 CHARS_ ---------------'})
---------------
| Hello World |
---------------
7 CHARS
---------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment