#Country ban with UFW#
Grab your different country ip addresses and save as Linux IPTables
http://www.ip2location.com/free/visitor-blocker
##Add country## Run the following command
| #!/bin/bash | |
| # Go to our working directory | |
| cd /tmp | |
| # Download Blacklist | |
| wget https://lists.blocklist.de/lists/all.txt --no-check-certificate | |
| wget http://opendbl.net/lists/talos.list | |
| # List cleaning |
| sudo ufw status numbered | grep 'DENY IN' | awk -F] '{print $1}' | sed 's/\[\s*//' | tac | xargs -n 1 bash -c 'yes|sudo ufw delete $0 |
| #!/usr/bin/env python | |
| # Parse disk:* from lshw -xml | |
| """ | |
| Sample Output: | |
| ATA Disk Hitachi HDS72105 /dev/sda | |
| Disk Space: 500107862016 | |
| Sector size: 512 |
| #!/usr/bin/env python3 | |
| import argparse | |
| import pprint | |
| import os | |
| import sys | |
| import datetime | |
| import signal | |
| from time import sleep | |
| from lxml import etree |
| #!/usr/bin/env python3 | |
| import requests | |
| import sys | |
| import xml.etree.ElementTree as ET | |
| import datetime | |
| # ICECAST RELATED CONSTANTS | |
| STATS_URL = "http://<URL>" | |
| ICECAST_USER = "<USER>" |
| import xml.etree.ElementTree as ET | |
| import urllib.request as MYURL | |
| # tree = ET.parse('song.xml') | |
| # rss = tree.getroot() | |
| # for element in rss.findall('.channel/song'): | |
| # print(element.attrib.get('sname')) | |
| # print(element.findtext('title')) | |
| # print(element.findtext('singer')) | |
| kmaURL = "http://www.kma.go.kr/weather/forecast/mid-term-rss3.jsp?stnId=109" |
#Country ban with UFW#
Grab your different country ip addresses and save as Linux IPTables
http://www.ip2location.com/free/visitor-blocker
##Add country## Run the following command
| #!/usr/local/bin/python | |
| import os | |
| import plivo | |
| import sys | |
| from time import strftime | |
| if not os.path.isdir(PATH): | |
| sys.exit() |
| #!/bin/bash | |
| date=`date +%Y-%m-%d` | |
| RETENTION_PERIOD="7" | |
| HEADER="Backup data" | |
| remove_oldfiles(){ | |
| echo "Removing directory $1 files older than $RETENTION_PERIOD days" | wall | |
| find $1 -type f -mtime +$2 -exec rm '{}' \; | |
| } | |
| BACKUPDIR="/disk0/svn_backup/001/" |
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| from os import listdir | |
| import json | |
| net = '/sys/class/net' | |
| stat = net + '/{}/statistics/{}x_bytes' | |
| interfaces = filter(lambda x: 'eth' in x, listdir(net)) |