Integrate sTeam-shell into Vi and Indentation of output in the look command to display like ls

 

GSoC2016Logofever_logoFOSSASIA bring’s people together to share, create, develop and make things with Open Technologies and software. We organize science hack labs, Open Tech events, meetups and coding programs with developers, designers and contributors.
Checkout the FOSSASIA Idea’s page for more information.
(ˢᵒᶜⁱᵉᵗʸserver) aims to be a platform for developing collaborative applications.
sTeam server project repository: sTeam.

Indentation of sTeam-shell output

During the 1 st week the Indentaton of the output in the look command in steam-shell is formatted to be displayed in the way the output is displayed when the ls command is executed.

The module reference provided by the pike language is used for formatting.

he screenwidth of the the user is calculated using the command tput rows.
This value is then passed as an argument to the write function to display it in the form of output of an ls command.
The example of this can be seen in the modref by Pike.

Issue. Github Issue Github PR
Indentation of output in steal-shell. Issue-24 PR-42

Example:

write("%-$*s\n", screen_width,"Given a\nlist of\nslosh-n\nseparated\n'words',\nthis option\n"+ "creates a\ntable out\nof them\nthe number of\ncolumns\n"+"be forced\nby specifying a\npresision.\nThe most obvious\n"+"use is for\nformatted\nls output.");

Output:

 Given a          list of          slosh-n
 separated        'words',         this option
 creates a        table out        of them
 the number of    columns          be forced
 by specifying a  presision.       The most obvious
 use is for       formatted        ls output.

The following chnages have been made in order to incorporate the changes:

IndentationCodeChange

Integration of sTeam-shell into Vi

For integration of sTeam-shell.pike into the Vi, the steam-shell is made compatible to be run when a command is passed as an argument to it. The changes have been made in steam-shell.pike and the applauncher.pike. Also a new file called as VisTeam.pike is created. When this is executed it validates the user and opens two vi buffers. One for typing the command and the other to display the log/ output of the executed command.

A steam-shell.vim vi plugin is created so as to be able to run the Steam function in vi. Whenever this function is executed the selected text in the vi visual mode will be executed.

The results are displayed in the log buffer in a new tab. Since the already existing vim scripts Golderratio.vim and watchforchanges.vim divide the command buffer and the log buffer in the ration 2:1, the output is not visible in the logs. Thus a newtab consisting of the logs is opened.

 

Issue. Github Issue Github PR
Integrate sTeam-shell into Vi. Issue-37 PR-41

InsertIntoVI

Execute the command:

ExecuteCommandsTeamDisplay the output:

DisplayTheOutput

Let the Coding Begin….!!!

GSoC2016Logo
fever_logoFOSSASIA bring’s people together to share, create, develop and make things with Open Technologies and software. We organize science hack labs, Open Tech events, meetups and coding programs with developers, designers and contributors.
Checkout the FOSSASIA Idea’s page for more information.
(ˢᵒᶜⁱᵉᵗʸserver) aims to be a platform for developing collaborative applications.
sTeam server project repository: sTeam.

Let the Coding Begin…!!!

Finally May 23, 2016 sets in.

The paths of glory lead but to the grave.
-Thomas Gray

The path of the GSOC journey is a bed of thorns and roses.

The community bonding period has elapsed and the real GSOC journey begins

GSOC-timeline

The community bonding period has lead to some real constructive work been done in the project.
The installation and deployment of the sTeam was largely dependent on the linux environment. This was a major hurdle for the development process.
Also the installation process of the sTeam project was quite cumbersome. These had to be improved.

The community bonding period was spent in addressing these issues.

For simplying the installation process I began with the creation of the .deb package. There was a .deb package for the earlier versions of sTeam. The .deb package was made to incorporate the new changes.
Finally a decision was made to rename the sTeam package to societyserver.
This renaming has lead to several deb source config issues in the package.

debianpackage

These issue’s will be addressed during the later part of the Summer.

In order to facilitate development in all the environments and give the user the ease from the cumbersome installation steps a docker image was made for the sTeam project.
This docker image contains all the necessary dependencies to start the sTeam server.
It also includes the sTeam UI and the Rest API along with it’s dependencies. These have already been installed and developer can start collaborating to it.

docker-image

The docker image can be found at :


https://hub.docker.com/r/ajinkya007/societyserver/

It has all the necessary information for it’s usage and installation.

The community bonding period also included in me exploring the import and export from git commands, the usage of steam-shell, resolution of some minor bugs in it, integrating the steam-shell in vi. This period also witnessed me getting hands on with the other repositories of the societyserver.org.
The repositories which were analyzed and explored include :-

https://github.com/societyserver/sTeam-web-interface-gsoc-2015
https://github.com/societyserver/steam-rest

So having formed a strong bond during this period, the real showdown begins from May 23, 2016.
The coding period has began, and the time to put words into action has come….
Happy Summer GSOC’ers  🙂

Talk is Cheap, Show me the code !!!

Bond, Community Bond

GSoC2016Logofever_logoFOSSASIA bring’s people together to share, create, develop and make things with Open Technologies and software. We organize science hack labs, Open Tech events, meetups and coding programs with developers, designers and contributors.
Checkout the FOSSASIA Idea’s page for more information.
(ˢᵒᶜⁱᵉᵗʸserver) aims to be a platform for developing collaborative applications.
sTeam server project repository: sTeam.

Bond, Community Bond

The bond was very highly covalent :p

The community bonding lead to sharing of knowledge between all the developers all around the world, their views and opinions on various technologies used in the current times.

The community bonding period saw to it that interaction between the organization mentors, developers , project mentors and colleagues and GSOC’ers all round the world takes place on a regular basis.

The interaction was initiated by Lays Rodrigues by forming a facebook group for 2016 GSOC’ers.


https://www.facebook.com/groups/GSoC2016/

The personal webblog can be found at ;


https://laysrodriguesdev.wordpress.com/2016/05/

Lays has also taken an initiative and created a map where by all the GSOC’ers in the world were mapped according to their place of residence. This can be seen at :

The community bonding period also ensured that I got included in the developer groups of the various organizations for ensuring that the development happens throughout the summer.

Notable include : sTeam.devel group

Additions to the FOSSASIA, Societyserver and PlanetGSoC organizations on github.

sTeamDevGroup
OrgList

 https://github.com/ajinkya007

One of the project which would be having the links to the majority of the blogs published by the GSOC’ers during the course of Summer is Planet GSoC developed by Rohan Verma.

Planet GSoC is Google Summer of Code Blog Aggregator.

This can be found at :

http://planetgsoc.github.io/

Data Recovery: Photo Rec step by step.

Run PhotoRec executable

If PhotoRec is not yet installed, it can be downloaded from TestDisk Download. Extract the files from the archive including the sub-directories.

To recover files from hard disk, USB key, Smart Card, CD-ROM, DVD, etc., you need enough rights to access the physical device.

  • Dos.png Under DOS, run photorec.exe
  • Win.png Under Windows, start PhotoRec (ie testdisk-6.13/photorec_win.exe) from an account in the Administrator group. Under Windows Vista or later, right click photorec_win.exe and then click Run as administrator to launch PhotoRec.
  • Linux.png Under Unix/Linux/BSD, you need to be root to run PhotoRec (ie. sudo testdisk-6.13/photorec_static)
  • Macosx.png Under Mac OS X, start PhotoRec (ie testdisk-6.13/photorec). If you are not root, PhotoRec will restart itself using sudo after a confirmation on your part. Sudo will ask for a password – enter your Mac OS X user password.
  • Os2.png Under OS/2, PhotoRec doesn’t handle physical devices, only disk images. Sorry.

To recover files from a media image, run

  • photorec image.dd to carve a raw disk image
  • photorec image.E01 to recover files from an Encase EWF image
  • photorec 'image.???' if the Encase image is split into several files.
  • photorec '/cygdrive/d/evidence/image.???' if the Encase image is split into several files in the directory d:\evidence

Linux.png Macosx.png Most devices should be autodetected including Linux software RAID (that is, /dev/md0) and file system encrypted with cryptsetup, dm-crypt, LUKS or TrueCrypt (ie. /dev/mapper/truecrypt0). To recover files from other devices, run photorec device.

Forensics users can use the parameter /log to create a log file named photorec.log; it records the location of the files recovered by PhotoRec.

Disk selection

PhotoRec startup.png

Available media are listed. Use up/down arrow keys to select the disk that holds the lost files. Press Enter to proceed.

Macosx.png If available, use the raw device, /dev/rdisk* instead of /dev/disk* for faster data transfer.

Source partition selection

PhotoRec src.png

Choose

  • Search after selecting the partition that holds the lost files to start the recovery,
  • Options to modify the options,
  • File Opt to modify the list of file types recovered by PhotoRec.

PhotoRec options

PhotoRec options.png
  • Paranoid By default, recovered files are verified and invalid files rejected.

Enable bruteforce if you want to recover more fragmented JPEG files, note it is a very CPU intensive operation.

  • Allow partial last cylinder modifies how the disk geometry is determined – only non-partitioned media should be affected.
  • The expert mode option allows the user to force the file system block size and the offset. Each filesystem has his own block size (a multiple of the sector size) and offset (0 for NTFS, exFAT, ext2/3/4), these value are fixed when the filesystem has been created/formated. When working on the whole disk (ie. original partitions are lost) or a reformated partition, if PhotoRec has found very few files, you may want to try the minimal value that PhotoRec let you select (it’s the sector size) for the block size (0 will be used for the offset).
  • Enable Keep corrupted files to keep files even if they are invalid in the hope that data may still be salvaged from an invalid file using other tools.
  • Enable Low memory if your system does not have enough memory and crashes during recovery. It may be needed for large file systems that are heavily fragmented. Do not use this option unless absolutely necessary.

Selection of files to recover

PhotoRec files.png

In FileOpts, enable or disable the recovery of certain file types, for example,

[X] riff RIFF audio/video: wav, cdr, avi
...
[X] tif  Tag Image File Format and some raw file formats (pef/nef/dcr/sr2/cr2)
...
[X] zip  zip archive including OpenOffice and MSOffice 2007

The whole list of file formats recovered by PhotoRec contains more than 300 file families representing more than 480 file extensions.

File system type

PhotoRec filesystem.png

Once a partition has been selected and validated with Search, PhotoRec needs to know how the data blocks are allocated. Unless it is an ext2/ext3/ext4 filesystem, choose Other.

Carve the partition or unallocated space only

PhotoRec free.png

PhotoRec can search files from

  • from the whole partition (useful if the filesystem is corrupted) or
  • from the unallocated space only (available for ext2/ext3/ext4, FAT12/FAT16/FAT32 and NTFS). With this option only deleted files are recovered.

Select where recovered files should be written

PhotoRec dst.png

Choose the directory where the recovered files should be written.

  • Dos.png Win.png Os2.png To get the drive list (C:, D:, E:, etc.), use the arrow keys to select .., press the Enter key – repeat until you can select the drive of your choice. Validate with Yes when you get the expected destination.
  • Linux.png File system from external disk may be available in a /media, /mnt or /run/media sub-directory. Mount your destination drive if necessary.
  • Macosx.png Partitions from external disk are usually mounted in /Volumes.

Recovery in progress

PhotoRec running.png

Number of recovered files is updated in real time.

  • During pass 0, PhotoRec searches the first 10 files to determine the blocksize.
  • During pass 1 and later, files are recovered including some fragmented files.

Recovered files are written in recup_dir.1, recup_dir.2… sub-directories. It’s possible to access the files even if the recovery is not finished.

Recovery is completed

PhotoRec end.png

When the recovery is complete, a summary is displayed. Note that if you interrupt the recovery, the next time PhotoRec is restarted you will be asked to resume the recovery.

  • Thumbnails found inside pictures are saved as t*.jpg
  • If you have chosen to keep corrupted files/file fragments, their filenames will beginning by the letter b(roken).
  • Hint: When looking for a specific file. Sort your recovered files by extension and/or date/time. PhotoRec uses time information (metadata) when available in the file header to set the file modification time
  • After Using PhotoRec: Some ideas to sort recovered files or repair broken ones.
  • Win.png You may have disabled your live antivirus protection during the recovery to speed up the process, but it’s recommended to scan the recovered files for viruses before opening them – PhotoRec may have undeleted an infected document or a trojan.

Source: http://www.cgsecurity.org/wiki/PhotoRec_Step_By_Step

Grub Customizer

Grub Customizer is a graphical tool for managing the Grub boot entries in Ubuntu Linux.

With it, you can set the default OS, add/remove boot entries, change boot order, set an background image, and more.

This simple tutorial is going to show you how to install the Grub Customizer in Ubuntu 14.04 Trusty Tahr from the developer’s PPA.

Grub Customizer 4.0

To get started:

press Ctrl+Alt+T on keyboard to open the terminal. When it opens, paste the commands below and run one by one:

sudo add-apt-repository ppa:danielrichter2007/grub-customizer

sudo apt-get update

sudo apt-get install grub-customizer

Once done, you’re able to open this tool from the Unity Dash or application menu. Enjoy!

Source: www.ubuntuhandbook.com

Boot Repair – Grub 2

Ubuntu and many other Linux distributions use the GRUB2 boot loader. If GRUB2 breaks — for example, if you install Windows after installing Ubuntu or overwrite your MBR — you won’t be able to boot into Ubuntu.

You can easily restore GRUB2 from a Ubuntu live CD or USB drive. This process is different from restoring the legacy GRUB boot loader on older Linux distributions.

Graphical Method – Boot Repair

Boot Repair is a graphical tool that can repair GRUB2 with a single click. This is the ideal solution to boot problems for most users.

If you have the media you installed Ubuntu from, insert it into your computer and restart. If you don’t, download a Ubuntu live CD and burn it to a disc or install it on a USB flash drive. You can also download a dedicated Boot Repair live CD.

After booting into the live Ubuntu environment, open a terminal from the Dash and run the following commands to install Boot Repair:

sudo apt-add-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair
boot-repair

image

The Boot Repair window will appear after you run the boot-repair command. After it scans your system, click the Recommended repair button to repair GRUB2 with a single click.

image

You can also click the Advanced options header to customize GRUB2’s options without learning its command-line syntax.

image

Restart your computer after using the Boot Repair tool. Ubuntu should boot up normally.

Terminal Method

If you’d rather get your hands dirty, you can do this yourself from a terminal. You’ll need to boot from a live CD or USB drive, as in the graphical method above. Ensure the version of Ubuntu on the CD is the same as the version of Ubuntu installed on your computer — for example, if you have Ubuntu 12.04 installed, ensure you use a Ubuntu 12.04 live CD.

Open a terminal after booting into the live environment. Identify the partition Ubuntu is installed on using one of the following commands:

sudo fdisk -l
sudo blkid

Here’s the output of both commands. In the fdisk -l command, the Ubuntu partition is identified by the word Linux in the System column. In the blkid command, the partition is identified by its ext4 file system.

image

Run the following command to mount the Ubuntu partition at  /mnt, replacing /dev/sdX# with the device name of your Ubuntu partition from the above commands:

sudo mount /dev/sdX# /mnt

For example, use /dev/sda1 for the first partition of the first hard disk device.

image

Important: If you have a separate boot partition, skip the above command and mount the boot partition at /mnt/boot. If you don’t know whether you have a separate boot partition, you probably don’t.

Run the following command to reinstall grub from the live CD, replacing /dev/sdX with the device name of the hard disk above. Omit the number. For example, if you used /dev/sda1 above, use /dev/sda here.

sudo grub-install –boot-directory=/mnt/boot /dev/sdX

image

Restart your computer and Ubuntu should boot properly.

Source: http://www.howtogeek.com/114884/how-to-repair-grub2-when-ubuntu-wont-boot/
https://askubuntu.com/questions/549172/how-to-install-windows-8-1-under-virtualbox-in-ubuntu

Recover, Restore or Reinstall Grub

Grub 2 typically gets overridden when you install Windows or another Operating System. To make Ubuntu control the boot process, you need Reinstall (Repair/Restore) Grub using a Ubuntu Live CD.

Terminal Commands

Mount the partition your Ubuntu Installation is on. If you are not sure which it is, launch GParted (included in the Live CD) and find out. It is usually a EXT4 Partition. Replace the XY with the drive letter, and partition number, for example: sudo mount /dev/sda1 /mnt.

sudo mount /dev/sdXY /mnt

Now bind the directories that grub needs access to to detect other operating systems, like so.Watch movie online Get Out (2017)


sudo mount --bind /dev /mnt/dev &&
sudo mount --bind /dev/pts /mnt/dev/pts &&
sudo mount --bind /proc /mnt/proc &&
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt

Now install, check, and update grub.

This time you only need to add the drive letter (usually a) to replace X, for example: grub-install /dev/sda, grub-install –recheck /dev/sda.


grub-install /dev/sdX
grub-install --recheck /dev/sdX
update-grub

Now grub is back, all that is left is to exit the chrooted system and unmount everything.


exit &&
sudo umount /mnt/sys &&
sudo umount /mnt/proc &&
sudo umount /mnt/dev/pts &&
sudo umount /mnt/dev &&
sudo umount /mnt

Shut down and turn your computer back on, and you will be met with the default Grub2 screen.

Mount system using Live CD

Mount the partition your Ubuntu Installation is on. If you are not sure which it is, launch GParted (included in the Live CD) and find out. It is usually a EXT4 Partition. Replace the XY with the drive letter, and partition number, for example: sudo mount /dev/sda1 /mnt.

sudo mount /dev/sdXY /mnt

Press Ctrl-Alt-F1

sudo mount /dev/sda1 /mnt

sudo mount --bind /dev /mnt/dev

sudo mount --bind /proc /mnt/proc

sudo mount --bind /sys /mnt/sys

sudo chroot /mnt