Skip to content

Instantly share code, notes, and snippets.

Lee gr33n7007h

Block or report user

Report or block gr33n7007h

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gr33n7007h
gr33n7007h / test.lua
Created Jun 5, 2019
Run Ruby from LuaJIT
View test.lua
#!/usr/bin/env luajit
local ffi = require 'ffi'
local cast = ffi.cast
local cdef = ffi.cdef
local load = ffi.load
local libruby = load '/usr/lib/libruby.so'
cdef[[
@gr33n7007h
gr33n7007h / callback.c
Last active Apr 5, 2019
Testing a C callback from Ruby
View callback.c
#include <stdio.h>
// compile: gcc -g -fPIC -Wall -Werror -Wextra -pedantic callback.c -shared -o libtest.so
void
message(void)
{
puts("wassupppp!");
}
View homer
,---. ,.'-. \ ( ( ,'"""""-. `,X `. /` ` `._ ( , ,_\ | ,---.,'o `. | / o \ ) \ ,. ( .____, \| \ \____,' \ '`'\ \ _,____,' \ ,-- ,-' \ ( C ,' \ `--' .' | | | .O | __| \ ,-'_ / `L `._ _,' ' `. / `--.._ `',. _\ ` `-. /\ | `. ( ,\ \ _/ `-._ / \ |--' ( \ ' `-. `' \/\`. `. ) \ \ `. | |
View monkey
__.__ .--. .-" "-. .--. / .. \/ .-. .-. \/ .. \ | | '| / Y \ |' | | | \ \ \ 0 | 0 / / / | \ '- ,\.-"'' ''"-./, -' / ''-' /_ ^ ^ _\ '-'' | \._ _./ | \ \ '~' / / '._ '-=-' _.' '~---~'
View segv.rb
>> handler = Handle.new '/usr/local/lib/libmonocypher.so'
=> #<Fiddle::Handle:0x0000556323b489b8>
>> sign_public_key = Function.new(handler.sym('crypto_sign_public_key'), [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOID)
=> #<Fiddle::Function:0x0000556323b723a8 @abi=2, @args=[1, 1], @ptr=140618144978256, @return_type=0>
>> sign = Function.new(handler.sym('crypto_sign'), [TYPE_VOIDP, TYPE_VOIDP, TYPE_VOIDP, TYPE_VOIDP, TYPE_SIZE_T], TYPE_VOID)
=> #<Fiddle::Function:0x0000556323ba1b30 @abi=2, @args=[1, 1, 1, 1, -5], @ptr=140618144981584, @return_type=0>
>> check = Function.new(handler.sym('crypto_check'), [TYPE_VOIDP, TYPE_VOIDP, TYPE_VOIDP, TYPE_SIZE_T], TYPE_INT)
=> #<Fiddle::Function:0x0000556323bdf7f0 @abi=2, @args=[1, 1, 1, -5], @ptr=140618144985856, @return_type=4>
>> sk = Random.bytes 32
=> "\xA9\x8A\xEEi\x85\x90\xAF\xEEq\xDAm\x7FX\x12\x96YMa\x80\xC2V\x8Ee\xB4\xF5\xA4\xCBA\x9F!\x8E\x81"
View pipe2.rb
>> module IO::Extensions
| extend Fiddle::Importer
| dlload Fiddle::Handle::DEFAULT
| extern 'int pipe2(int pipefd[2], int flags)'
|
| def self.pipe_2 flags:
| pipefds = [0,0].pack 'i2'
| if pipe2(pipefds, flags).zero?
| pipefds.unpack('i2').map &IO.method(:for_fd)
| else
View imap.rb
>> require 'net/imap'
=> true
>> Net::IMAP.new "imap.gmail.com", 993, true
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed (self signed certificate)
from /usr/lib/ruby/2.5.0/net/protocol.rb:44:in `connect_nonblock'
>> m = <<~SNI_test
| def start_tls_session(params = {})
| unless defined?(OpenSSL::SSL)
| raise "SSL extension not installed"
| end
View mello.rb
require 'net/http'
uri = URI.parse("https://mydomain.com/attachments")
request = Net::HTTP::Post.new(uri)
request["Authorization"] = "Got this"
req_options = {
use_ssl: uri.scheme == "https",
}
View test.rb
require 'fiddle/import'
module Test
extend Fiddle::Importer
dlload '/usr/lib/libargon2.so.1'
typealias 'uint8_t', 'unsigned char'
typealias 'uint32_t', 'unsigned int'
Argon2_Context = struct [
@gr33n7007h
gr33n7007h / b.rb
Created Nov 2, 2018
binary dance ;)
View b.rb
loop { $><< "\e[#{rand(50)};#{rand(50)}H"; $><< "%d" % rand(2); sleep 0.1 }
You can’t perform that action at this time.