This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#the following code takes a list such as | |
#[1,1,2,6,8,5,5,7,8,8,1,1,4,5,5,0,0,0,1,1,4,4,5,1,3,3,4,5,4,1,1] | |
#with states labeled as successive integers starting with 0 | |
#and returns a transition matrix, M, | |
#where M[i][j] is the probability of transitioning from i to j | |
def transition_matrix(transitions): | |
n = 1+ max(transitions) #number of states | |
M = [[0]*n for _ in range(n)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
class Server(object): | |
def __init__(self,host,port): | |
self._host = host | |
self._port = port | |
def __enter__(self): | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,1) | |
sock.bind((self._host,self._port)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ubuntu Privacy | |
sudo systemctl stop apport.service | |
sudo systemctl disable apport.service | |
sudo systemctl mask apport.service | |
gsettings set com.ubuntu.update-notifier show-apport-crashes false | |
ubuntu-report -f send no | |
sudo systemctl stop whoopsie.service | |
sudo systemctl disable whoopsie.service | |
sudo systemctl mask whoopsie.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#If possible, add something in for choosing [1] Configure Basics [2] Configure Security [3] Configure VMware Tools [4] Configure All. This might require Perl. | |
#set -x | |
#read -p "Configure this server to be on 192.168.1.3/24?" yn | |
#while true; do | |
#case $yn in | |
# [Yy]* ) | |
# echo "What IP address will be assigned to this server?" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#this may take a while, run with no hup and monitor the log | |
rm blocklist-ipsets/ -r | |
git clone https://github.com/firehol/blocklist-ipsets.git | |
cd blocklist-ipsets/ | |
#We just want the IP's | |
grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" *.ipset > merged-file | |
#We just want the unique IP's across the board | |
sort -u merged-file > merged-file_output | |
#Just the unique ips, iptables | |
for IP in $(cat merged-file_output | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | awk '{print $1}' | sort | uniq); do echo "Banning $IP"; iptables -A INPUT -s $IP/32 -d 0/0 -j DROP; iptables -A INPUT -s $IP/32 -d 0/0 -j LOG --log-prefix 'firehol-iptables-rule-js'; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove previous rules | |
iptables -F | |
iptables -X | |
iptables -Z | |
# Set default policies | |
iptables -P INPUT DROP | |
iptables -P OUTPUT ACCEPT | |
iptables -A INPUT -p tcp --dport 22 -m limit --limit 25/minute --limit-burst 100 -j ACCEPT | |
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT | |
iptables -A INPUT -p tcp --dport 22 -j ACCEPT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import re | |
import socket, struct | |
from ipwhois import IPWhois | |
from ipaddress import ip_network, ip_address | |
ips = [] | |
with open("merged-file3") as f: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import re | |
import socket, struct | |
import datetime | |
ips = [] | |
with open("merged-file3") as f: | |
for line in f: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
import time | |
import threading | |
########################### | |
from multiprocessing import Process | |
import random | |
########################### | |
import dns.resolver | |
import dns.reversename | |
import ftplib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Avg Price Mar Req 1/pt 2/pt 3/pt | |
20 4.2 4.2 8.4 12.6 | |
30 6.3 6.3 12.6 18.9 | |
50 10.5 10.5 21 31.5 | |
70 14.7 14.7 29.4 44.1 | |
85 17.85 17.85 35.7 53.55 | |
102 21.42 21.42 42.84 64.26 | |
119 24.99 24.99 49.98 74.97 | |
136 28.56 28.56 57.12 85.68 | |
153 32.13 32.13 64.26 96.39 |
OlderNewer