Saturday, November 23, 2019

[PythonOOPTutorial] 01 How to Setup Python

This is the first article of the Python OOP Tutorials.

First you can check whether you have already installed python on your computer by executing following command.

"python --version"


If python version is displayed, then it says you have already installed Python on your computer. Otherwise you can follow below steps to install python on your computer.

You can download Python setup from Python.org. From there it is always better to download the latest version.


If you want to download a previous version you can choose those from the "Downloads" section. (Python downloads page)

There are different download types and you can select what is most suitable based on your operating system and requirement. What I prefer is exe version.

Then run the downloaded exe file. Do not forget to check the "Add to path" checkbox. Otherwise you will have to add Python for the PATH manually. 

After successful installation you can run the previous command again and check for the current Python version check by the command "python --version". It should work now.To make sure Python is working fine, you can download below file and run it.Sample file: https://drive.google.com/open?id=1vHIAmN7cpfqjJNESmY-23ABSE9rm5THZ- Open command prompt.
- Navigate to the file saved location.
- Run "py TestPython.py"
Then you will get output like below.
Now Python is working fine in your computer. Lets continue the learning process.
Cheers...!!


Wednesday, August 7, 2019

Canary Tokens (Traps) – Expose Information Leaks

Canary Tokens are traps to identify information leaks. Using canary tokens you can identify who has accessed your secret files (timestamp, geographical location, etc...)

You can generate canary tokens in different formats. To generate canary token you can visit below websites.


>> Lets start with the first website

  • First you have to select the token type from the drop-down. For our easiness select "MS Word" option.
  • your email address (when file is accessed, notification will be sent to this email address)
  • some text to identify the token

Then download the generated canary token. When you open the file, you will get an email notification as below (you can edit the content of the downloaded MS Word file as you wish. You can include some false information and an attractive file name such as "my_passwords". So hackers will surely open that file and you will get their information)



When you open the email alert you will see some details of the file access.


By clicking on the "Manage this Canarytoken" you can manage the future email notifications for this canary token.
By clicking on the "More info on this token" you can see details access information.



>> If you visit the second website first you have to enter two fields.

  • your email address (when file is accessed, notification will be sent to this email address)
  • some text to identify the token

After clicking on "Generate Token" button you will see what are the available options to generate canary tokens. Below are some of the token types available.

  • Web bugs
  • DNS Tokens
  • SMTP Token
  • Remote Image
  • QR Code
  • SQL Server Alert on SELECT, UPDATE, INSERT, DELETE
  • MS Word
  • Acrobat Reader PDF
  • SVN Token
  • Signed EXE / DLL
  • SecretKeeper Token
  • Windows Directory Browsing

For this example you can select "MS Word" and download the canary token file. When you open the file, you will get an email notification as below (you can edit the content of the downloaded MS Word file as you wish. You can include some false information and an attractive file name such as "my_passwords". So hackers will surely open that file and you will get their information)


When you open the email alert you will see all details of the file access.


When you visit the provided url at the bottom of the email, you will be able to see the file access history too.

Using MS Word files is just a one way to use canary tokens. There are lots of options available and you can use those wisely.


Cheers...!!

Thursday, September 6, 2018

AWS SQS Standard Queue vs FIFO Queue

When it comes to cloud computing, AWS plays a major role as a IaaS (Infrastructure as a Service), PaaS (Platform as a Service) and SaaS (Software as a Service). Amazon Web Service (AWS) is a well known public cloud service provider. You can find out more about AWS from https://aws.amazon.com/

Simple Queue Service is one of the most useful service which is provided by AWS. If you are using AWS then no need to waste your time on implementing queues. AWS has done that part for you. You just have to use it. You can find more details from https://aws.amazon.com/sqs/

AWS SQS provides two types of queues.
  • Standard Queue
  • FIFO Queue (First In First Out queue)

Comparison of Standard and FIFO queue types are as below.

