Skip to content

Instantly share code, notes, and snippets.

View kohnakagawa's full-sized avatar
🌴
On vacation

tsunekoh kohnakagawa

🌴
On vacation
View GitHub Profile
@kohnakagawa
kohnakagawa / tlsh_test.go
Created January 17, 2019 13:57
tlsh example in Go lang
package main
import (
tlsh "github.com/glaslos/tlsh"
"fmt"
"os"
"io/ioutil"
)
func readBinary(fname string) ([]byte, error) {
@kohnakagawa
kohnakagawa / ssdeep_test.go
Created January 17, 2019 13:32
ssdeep example in Go lang
package main
import (
ssdeep "github.com/glaslos/ssdeep"
"fmt"
"os"
"io/ioutil"
)
func main() {
@kohnakagawa
kohnakagawa / notify-annict-info.py
Created January 12, 2019 06:06
annict graphql をつかって、今期アニメ視聴者数Top10をとってきてSlackに通知するためのスクリプト
#!/usr/bin/python3
import requests
import slackweb
import datetime
import sys
import configparser
@kohnakagawa
kohnakagawa / notify-cfp-info.py
Last active January 6, 2019 10:33
cfp timesの新着情報を取得して投稿するためのスクリプト
#!/usr/bin/env python3
import requests
import sqlite3
import json
import slackweb
import datetime
import sys
import os
@kohnakagawa
kohnakagawa / gsl_quantile.cpp
Created January 4, 2019 07:56
GSLでquantileを計算する例
#include <iostream>
#include <tuple>
#include <vector>
#include <algorithm>
#include <utility>
#include <gsl/gsl_statistics.h>
template<typename T>
std::tuple<double, double, double> make_quantile(const std::vector<T>& input) {
std::vector<double> sorted_buffer(input.size());
@kohnakagawa
kohnakagawa / lief_cpp_example.cpp
Created January 3, 2019 10:42
LIEFのC++バインディングの例
#include <iostream>
#include <fstream>
#include <memory>
#include <LIEF/LIEF.hpp>
int main() {
const size_t size = 245761;
std::ifstream fin("/mnt/c/Windows/System32/notepad.exe", std::ios::binary);
std::vector<uint8_t> buffer(size);
fin.read((char*)buffer.data(), size);
@kohnakagawa
kohnakagawa / docker-compose.yml
Last active December 29, 2018 23:29
Drone CI server docker-compose.yml
version: '2'
services:
drone-server:
image: drone/drone:1.0.0-rc.3
ports:
- 8888:80
- 443:443
volumes:
- /var/run/docker.sock:/var/run/docker.sock
@kohnakagawa
kohnakagawa / fuzzy_hash.py
Created November 25, 2018 06:39
fuzzy hashを計算し、簡易的にクラスタリングを行うためのツール
import ssdeep
import pyimpfuzzy as pyimf
import sys
import pandas as pd
from hashlib import sha256
from itertools import combinations
from pylouvain.pylouvain import PyLouvain
SS_THRESHOLD = 30
@kohnakagawa
kohnakagawa / crypto_hash.py
Created November 25, 2018 06:38
pehash imphashを計算するためのツール
import pandas as pd
import numpy as np
import sys
from hashlib import sha256
from pefile import PE
from pehash import totalhash_hex, anymaster_hex, anymaster_v1_0_1_hex
from pehash import endgame_hex, crits_hex
from sklearn.metrics import homogeneity_score
@kohnakagawa
kohnakagawa / neo4jtest.py
Last active November 22, 2018 07:02
クラスタリングの結果をneo4jで可視化するためのスクリプト
import pandas as pd
import numpy as np
from random import randint
from numpy import linalg as LA
from itertools import combinations
from sklearn import datasets
from sklearn.cluster import KMeans
from sklearn.metrics.cluster import homogeneity_score
from neomodel import StructuredNode, StructuredRel
from neomodel import StringProperty, FloatProperty