Saturday, August 24, 2019

Kali Linux Blank Screen Problem with Virtualbox

You might come across this problem with Kali Linux where black screen will be displayed immediately after the grub screen. Here are some of the solutions you should try:

Solution 1:
1. Edit the grub and go to the line where it starts with "linux" and end with word "quiet". Add "nomodeset" at the end. So your line would look like quiet nomodeset
2. Press Ctrl + X to reboot the system. Note that this is just temporary. Every time you reboot your kali linux, you have to add it.
3. Once you are logged into the linux, open terminal.
4. Edit your grub using "sudo nano /etc/default/grub"
5. Go to the line where "quiet" is mentioned. Add "nomodeset" after word "quiet". Save the editor and exit
6. Update the grub using "sudo update-grub"
7. Restart your OS and check if it works out. If it does not work, then please try other solutions. 

Sunday, October 02, 2016

New Life !!

Starting a new era of learning. From Last few years, I have not posted a single blog. Expect a few articles in the field of Information Security from me on this blog. See you soon !!

Thursday, November 14, 2013

Wednesday, November 13, 2013

Linux/Unix Basic (but useful) Commands


Split the file into parts
  1. Find out how many lines do you have in your file. 
  2. Know how many parts you require. 
  3. Accordingly apply this command in your terminal: split -l 10000 filename (Here 10000 is the no of lines in my files. So if I have 20000 lines in my file, and if I issue above command, then my file will be divided in two parts.)
Change directory folder with spaces

If I have my folder as /home/jenis/folder name/

then, 

cd /home/jenis/folder\ name

        or
cd /home/jenis
cd "folder name"

Thursday, November 07, 2013

Funny bug about teamviewer

