Skip to content

Instantly share code, notes, and snippets.

@mattm7n
mattm7n / gist:1405067
Created November 29, 2011 14:54
Monitor DHCP traffic with tcpdump
# Monitoring on interface eth0
tcpdump -i eth0 -n port 67 and port 68
@marcelom
marcelom / pysyslog.py
Created December 5, 2012 18:06
Tiny Python Syslog Server
#!/usr/bin/env python
## Tiny Syslog Server in Python.
##
## This is a tiny syslog server that is able to receive UDP based syslog
## entries on a specified port and save them to a file.
## That's it... it does nothing else...
## There are a few configuration parameters.
LOG_FILE = 'youlogfile.log'
@plentz
plentz / nginx.conf
Last active June 9, 2024 13:18
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@haukurk
haukurk / syslogger.py
Created December 11, 2014 17:04
Logger that sends to syslog servers.
#!/usr/bin/python
# -*- encoding: iso-8859-1 -*-
"""
Python syslog client.
This code is placed in the public domain by the author.
Written by Christian Stigen Larsen.
This is especially neat for Windows users, who (I think) don't
@warewolf
warewolf / iptables.txt
Last active February 8, 2022 16:52
iptables based rate limiting
-A INPUT -i eth0 -p udp -m udp --dport 5060 -j SIP
#
-A SIP -i eth0 -p udp -m udp --dport 5060 -m string --string "INVITE" --algo bm --from 23 --to 28 -m comment --comment "Catch SIP INVITEs" -j SIPINVITE
-A SIP -i eth0 -p udp -m udp --dport 5060 -m string --string "REGISTER" --algo bm --from 23 --to 30 -m comment --comment "Catch SIP REGISTERs" -j SIPREGISTER
-A SIP -m comment --comment "Catch and accept everything else" -j ACCEPT
#
-A SIPINVITE -m hashlimit --hashlimit-upto 4/min --hashlimit-burst 4 --hashlimit-mode srcip,dstip,dstport --hashlimit-name anon-sip-rateinv --hashlimit-srcmask 24 -m comment --comment "Rate limit SIP invites" -j ACCEPT
-A SIPINVITE -m limit --limit 10/min -j LOG --log-prefix "SIPINV DROP: "
-A SIPINVITE -m comment --comment "Rate limit exceeded, reject" -j REJECT
#
@tbranyen
tbranyen / _usage.md
Last active April 19, 2024 12:24
OpenWeatherMap / Weather Icons integration
  1. Include Weather Icons in your app: https://github.com/erikflowers/weather-icons

  2. Include the below JSON in your application, for example purposes, lets assume it's a global named weatherIcons.

  3. Make a request to OpenWeatherMap:

req = $.getJSON('http://api.openweathermap.org/data/2.5/weather?q=London,uk&callback=?');
@bigsnarfdude
bigsnarfdude / gist:b6ae4dbd1b9b60d40cba
Created January 7, 2016 17:23
incident report template
Example infrastructure outage incident report
Friday, May 13, 2077
By the Example Security Team
Earlier this week we experienced an outage in our API infrastructure. Today we’re providing an incident report that details the nature of the outage and our response.
The following is the incident report for the Example Security outage that occurred on April 30, 2077. We understand this service issue has impacted our valued developers and users, and we apologize to everyone who was affected.
@cephurs
cephurs / blacklist.txt
Created February 26, 2016 03:42 — forked from jedisct1/blacklist.txt
2500+ IP malicious IP addresses
2500+ IP addresses dedicated to serving malware.
1.168.33.91
103.12.217.155
103.242.11.1
103.242.11.94
103.243.51.129
103.253.141.43
103.255.101.168
@alirobe
alirobe / reclaimWindows10.ps1
Last active June 7, 2024 16:24
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
###
@rchrd2
rchrd2 / test-php-basic-auth.php
Last active February 1, 2024 21:18 — forked from westonruter/test-php-basic-auth.php
PHP basic auth example
<?php
function require_auth() {
$AUTH_USER = 'admin';
$AUTH_PASS = 'admin';
header('Cache-Control: no-cache, must-revalidate, max-age=0');
$has_supplied_credentials = !(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['PHP_AUTH_PW']));
$is_not_authenticated = (
!$has_supplied_credentials ||
$_SERVER['PHP_AUTH_USER'] != $AUTH_USER ||
$_SERVER['PHP_AUTH_PW'] != $AUTH_PASS