Page 1 of 2
HTTP / HTTPS Proxy in Purebasic
Posted: Fri Dec 22, 2023 6:04 pm
by lisa_beille
Hello
i'm currently developing an http(s) packet inspection tool (kind of burpsuite) and my main concern is about creating an http / https proxy in purebasic that can intercept requests, analyze them then forward them to their destination.
I tried some codes but i get confused and it doesn't work.
Does anyone have a minimalistic workig code ?
thanks
Re: HTTP / HTTPS Proxy in Purebasic
Posted: Fri Dec 22, 2023 6:10 pm
by NicTheQuick
Is your goal to do that by yourself to learn from or why do you not want to use already existing tools?
The most complicated part with that is going to be the SSL/TLS part because that's a huge field where you should better use existing libraries.
Re: HTTP / HTTPS Proxy in Purebasic
Posted: Fri Dec 22, 2023 6:29 pm
by lisa_beille
.
Re: HTTP / HTTPS Proxy in Purebasic
Posted: Fri Dec 22, 2023 6:29 pm
by lisa_beille
NicTheQuick wrote: Fri Dec 22, 2023 6:10 pm
Is your goal to do that by yourself to learn from or why do you not want to use already existing tools?
The most complicated part with that is going to be the SSL/TLS part because that's a huge field where you should better use existing libraries.
It would be great if I could do that by myself but what tools or libraries can I use that can be intergrated with PB ?
Re: HTTP / HTTPS Proxy in Purebasic
Posted: Fri Dec 22, 2023 6:31 pm
by NicTheQuick
You can basically use every library that also can be used by C.
Re: HTTP / HTTPS Proxy in Purebasic
Posted: Fri Dec 22, 2023 6:34 pm
by lisa_beille
NicTheQuick wrote: Fri Dec 22, 2023 6:31 pm
You can basically use every library that also can be used by C.
can you suggest a good library ?
Re: HTTP / HTTPS Proxy in Purebasic
Posted: Fri Dec 22, 2023 6:58 pm
by NicTheQuick
On Linux I would suggest libssl I guess. But I don't do stuff like that with Purebasic because it's way to much effort if there are other languages that already have such things integrated natively.

Re: HTTP / HTTPS Proxy in Purebasic
Posted: Sat Dec 23, 2023 10:12 am
by infratec
Re: HTTP / HTTPS Proxy in Purebasic
Posted: Sat Dec 23, 2023 7:45 pm
by lisa_beille
Thanks
Do you know any minimalistic code example for a proxy in PB ?
Re: HTTP / HTTPS Proxy in Purebasic
Posted: Sat Dec 23, 2023 11:39 pm
by infratec
There is no minimalistic example
Years ago I wrote a proxy for postgres to make secured access from PB to a postgres server.
It was very tricky and not easy to implement.
For normal http https I would use nginx as proxy.
Re: HTTP / HTTPS Proxy in Purebasic
Posted: Sun Dec 24, 2023 11:15 am
by NicTheQuick
Proxying is not as easy as piping network traffic from one port to an other one. You have to parse and interpret the HTTP headers and change them accordingly. And with HTTPS you also have to match certificates and check them. It's really a complicated topic.
I am also not aware of any minimalistic example code since it is too complex to be minimalistic.
I also never did that by myself. I think there are enough ready to use applications that can be used for that.
Re: HTTP / HTTPS Proxy in Purebasic
Posted: Mon Dec 25, 2023 12:07 pm
by lisa_beille
NicTheQuick wrote: Sun Dec 24, 2023 11:15 am
Proxying is not as easy as piping network traffic from one port to an other one. You have to parse and interpret the HTTP headers and change them accordingly. And with HTTPS you also have to match certificates and check them. It's really a complicated topic.
I am also not aware of any minimalistic example code since it is too complex to be minimalistic.
I also never did that by myself. I think there are enough ready to use applications that can be used for that.
then a minimal working example

Re: HTTP / HTTPS Proxy in Purebasic
Posted: Sun Dec 31, 2023 7:13 pm
by lisa_beille
NicTheQuick wrote: Sun Dec 24, 2023 11:15 am
Proxying is not as easy as piping network traffic from one port to an other one. You have to parse and interpret the HTTP headers and change them accordingly. And with HTTPS you also have to match certificates and check them. It's really a complicated topic.
I am also not aware of any minimalistic example code since it is too complex to be minimalistic.
I also never did that by myself. I think there are enough ready to use applications that can be used for that.
what is i use the httprequest purebasic function ?
Re: HTTP / HTTPS Proxy in Purebasic
Posted: Sun Dec 31, 2023 8:18 pm
by DarkDragon
lisa_beille wrote: Sun Dec 31, 2023 7:13 pmwhat is i use the httprequest purebasic function ?
That's just a client, not a proxy.
Re: HTTP / HTTPS Proxy in Purebasic
Posted: Mon Jan 01, 2024 2:29 pm
by lisa_beille
DarkDragon wrote: Sun Dec 31, 2023 8:18 pm
lisa_beille wrote: Sun Dec 31, 2023 7:13 pmwhat is i use the httprequest purebasic function ?
That's just a client, not a proxy.
maybe i can forward the request with http request and then send back the reponse to client ?