Т
root@vsi:/mnt/d/ctf/pervaki/pwn7/mc# ipython
Python 3.8.0 (default, Oct 28 2019, 16:14:01)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.13.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import struct
In [2]: struct.pack('d', 345.678)
Out[2]: b'\x02+\x87\x16\xd9\x9au@'
In [3]: struct.pack('d', 345.678).hex()
Out[3]: '022b8716d99a7540'
In [4]: struct.pack('d', 1000).hex()
Out[4]: '0000000000408f40'
In [5]: struct.unpack('d', b'\x00\x00\x00\x00\x00\x40\x8f\x40')
Out[5]: (1000.0,)
In [6]: struct.unpack('d', b'ololokek')
Out[6]: (2.2005931559457482e+209,)
In [7]: struct.pack('d', 2.2005931559457482e+209)
Out[7]: b'ololokek'
In [8]:
Do you really want to exit ([y]/n)?
root@vsi:/mnt/d/ctf/pervaki/pwn7/mc# cat > test.c
#include <stdio.h>
int main() {
double d;
d = 2.2005931559457482e+209;
printf("%s\n", (char*)&d);
}
root@vsi:/mnt/d/ctf/pervaki/pwn7/mc# gcc -o test test.c
root@vsi:/mnt/d/ctf/pervaki/pwn7/mc# ./test
ololokek