(sry for bad en)
i wana extact only a specific parts of a buffer that i recive from a socket conection.
i have allready socket conected to the server when i do this:
sprintf(buffer, "GET %sindex.php?username=root&password=ok HTTP/1.1\r\n"
"Host: %s\r\n"
"User-Agent: revolt\r\n"
"Keep-Alive: 300\r\n"
"Connection: keep-alive\r\n" "\r\n",username,inet_ntoa(t_in));
i recive a response from the server:
HTTP/1.1 302 Found
Date: Tue, 15 Jul 2008 14:53:29 GMT
Server: Apache/2.2.8 (Ubuntu) PHP/5.2.4-2ubuntu5.2 with Suhosin-Patch
X-Powered-By: PHP/5.2.4-2ubuntu5.2
Set-Cookie:
etc ....
Location: **//x.x.x.x/index.php?lang=en-utf-8&convcharset=iso-8859-1&collation_connection=utf8_unicode_ci&token=071a0fb26339b8123384b96d1310dd50
etc ...
**i leave the http cuze this forum doesnt detect the link
so from that buffer that i recived i wana extract the cookie info the location link to write other buffer and then log in on the web...
the response of the server i save it on buffer buff then i copy it to other buffer to extract the info (it is cuze i need extrac some info and if i use the same buff buffer it is broke when i use strtok() on it)
strcpy(dinamico, buff);
so the problem is when i try to extract the pice of info from that buffer
for example i am using:
char *pma_mcrypt_iv ;
char cry[256]; //enoug space for the pointer space
if(pma_mcrypt_iv = strstr(dinamico,"pma_mcrypt_iv=")){
pma_mcrypt_iv = strtok(pma_mcrypt_iv,";");
printf("%s\n",pma_mcrypt_iv);
// it prints ok:
// pma_mcrypt_iv=3gpe5PkvUso%3D
// that means the info was extracted
strcpy(cry,pma_mcrypt_iv);
// then copy it to a char array
}
the is the way to extract 10 cokkie info thati used ... then
after i check in printf that all info are printed ok on the pointers
then i think is done so in build the new response to the server
sprintf(response,"GET /index.php?%s HTTP/1.1\r\n"
"Connection: close"
"Host: %s",link,...);
etc ...
then i print the buffer to see if everithin its ok
but
GET /index.php?%s HTTP/1.1
it wuold be
GET /index.php?1token=071a0fb26339b8123384b96d1310dd50 HTTP/1.1
but
HTTP/1.1token=071a0fb26339b8123384b96d1310dd50
doesnt show correctly
some happends whit the char array that is a copy of the pointer
and of course when i send the response to the server it respond me whit
<title>501 Method Not Implemented</title>
=(
i think is the way, iam using to extrac the info, cuze of course buffers before of this all work ok
so somebody see a err ?
somebody can explainme or paste some code of how to extract info from a buffer an save it into a array?
i there a way to fill a sprintf() whit pointers ?
thnx guys =)