Free SSL Certbot


Hits: 17  

Certbot, It was Let’s Encrypt Client previously. Automatically enable HTTPS on your website with EFF’s Certbot, deploying Let’s Encrypt certificates.

Server Support

– Apache
– Nginx
– Haproxy
– Plesk

OS Support

– Web Hosting Service
– Debian 7 (wheezy)
– Debian 8 (jessie)
– Debian 9 (stretch)
– Debian testing/unstable
– Debian (other)
– Ubuntu 17.04 (zesty)
– Ubuntu 16.10 (yakkety)
– Ubuntu 16.04 (xenial)
– Ubuntu 14.04 (trusty)
– Ubuntu (other)
– Gentoo
– Arch Linux
– Fedora 24+
– CentOS 6
– RHEL 6
– CentOS/RHEL 7
– FreeBSD
– OpenBSD 5.9
– OpenBSD 6.0+
– OpenBSD (other)
– macOS
– Devuan Jessie 1.0
– Devuan (other)
– Other UNIX
– Non-UNIX

Install on Ubuntu 17.04 (zesty) Apache

$ sudo apt-get update
$ sudo apt-get install software-properties-common
$ sudo add-apt-repository ppa:certbot/certbot
$ sudo apt-get update
$ sudo apt-get install python-certbot-apache

Get Started https://certbot.eff.org/#ubuntutzesty-apache

$ sudo certbot --apache

$ sudo certbot --apache certonly

Automating renewal

$ sudo certbot renew --dry-run

$ sudo crontab -e

30 1 * * * /usr/bin/certbot renew --quiet

It will run renewal command at 1:30 am, every day.

PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib64/php/modules/zip.so’


Hits: 43  

CentOS 7 with PHP

# php --ini
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib64/php/modules/zip.so’ – /usr/lib64/php/modules/zip.so: undefined symbol: php_pcre_exec in Unknown on line 0
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php.ini
Scan for additional .ini files in: /etc/php.d
Additional .ini files parsed: /etc/php.d/10-opcache.ini,
/etc/php.d/20-bcmath.ini,
/etc/php.d/20-bz2.ini,
/etc/php.d/20-calendar.ini,
.
.
.

Install Apache, MySQL, PHP 5.6 on Centos 7

Solution

# yum install php-zip

# service httpd restart
Redirecting to /bin/systemctl restart httpd.service

PHP Check Loaded Modules

# php -m
[PHP Modules]
apc
apcu
bcmath
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
igbinary
json
libxml
mbstring
mcrypt
memcache
memcached
mhash
mongo
msgpack
mysql
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
readline
recode
redis
Reflection
session
shmop
SimpleXML
sockets
SPL
SQLite
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

PHP Check Loaded ini files
# php --ini

# php -v
PHP 5.6.31 (cli) (built: Jul 6 2017 08:06:11)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Install Apache, MySQL, PHP 5.6 on Centos 7


Hits: 64  

Install Apache

# yum update
# yum install httpd
# systemctl start httpd.service

Now Browser your Apache Server http://Server_IP_address/

Enable Apache to start at server boot

# systemctl enable httpd.service

Install Mariadb MySQL

# yum install mariadb-server mariadb
# systemctl start mariadb
# mysql_secure_installation

Enable MySQL to start at server boot

# systemctl enable mariadb.service

Install PHP 5.6

Install EPEL repository

# rpm -Uvh http://vault.centos.org/7.0.1406/extras/x86_64/Packages/epel-release-7-5.noarch.rpm

Note: Make sure you installed “epel-release-7-5.noarch.rpm” else google it for different location …. search on Google “index of” + epel-release-7-5.noarch.rpm

Install remi repository

# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

Note: Make sure you installed “remi-release-7.rpm” else google it for different location

Enable remi

# yum --enablerepo=remi,remi-php56 install php php-common

Install php 5.6 on Centos 7

# yum --enablerepo=remi,remi-php56 install php-cli php-pear php-pdo php-mysql php-mysqlnd php-pgsql php-sqlite php-gd php-mbstring php-mcrypt php-xml php-simplexml php-curl

# systemctl restart httpd.service
# chown -R apache:apache /var/www/html/

# chmod -R 775 /var/www/

<?php phpinfo(); ?>

http://Server_IP_address/phpinfo.php

CentOS 7 + SELinux + Apache + PHP write/access permission


Hits: 59  

