IPdeny.com – Download collections of Country IP Addresses

IPdeny.com is a service which offers a free collection of Regional and Country IP address blocks list.

ipdeny

The IP address blocks is useful for application developer and system administrator to enhance their system. For example, application developer can use the information redirect users from certain countries to regional websites or pages, or a system administrator can use the IP address information to isolate users from different countries.

How to Optimize and speed up PHP with OPCache

PHP 5.5 and 5.6 comes with OPCache. OPCache speeds up PHP execution by storing precompile bytecode of PHP in shared memory. Taking advantage of fast memory operations compared to hard disk operation, OPCache eliminates the process of having to read PHP scripts from the disk each time whenever a script must be executed.

In short, OPCache saves the time needed to serve PHP-powered websites!

How to enable OPCache?
This tutorial is written from Ubuntu 14.04 LTS standpoint – using php5-fpm, but it should also work for other Linux distro.

  1. First edit ‘/etc/php5/fpm/php.ini‘ file.
  2. Find “opcache” section in the PHP ini.
  3. Uncomment and change opcache.enable to opcache.enable=1
  4. Do the same for >opcache.memory_consumption, changed its value from 64 to 128 (or 256)
  5. Change opcache.interned_strings_buffer from 4 to 16
  6. Changed the opcache.max_accelerated_files to 8192

Activate OPCache with php5enmod command.

sudo php5enmod opcache

Save file and restart php5-fpm.

sudo service php5-fpm restart

PHP OPCache should be running on your server now. Here’s a reference of /etc/php/fpm/php.ini file in Ubuntu 14.04 LTS.

[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=1

; Determines if Zend OPCache is enabled for the CLI version of PHP
opcache.enable_cli=0

; The OPcache shared memory storage size.
opcache.memory_consumption=128

; The amount of memory for interned strings in Mbytes.
opcache.interned_strings_buffer=16

; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 100000 are allowed.
opcache.max_accelerated_files=8192

BONUS: How to verify whether PHP OPCache is running ??
You can verify whether OPCache is running by using opcache-status by Rasmus Lerdorf. Just drop the script in one of your web directory and browse. If you’re not a Git fan, I’ve also have taken the liberty of mirroring the download: opcache-status.zip

opcache-status screenshot
opcache-status-ss

How to check if your website supports SPDY 3.1

Although Google has announce to drop SPDY support by early February 2016 in favor of HTTP/2, SPDY remains the best HTTP protocol extension to maximize compression and reduce webpage load latency.

The current and final SPDY implementation supported by Mozilla Firefox and Google Chrome is SPDY/3.1.

In order to check if your webserver supports SPDY 3.1, just simply:

  1. Go to your website, eg: https://blog.mypapit.net/
  2. Using Chrome, type – “chrome://net-internals/#spdy” at the addressbar
  3. You should see your website name and spdy/3.1 protocol listed, refer to Screenshot below

spdy

Additionally, you could go to spdycheck.org to check if your web server supports SPDY.

Have fun!

How to send Email with SMTP using Telnet in GNU/Linux

SMTP is a protocol to send email over the internet and it is documented in RFC821. Sending email using Telnet is straight-forward if you know how to do it.

telnet smtp.example.com 25
MAIL FROM: <example_from @ example.com>
RCPT TO: <example_to @ example.com>
DATA
From: [John Doe] <example_from @ example.com>
To: [Jane Doe] <example_to @ example.com>
Subject: This is a test message....

This is an example email content to demonstrate email sending using Telnet.

.

QUIT
[/pre]

Note that you need to type "." and QUIT after you've finished writing the email content. You should change the SMTP server domain and the email used in the example accordingly.



BlackBuntu – Ubuntu-flavored Linux Penetration Distro

Blackbuntu is a Ubuntu-based distro used for penetration testing and security auditing. Blackbuntu is designed to be used by students and practitioners who are interested in the field of information security.

Blackbuntu tools are divided into several categories:

  • Information Gathering
  • Network Mapping
  • Vulnerability Identification
  • Penetration
  • Privilege Escalation
  • Radio Network Analysis
  • VoIP Analysis
  • Digital Forensic
  • Reverse Engineering
  • Miscellaneous

Which includes these tools among others: Lanmap2, nmbscan, dnsmap, fierce, hostmap, ltrace, tctrace, sqlbrute, sqlmap,sqlninja, mysqloit, sqlcheck, wfuzz,xsser,xssploit,jmeter, nikto2,skipfish,wbox, autopsy,scalpel,mboxgrep,galetta,afstats, wepcrack,giskismet,fakeap,aircrack-ng,cowpatty,bluebugger,bluescan, bluesnarfer, iwar,protos-sip,sipcrack,brutessh,hydra,sshater

…and many more.

Blackbuntu can be downloaded from its official website – http://www.blackbuntu.com/

How to limit cpu usage for a process with cpulimit (Ubuntu / Debian server)

cpulimit is a tool that can be used to limit cpu usage (throttle cpu usage) for a single process (by its PID). cpulimit is useful to ensure that a single process would not hogs the cpu cycles, which can be use by other processes. cpulimit is different from ‘nice’ as it limits the real cpu usage for a process, while ‘nice’ controls scheduling priorities for a particular process.

How to use cpulimit?
Basic usage:
[bash]
cpulimit -p [pid] -l [ cpu percentage]
cpulimit -p 12345 -l 25
[/bash]

Running cpulimit on background:

[bash]
cpulimit -p 12345 -l 25 -z -b
[/bash]

Note: The cpu percentage is the same one as reported by the ‘top’ command.

cpulimit can be installed from Ubuntu and Debian 6.0 (Squeeze) repository through apt-get. The official website of cpulimit is http://limitcpu.sf.net