Look into SSLStrip. It strips off the HTTPS request headers during MITM attack. If web server uses HSTS and browser supports it, then this tool won't be able to strip HTTPS. The code may give you some ideas.

Another option is scapy, which is a packet manipulation program that may be able to do what you are asking.

"It does not work with browsers that use HSTS" sslstrip could be used to avoid the HSTS in the first place!
–
curiousguyJun 27 '12 at 22:01

1

@curiousguy Google Chrome actually hard-codes a list of HSTS sites, so it wouldn't work there with most common sites. Stripping the HSTS header would also only work if it was the first visit to the site. I had thought a while ago about adding that functionality (the source is on github).
–
servarevitas3Jun 28 '12 at 13:08

Ettercap is a comprehensive suite for man in the middle attacks. It features sniffing of live connections, content filtering on the fly and many other interesting tricks. It supports active and passive dissection of many protocols and includes many features for network and host analysis.

It's a pretty well known tool, so doing a simple ettercap tutorial google search gives plenty of entry level examples, which will walk you through performing ARP poisoning, intercepting traffic, and then create filters to modify data as it goes through your computer.