Standard Queue FIFO Queue
Available on all AWS regions Available in the US West (Oregon), US East (Ohio), US East (N. Virginia), and EU (Ireland) regions
Unlimited Throughput Support up to 3,000 messages per second
Message delivered at least once, but occasionally more than one Delivered once
Not execute in order they sent First in first out
Good for high throughput scenarios Recommended when order of the event is important


Hope this will help you too.


Cheers...!!

Wednesday, August 16, 2017

Solve unrelated svn blames while building projects with maven

Previously I have used Subversion as the version control system. Then moved the projects to Git. Converted all the Jenkins build jobs accordingly. But while building some sonar jobs got below error.

[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project YourTestProject: The svn blame command [svn blame --xml --non-interactive -x -w --username ******** --password ******** src/your/test/project/code/path/Main.java] failed: svn: 'src/your/test/project/code/path/' is not a working copy -> [Help 1]

Since we are using Git and so no need of any svn blames. Using below parameters disabled svn activities.

-Dsonar.scm.disabled=True

Hope this will help you too.


Cheers...!!

Saturday, June 11, 2016

Solve Jenkins Maven jobs build fail due to OutOfMemoryError

There are two major OutOfMemoryError types.

  1. java.lang.OutOfMemoryError: Heap space
  2. java.lang.OutOfMemoryError: PermGen space
You can easily solve this by adding/changing Jenkins environment variables.
Go to
Manage Jenkins >> Configure System >> 
In the Global Properties section check the Environment Variables check box.

Then add parameters as below
Name: MAVEN_OPTS
Value: -Xmx1024m -XX:MaxPermSize=1024m

Setting Xmx will solve your Heap Space issue and setting XX:MaxPermSize will solve your PermGen Space issues.


Cheers...!!

Thursday, June 9, 2016

Solve Jenkins and Subversion time sync issue

You will notice below warning when your Jenkins server and Subversion server have different times (not in a time sync status)

WARNING: clock of the subversion server appears to be out of sync. This can result in inconsistent check out behavior.

There are two ways to sync Jenkins server with svn.
  1. Based on Jenkins time and svn time
  2. Based on Jenkins revision number and snv revision number

Before build projects Jenkins takes updates from svn. If times are not synced changes will not reflect properly. To solve this issue you can configure Jenkins to take updates based on head revision. Fix is simple.
You just have to add @HEAD to the end of your svn url.

for example:
If your previous svn url is 'http://your.svn.server/svnroot/your/code/location'
add @HEAD to the end of url.
New url is 'http://your.svn.server/svnroot/your/code/location@HEAD'

This will solve Jenkins and svn out of sync issues.


Cheers..!!

Saturday, June 6, 2015

Why URI Encoding...?


Most of you must heard about URI Encoding...

Why do we need to Encode URIs?

It is because otherwise servers cannot identify what we sent there.

When we are accessing/using urls we cannot add spaces there. While sending a GET request you may want to add spaces there. Then how do you send those data..?
When we are accessing/using urls we cannot add '/' there. '/' is reserved for use as a component separator. Then how do you send those data..?
Consider that you want to send a XML file attached there..

Here comes the URI encoding.

For example:
you want to encode this
http://www.mysite.com/?XML=<cs><o n="authcode" v="d82709ae"/><c n="FlightSearch"><q n="StartDate" v="18-May-2015"/><q n="EndDate" v="21-May-2015"/></c></cs>

into this
http://www.mysite.com/?XML=%3Ccs%3E%0A%3Co%20n=%22authcode%22%20v=%22d82709ae%22/%3E%0A%3Cc%20n=%22FlightSearch%22%3E%3Cq%20n=%22StartDate%22%20v=%2218-May-2015%22/%3E%0A%3Cq%20n=%22EndDate%22%20v=%2221-May-2015%22/%3E%3C/c%3E%0A%3C/cs%3E


You can try it here..


URL:






Cheers...!!