Skip to content

Instantly share code, notes, and snippets.

View mertyildiran's full-sized avatar
:octocat:
Doing some octopus work

M. Mert Yildiran mertyildiran

:octocat:
Doing some octopus work
View GitHub Profile
@mertyildiran
mertyildiran / example.js
Last active March 24, 2023 01:36
JavaScript code with issues
var kflPcapS3Data = null;
wrapper.kflPcapS32 = function (data, params) {
function kflPcapS3detect(data) {
if (kflPcapS3Data === null)
return;
kflPcapS3Data.kflArr.forEach(function (kflQuery, idx) {
if (kfl.match(kflQuery, data)) {
kflPcapS3Data.pcapInfoArr[idx].pcapArr.push(data.stream);
@mertyildiran
mertyildiran / out.txt
Created February 3, 2023 23:56
Kubeshark segmentation violation
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7f124447b5ca]
runtime stack:
runtime.throw({0x1b8c38e, 0x7f11d8000d53})
/usr/local/go/src/runtime/panic.go:1198 +0x71
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:719 +0x396
goroutine 659 [syscall]:
@mertyildiran
mertyildiran / Dockerfile
Created December 28, 2022 14:14
Nginx with runtime-env-cra
FROM nginx:1.22.0-alpine
RUN rm -rf /etc/nginx/conf.d
RUN apk add --update nodejs
RUN apk add --update npm
RUN npm install -g runtime-env-cra@0.2.4
@mertyildiran
mertyildiran / main.go
Created May 31, 2022 20:45
Go HTTP request weird behavior
package main
import (
"fmt"
"net/http"
"strings"
)
// build with: go build -o main main.go
@mertyildiran
mertyildiran / README.md
Last active October 9, 2021 11:09
HTTP dissector with TCPDUMP

Reproducing malformed HTTP packets

This is a slightly edited version of reassemblydump example of GoPacket.

Setup Sock Shop and its load tests in Google Kubernetes Engine.

Add and enter into sniffer pod:

kubectl run tapper-test -n sock-shop --rm -i --tty --overrides='{"spec": {"hostNetwork": true}}' --image mertyildiran/tapper-test -- /bin/bash
@mertyildiran
mertyildiran / README.md
Last active September 15, 2021 11:02
Mizu Traffic Storage Solutions

Mizu Traffic Storage Solutions

In this Gist, three solutions will be proposed for the traffic storage in Mizu:

  • Migrate to MongoDB, add a collection per protocol and an additional collection for TCP-level information. Indexes defined per protocol.
  • Migrate to a log oriented solution like Elasticsearch/KQL.
  • Develop a custom DBMS that's specialized in traffic storage, store dissected packets in binary files. (Let's say its name is Basenine)

Docker image size with SQLite: 85.5MB

@mertyildiran
mertyildiran / admin_client.py
Created September 3, 2021 23:45
Kafka Py demo code
from confluent_kafka.admin import AdminClient, NewTopic
a = AdminClient({'bootstrap.servers': 'kafka:9092'})
new_topics = [NewTopic(topic, num_partitions=3, replication_factor=1) for topic in ["topic1", "topic2"]]
# Note: In a multi-cluster production scenario, it is more typical to use a replication_factor of 3 for durability.
# Call create_topics to asynchronously create topics. A dict
# of <topic,future> is returned.
print("CreateTopic")
@mertyildiran
mertyildiran / consume.go
Last active September 3, 2021 23:44
Kafka Go demo code
package main
import (
"context"
"fmt"
"log"
"time"
"github.com/segmentio/kafka-go"
)
@mertyildiran
mertyildiran / 29-mizutest-amqp-py-dep.yaml
Last active September 4, 2021 23:23
Mizu message queue capture on Kubrenetes
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mizutest-amqp-py
labels:
name: mizutest-amqp-py
namespace: sock-shop
spec:
replicas: 1
@mertyildiran
mertyildiran / README.md
Last active December 10, 2021 00:54
Mizu Development Workflow

In this tutorial we'll explain two development workflows for Mizu:

  • Standard development workflow that you build a Docker image, publish into Docker Hub and pull it to Kubernetes. The workflow is only necessary if you're developing some Kubernetes specific feature.
  • Local machine development workflow that you run Mizu Agent on your machine with sudo privileges. Which is much faster than the standard development workflow and can be used if you're not developing a Kubernetes specific feature.

Standard Development Workflow

Whenever you make changes in the agent and tap packages or protocol extensions to test it; you first need to build a Docker image: