Skip to main content

Posts

Showing posts from May, 2020

Using Regular Expression / Regex In Javascript!

Writing a simple function to extract matched strings using Regex in Javascript Today i want to show how to extract string data using Regular Expression in Javascript. A regular expression is an object that describes a pattern of characters. Syntax for javascript : / pattern / modifiers ; First we can create a simple function that will process the string extraction. example of string input will be something like this <p>This is just a simple example input string</p> (     [message] => "Hello",     [desc] => "its a handshake hello!" ) <p>The purpose is to extract message and desc pattern matching</p> Simple function that will process the string extraction function extract(stringInput) { var regexp = /\[(message|desc)\](.*)/gm; var arr = []; while (result = regexp.exec(stringInput)) { arr.push(result[0]); } return arr; } The ' extract ' function will look for a pattern on anything that has opening bracket with the matching g

Simple Security Implementations to Control SSH Access in Digital Ocean Droplet/VPS

Image by S. Hermann & F. Richter from Pixabay By default Digital Ocean Droplet will allow root SSH access When we first create a droplet in DO, DO will send us the credential access through our email and we can access the droplet using DO console easily. After that we will change the password to our own password. Then whats next? Are we good to go? Before we go in depth. Let us revisit what is a brute force attack. A brute force attack is an attempt to crack a password or username or find a hidden web page, or find the key used to encrypt a message, using a trial and error approach and hoping, eventually, to guess correctly. - Kapersky In case of droplet users, we need to secure our VPS from being attacked by brute force attack. On SSH brute force attack the mechanism is slightly different. The mechanism is SSH brute-force attack, the mechanism is reversed. Instead of trying thousands of username and password combinations on a single server, the crooks try one username and pas