This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
,---. ,.'-. \ ( ( ,'"""""-. `,X `. /` ` `._ ( , ,_\ | ,---.,'o `. | / o \ ) \ ,. ( .____, \| \ \____,' \ '`'\ \ _,____,' \ ,-- ,-' \ ( C ,' \ `--' .' | | | .O | __| \ ,-'_ / `L `._ _,' ' `. / `--.._ `',. _\ ` `-. /\ | `. ( ,\ \ _/ `-._ / \ |--' ( \ ' `-. `' \/\`. `. ) \ \ `. | | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__.__ .--. .-" "-. .--. / .. \/ .-. .-. \/ .. \ | | '| / Y \ |' | | | \ \ \ 0 | 0 / / / | \ '- ,\.-"'' ''"-./, -' / ''-' /_ ^ ^ _\ '-'' | \._ _./ | \ \ '~' / / '._ '-=-' _.' '~---~' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> 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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loop { $><< "\e[#{rand(50)};#{rand(50)}H"; $><< "%d" % rand(2); sleep 0.1 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'fiddle' | |
require 'fiddle/import' | |
module Signal::C | |
include Fiddle | |
extend Fiddle::Importer | |
dlload Handle::DEFAULT | |
SigHandler = bind 'void sig_cb(int)' do |signo| | |
puts %q{you can't escape me!} if signo == 2 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'fiddle' | |
require 'fiddle/import' | |
#require 'io/console' | |
extend Fiddle::Importer | |
KDGETKEYCODE = 0x4b4c |