IMAP server implementation in Ruby EventMachine - ruby

I am looking for IMAP server protocol implementation in Ruby EventMachine.
Can someone advice a library or share some source code?

I don't know of any existing IMAP server in ruby but depending on your needs there is another approach you could use: setup a full fledged imap C server but instead of binding it to an external port you bind it on localhost and put an eventmachine process between it and the clients. This way you can intercept/modify commands you care about and let the other pass through.
Without knowing more about what you want to do it is hard to give a more relevant answer.

Related

How to listen to GET and POST requests for all connections using GO

I am using python and mitmproxy to listen to all incoming and outgoing traffic so that I can capture the URLs. I run the script and it tells me all URLs my computer is trying to connect to.
I need to implement the same using Go but have not got a clue on how to start or what package to use. Can anyone guide me in the right direction please?
Thanks
You can either easily build a proxy with httputil - example here.
Or you might want to use gopacket as described here.
You would need a local intermediate proxy, in order to capture its traffic and display the URLs used.
See for example, in Go, sipt/shuttle, with its GUI web interface:

TLS-PSK over TOR python

I am currently trying to create a "TOR version" of a service I created, running with TLS. I want to perform mutual authentication of both parties ; client and server.
I thought about using TLS-PSK over TOR, which would gives me the properties I desire, especially eavesdropping prevention.
I wanted to use the socket library and to double wrap a socket instance using first the ssl library then to do the same thing with TOR, but it looks like there is no library existing allowing me to do the second wrapping.
Do you have any idea about existing libraries allowing me to do something like that ?

Implement syslog to remote host in Windows service

I've been looking to implement sending log data to a remote Syslog host from my Windows service, so far the only decent library based option I have found is the UDP remote Syslog sender in the POCO net library. I'm interested in Syslog with TLS as described in RFC 5425, which the POCO library doesn't currently support.
My question is twofold, firstly have I missed an existing implementation of Syslog for Windows that supports sending to a remote host via TCP/TLS? Secondly, if no such implementation exists, I was looking to write my own (or perhaps extend the POCO one) - it doesn't look much more complicated than establishing a secure TLS session and putting Syslog formatted text strings into a TCP socket, I would use something like the .NET TLS implementation previously discussed here for the TLS part. Have I missed something, is this not that simple? Or is the reason that I can't find any libraries that implement this sort of Syslog communication for Windows that nobody wants to do this? Am I missing the brilliant alternative to Syslog that every other Windows dev is using?
Thanks in advance.
The only packaged solution I've come across for this is from Balabit. It seems to be the only thing out there that supports TLS and RFC5425. If anyone else has come across another solution, I'd like to hear about it as well.
Nxlog can do TLS/RFC5425 and is open source. (disclaimer: I'm the author)
While it's not a library, it has several input modules to make integration easier.

Ruby MITM proxy

I'm searching for some examples on how to write a proxy in Ruby that supports HTTPS. I have a simple proxy implemented with Webricks HTTPProxyServer, but I noticed, that HTTPS traffic is just tunneling (as it should ;) ). But I want to record the content with VCR (regarding my question here VCRProxy: Record PhantomJS ajax calls with VCR inside Capybara) and as long the content is only tunnled through, VCR can't record it.
So I was thinking of writing the proxy as a man-in-the-middle, generate SSL certificates on the fly (I don't care about certificate errors, its just for testing), and then I would be able to record the content / playback it later.
So if somebody has a good ressource from how to start, or a tutorial or a gist, please let me know.
PS: I have already seen this questions, but they don't provide any further stuff (and it need to be in ruby):
Man in the Middle (MITM) proxy with HTTPS support
How do I write a simple HTTPS proxy server in Ruby?
Help with HTTP Intercepting Proxy in Ruby?
An old question, but for the sake of completeness here goes another answer.
I've implemented a HTTP/HTTPS interception proxy in Ruby, the project is hosted in github.
The project is new, so it's not (yet) as mature as Python's mitmproxy, but it supports HTTPS with certificates generation on-the-fly.
There's an excellent MITM proxy in Python aptly named mitmproxy. The netlib library by the author does the tricks and mitmproxy uses it.
The codebase isn't large and it shouldn't be hard to go through it given that you know Ruby.

How to use Ruby's xmpp library behind a HTTP proxy

I want to use to the xmpp4r gem to send notifications to gtalk from my Rails app. However I am behind a HTTP proxy and hence cannot use regular jabber. Also, xmpp4r supports HTTPBind but it seems gtalk does not. So is there a way to use HTTPBind with gtalk?
Use proxifier http://rubygems.org/gems/proxifier.
If your proxy is configured on the environment already (ex. by setting the environment variable http_proxy) you can simply add the following two lines to your code.
require "proxifier"
require "proxifier/env"
This enhances the used TCPSocket to support connection via proxy.
xmpp4rproxifier

Resources