How to include post variables when using pcap.net to create a http post request?

Apr 20, 2014 at 1:20 PM
I searched and found the code necessary for creating valid tcp 3 way handshake, done that, now in the last part I simply don't know how to include the post variables using HttpField.CreateField() method, i.e. username, password Content-Type="application/x-www-form-urlencoded" etc. when using the HttpRequestKnownMethod.Post method, I am unable to find any documentation on that specific implementation also, any working example would be appreciated.
Coordinator
Apr 21, 2014 at 7:33 AM
Hi dkk,

There's an example in Pcap.Net user guide for creating an HttpRequestLayer.
Can you elaborate what do you find missing?

Boaz.
Apr 21, 2014 at 9:05 AM
I am trying to create the http layer as follows :
 // HTTP Layer
                HttpLayer httpLayer = new HttpRequestLayer
                {
                    Uri = "someurl...",

                    Header = new HttpHeader(HttpField.CreateField("Host", Host), HttpContentTypeField.CreateField("Content-Type",Encoding.ASCII.GetBytes("application/x-www-form-urlencoded"))),
                    Method = new HttpRequestMethod(HttpRequestKnownMethod.Post),
                    Version = PcapDotNet.Packets.Http.HttpVersion.Version11,
                };
How to include username="user" and password="pw" in this request?
Apr 22, 2014 at 1:45 PM
Brickner wrote:
Hi dkk,

There's an example in Pcap.Net user guide for creating an HttpRequestLayer.
Can you elaborate what do you find missing?

Boaz.
Why is there no proper documentation of such a good wrapper? and what about my answer, being the co-ordinator, you really can't tell or you won't? :D

Regards,
Dkk.
Coordinator
Apr 25, 2014 at 10:23 AM
Did you try creating the user and password fields the same way you create the host field?
This is a free open source, anyone is welcome to add documentation, though note that in addition to the Pcap.Net user guide, every public type, method and const is documented to some extent.