
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
mojombo-proxymachine
Advanced tools
By Tom Preston-Werner (tom@mojombo.com)
WARNING: This software is alpha and should not be used in production without extensive testing. You should not consider this project production ready until it is released as 1.0.
ProxyMachine is a simple content aware (layer 7) TCP routing proxy built on EventMachine that lets you configure the routing logic in Ruby.
If you need to proxy connections to different backend servers depending on the contents of the transmission, then ProxyMachine will make your life easy!
The idea here is simple. For each client connection, start receiving data chunks and placing them into a buffer. Each time a new chunk arrives, send the buffer to a user specified block. The block's job is to parse the buffer to determine where the connection should proxied. If the buffer contains enough data to make a determination, the block returns the address and port of the correct backend server. If not, it can choose to either do nothing and wait for more data to arrive, or close the connection. Once the block returns an address, a connection to the backend is made, the buffer is replayed to the backend, and the client and backend connections are hooked up to form a straight proxy. This bidirectional proxy continues to exist until either the client or backend close the connection.
gem install mojombo-proxymachine -s http://gems.github.com
Usage:
proxymachine -c <config file> [-h <host>] [-p <port>]
Options:
-c, --config CONFIG Configuration file
-h, --host HOST Hostname to bind. Default 0.0.0.0
-p, --port PORT Port to listen on. Default 5432
class GitRouter
# Look at the routing table and return the correct address for +name+
# Returns "<host>:<port>" e.g. "ae8f31c.example.com:9418"
def self.lookup(name)
...
end
end
# Perform content-aware routing based on the stream data. Here, the
# header information from the Git protocol is parsed to find the
# username and a lookup routine is run on the name to find the correct
# backend server. If no match can be made yet, do nothing with the
# connection yet.
proxy do |data|
if data =~ %r{^....git-upload-pack /([\w\.\-]+)/[\w\.\-]+\000host=\w+\000}
name = $1
{ :remote => GitRouter.lookup(name) }
else
{ :noop => true }
end
end
{ :remote => String }
- String is the host:port of the backend server that will be proxied.
{ :remote => String, :data => String }
- Same as above, but send the given data instead.
{ :noop => true }
- Do nothing.
{ :close
=> true } - Close the connection.
{ :close => String }
- Close the connection after sending the String.
If you'd like to hack on ProxyMachine, start by forking my repo on GitHub:
http://github.com/mojombo/proxymachine
To get all of the dependencies, install the gem first. The best way to get your changes merged back into core is as follows:
rake
Copyright (c) 2009 Tom Preston-Werner. See LICENSE for details.
FAQs
Unknown package
We found that mojombo-proxymachine demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.