Skip to content

Instantly share code, notes, and snippets.

require 'socket'
HOST = 'localhost'
PORT = 5555
def connect_and_close
socket = TCPSocket.new(HOST, PORT)
linger = [1,0].pack('ii')
socket.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, linger)
socket.close
# encoding: utf-8
# JRUBY_OPTS="-J-Xmx4g -J-Xms4g" ruby beats_writer_ssl.rb
require "socket"
require "thread"
require "zlib"
require "json"
require "openssl"
Thread.abort_on_exception = true
HOST="127.0.0.1"
# written for python 2.7
#
# CAKe : CEF Army Knife experiment
# A versatile CEF manipulation and generation tool
#
# Author : Gaetan Cardinal
# cardinal_gaetan |at| yahoo.fr
#
# Version: 0.2
# Updated: Jan 2014
@jsvd
jsvd / script.rb
Last active December 13, 2021 12:16
# encoding: utf-8
# Script to test local Logstash instance for JNDI lookups (Log4j vulnerability)
#
# To run, copy script to Logstash folder and run:
#
# bin/ruby script.rb
#
# Script's steps:
# Step 1: setup environment
require 'openssl'
require 'net/http'
def cert_from_url(url)
txt = Net::HTTP.get(URI(url))
OpenSSL::X509::Certificate.new(txt)
end
LEAF_CERTIFICATE = OpenSSL::X509::Certificate.new %q[
-----BEGIN CERTIFICATE-----
# reproducer for https://github.com/jruby/jruby-openssl/issues/236
# If a certificate has two trust paths, jruby doesn't prioritize using non expired certificates, while CRuby (openssl 1.1.1+) does
# In this reproducer we have a leaf certificate with two possible chains:
# a) leaf -> intermediate cert A -> ISRG Root X1 cross-signed by (expired) DST ROOT CA X3 -> (expired) DST ROOT CA X3
# b) leaf -> intermediate cert B -> ISRG Root X1
# JRuby will produce chain a) causing an error, while CRuby produces a valid chain b)
require 'openssl'
require 'net/http'
def cert_from_url(url)
Repos related to CI
- [ ] [logstash-devutils](https://github.com/elastic/logstash-devutils)
- [ ] [docs-tools](https://github.com/elastic/docs-tools)
- [ ] [.ci](https://github.com/logstash-plugins/.ci)
- [ ] [infra](https://github.com/elastic/infra/tree/master/ci/jjb/logstash-ci) (NOTE: no branch changes needed here, only adapting CI jobs)
Repos associated with Docs
- [ ] [logstash-docs](https://github.com/elastic/logstash-docs)
@jsvd
jsvd / 0_setup_readme.txt
Last active April 20, 2021 15:14
reproduce jdbc_static issues
1. start postgres instance using docker
2. generate csv and import it to a "data" table
3. download logstash and the postgres jdbc driver
4. use logstash configuration to stress the jdbc_static filter
# Usage:
#
# ruby send_broken.rb <host> <port> <CA_file> <Cert_file> <Key_file>
# ruby send_broken.rb 127.0.0.1 5044 /Users/joaoduarte/certs/RootCA.crt /Users/joaoduarte/certs/Client-Root.crt /Users/joaoduarte/certs/Client-Root.key
#
# encoding: utf-8
require "socket"
require "zlib"
require "json"
require "openssl"
/tmp/logstash-7.10.1
❯ cat cfg
input {
generator {
codec => json
message => '{"systat": {"start": {"timestamp": {"timesecs": 10}}, "intervals": {"streams": {"end": 10}}}}'
count => 1
}
}
filter {