Skip to content

Instantly share code, notes, and snippets.

ProductID Database
106 GeoIP.dat
111 GeoIPOrg.dat
112/115 GeoIPRegion.dat
117 GeoIPASNum.dat
119 GeoIPUserType.dat
121/122 GeoIPISP.dat
132/133 GeoIPCity.dat
135 GeoIPAreaCode.dat
137 GeoIPDMACode.dat
@dcode
dcode / install-bro-w_pfring_and_options.sh
Created October 22, 2015 14:02
Install bro packages that include PF_RING and optional performance enhancements on CentOS 7
# Install epel
sudo yum -y install epel-release
# Install kernel headers for current kernel
sudo yum install -y kernel-devel-$(uname -r) kernel-headers-$(uname -r)
# Install ntop repos
cat << EOF | sudo tee /etc/yum.repos.d/ntop.repo
[ntop]
name=ntop packages
@dcode
dcode / kafka commands.md
Last active August 19, 2021 15:47
Some kafka operations

Commands to check various states of Kafka

NOTE: Code blocks indicate input on prompt with a '$'. Everything else is output

Create a new topic

$ /opt/kafka/bin/kafka-topics.sh --topic my_topic --zookeeper localhost:2181 --create --partitions 1 --replication-factor 1
Created topic "my_topic".
@drmalex07
drmalex07 / README-oneshot-systemd-service.md
Last active July 7, 2024 19:47
An example with an oneshot service on systemd. #systemd #systemd.service #oneshot

README

Services declared as oneshot are expected to take some action and exit immediatelly (thus, they are not really services, no running processes remain). A common pattern for these type of service is to be defined by a setup and a teardown action.

Let's create a example foo service that when started creates a file, and when stopped it deletes it.

Define setup/teardown actions

Create executable file /opt/foo/setup-foo.sh:

@dcode
dcode / snort_unified2_output.sh
Created January 19, 2016 21:10
Configure Snort w/ the RPM for unified2 output
sudo sed -i'' 's/^# output unified2/output unified2/' /etc/snort/snort.conf
sudo sed -i'' 's/ALERTMODE/#ALERTMODE/' /etc/sysconfig/snort
@rhwood
rhwood / rpi3-wireless-drivers.sh
Last active August 2, 2017 12:39
CentOS 7 Raspberry Pi 3 Wireless Drivers
#!/bin/bash
curl --location https://github.com/raspberrypi/firmware/raw/master/boot/bcm2710-rpi-3-b.dtb > /boot/bcm2710-rpi-3-b.dtb
curl --location https://github.com/RPi-Distro/firmware-nonfree/raw/54bab3d6a6d43239c71d26464e6e10e5067ffea7/brcm80211/brcm/brcmfmac43430-sdio.bin > /usr/lib/firmware/brcm/brcmfmac43430-sdio.bin
curl --location https://github.com/RPi-Distro/firmware-nonfree/raw/54bab3d6a6d43239c71d26464e6e10e5067ffea7/brcm80211/brcm/brcmfmac43430-sdio.txt > /usr/lib/firmware/brcm/brcmfmac43430-sdio.txt
echo "Reboot to ensure the dtb is initialized and kernel knows about the hardware in place."
echo
@dcode
dcode / http_gauss_browse.py
Last active June 1, 2016 14:07
Takes in a list of CSV ordered by (rank,domain) (from Alexa, for instance) and browses the highest ranking more often.
#!/usr/bin/env python2
from multiprocessing import Pool
from time import sleep
from random import randint, gauss
import os, sys
import requests
## TODO
# . recursively download linked resources:
# . images
@et0x
et0x / Get-DownloadedPEHashes.ps1
Created August 8, 2016 17:32
Get the hashes of all exe / dll files downloaded from the internet. Checks for the Zone.Identifier ADS and ensures the value is 3.
function Get-DownloadedPEHashes
{
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true, Position=0)]
[String]$Path,
[Switch]$Recursive = $true
)
if (!$Path.EndsWith('\'))
@dcode
dcode / json2csv.jq
Created August 30, 2016 16:58
Useful for mapping JSON to CSV when each of the records have the same structure. You can put this into a script and `chmod +x` it.
#!/usr/local/bin/jq -s -r -f
( map(keys) | add | unique ) as $cols |
map(. as $row | $cols | map($row[.])) as $rows |
$cols, $rows[] | @csv
@dcode
dcode / [email protected]
Last active September 7, 2016 16:27
Example template service file for multiple instances. Set `node.name` in `elasticsearch.yml` to ${NODENAME}.
[Unit]
Description=Elasticsearch
Documentation=http://www.elastic.co
Wants=network-online.target
After=network-online.target
[Service]
Environment=ES_HOME=/usr/share/elasticsearch
Environment=CONF_DIR=/etc/elasticsearch
Environment=DATA_DIR=/var/lib/elasticsearch