Tuesday, December 27, 2016

Regular Expression Basics - 2

We are continuing the regular expression basics with this post
  
/(cbc|dnn)/g
You can "OR" the characters with the "|" metacharacter

Watchdnn&cbcforthenews

/h(ale|asan)/g

Don'tcomewithhaleorhasan99

/(Java|Lava)Script/g

LearnJavaScriptinsteadofLavaScript!

----

/^wow/g

The above regular expression matches the strings beginnign with wow.

wow!great! 100?wow!! woxxw!whatchataling?wow

 ----

/wow$/g

The above regular expression matches the strings endinig with wow.

wow!great! 100?wow unbelievable!wow!

----

/x(?=y)/g

The above regular expression matches "x" if it is followed by "y".

fixitorleavethegataxy isittoxic?orfoxy

----

/x(?!y)/g

The above regular expression matches "x" if it is not followed by "y".

fixitorleavethegataxy isittoxic?orfoxy laxairport

----

/^[0-9]{4}-[0-9]{3}-[0-9]{4}$/g

0555-444-2233 312-444-7766 0462-6667788 0462-222-0099

----

/^\w*@\w*\.\w*$/g

abc@def.com abidik99@gubidik.com 
 
----

/grea?t/g

0 or 1 "a"

great grept gret greet greaaat!

----

/bo+t/g

1 or more "o"

boot booth bot booots orbots say_booooooots

----

/le*d/g

 0 or more "e"

led leeeed gled gleed fled fleed fleeeeed hold told folder foleds

 

Thursday, December 22, 2016

Regular Expressions vs Perl

A funny cartoon about regular expressions and Perl.

Thursday, December 15, 2016

Regular Expression Basics - 1

In this post I wanna share some basic regular expression rules. But first I need to write down the metacharacters. Metacharacters are those characters which have a special meaning in regular expressions. i.e. "-" and "[" handled differently in regular expressions. Metacharcters are are as follows:
 
+

/1.5/g
Dot (.) matches anything, except for the line breaks.

1a5, 41e5y, 1x5o, 89xy1&5P55 are all the same

****

If you need to include dot (.) in your search than you have to put a backslash (\) before the dot (.)
/3\.9/g
According to the above expression it matches only the characters "3" and "9" in between they have a "."
 
93.96, a3.9t, 13.9s, x3.9t

----
 
If you want to search more characters which you don't want to type one-by-one than there is a solution which is called quantifiers.
For example if you want to search 10 "b"s than you have to type either /bbbbbbbbbb/g or /b{10}/g. If you're gonna search 10 "b"s than that's may be okay but if you're gonna search 100 "b"s it doesn't seem so straightforward.
If you want to search at least 6 "b"s than you have to put a comma (,) after the number which is between paranthesis. /b{6,}/g won't catch 5 "b"s it will only catch "b"s which are 6 or more.
If you want at least 7 "b"s but at most 10 "b"s then you have to type two numbers in between the paranthesis. i.e. /b{7,10}/g

----
 
/[gyb]/g
This regexp matches either "g", or "y" or "b". This regexp finds only "1" occurence of one of these letters.

----
 
/[gyb]+/g
If you put a "+" after the square bracket then it will find any occurences of "g" or "y" or "b".
 
ggyybb, gyyyybbb, bbb, yy, bgyyy, yyggaaa, lkbgyata, 12hytbyggg90g0b

----
 
/[a-z]+/g
If you want to catch all the letters of the English alphabet in the regexp than you can define a range. The regular expression above catches every letter of the English alphabet. But it doesn't catch any numbers or symbols regardless of their occurences.
 
abjuyr, amnxc5, 77yhbbd76dg76, xbn8dmmdn, %!98hnsb!!mmcasd98lk=

----
 
/[a-z0-9]+/g
The expression above detects all the letters of the English alphabet and all the letters regardless of their occurences.
11009hsndh%88uj, 56+67=123=xyz, $var=99

----
 
/[a-zA-Z0-9_]+/g equals to /\w+/g
There are some shortcuts of the whole English alphabet and whole numbers. i.e. the regular expressions /[a-z0-9_]+/g and /\w+/g are the same. Both find the letters (small or capital) and numbers including the underscore (_) regardless of their occurences.

----
 
/[0-9]+/g equals to /\d+/g
If you want to match only numbers then you have to use the one of the above regular expressions.

----

/^[m-z]+/g
You can negate the classes with the "^" character. With the above regular expression you will catch the characters other than [t-z]. namely the regular expressin will match the small letters a, b, c, d, e, f, g, h, i, j, k, l and all the capital letters from A to Z and also the numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and also symbols like %, & etc.

whatta99yathink88? iaint77do21ANYTHING%% HappyNewYear-In-2017!!!

----

/^\w+/g = /\W+/g
The above regualar expression above matches anything that's not the letter or number or underscore (_)

Mr.&MrsBrown_werein1960!s

----

/^\d+/g = /\D+/g

The above regular expression above matches anything that is not a number.

14mfly1ngt0C4n4ry15l4nd 4w0rldw1th0utr3g3xp5??!!
 

Thursday, December 8, 2016

What Does "Malware" Mean?

A very short but valuable description of malware:
 
The word "mal" has its origin in Latin and means "bad" in English. "Ware", on the other hand, carries the meaning of "products". Hence, when we put these two together, we get the sense of having bad products or goods made with a bad intent.
Learning Network Forensics - Samir Datt

Tuesday, December 6, 2016

Star Wars over Telnet


 
Anybody wanna watch Star Wars over telnet? If yes try this: "telnet towel.blinkenlights.nl"
 
I mean, open a command prompt in your computer, type "telnet towel.blinkenlights.nl", hit ENTER and just watch. Well. Have fun! =))