Tags: rev 

Rating:

Run the fiboncci program and the following script as another process. It will quantum computer speed to the program.
```
from __future__ import print_function
import frida
import sys

session = frida.attach("fibonacci")
script = session.create_script("""
last = -1;
var memp = [];
var memr = [];
Interceptor.attach(ptr("%s"), {
onEnter: function(args) {
this.skip=0;
this.origIndex = args[0].toInt32();
this.origValue = Memory.readInt(args[1]);
this.origAddress = args[1];
if(last>=args[0].toInt32()){
this.skip=1;
args[0] = ptr(0);
}
},
onLeave: function (retval) {
if (this.skip===0) {
last = this.origIndex;
memr.push(retval.toInt32());
memp.push(Memory.readInt(this.origAddress)^this.origValue);
}else{
Memory.writeInt(this.origAddress, this.origValue^memp[this.origIndex]);
retval.replace(memr[this.origIndex]);
}
}
});
""" % 0x400670)

script.on('message', lambda x,d: print(x,d))
script.load()
sys.stdin.read()
```