CentOS 7 have SELinux, it is security enhancement to Linux which allows users more control over access control.

SELinux make problem to access or write files or directories

– Can’t serve files on directory
– Can’t write to file

SELinux is blocking the read/write operations

# chcon -Rv --type=httpd_sys_rw_content_t /var/www/html/ (if you want to allow full web root)

# chcon -Rv --type=httpd_sys_rw_content_t /var/www/html/uploads/ (Or just uploads folder)

Ownership
# chown apache:apache -R /var/www/html/

Recursive File permissions
# find . -type f -exec chmod 0644 {} \;

Recursive Directory permissions
# find . -type d -exec chmod 0755 {} \;

Resursive SELinux serve files off Apache
# chcon -t httpd_sys_content_t /var/www/html/ -R

Allow write to specific directories
# chcon -t httpd_sys_rw_content_t /var/www/html/logs/ -R
# chcon -t httpd_sys_rw_content_t /var/www/html/uploads/ -R

httpd_sys_content_t – allow Apache to serve contents
httpd_sys_rw_content_t – allow Apache to write to those path.

Facebook Delight Text Keywords


Hits: 158  

Facebook Delight Text display celebration balloons on Facebook Page / Post. Facebook have selected Greeting Text Keywords from different languages. Facebook Delight Text give celebration feel to Facebook Users.

Keywords:[“Congrats”,”تهانينا”,”مبروك”,”ألف مبروك”,”مبارك”,”Glückwunsch”,”Gratuliere”,”Enhorabuena”,”Felicitaciones”,”Félicitations”,”बधाई”,”Selamat”,”Congratulazioni”,”おめでとう”,”축하해”,”축하해요”,”Мои поздравления”,”Поздравляем”,”Поздравляю”,”ยินดีด้วย”,”Tebrikler”,”恭喜”,”Geluk”,”অভিনন্দন”,”Gratulace!”,”Til lykke”,”Tillykke”,”Συγχαρητήρια”,”Paljon onnea”,”Onnea”,”અભિનંદન”,”מזל טוב”,”Gratula”,”Čestitam”,”Čestitke”,”Čestitamo”,”അഭിനന്ദനങ്ങൾ”,”ಶುಭಾಶಯ”,”Tahniah”,”Grattis”,”अभिनंदन”,”ਵਧਾਈਆਂ”,”Parabéns”,”Gratki”,”Gratulacje”,”Felicitări!”,”Gratulujem”,”Blahoželám”,”Gefeliciteerd”,”வாழ்த்துகள்”,”வாழ்த்துக்கள்”,”అభినందనలు”,”مبارکباد”,”Chúc mừng”,”Честитам”,”Hongera”]

What is a Self-XSS scam?

A Self-XSS scam usually works by promising to help you access somebody else’s account. Instead, the scammer tricks you into gaining access to your account for fraud, spam and tricking more people into a scam.
Scammers will usually target your friends by posting to your Timeline.
To avoid Self-XSS attacks, never copy and paste suspicious links.
(Source: Facebook)

This is a browser feature intended for developers. If someone told you to copy-paste something here to enable a Facebook feature or “hack” someone’s account, it is a scam and will give them access to your Facebook account.

ZRUYR1S8XUa.js: https://www.facebook.com/rsrc.php/v3/y0/r/ZRUYR1S8XUa.js

See https://www.facebook.com/selfxss for more information.
(Source: Chrome Console)

Amazon DynamoDB Formatted JSON using JQ


Hits: 171  

Linux sed is useful tool to format and transform plain text. But sed is not so useful for structured data like JSON. JQ is a sed-like tool easily deal with JSON.

./jq

is a lightweight and flexible command-line JSON processor.

Install jq on OS X:
brew install jq

Install jq on Ubuntu:
apt-get install jq

Others:
https://stedolan.github.io/jq/download/

UserPoints.json data exported from Amazon DynamoDB

# AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXXXXX AWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX /usr/local/bin/aws dynamodb scan –table-name UserPoints –region us-east-1 –output json > UserPoints.json

# jq “[.Items[] | { userId: .userId.S, CompanyCode: .CompanyCode.S, date: .date.S, points: .points.S, Id: .Id.S }]” UserPoints.json

It will output like this…

[
{
“userId”: “user1@gmail.com”,
“CompanyCode”: “ABC107”,
“date”: “2017/04/08”,
“point”: “16”,
“Id”: “1496238999”
},
{
“userId”: “user2@gmail.com”,
“CompanyCode”: “ABC107”,
“date”: “2017/02/07”,
“point”: “45”,
“Id”: “1496239218”
}
]

