Gallopsled / pwntools

CTF framework and exploit development library
http://pwntools.com
Other
11.74k stars 1.67k forks source link

Speed up disasm with color #2334

Closed snarkyyy closed 6 months ago

snarkyyy commented 6 months ago

Pwntools Pull Request

https://github.com/Gallopsled/pwntools/issues/2239

Testing

I tried it on the example from the issue, other than that I haven't tested yet.

Target Branch

I chose dev as target, feel free to change.

Changelog

No change to changelog as the intend of the change it to not change any behaviour, just speed up the function.

snarkyyy commented 6 months ago

I tested the change a bit and noticed that my patch doesn't give exact same output as it was before as it incidentally fixes a bug.

The bug was present only for colored output, you can observe it if you give to disasm some bigger binary like /usr/bin/ls, you will notice in the colored output some lines that look like this: ... ... ..., this is because there was a bug were all lines that weren't matching a standard disasm line pattern were pasted three times in a row, the correct line should contain just a singe ..., my patch fixes that.