Saturday, March 23, 2019

Resources to Recover from a Ransomware Attack

No More Ransomware

Crypto Sheriff

Watchpoint Data

Sending JSON via POST in PHP

Sometimes, you’ll come across web services and APIs that will require you to send JSON via a POST request. The php code that you need:
Step by step explanation of the above code:
stolen from:

Saturday, March 2, 2019

Remove and Replace non-alphanumeric Characters from Form Inputs with regex

Remove and Clean up Form inputs on POST and GET

For your contact us forms, you do not want bad people to inject malware into your email, so you need to scrub and slug the posts with regex to remove any html code, and non-alphas that can be used to do nasty things to end users.

Shared on GIST

Example: (on ssh console)
$ php slug.php
DIRTY:Hello Mr. O'Leary, I am calling to ask your help with releasing $10000<br/> in lost cash from nigeria. Click Here: <a href="">Free Virus</a> You gotta "trust" \'me\'
CLEAN:hello mr. o-leary, i am calling to ask your help with releasing $10000br in lost cash from nigeria. click here a virusa you gotta -trust- -me

Sunday, February 24, 2019

How it works: The PFC8574T I2C 8 Bit Adapter with the Vishay 20x4 LCD

Using the I2C 4 line LCD
There is a section on the I2C LCD Backpack.
The PFC8574T I2C to 8 bit IO adapter backpack onto Vishay LCD-020N004L
PFD8574  ------------------->    20x4 LCD Header Strip  
(4)  D0                          4  Rs   H/L Register Select
(5)  D1                          5  R/W  H/L Read/write 
(6)  D2                          6  E    H/L Enable     
(7)  D3                                    --NC--       
(9)  D4                          11 DB4  data bus 0x10  
(10) D5                          12 DB5  data bus 0x20  
(11) D6                          13 DB6  data bus 0x40  
(12) D7                          14 DB7  data bus 0x80  
only the upper 4 bits are used to write a character into the LCD, the lower 3 bits are control bits.

PFC8574 DataSheet

pi@raspberrypi:~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- 27 -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
pi@raspberrypi:~ $

20x4 LCD Commands

Buy One

Coming Soon

Many Thanks To

This Tech Tidbit was brought to you by your friends at Eleven Dimensions Computer Technologies.
See our new 11D website at:

Our Partner Websites:

Bare Wire Networks:
CTI Solutions:

Tuesday, February 19, 2019

Center image in HTML DIV horizontally

First Part is the CSS

Somebody once said "I have an img in a div and I want this image to be exactly in the middle of the div but nothing I try works..."
Suppose you want to place 2 images side by side and centered in their div elements. you need to edit your style sheets to have an outer div, and 2 inner divs, and an image element inside the inner divs. You need to set your margin sides to auto, and your width to 50%

  1. div.column-2-block { position:relative; float: left; display:inline-block; border: 0px red solid; margin-top:25px; } div.column-inside { position:relative; float: left; display:inline-block; border: 0px green solid; width:50%; } div.image-holder { position:relative; display:block; } img.centered { margin:0 auto; width:50%; }

Then the HTML code
  1. <div class="column-2-block"> <div class="column-inside"> <img class="centered" src="" width="320"> </div> <div class="column-inside"> <img class="centered" src="" width="400"> </div> </div>

The Result

Sunday, February 10, 2019

Configure Shoretel Voicemail Notifications to your email inbox

Configure Your Shoretel Voicemail Server to Send Voicemails As Wave Files to your inbox

How Can SocketLabs Help You Setup a Free SMTP Relay

Socketlabs is a free and paid service that can allow you to send 10000 free SMTP relays every month from your verified domain. But first you need a real domain with it's own email accounts and a professional looking website on top of that, plus you need to look like a legitimate business with contact numbers and email addresses. It is not for spammers. Once you are ready, you create a free account at then allow the admins to verify your email and your web presence.  Once that's done, you get your credentials for their free SMTP relay that you can use in your IIS SMTP gateway to send free emails from your voicemail appliances, and your other IOT things that need to send email out, but cannot authenticate.  Many devices cannot authenticate such as Shoretel voicemail servers, all in one printers, fax machines. They only know how to send simple SMTP to port 25.  SocketLabs and your own IIS server can be the intermediate gateway for these devices.  Fore more information, you may contact Eleven Dimension Technologies or see our website at:

Shoretel Director

The Shoretel phone system, all verisons and the new Mitel versions include functionality to send voicemails as .WAV files to your email inbox to any email domain. To do this you need to configure your shoretel server and your IIS6.0 SMTP server.  This is the most basic of CTI tasks that you can do.

Here are a few steps to take to make it happen.

Install IIS6 and the TELNET client on your shoretel director server.
Logon to Shoretel Director and Click on "Voice Mail" in the left column menu, enter a From Address for Email Notifications.
Enter the email address associated with your socketlabs account

Now Visit the Sites menu, and set the SMTP Relay Address, It should be the IP Address of your Shoretel Director server with the IIS6 server.

Finally, for each mailbox, be sure to visit the "Escalation Profiles and Other Mailbox Options" menu in each profile at the bottom of the page,

IIS Configuration

Finally, you need to configure your IIS6 server to send email. You will need to register for a SocketLabs email sender account at You can get a free account for 2000 SMTP relays. First you'd better have a working domain with an email account to recieve verification emails and a working website, not just some placeholder. You need a working website that make you look legitimate. Once you register, visit the SMTP credentials and set them up. Get them and save them. You can only send emails from your own domain name.
Configure as follows:
Click on "SMTP Virtual Server #1" and bring up the properties page
Domains only include SHORETEL (your computer name)
Properties Page
In each tab, configure as follows: Access Tab: Relay Button, grant the entire subnet permssion.Authentification: "Anonymous Access" only checked. Messages Tab: No Change, Delivery Tab: Configure Outbound Security: Basic Authentifiction, and TLS Encryption. drop in your username and password from the SMTP page of socketlabs, Outbound Connections: set the TCP Port to 25. Advanced Delivery page,
The Advanced Button

Outbound Security
Security Tab

Finally restart the IIS SMTP service. Then test it out by using the Windows Telnet Client on the MSDOS command line. Use this command: telnet IPAddress 25, then paste in this test script: (if your domain on socketlabs was

mail from:
rcpt to:
rcpt to:
subject: Hello This is a Test, thanks! 
hey ya did you get it?



This script will trigger an email to be sent out thru your IIS6 SMTP virtual server via socket labs. You must have registered as your domain on socketlabs.

You should check these directories on your server:

If you see anything there, then you have done it wrong.

Your SMTP log files are in this directory:

A normal transaction with socketlabs looks like this:

Many Thanks To

This Tech Tidbit was brought to you by your friends at Eleven Dimensions Computer Technologies.
See our new 11D website at:

Our Partner Websites:

Bare Wire Networks:
CTI Solutions:

Saturday, February 9, 2019

Rasberry Pi i2c as a /dev/ device in ANSI C

I2C Is Just like SMBus
You can always use WiringPI code library from GIT.

git clone

Which will make the whole thing easier.
  1. #include <fcntl.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <stdint.h> #include <time.h> #include <sys/ioctl.h> #include "linux/i2c-dev.h" int main(int argc, char *argv[]) { int fd; struct timespec _500ms; _500ms.tv_sec = 0; _500ms.tv_nsec = 5000000L; fd = open("/dev/i2c-1", O_RDWR); if(fd < 0) { fprintf(stderr, "Error opening device\n"); exit(EXIT_FAILURE); } if(ioctl(fd, I2C_SLAVE, 0x20) < 0) { fprintf(stderr, "Error setting slave address\n"); close(fd); exit(EXIT_FAILURE); } char buf[10]; buf[0] = 0x07; // IODIR PORT1 buf[1] = 0x00; // all output if(write(fd, buf, 2) != 2) { fprintf(stderr, "Error writing (1)\n"); close(fd); exit(EXIT_FAILURE); } printf("Write success!\n"); nanosleep(&_500ms, NULL); buf[0] = 0x01; // PORT1 buf[1] = 0xff; // output high if(write(fd, buf, 2) != 2) { fprintf(stderr, "Error writing (2)\n"); close(fd); exit(EXIT_FAILURE); } close(fd); printf("Done.\n"); exit(EXIT_SUCCESS); }