Tuesday, November 25, 2014

Advanced bash scripting : essence zenity : Interactive filemerger

#!/bin/sh -u 
zenity --info --ok-label="Start" --width="500" --height="300" --title="Horopter Inc." --text "`basename $0` is loaded. Click start to continue."
current=`pwd`
zenity --question --width="500" --height="300" --title="Welcome to Horopter fileconverter." --text "You need to put all the required files together in a directory, did you do that?"
if [ $? -eq 0 ]
then 
 zenity --info --width="500" --height="300" --title="Horopter Inc." --text "Example: If the files are in a directory called 'apple',\n /folder1/folder2/apple is location into the directory apple."
 path=$(zenity --entry --width="500" --height="300" --title="Directory selection" --text "Enter the location into the directory as absolute path, . for current directory: ")
 if [ -n "$path" ]
 then 
  cd $path
  flname=$(zenity --entry --width="500" --height="300" --title="Directory selection" --text "Enter the name of the output file with extension.")
  echo -e "*******************************   $flname  ******************************\n" > $flname
  echo -e "------------ Compiled by a software from SANTOSH KUMAR DESAI ------------\n" >> $flname
  echo -e "<< This is preformatted text >>" >> $flname
  declare -a var
  var=(*.html *.css *.txt)
  count=0
  for i in "${var[@]}"
  do
   input=`echo $i | cut -d '.' -f1`
   if [ "$input" != "*" ]
   then 
   let count=count+1
   fi
  done
  zenity --info --title="Horopter Inc." --width="500" --height="300" --text "Total $count files were found."
  cnt=1
  ( for i in "${var[@]}"
  do
   input=`echo $i | cut -d '.' -f1`
   if [ "$input" != "*" ]
   then
   echo -e "# copying $i ($cnt of $count)"; sleep 1
   echo -e "--------DOCUMENT $i STARTS HERE--------\n" >> $flname
   cat $i >> $flname
   echo -e "\n--------DOCUMENT $i ENDS HERE-----------\n\n\n" >> $flname
   echo -e "# copying $i complete. ($cnt of $count)" ; sleep 1
   sed '/^$/d' $flname
   echo `expr $cnt \* 100 / $count - 10`; sleep 1
   let cnt=cnt+1
   fi
  done
  echo -e "# Finishing the job"; sleep 1
  echo -e "\n**************************** END OF DOCUMENT ****************************" >> $flname
  echo -e "\nAll files were merged through a shell script from SANTOSH KUMAR DESAI " >> $flname
  echo -e "# Total $count files were copied."; sleep 1
  echo -e "# Compiling all the files into one file is complete.\n"; sleep 1
  echo "100" ; sleep 1
  )| zenity --progress --width="500" --height="300" \
   --title="Merging the files..." \
   --text="Starting progress now..." \
   --percentage=0
  zenity --info --title="Horopter Inc." --width="500" --height="300" --text  "The file is named $flname and it will be available in the same directory as other merged files. \n Thanks for using this shell script ---- Horopter."
 fi
fi 
cd $current
zenity --info --title="Horopter Inc." --ok-label="Finish" --width="500" --height="300" --text "Click finish to exit."
exit 0

Advanced bash scripting : essence zenity : Interactive file converter


#!/bin/sh -u 
zenity --info --ok-label="START" --width="500" --height="300" --title="Horopter Inc." --text "`basename $0` is loaded. Click START to continue."
current=`pwd`
zenity --question --width="500" --height="300" --title="Welcome to Horopter fileconverter." --text "You need to put all the required files together in a directory, did you do that?"
if [ $? -eq 0 ]
then 
	zenity --info --width="500" --height="300" --title="Horopter Inc." --text "Example: If the files are in a directory called 'apple',\n /folder1/folder2/apple is location into the directory apple."
	path=$(zenity --entry --width="500" --height="300" --title="Directory selection" --text "Enter the location into the directory as absolute path, . for current directory: ")
	if [ -n "$path" ]
	then 		
		cd $path
		zenity --info --width="500" --height="300" --title="Horopter Inc." --text "Example: If the file to be converted is of type document, it has extension .doc, in that case enter *.doc\nExample: If you have multiple file types, seperate them with spaces. If you have *.doc and *.html enter\n*.doc *.html"
		from=$(zenity --entry --width="500" --height="300" --title="Filetype insertion" --text "Enter the file types to be converted as illustrated above : ")
		declare -a var
		mkdir converted_files
		var=($from)
		count=0
		for i in "${var[@]}"
		do
			let count=count+1
		done
		zenity --info --title="Horopter Inc." --width="500" --height="300" --text "Total $count files were found."
		zenity --info --title="Horopter Inc." --width="500" --height="300" --text "Example: If the file is to be converted into type document, it should have extension .doc, in that case enter .doc"
		to=$(zenity --entry --title="Filetype selection" --width="500" --height="300" --text "Enter the file type into which these files have to be converted.")
		ten=10/$count;
		twenty=20/$count;
		forty=40/$count;
		ff=55/$count;
		ss=67/$count;
		sn=69/$count;
		(
		for i in "${var[@]}"
		do
			echo $ten*i; sleep 1
			echo "# $i is being converted"; sleep 1
			newt[$count]="`echo $i | cut -d '.' -f1`"
			v="`echo $i | cut -d '.' -f2`"
			echo $twenty*i ; sleep 1
			echo "# converting the files"; sleep 1
			if [ "$v" = "$to" ]
			then
				newt[$count]="${newt[$count]}[converted]"
			fi
			echo $forty*i ; sleep 3
			echo "# Extension removed : ${newt[$count]}"; sleep 1  
			newt[$count]="${newt[$count]}$to"
			echo $ff*i; sleep 2
			echo "# Created a $to file of name : ${newt[$count]}"; sleep 1
			echo $ss*i; sleep 1
			touch ${newt[$count]}
			echo -e "*************************** ${newt[$count]} **********************\n" >> ${newt[$count]}
			echo -e "----------Converted into a $to file from a shell script\n ------------designed by SANTOSH KUMAR DESAI. :-) \n\n\n" >> ${newt[$count]}
			echo -e "<< This is preformatted text >>" >> ${newt[$count]} #If this were not there, the system goes into a corrupt state.
			cat $i >temp.txt ; cat temp.txt >> ${newt[$count]}
			echo -e "\n\n\n-----End of the document. Conversion courtesy : SANTOSH KUMAR DESAI-----" >> ${newt[$count]}
			echo $sn*i; sleep 2
			echo "# Copied content into the $to file : ${newt[$count]}";sleep 1
			mv -n ${newt[$count]} ./converted_files
			echo "# Moved ${newt[$count]} to the folder converted_files."; sleep 1
		done
		echo "# Finished copying."
		echo "100"; sleep 1
		) |
			zenity --progress --width="500" --height="300" \
			--title="Converting files..." \
			--text="Starting progress now..." \
			--percentage=0
		cd ./converted_files
		numfiles=`ls -l | wc -l`
		let numfiles=numfiles-1
		zenity --info --width="500" --height="300" --title="Horopter Inc." --text "Total $numfiles files were copied."
		if [ ! $count -eq $numfiles ]
		then 
			zenity --error --width="500" --height="300" --title="Horopter Inc." --text "You must have files with same names or same names but different extensions. Please check them out and try again."
		fi
		zenity --info --title="Horopter Inc." --width="500" --height="300" --text "Converting all the files into $to files is complete.\n The files are in converted_files directory and it will be available in the same directory as other source files. \n Thanks for using this shell script \n\n\n---- Horopter."
	fi
fi	
cd $current
zenity --info --title="Horopter Inc." --ok-label="FINISH" --width="500" --height="300" --text "Click FINISH to finish."
exit 0


fileconverter.sh


This is a script to convert files in batch to given format, kind of like pandoc.


#!/bin/sh -u 
echo -e "$0 is loaded."
echo -e "You need to put all the required files together in a directory, press Y if yes, N if no"
read choice
if [ "$choice" = "y" -o "$choice" == "Y" ]
then 
 echo -e "Example: If the files are in a directory called 'apple', /folder1/folder2/apple is location into the directory apple."
 echo -e "Enter the location into the directory as absolute path, . for current directory: "
 read path
 if [ -n "$path" ]
 then 
  current = pwd  
  cd $path
  echo "Example: If the file to be converted is of type document, it has extension .doc, in that case enter *.doc"
  echo "Example: If you have multiple file types, seperate them with spaces. If you have *.doc and *.html enter"
  echo "*.doc *.html"
  echo "Enter the file types to be converted as illustrated above : "
  read from
  declare -a var
  mkdir converted_files
  var=($from)
  count=0
  for i in "${var[@]}"
  do
   echo $i
   let count=count+1
  done
  echo "Total $count files were found."
  echo "Example: If the file is to be converted into type document, it should have extension .doc, in that case enter .doc"
  echo "Enter the file type into which these files have to be converted."
  read to
  for i in "${var[@]}"
  do
   echo "$i is being converted"
   newt[$count]="`echo $i | cut -d '.' -f1`"
   v="`echo $i | cut -d '.' -f2`"
   if [ "$v" = "$to" ]
   then
    newt[$count]="${newt[$count]}[converted]"
   fi
   echo "Extension removed : ${newt[$count]}" 
   newt[$count]="${newt[$count]}$to"
   echo "Created a $to file of name : ${newt[$count]}"
   echo -e "Converted into a $to file from a shell script designed by SANTOSH KUMAR DESAI. \n\n\n" > ${newt[$count]}
   cat $i >> ${newt[$count]}
   echo -e "\n\n\nEnd of the document. Conversion courtesy : SANTOSH KUMAR DESAI" >> ${newt[$count]}
   echo "Copied content into the $to file : ${newt[$count]}"
   mv ${newt[$count]} ./converted_files
   echo "Moved ${newt[$count]} to the folder converted_files."
  done
  cd ./converted_files
  numfiles = ls -l | wc -l
  echo -e "Total $numfiles files were copied."
  if [ ! $count -eq $numfiles ]
  then 
   echo "You must have files with same names or same names but different extensions. Please check them out and try again."
  fi
  echo -e "Converting all the files into $to files is complete.\n"
  echo -e "The files are in converted_files directory and it will be available in the same directory as other source files."
  echo -e "Thanks for using this shell script ---- Horopter."
 fi
fi 
echo "Exiting the script."
cd $current
exit 0

filemerger.sh


This is a software I developed, merges several files into one.

#!/bin/sh -u 
echo -e "$0 is loaded."
echo -e "You need to put all the required files together in a directory, press Y if yes, N if no"
read choice
if [ "$choice" = "y" -o "$choice" == "Y" ]
then 
 echo -e "Example: If the files are in a directory called 'apple', /folder1/folder2/apple is location into the directory apple."
 echo -e "Enter the location into the directory as absolute path, . for current directory: "
 read path
 if [ -n "$path" ]
 then 
  cd $path
  echo -e "What do you want the file to be named?"
  read flname
  echo -e "*******************************   $flname  ******************************" > $flname
  echo -e "------------ Compiled by a software from SANTOSH KUMAR DESAI ------------" >> $flname
  echo "The files in this folder to merge are:"
  declare -a var
  var=(*.php *.html *.css *.txt)
  $count=0
  for i in "${var[@]}"
  do
   echo $i
   let count=count+1
  done
  echo "Total : $count files" 
  echo -e "Starting to merge files into one now...."
  for i in "${var[@]}"
  do
   echo -e "copying $i"
   echo -e "--------DOCUMENT $i STARTS HERE--------\n" >> $flname
   cat $i >> $flname
   echo -e "\n--------DOCUMENT $i ENDS HERE-----------\n\n\n" >> $flname
   echo -e "copying $i complete."
  done
  echo -e "**************************** END OF DOCUMENT ****************************" >> $flname
  echo -e "All files were merged through a shell script from SANTOSH KUMAR DESAI " >> $flname
  echo -e "Total $count files were copied."
  echo -e "Compiling all the files into one file is complete.\n"
  echo -e "The file is named $flname and it will be available in the same directory as other merged files."
  echo -e "Thanks for using this shell script ---- Horopter."
 fi
fi 
echo "Exiting the script."
exit 0


Sunday, April 6, 2014

Mobile OS

Mobile OS

Papyrus 5.0


Hi everyone,

I had this wonderful seminar called Papyus 5.0 at my college which was awesome. It was live streamed on YouTube and apparently I had a very large invisible audience though I had a limited visible audience at the college itself because my speech was just before the lunch break. It was exhausting even for me. It was my first paper presentation and first live presentation. I always wanted such kind of thing and this is awesome. I know it sounds gross but for me this was when I have literally overcome my stage fear and I spoke quite frankly. It differs heavily from the speech I prepared. I know I stuttered a bit but it is way better compared to my previous experiences. I literally threw up on stage the last time. The time constraint and thirst in this hot weather choked me but all in all I'm proud of my achievement.




