Skip to content

Instantly share code, notes, and snippets.

View ankitraturi's full-sized avatar

Ankit Raturi ankitraturi

View GitHub Profile
@ankitraturi
ankitraturi / ddos-ip.sh
Created April 9, 2019 12:33
DDoS Mitigation Script: ban, unban and list IP to CloudFlare via API
#!/bin/sh
##############################################################################
# DDoS Mitigation Script: ban, unban and list IP to CF via API #
# #
##############################################################################
#TODO:: set ddosP in system path
load_conf()
{
@ankitraturi
ankitraturi / ddos-ua.conf
Created April 9, 2019 12:28
DDoS Mitigation Script: ban, unban and list user-agents to CloudFlare via API
##### Paths of the script and other files
PROGDIR="/usr/local/ddos"
PROG="/usr/local/ddos/ddos.sh"
BLOCK_IP_LIST="/usr/local/ddos/block.ip.list"
BLOCK_UA_LIST="/usr/local/ddos/block.ua.list"
IGNORE_IP_LIST="/usr/local/ddos/ignore.ip.list"
IGNORE_UA_LIST="/usr/local/ddos/ignore.ua.list"
IGNORE_IP_KEYWORDS="/usr/local/ddos/ignore.ip.keywords"
IGNORE_UA_KEYWORDS="/usr/local/ddos/ignore.ua.keywords"
IGNORE_NETWORK_LIST="/usr/local/ddos/ignore.network.list"
@ankitraturi
ankitraturi / ddos.conf
Created April 9, 2019 12:17
ddos Mitigation
##### Paths of the script and other files
PROGDIR="/usr/local/ddos"
PROG="/usr/local/ddos/ddos.sh"
IGNORE_IP_LIST="/usr/local/ddos/ignore.ip.list"
IGNORE_NETWORK_LIST="/usr/local/ddos/ignore.network.list"
#CRON="/etc/cron.d/ddos.cron"
APF="/etc/apf/apf"
IPT="/sbin/iptables"
##### frequency in minutes for running the script
#!/bin/bash
declare -a dbs
unset opt
for each in $(echo "show databases;" | mysql -u root) ;do
dbs+=($each)
done
@ankitraturi
ankitraturi / ConvertCurrency.php
Last active April 12, 2018 05:28
XE Live currency conversion in PHP
function convertCurrency($from = null, $to = null, $amt = null) {
$url = "https://www.xe.com/currencyconverter/convert/?Amount=$amt&From=$from&To=$to";
$ch = curl_init(); // Initialize a CURL session.
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Return Page contents.
curl_setopt($ch, CURLOPT_URL, $url); // Pass URL as parameter.
$data = curl_exec($ch); // grab URL and pass it to the variable.
curl_close($ch); // close curl resource, and free up system resources.
/*
This CSS is used for responsive tables.
id of the table parent should be 'no-more-tables'.
table should have class 'table'
*/
table {
width: 100%;
border-collapse: collapse;
}
<?php
/**
* @author Anush Prem <goku.anush@gmail.com>
* @package Solver
* @subpackage Sudoku
* @version 0.1
*/
/**
@ankitraturi
ankitraturi / breadthFirstSearch
Last active August 29, 2015 14:17
Breadth First Search in PHP for binary tree
<?php
Class Test extends SplQueue
{
}
$queue = [];
//SplQueue new object
$dummyQueue = new test();