I was having some problems with using teamviewer lately. Sometimes, when I switch window from Remote computer to local computer, I was not able to key anything in the remote computer. Teamviewer (or whatever) was behaving as if teamviewer is not running at all. Finally, I thought that let me see if any of my keys are having some problems ( I figured this out as I had used old 90s computers where keyboards were different than what we have right now. During that time too, there was a similar problem, if some key is halt or jammed, if you try to type in anything, you won't be able to type.)

So, anyway, if you find similar problem with teamviewer, try holding "Alt" key for 2-3 seconds and your problem would be resolved. I would be curious if someone knows the exact reason behind it. Anyway, enjoy. 

Matlab Tricks

MATLAB tricks.

1. If you have two cell arrays, you can concat them together using concat(c1,c2);
2. To delete element from Vector (or Double matrix), Use:
a=[1,2,3,4,5];
b = a(a~=3);

Output: [1,2,4,5]
Ref: http://www.mathworks.com/matlabcentral/answers/48938

3. To remove space between string, 
regexprep(stringvalue,'[^\w'']','')



Thursday, September 19, 2013

Provide access to USB devices

I have been having problem with accessing USB devices I use in the lab. Whenever I unplug device and plug it again, it always cries for providing admin access. So here is what I did :

jenis@Jenis-Laptop:~$ ls -al /dev/ttyUSB0

crw-rw---- 1 root dialout 188, 0 Sep 19 12:15 /dev/ttyUSB0

Add your user to dialout group by using :

"sudo adduser jenis dialout"

And you are done. Restart/Re-log your machine.

Source: http://stackoverflow.com/questions/9839988/dev-ttys0-does-not-open-in-ubuntu-12-04-beta

Cheers.
Jenis

Thursday, September 12, 2013

Learning Hadoop/Map-Reduce

Trying some hands on this new technology, had worked on one of the projects long back. So trying to get those details back. Meanwhile, came across this simple example of Map-Reduce, thought of sharing:

http://ksat.me/map-reduce-a-really-simple-introduction-kloudo/

Cheers. 

Friday, September 06, 2013

Interesting fact about finding perl array size

Recently, I came across a problem with Perl array. I was assuming that these three methods generate same output for finding array size, but I am WRONG :

my @newArray = (2);
print scalar @newArray;   #1
print $#newArray; #2
print @newArray; #3


First and third give me proper values, but second gave me 0 size. So be careful, while using it. I would recommend using "scalar @newArray".

Here is some explanation on it : http://stackoverflow.com/questions/7406807/find-size-of-array-in-perl

Cheers.



Friday, August 30, 2013

Tuesday, August 27, 2013

Cannot insert perl array in database

I recently came across a problem where my perl array was generating some random value in MySql query. I finally figured out that, you have to convert perl array to string first and then can insert in the database. Here is how you can do it:

my @arrayData = ("aaa","bbb","ccc");
my $ArrayString = join " ", @arrayData;

use above variable in MySql query.

Cheers. 

Thursday, August 01, 2013

Add variable in TinyOS symbol table


  1. Add uint_8 volatile myVar=255; in Implementation.
  2. In boot method, add myVar+=1;
  3. Use this command to check if symbol is added: tos-set-symbols --read /build/telosb/main.exe
  4. Change value of variable using:tos-set-symbols --objcopy msp430-objcopy --objdump msp430-objdump --target ihex build/telosb/main.ihex build/telosb/main.ihex MoudleName__myVar=30 TOS_NODE_ID=5 ActiveMessageAddressC__addr=5
  5. Run your ihex file. 

Thursday, May 23, 2013

Perl display time and date

To display time and date in perl use:

use POSIX qw(strftime);
print strftime("%a, %d %b %Y %H:%M:%S %z", localtime(time())) . "\n";

Note: you might need to install date time module.  sudo apt-get install libdatetime-perl 

Wednesday, May 22, 2013

Best way to debug in TinyOS

Today I realized one thing in TinyOS. The best way to debug something in TinyOS is "LEDS". I was trying to setPower() on transmitter and then tried to receive node's power using getPower() - it did not give me the same value. Instead it gave me "0". I banged my head for so much of time and later (still not 100% sure) realized that, CC2420Packet.getPower() does not return the same value as CC2420Packet.setPower().

Another problem I faced was with using "printf". I couldn't find much help on "printf". So, I finally gave up , started debugging my code by comparing value and if condition is true than blink LED else turn off LED.

So, my advice to all newbees would be to use "LEDS" to debug instead of depending on something else. 

Tuesday, March 26, 2013

Motelab Problem with Sender Address (Wireless Sensor Networks)

Hi,

From last few days, I have been getting a weird problem with my research work. I had written one simple application which was sending packets from Radio To Serial. I developed the application, so that I can check channel diversity. I was getting a sender address from AMPacket.source() method. This code worked fine when I deployed application manually into 3-4 motes, but when I deployed the application in Harvard's Motelab, I got this weird error. Instead of getting actual address of motes, I got "1" as sender address. 

I did search a lot on Google, but couldn't get any satisfying answer. Finally, I received a link - which tried to put some limelight on the problem, but wait a second - the link actually just told that there is a problem with Motelab's configuration - but did not give a solution to that ( at least I couldn't understand). 

Finally, I got solution from Olaf Landsiedel, who provided me his blog's link. That's exactly I was looking for. 

So, whenever anyone gets error with Sender address in Motelab - Please use below code in your starting method and you will be done. 

call ActiveMessageAddress.setAddress 
(call ActiveMessageAddress.amGroup(), TOS_NODE_ID);


Enjoy.  Let me know your views if this resolves your issue. 

Friday, December 07, 2012

Thursday, December 06, 2012

Super Ellipsoid using OpenGL

Please use below Youtube URL to check out the output of this project. Please post your comments.
-- Source code: https://github.com/jenis23/SuperEllipsoid






Saturday, October 06, 2012

Toroidal Spiral using OpenGL

Some of My Experiments with OpenGL. I have created all of them in C language.
-- Source code: TBD






I can't upload .exe file here, otherwise you can get various other designs. I will share the code very soon with all of you. Share your comments about the post. 

Friday, May 11, 2012

TinyOS Errors and Solutions

Hi All,

I am posting here some of the errors which I get and spend so much of time in solving it as some solutions are not available on web. Again, this is my own opinion, it has no relation with anybody. I will update the post the way I get errors while using it.This way, even I can track the changes I did in my code and people can get the answers.

1. If you try to install apps using telosb on tinyos and if you use tinyos version 2.1.1 or previous, you might get error over msp430. The simple workout solution to the problem is to use version 2.1.2. you can get this version at http://tinyos-main.googlecode.com/svn/tags/release-2.1.2-rc1/
2. Please find this link for problem with sender address in Motelab. 

Install TinyOS under Ubuntu 12.04 or later

Installing TinyOS under Ubuntu 12.04 or 12.10 or 13.04 or 13.10


I am specifying 3 different methods for installing tinyos. There are different ways one can install. I prefer last method for advanced users and first two methods for simple use. Also, not to forget that There is a problem reported with MSP430-gcc version < 4.6.3. So, all users should make sure that they use MSP430-gcc version 4.6.3 for TelosB devices. If you want to download 4.6.3, please follow http://tinyprod.net/repos/debian/README-46.html .

When you try different methods, please make sure to remove previous installations (including toolchain).

Method 1:
1. Add software source, deb http://tinyos.stanford.edu/tinyos/dists/ubuntu lucid main to /etc/apt/sources.list

2. Type, sudo apt-get update to get new changes. Install tinyos-2.1.1 by typing sudo apt-get install tinyos-2.1.1.

3. Change the environment variables. Open the .bashrc file (sudo gedit ~/.bashrc), and add the following lines to the bashrc file:
       
       export TOSROOT=/opt/tinyos-2.1.1
       export TOSDIR=$TOSROOT/tos
       export CLASSPATH=$TOSROOT/support/sdk/java/tinyos.jar:.$CLASSPATH
       export MAKERULES=$TOSROOT/support/make/Makerules
       export PATH=/opt/msp430/bin:$PATH
       source /opt/tinyos-2.1.1/tinyos.sh

Use command: source ~/.bashrc to update changes. 

3. Get the access authority to the tinyos folder (sudo chown usr_name:usr_name -R /opt/tinyos-2.1.1/). Also follow this 2 steps:
  • Change the ownership on your /opt/tinyos-2.x files: chown -R <your uid> /opt/tinyos-2.x
  • Change the permissions on any serial (/dev/ttyS<N>), usb (/dev/tts/usb<N>, /dev/ttyUSB<N>), or parallel (/dev/parport) devices you are going to use: chmod 666 /dev/<devicename>

4. Install tinyos jave tools. First install JNI by running "tos-install-jni". Go to "$TOSROOT/support/sdk/java/". If the directory has a Makefile in it, type make and make install.

//optional step:
5. Generate the documents of TinyOS java tools. Go to  "$TOSROOT/support/sdk/java/" , copy the the directory to another place (e.g., /home/usr_name), open the Makefile, change "JAVADOCDIR" to the intended location. Type "make javadoc" to generate the documents.

Close all editors, restart the machine. And you are done.


Method 2:

  1. Remove tinyos using : sudo apt-get remove tinyos-2.1.2
  2. Add software source, 

deb http://tinyos.stanford.edu/tinyos/dists/ubuntu lucid main
deb http://tinyos.stanford.edu/tinyos/dists/ubuntu maverick main
deb http://tinyos.stanford.edu/tinyos/dists/ubuntu natty main

       to /etc/apt/sources.list
      Type as instructed in bullet.
      • Type, sudo apt-get update to get new changes. Install tinyos-2.1.2 by typing sudo apt-get install tinyos-2.1.2.
      • Type: cd /opt 
      • Get tinyos repository using: sudo git clone https://github.com/tinyos/tinyos-main.git 
      • sudo cp -R /opt/tinyos-main /opt/tinyos-2.x
      • Change the ownership on your /opt/tinyos-2.x files: chown -R <your uid> /opt/tinyos-2.x
      • Change the permissions on any serial (/dev/ttyS<N>), usb (/dev/tts/usb<N>, /dev/ttyUSB<N>), or parallel (/dev/parport) devices you are going to use: chmod 666 /dev/<devicename>
           4. Copy tinyos.sh file from /opt/tinyos-2.1.2/ using: sudo cp /opt/tinyos-2.1.2/tinyos.sh /opt/tinyos-2.x/tinyos.sh (if don't have tinyos.sh file under tinyos-2.1.2, get it from tinyos-2.1.1)

             5. Change permission: sudo chmod +x /opt/tinyos-2.x/tinyos.sh

             6. Open tinyos.sh file under /opt/tinyos-2.x/ and add below lines, save and exit:

      #! /usr/bin/env bash
      # Here we setup the environment
      # variables needed by the tinyos
      # make system
      echo "Setting up for TinyOS 2.x Repository Version"
      export TOSROOT=
      export TOSDIR=
      export MAKERULES=
      TOSROOT="/opt/tinyos-2.x"
      TOSDIR="$TOSROOT/tos"
      CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java:.:$TOSROOT/support/sdk/java/tinyos.jar
      MAKERULES="$TOSROOT/support/make/Makerules"
      export TOSROOT
      export TOSDIR
      export CLASSPATH
      export MAKERULES


              7. Type sudo gedit ~/.bashrc and add below line:
                source /opt/tinyos-2.x/tinyos.sh

        8. Install tinyos jave tools. First install JNI by running "tos-install-jni". Go to "$TOSROOT/support/sdk/java/". If the directory has a Makefile in it, type make and make install.

      Close all editors, restart the machine. And you are done.

      Method 3:

      My preferred way (difficult for some people though).
      1. Get tinyos repository using: sudo git clone https://github.com/tinyos/tinyos-main.git 
        1. cd ~ ;
        2. mkdir local/src
        3. sudo git clone https://github.com/tinyos/tinyos-main.git
      2. Get required tools using TinyOS wiki step 3. You can try converting rpm to deb using simple search on Google.  
      3. Make sure you install MSP430-gcc version 4.6.3 from http://tinyprod.net/repos/debian/README-46.html. Before installing version 4.6.3, make sure to remove previous versions from your machine, otherwise you will end up having errors in your machine.  
      4. Once everything is done, install automake using sudo apt-get install automake;
      5. Use following commands: 
        1. sudo apt-get install automake
        2.  cd tinyos-2.x/tools
        3.  ./Bootstrap
        4.  ./configure --prefix=$HOME/local
        5.  make all
        6.  make install
      6. Set environment variables under bashrc:
      7. #! /usr/bin/env bash
        # Here we setup the environment
        # variables needed by the tinyos
        # make system
        echo "Setting up for TinyOS 2.x Repository Version"
        export TOSROOT=
        export TOSDIR=
        export MAKERULES=
        TOSROOT="/opt/tinyos-2.x"
        TOSDIR="$TOSROOT/tos"
        CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java:.:$TOSROOT/support/sdk/java/tinyos.jar
        MAKERULES="$TOSROOT/support/make/Makerules"
        export TOSROOT
        export TOSDIR
        export CLASSPATH
        export MAKERULES

        You are done. Close all editors and Enjoy. 
      Method 4:

      My preferred way (Very easy to follow).

      Follow Eric Decker's link for installation. After following his steps from 1 to 4 (and of-course "Note" mentioned)


      • cd /opt/
      • Get git repos using: sudo git clone https://github.com/tinyos/tinyos-main.git 
      • sudo cp -R /opt/tinyos-main /opt/tinyos-2.x
      • Change the ownership on your /opt/tinyos-2.x files: chown -R <your uid> /opt/tinyos-2.x
      • Create tinyos.sh file under /opt/tinyos-2.x/ and add these lines:

      #! /usr/bin/env bash
      # Here we setup the environment
      # variables needed by the tinyos
      # make system
      echo "Setting up for TinyOS 2.x Repository Version"
      export TOSROOT=
      export TOSDIR=
      export MAKERULES=
      TOSROOT="/opt/tinyos-2.x"
      TOSDIR="$TOSROOT/tos"
      CLASSPATH=$CLASSPATH:$TOSROOT/support/sdk/java:.:$TOSROOT/support/sdk/java/tinyos.jar
      MAKERULES="$TOSROOT/support/make/Makerules"
      export TOSROOT
      export TOSDIR
      export CLASSPATH
      export MAKERULES

      • Type sudo gedit ~/.bashrc and add below line: source /opt/tinyos-2.x/tinyos.sh
      • Install tinyos jave tools. First install JNI by running "tos-install-jni". Go to "$TOSROOT/support/sdk/java/". If the directory has a Makefile in it, type make and make install.

      Enjoy. 


      Please post your comments and suggestions if you find this helpful.