Skip to content

Instantly share code, notes, and snippets.

View rikatz's full-sized avatar
Away for the next days

Ricardo Katz rikatz

Away for the next days
View GitHub Profile
@rikatz
rikatz / test cert
Created October 24, 2017 01:55
Test Certificate existense
<?php
$headers = apache_request_headers();
$cert1 = str_replace("\\n","\n",$headers['ssl-client-cert']);
if(!empty($cert1)) {
$certificado = openssl_x509_read($cert1);
$certuser = openssl_x509_parse($certificado);
$username = $certuser['subject']['CN'];
@rikatz
rikatz / calicolab.txt
Created January 14, 2018 22:09
Calico Lab
-- If using GCE as your provider, you must first create networks, firewall rules and Instances
-- The following is based in Kelsey Hightower 'Kubernetes The Hard Way' tutorial
gcloud compute networks create calico-demo --subnet-mode custom
gcloud compute networks subnets create kubernetes \
--network calico-demo \
--range 10.240.0.0/24
@rikatz
rikatz / area31bot.go
Last active September 11, 2018 01:37
Area 31 bot
package main
import (
"log"
"os"
"regexp"
"github.com/go-telegram-bot-api/telegram-bot-api"
)
@rikatz
rikatz / eventexporter.yml
Created November 5, 2018 18:21
Kubernetes Events Export with Metricbeat + Logstash
---
apiVersion: v1
kind: ConfigMap
metadata:
name: metricbeat-config
namespace: kube-system
labels:
k8s-app: metricbeat
data:
metricbeat.yml: |-
@rikatz
rikatz / eventexporter.yml
Last active November 8, 2018 18:36
Deployment to get EVENTS from Kubernetes and put them into a logstash/beats/graylog collector
---
apiVersion: v1
kind: ConfigMap
metadata:
name: metricbeat-config
namespace: kube-system
labels:
k8s-app: metricbeat
data:
metricbeat.yml: |-
package main
import (
"errors"
"fmt"
"net"
"strings"
"sync"
"syscall"
guestinfo.userdata = "IyMgdGVtcGxhdGU6IGppbmphCiNjbG91ZC1jb25maWcKCndyaXRlX2ZpbGVzOgotICAgcGF0aDogL3Vzci9sb2NhbC9iaW4va3ViZWFkbS1ib290c3RyYXAtc2NyaXB0CiAgICBvd25lcjogcm9vdAogICAgcGVybWlzc2lvbnM6ICcwNzU1JwogICAgY29udGVudDogfAogICAgICAjIS9iaW4vYmFzaAogICAgICAjIENvcHlyaWdodCAyMDIwIFRoZSBLdWJlcm5ldGVzIEF1dGhvcnMuCiAgICAgICMKICAgICAgIyBMaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wICh0aGUgIkxpY2Vuc2UiKTsKICAgICAgIyB5b3UgbWF5IG5vdCB1c2UgdGhpcyBmaWxlIGV4Y2VwdCBpbiBjb21wbGlhbmNlIHdpdGggdGhlIExpY2Vuc2UuCiAgICAgICMgWW91IG1heSBvYnRhaW4gYSBjb3B5IG9mIHRoZSBMaWNlbnNlIGF0CiAgICAgICMKICAgICAgIyAgICAgaHR0cDovL3d3dy5hcGFjaGUub3JnL2xpY2Vuc2VzL0xJQ0VOU0UtMi4wCiAgICAgICMKICAgICAgIyBVbmxlc3MgcmVxdWlyZWQgYnkgYXBwbGljYWJsZSBsYXcgb3IgYWdyZWVkIHRvIGluIHdyaXRpbmcsIHNvZnR3YXJlCiAgICAgICMgZGlzdHJpYnV0ZWQgdW5kZXIgdGhlIExpY2Vuc2UgaXMgZGlzdHJpYnV0ZWQgb24gYW4gIkFTIElTIiBCQVNJUywKICAgICAgIyBXSVRIT1VUIFdBUlJBTlRJRVMgT1IgQ09ORElUSU9OUyBPRiBBTlkgS0lORCwgZWl0aGVyIGV4cHJlc3Mgb3IgaW1wbGllZC4KICAgICAgIyBTZWUgdGhlIExpY2Vuc2UgZm9yIHRoZS
curieproxy | [2020-11-13 11:58:48.429][9][debug][main] [source/server/server.cc:174] flushing stats
curieproxy | [2020-11-13 11:58:48.697][15][debug][conn_handler] [source/server/connection_handler_impl.cc:353] [C3] new connection
curieproxy | [2020-11-13 11:58:48.698][15][debug][http] [source/common/http/conn_manager_impl.cc:264] [C3] new stream
curieproxy | [2020-11-13 11:58:48.698][15][debug][http] [source/common/http/conn_manager_impl.cc:764] [C3][S14358749960589937270] request headers complete (end_stream=true):
# import socket programming library
import socket
# import thread module
from _thread import *
import threading
print_lock = threading.Lock()
class frame():
80ms 44.11s (flat, cum) 91.61% of Total
. . 7:
. . 8: "unicode/utf8"
. . 9:)
. . 10:
. . 11://ModsecTransaction parses a request and return if it needs intervention
20ms 20ms 12:func ModsecTransaction(request *apis.Request, agent *ModsecAgent) (intervention bool, err error) {
. . 13:
. . 14: var path string
. . 15: