26 May 2010

Lookup details of an IP or Domain (whois lookup) graphically

By using the following script you can easily lookup for an ip or domain using zenity and shell script. (sorry Windows folks, i just hate you).

 

#!/bin/bash
# Get the domain name
Z="/usr/bin/zenity"
O="/tmp/whois.o.$$"
domain=$(${Z} --title  "Domain Information" \
                --entry --text "Domain name who's information you seek!" )

if [ $? -eq 0 ]
then
    whois $domain  | tee >${O}
 
  # Display back output
  ${Z} --width=800 --height=600  \
               --title "Whois info for $domain" \
               --text-info --filename="${O}"
else
  ${Z} --error \
               --text="No input provided"
fi

 

Enjoy. :D

21 Mar 2010

Make Your Linux Box Blazing fast!

This list is compiled for my personal use, should work for anyone. Try the followings:

1. Use lighter applications (Replace your default applications with them)

Gedit >> Mousepad
Picture viewer (EOG ...) >> Gpicview
Network Manager >> Wicd
Open Office Writer >> AbiWord
Open Office Spreadsheet >> Gnumeric
Evince >> epdfview

2. Increase Swappiness

$ sudo vim /etc/sysctl.conf
Edit: vm.swappiness=10

3.  For dual cores (Use Concurrency)

$ sudo vim /etc/init.d/rc
Edit: CONCURRENCY=shell

Read the rest of this post »

13 Jan 2010

My .vimrc file

Vim is the editor of my choice for my linux box. I have configured my .vimrc file in my ubuntu.

-------------------------------------------------------------------------------------------------------------

" Tushar Neupaney's VIMRC File
" Followme twitter.com/tneupaney
" linuxfanatic.posterous.com

" (sw)shiftwidth: how many columns text is indented with reindent operations
" (sts)softtabstop: how many columns vim uses when you hit tab
" (ts)tabstop: how many columns a tab counts for
set ts=4 sw=4 sts=2

" expandtab: appropriate number of spaces in insert mode
set expandtab

" Make gvim colorscheme as evening
if v:progname =~? "gvim"
    colorscheme evening
endif

" Prevents keeping of backup after overwriting the file
set nobk

" To see line numbers on the left
set number

" autocomplete parenthesis, brackets and braces
inoremap ( ()<Left>
inoremap [ []<Left>
inoremap { {}<Left>

" Syntax highlighting on
syntax on

" share windows clipboard
set clipboard+=unnamed

" Hightlight the curent column
set cursorcolumn

" Hightlight the current line
set cursorline

-------------------------------------------------------------------------------------------

Here is the Screenshot!

 

8 Sep 2009

Nitche bash commands to use

I use a lot of scripting for my daily stuffs. I had listed a collection of commands that are useful to me and guess is useful to everyone else reading this blog.
The stuffs below are collected from different sources but i have tested them for working conditions.
If there are any other ways of doing the same thing, please comment.

1. Connect via ssh using mac address
    ssh root@'for ((i=100; i<=110; i++));do arp -a 192.168.1.$i; done | grep 00:35:cf:56:b2:2g |
    awk '{print $2}' | sed -e 's/(//' -e 's/)//

2. Show directories in the PATH, one each line
    echo $PATH | tr \: \\n

3. Check your unred yahoo mail with wget
    wget -q -O - --load-cookies=cookies.txt "http://uk.mc267.mail.yahoo.com/mc/showFolder?
    fid=Inbox&order=down&pSize=25" | sed 's/<[^>]*>/\n/g' | grep '.' | awk '/^Unread$/,/KB$/' |
    grep -v '&nbsp' | sed 's/^Unread$/===============/'

4. Rip VCD
    cdrdao read-cd --device ATA:1,1,0 --driver generic-mmc-raw --read-raw image.toc

5. Check your gmail from the command line
    curl -u username --silent "https://mail.google.com/mail/feed/atom" |
    perl -ne 'print "\t" if /<name>/; print "$2\n" if /<(title|name)>(.*)<\/\1>/;'

6. Remove html tags from a file
    sed 's/<[^>]*>//g' index.html
   
7. Make ISO file using the dd command
    dd if=/dev/cdrom of=output.iso

8. Watch the load average of your computer
    watch 'cat /proc/loadavg'

9. List all harddisk partitions
    fdisk -l |grep -e '^/' |awk '{print $1}'|sed -e "s|/dev/||g"

10. Reinstall Grub
    sudo grub-install --recheck /dev/sda1

11. Flash emergency signals from your computer
    while true; do xset dpms force off; sleep 0.3; xset dpms force on; xset s reset; sleep 0.3; done
   
12. Scan all active ip addresses in your network
    arp-scan -l   

27 Aug 2009

Examples of WMIC a hidden secret

WMIC stands for windows management instrumentation command-line, a well kept secret which has been silently being featured in Windows based Operating system actively after windows 2000. The tool is not only robust, powerful and flexible, it can also be used over the network seamlessly.

To access this tool, you have to enter wmic in the command line of windows, which will end up in it's own shell. Mostly, you should have wmic installed as it is the default in windows, you may also see a message saying wmic installing which happens for the first time only. It basically works after the WMI service starts to run. WMIC also has an easy API structure. To use the api you will have to use the WQL or Windows Query Language which is quite similar to SQL or Structed Query Language.

The format of WMIC is:

WMIC [Credentials] [area] [QueryString]

Some Examples and usage of WMIC:

1.  To get the process list - wmic process list
2.  To get the group list - wmic group list
3.  To get the NIC Card Configuration - wmic nicconfig list
4.  To get user account list - wmic useraccount list
5.  To get the built in System account list - wmic sysaccount list
6.  To get the Environment list - wmic environment list
7.  To get the information of all shares (including hidden) - wmic share list
8.  To get the list of services - wmic services list
9.  To get the computer system details - wmic computersystem list
10. To get the volume information - wmic volume list
11. To get full startup list - wmic startup list full
12. To get Information of logical disks - wmic logicaldisk get description, filesystem, name, size
13. To get screensaver information - wmic desktop get screensaversecure, screensavertimeout
14. To get logon information - wmic logon get authenticationpackage
15. To get information about the OS - wmic os get name, servicepackmajorversion
16. To get information about QFE (Quick Fix Engineering) - wmic qfe get description,installedOn
17. To get information about the computer - wmic csproduct get name,vendor,identifyingNumber
18. To get the toal ram - wmic computersystem get TOTALPhysicalMemory,caption
19. To get the macaddress of nic card - wmic nic get macaddress,description

Note: In all the above you can use "brief" command to get a brief list of information and "full" to get the full list of information, for example use wmic process list brief, wmic process list full.

Doing some niche tasks from wmic:

1. Updage static ip address
wmic nicconfig where index=9 call enablestatic("192.168.0.117"),("255.255.255.0")

2. To Change the network gateway
wmic nicconfig where index=9 call setgateways("192.168.0.117","192.168.0.118"),(1,2)

3. To start an application
wmic process call create "paint.exe"

4. To enable dhcp
wmic nicconfig where index=9 call enabledhcp

5. To kill an application
wmic process where name="paint.exe" call terminate

6. To change the process priority
wmic process where name="iexplorer.exe" call setpriority 64

7. To get name and process id of a process
wmic process where (Name='svchost.exe') get name,processid