Friday, April 9, 2021

My first ever Bash script in kali Linux.

Here is the bash.sh file 

01  #! user/bin/bash

02 echo "this is my first bash script"

03 echo "what is your name ?"

04 read name 

05 echo "WOW you are: $name" 

06 echo $(whoami)

07 if [ $name ];then

08        echo "you are the owner of this system $name"

09 else

10       echo "Who are you !"

11 fi

and the output is like this 


The first line is for the terminal that it is a bash code  " #! user/bin/bash" and you have to find it by typing "which bash" command in the terminal. 

then the second line shows the string "this is my first bash script" by using "echo "this is my first bash script""

line number three is similar to line no two it is just showing a string output.

In the fourth line I asked for user input in the next line I used that input to show inside of a string as output. Like in the picture I passed a string of "mahabub" and got the output "WOW you are: mahabub".

Line number six is different though, by the command "echo $(whoami)" I actually executed a command. Where whoami shows the current user. you can use it for all types of commands like ipconfig, cal, time, etc. It is an interesting thing to learn.


Finally from line no 07 to 11 I implemented a conditional statement using if and else. 

 if [ $name ];then

        echo "you are the owner of this system $name"

 else

       echo "Who are you !"

 fi

 Here, the syntax is 

 if [condition ];then

        executable code

 else

       executable code

 fi

using this one can easily implement conditions in Bash.


Thursday, April 8, 2021

What is faced to write '#' while using vi editor in kali linux

 I was not aware of this kind of text editor before where things are very different. The story begins when I was following a tutorial on youtube and implementing it to my pc while I became shocked by not being able to put the symbol '#' in my document. I tried for at least 10 minutes for putting a '#' in the document but it was doing something else. Then I decided to search for it and found out that for editing/inserting something to your document you need to type the command 'i' then you can edit the text of it picture one shows it. 


The saddest part is that there was no proper documentation in the window which could help me out. 

Is it illegal to use TOR in Bangladesh?

I was trying to use a free VPN while I came across the word TOR.  

I have searched the internet for the answer by myself but did not found any useable information on that. 


To my best knowledge, I could not found any policy from Bangladesh Government regarding regulating TOR. Though I found that many people using it for their data privacy. And Tor use skyrocketed in Bangladesh after government bans social networks back in 2015. 

What is it? 
Simply it is a browser having the ability to make you invisible to others.

Wednesday, April 7, 2021

How I solved "SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape" error in Python

The Problem 

I was verifying a piece of code, in that process, I had to use a path like "c:\Users\users\Downloads\". I just copied the path and pest it directly to the code and the error code "SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape" appeared in my jupyter notebook. 

Jupyter

The Solution 

Then as usual I searched on the internet by the whole error code and found out the followings.

1. this error is due to the escape character. It is a common error in Python.

2. there are several solutions to this but what I like the most is adding the character 'r' at the beginning of the string

        ex. in my case my path should be written like 

            path = r'c:\Users\user\Downloads\file.txt'

that solved my problem. 

for other solution to the problem, and further quarry I would suggest you should visit this article.

My first ever Bash script in kali Linux.

Here is the bash.sh file   01   #! user/bin/bash 02 echo "this is my first bash script" 03 echo "what is your name ?" ...