
Security News
Researcher Exposes Zero-Day Clickjacking Vulnerabilities in Major Password Managers
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
http://github.com/mojombo/erlectricity
By Scott Fleckenstein, Tom Preston-Werner
Development Status: Production/Stable
Erlectricity allows a Ruby program to receive and respond to Erlang messages sent over the Erlang binary protocol.
$ gem install erlectricity
-or-
$ gem install mojombo-erlectricity -s http://gems.github.com
require 'rubygems'
require 'erlectricity'
receive do |f|
f.when([:echo, String]) do |text|
f.send!([:result, "You said: #{text}"])
f.receive_loop
end
end
-module(echo).
-export([test/0]).
test() ->
Cmd = "ruby echo.rb",
Port = open_port({spawn, Cmd}, [{packet, 4}, nouse_stdio, exit_status, binary]),
Payload = term_to_binary({echo, <<"hello world!">>}),
port_command(Port, Payload),
receive
{Port, {data, Data}} ->
{result, Text} = binary_to_term(Data),
io:format("~p~n", [Text])
end.
% Port is the port opened via open_port({spawn, Cmd}, [{packet, 4}, ...])
% Message is the Erlang term to encode and send to the port
send(Port, Message) ->
port_command(Port, term_to_binary(Message)).
# Each triplet below represents:
# (line 1) the Erlang call
# (line 2) the Ruby matcher
# (line 3) the Ruby output
send(Port, test).
f.when(:test) { p :ok }
# :ok
send(Port, {atom, symbol}).
f.when([:atom, Symbol]) { |sym| p sym }
# :symbol
send(Port, {number, 1}).
f.when([:number, Fixnum]) { |num| p num }
# 1
send(Port, {string, <<"foo">>}).
f.when([:string, String]) { |str| p str }
# "foo"
send(Port, {array, [1,2,3]}).
f.when([:array, Array]) { |arr| p arr }
# [1, 2, 3]
send(Port, {array, [<<"abc">>, <<"def">>]}).
f.when([:array, Array]) { |arr| p arr }
# ["abc", "def"]
send(Port, {hash, [{key,val}]}).
f.when([:hash, Erl.hash]) { |hash| p hash }
# {:key=>:val}
send(Port, {object, {1,{2},3,<<"four">>}}).
f.when([:object, Any]) { |any| p any }
# [1, [2], 3, "four"]
If you'd like to hack on Erlectricity, start by forking my repo on GitHub:
http://github.com/mojombo/erlectricity
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 Scott Fleckenstein and Tom Preston-Werner. See LICENSE for details.
FAQs
Unknown package
We found that erlectricity demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Security News
Hacker Demonstrates How Easy It Is To Steal Data From Popular Password Managers
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.