Skip to content

Instantly share code, notes, and snippets.

View knqyf263's full-sized avatar

Teppei Fukuda knqyf263

View GitHub Profile
@knqyf263
knqyf263 / client.rb
Last active August 29, 2015 14:24
Alternative chains certificate forgery(CVE-2015-1793)
require 'net/https'
https = Net::HTTP.new('bad', 12345)
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_PEER
https.ca_file = 'certs/roots.pem'
https.start { |h|
response = h.get("/")
puts response.body
}
@knqyf263
knqyf263 / Makefile
Last active August 23, 2017 05:10
LKM rootkit
KERNDIR := /lib/modules/`uname -r`/build
BUILD_DIR := $(shell pwd)
VERBOSE = 0
obj-m := syscall_replace.o
smallmod-objs := syscall_replace.o
all:
bash set_syscall_table_address.sh
make -C $(KERNDIR) SUBDIRS=$(BUILD_DIR) KBUILD_VERBOSE=$(VERBOSE) modules
@knqyf263
knqyf263 / pet-snippet.toml
Last active March 12, 2017 09:08
description
[[snippets]]
description = "Create a .keep file in all empty directories"
command = "find . -type d -empty -print0 | xargs -0 -I % touch %/.keep"
[[snippets]]
description = "Display all listen port"
command = "lsof -Pan -i tcp -i udp"
[[snippets]]
description = "Process with the largest memory usage"
@knqyf263
knqyf263 / redis_test.go
Last active May 16, 2023 14:11
go-redis pipeline
func TestRedis(t *testing.T) {
s, _ := testutil.PrepareTestRedis()
for i := 0; i < 10000; i++ {
s.Set("key"+strconv.Itoa(i), "hoge"+strconv.Itoa(i))
}
client := redis.NewClient(&redis.Options{Addr: s.Addr()})
// 普通にループ
result := map[string]string{}
for i := 0; i < 10000; i++ {
http.HandleFunc("/slash", func(w http.ResponseWriter, r *http.Request) {
s, err := slack.SlashCommandParse(r)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
}
if !s.ValidateToken(verificationToken) {
w.WriteHeader(http.StatusUnauthorized)
return
#!/usr/bin/python
#coding:utf-8
import json, toml, hashlib
groups = {
'default': [],
'develop': []
}
@knqyf263
knqyf263 / README.md
Last active January 30, 2019 08:09
Infinite loop
@knqyf263
knqyf263 / Dockerfile
Last active May 3, 2019 18:08
rpm debug
FROM centos:7
RUN yum -y update \
&& yum -y groupinstall "Development tools" \
&& yum -y install git vim openssl openssl-devel nspr nspr-devel nss nss-devel \
file file-devel popt popt-devel lua-static lua-devel db4 db4-devel wget tar \
libarchive libarchive-devel strace gdb-gdbserver libdb-devel lzma xz-devel
RUN git clone https://github.com/rpm-software-management/rpm.git \
&& cd rpm \
&& git checkout rpm-4.11.3-release \
@knqyf263
knqyf263 / main.go
Last active March 30, 2020 16:20
mmap panic
package main
import (
"fmt"
"io/ioutil"
"os"
"syscall"
"unsafe"
"golang.org/x/sys/unix"
@knqyf263
knqyf263 / policy.yaml
Last active July 29, 2022 18:56
Kyverno Vulnerability Attestation
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: check-vulnerabilities
spec:
validationFailureAction: enforce
webhookTimeoutSeconds: 10
failurePolicy: Fail
rules:
- name: no-critical-vuln