Access Skype SQLite Database


Hits: 194  

I was working for Online Radio Server setup with Icecast and Skype. This Radio Station was using Skype Group Calls with real listeners of station then I have to feed Live Skype Audio to Icecast Radio Server as Input.

Radio Setup Tools Online Radio Schedule with Skype & Icecast

– SAM Broadcaster
– Icecast Server
– Skype account as Radio Station
– Virtual Audio Cable to manage Icecast / Skype Patch

Radio Listeners normally connect to Radio Server Skype from Website. Listeners can send contact request to Skype then Radio Server Manager Schedule some calls based on Radio Schedule. Radio Server Skype Auto Connect new Skype requests

Radio Station with Icecast Skype Features

– Listeners can chat live on Skype
– Selected Listeners can participate in Live Talk

Now I need to show real status of Radio Server Skype on the Radio Station Website??

I know Skype use SQLite to save Database on computer here “C:/Users/[Radio-Server]/AppData/Roaming/Skype/[Radio-Skype]/main.db”

So, I just have query some tables to get REAL Status of Radio Server Skype

– Radio Server Skype is busy in any CALL?
– Radio Server Skype is Free for next CALL?
– Any Live Radio Schedule is running using Skype Calls?

Skype-SQLite

SQLite Tools

DB Browser for SQLite
Skyperious is a Skype database viewer and merger in Python

Skype-SQLite

PHP with SQLite extension to access Skype Database

PHP-PDO-SQLite

PHP-SQLite

<?php
$skype_path = "C:/Users/[Radio-Server]/AppData/Roaming/Skype/[Radio-Skype]/main.db";

// Path for skype main.db file
$db = new SQLite3($skype_path);

$query = "SELECT id, name FROM Calls where is_active='1';";

$stmt = $db->prepare($query);
$results = $stmt->execute();

$call 	= $results->fetchArray();


// Get all Mamabers for current Skype CALL
$query = "SELECT id, identity, guid FROM CallMembers where call_name='".$call['name']."';";

$stmt = $db->prepare($query);
$results = $stmt->execute();

echo "<pre>";

while($data = $results->fetchArray()){

// Print all records in current Skype CALL
print_r($data); 

}

echo "</pre>";

$db->close();

?>

SQLite-CMD

JavaScript Detecting Internet Connection


Hits: 393  

Offline.js automatically alerts users for their internet connection using AJAX requests.

Download offline.min.js

offline.html

<script src="offline.min.js"></script>
<script>

Offline.options = {checks: {xhr: {url: 'offline.html'}}};

var run = function(){

// check internet connection
Offline.check();

// return internet connection state  
console.log(Offline.state);

document.getElementById("status").innerHTML = Offline.state; 
 
}

setInterval(run, 5000);

</script>

<div id="status">up</div>

Bottle: Python Web Framework


Hits: 649  

I really like Bottle: Python Web Framework. Bottle is very simple, fast and powerful Python micro-framework. It is perfect for small web applications and rapid prototyping where you need simple/small API server.

Bottle is a fast, simple and lightweight WSGI micro web-framework for Python.

Installation

Install Bottle with pip install bottle or download the source package at PyPI.

Download and Install

Install the latest stable release (Bottle runs with Python 2.7 and 3.3+.)

#pip install bottle

Or

#easy_install -U bottle

Or

download bottle.py (unstable) into your project directory.

– app.py
– bottle.py

Example: “Hello World” (app.py)

from bottle import route, run

@route(‘/hello/:name’)
def index(name=’World’):
return ‘Hello %s!‘ % name

run(host=’localhost’, port=8080)

Bottle Python

Point your browser to http://localhost:8080/hello/sandeep

Links

https://github.com/bottlepy/bottle
https://raw.githubusercontent.com/bottlepy/bottle/master/bottle.py

Below find simple routing, template, static CDN, Ajax, redirect functions

Test URL for above bottle python code run on port 7800

# python bottle_example.py

http://localhost:7800/
http://localhost:7800/hello
http://localhost:7800/ajax
http://localhost:7800/redirect
http://localhost:7800/404
http://localhost:7800/upload
http://localhost:7800/tpl (“test” is text file on [Web-App-Root])
http://localhost:7800/static/god.jpg (“god.jpg” saved on [Web-App-Root])