大家帮忙分析一下,看有什么办法可以把post包的内容从instream里取出来!谢谢!

2 views
Skip to first unread message

rain chen

unread,
Nov 16, 2009, 11:50:38 PM11/16/09
to china-li...@googlegroups.com

函数:

void post_apply(FILE *instream, int contentlen)
{
    int r, i;
    static char post_buf[32768];    /* 32KB is OK? mainly for block_sites!*/
    ...

    //MIN是取两者小的值,contentlen从post包里拿到的值是12113,这边不重要
    r = MIN(contentlen + 1, sizeof(post_buf) - 1);
   
    i=0;
    while(i + 1 < r){
          if(!fgets(&(post_buf[i])), r, instream) {  
                 return;
           }

           i = strlen(post_buf);
     }

     ...   

}

附件里是抓的包!
注:1. instream 从post包里拿的内容是从Content-Length: 12113下面一行开始到content-Disposition: form-data; name="dummy"下面的一行结束。
2. Content-Type: application/download这下面的是段经过加密的文件。fgets虽然读完包所有的内容,但还是return了,不知道为什么。
3. 也试过用post_buf[i++] = getc(instream);来读,但读到Content-Type: application/download就结束了,下面的加密的内容也同样读不出来!


--
^_^
pkt.pcap
Reply all
Reply to author
Forward
0 new messages