Skip to content

Instantly share code, notes, and snippets.

@elico
elico / Dockerfile
Last active July 9, 2016 22:52
betolj/ndpi-netfilter opensuse docker build node
FROM opensuse:leap
RUN zypper --non-interactive ref \
&& zypper --non-interactive install --type pattern devel_basis devel_C_C++ devel_kernel \
&& zypper --non-interactive install libxtables-devel libnetfilter_conntrack-devel xtables-addons libjson-c-devel \
&& zypper --non-interactive install kernel-default kernel-default-devel kmod \
&& zypper --non-interactive install libpcap-devel git \
&& zypper --non-interactive clean
RUN mkdir /build
@elico
elico / Dockerfile
Last active July 5, 2016 18:05
CentOS 6 x86_64 https://github.com/betolj/ndpi-netfilter docker build files
FROM centos:6
ADD RPM-GPG-KEY-elrepo.org /etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
ADD elrepo.repo /etc/yum.repos.d/elrepo.repo
RUN rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm \
&& yum remove -y kernel-headers kernel kernel-devel \
&& yum update -y \
&& yum --enablerepo=elrepo-kernel install -y kernel-lt kernel-lt-devel kernel-lt-doc.noarch kernel-lt-headers \
&& yum groupinstall -y "Development Tools" \
@elico
elico / Dockerfile
Last active July 6, 2016 01:20
Debian wheezy netfilter-ndpi
FROM debian:wheezy
RUN echo "deb http://ftp.debian.org/debian/ wheezy-backports main non-free contrib" >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get upgrade -y \
&& apt-get -t wheezy-backports install -y linux-image-amd64 linux-headers-amd64 \
&& apt-get install -y build-essential iptables-dev iptables conntrack libnetfilter-conntrack-dev \
&& apt-get install -y autoconf libtool git libpcap-dev \
&& apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y
@elico
elico / fetch-task.sh
Created July 10, 2016 21:19
ms-updates-logger-proxy
#!/usr/bin/env bash
lockfile -r 0 /tmp/store-fetcher.lock || exit 1
/usr/bin/store-fetcher -dir=/var/storedata
echo ""
echo ""
echo "removing lock file: /tmp/store-fetcher.lock"
rm -f /tmp/store-fetcher.lock
@elico
elico / check-add-hit.sh
Created July 18, 2016 15:04
Add CDN HIT notation
#!/usr/bin/env bash
HEADERSDIR=/opt/dir/
function add() {
grep -H "X-SHMSCDN: HIT" $1 || perl -pi -e '$/="";s/\r\n\r\n/\r\nX-SHMSCDN: HIT\r\n\r\n/;' $1
}
if [ "$1" = "-add" ]; then
shift 1
@elico
elico / private-public-test.sh
Created July 19, 2016 18:51
A script to verify how many private objects are being stored in the store
#!/usr/bin/env bash
#ls /mnt/wu/storedata/header/v1/ | xargs -l1 grep -i "public"
#ls /mnt/wu/storedata/header/v1/ | xargs -l1 grep -i "private"
# Change the directory to reflect your use case
DIR=/mnt/wu/storedata/header/v1/
FILES=($(/bin/ls "$DIR"))
@elico
elico / client.go
Created July 26, 2016 00:21
golang tcp client connection alive check
package main
import (
"fmt"
"io"
"net"
"time"
)
func main() {
@elico
elico / squid-domslog.go
Created July 26, 2016 23:07
A request domains logger
package main
/*
license note
Copyright (c) 2016, Eliezer Croitoru
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
@elico
elico / bypassdoms.sh
Created September 29, 2016 20:30
iptables specific domains intercept bypass
#!/usr/bin/env bash
set -x
iptables -t nat -L PREROUTING |grep bypasspool
if [ "$?" -ne "0" ];then
iptables -t nat -I PREROUTING -m set --match-set bypasspool dst,src -j ACCEPT
fi
ipset create bypasspool hash:ip
@elico
elico / Dockerfile
Created November 25, 2016 21:22
vyos iso build docker
FROM debian:squeeze
#MAINTAINER Chris Bennett <[email protected]>
MAINTAINER Eliezer Croitoru <[email protected]>
ENV DEBIAN_FRONTEND noninteractive
ADD sources.list /etc/apt/sources.list
ENV PATH="/data/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"