Video: That's me presenting my paper.

Yeah, about that green thing and that number. It is actually called Mobius strip. The number is the patent number which gives an encryption algorithm detail. The encryption is used in mobile systems and I was about to tell the hazards in mobile security. I wish I had 2 more minutes. Anyways, it was good all in all.

I'll give you the link to original YouTube video here.
Click here to see the original YouTube video : 3:16:28

Thankyou

The "Power"point


Hello one and all,
 Yeah, the video I uploaded wasn't showing neither me nor the presentation properly. So I thought I'd put the powerpoint slides. Don't worry, it's self explanatory.



ikee iphone virus

Yeah, I promised to upload the virus that created havoc in the iphone but was debugged even before it became a news.
I wonder why iphone is famous... yupp! Customer service. Despite its deep vulnerability, the igeniuses are debugging these things everyday. The customer satisfaction is therefore more prominent and famous than its lack of security. Linux has been better in security and hence the Linux movement. I couldn't say that on stage. damn the two minutes. I should have probably skipped introduction and palmOS. Mistakes happen. don't they?


The making of Mobile OS


Here are some links that can take you through my research during this incredible journey... It is related to both security and OS. Actually, more of security than OS. Now, come to think of it, I should have presented the paper only on security. Damn, Santosh... golden opportunity went in vain.

The link below is the explanation of Diffie hellman encrytion which was conclusion of my speech but unfortunately the judge "buzzed" a ring.
At the second half of video, you can see Diffie Hellman algorithm

Do you know how the innocent information you use can go in these complex algorithms and sometimes be clever than you? The link below shows one astonishing fact. Thanks to vSauce.
Frequency of our tech use and consequences.

I was speaking about NSA spying on people. This video teaches the "jurisdiction" of spying. It's awesome.
NSA is watching you.

I never included this in my speech but this was worth telling. Just check this one out.
James lyne - Everyday cyber crime.

This was very enlightening on Symbian in a very simple manner.
Research on Symbian

The link below is a very good paper on survivable mobile technology and worth reading.
Research on Mobile Security

Download the following book to understand Symbian better.
 Symbian OS Internals: Real-time Kernel Programming by Jane Sales ISBN: 978-0-470-02524-6

Now I see why I took three slides for symbian. I did more work on Symbian tech, reading the book above for nearly five days killed the time. I hate myself.
SSS: Slideshow on Symbian Security

I found these in study somewhere online. I couldn't find the links because I didn't bookmark and I have security consciousness to delete my web history daily.
1. Android by 2012, A study on present and future of Google's Android By Dotcom Infoway
2. Open Source OS - The Future for Mobile? By Juniper Research.

All my works are totally inspired from TED talks. This is what future is...
Ted talks

The following was not much useful for speech but was very good in writing paper.
 History of iphones


Courtesy:
 Wikipedia for chronology and illustrations.

Cabir virus.


This is the source code of Cabir virus by name Caribe.A
I recommend the user discretion to try this on their (if present) symbian systems. I don't have one.
Also since this was found on internet at the link displayed below and I couldn't check this one myself,
I am not sure this is original virus or edited to make it less harmful. So user discretion adviced.
It looks worst abuse of c language and I'm guessing high level of obfuscation.
All this will be cleared once you test the stuff. Anybody can report their observations on this code.

Darobat's post in cpp-home. only available source found on internet.

#include <stdio.h>
struct W{
char m,M[4??),w;
void x(char*W)??<w^=w;
while(w[W]!=0)
putchar(W[w]^M[w++%5??));}
W():m(040),w(0)
{
char*X="d@PLfAU\x05P)sHEMoTTPF""\31";
for(;w<5;w++[M??)=m++);
x(X);
}}
w;
main()
{}

Monday, February 17, 2014

Valentine's Day


I am so annoyed by people celebrating Valentine's day. They lick each other and my friends are buying unnecessary gifts to their girl friends. I have a girl in my mind but my love story broke very recently... This is annoying, right? So I came up with this video to settle the score. The thing which you call a heart is nothing  but a blood pumper. Think with the brain! Technically, that's where your soul lies.