Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Install GO in UNIX/LINUX Environment

Go is a statically typed, compiled programming language designed at Google by Robert Griesemer, Rob Pike, and Ken Thompson. Follow the below steps to install it on you Linux/Unix Box :

  1. Download it from https://golang.org/dl/
$ curl -sSL https://golang.org/dl/goX.XX.X.linux-amd64.tar.gz -o goX.XX.X.linux-amd64.tar.gz

replace the X.XX.X with current version.

  1. Extract the downloaded file to /usr/local
$ sudo tar -C /usr/local -xzf goX.XX.X.linux-amd64.tar.gz
  1. Add the path /usr/local/go/bin to the environment variable, and for that just add the below lines to your .bashrc file, which is located on your home directory ~/.bashrc. Add below lines
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

and now you are good to GO {he he !!}. Test the setup with go version

$ go version  
go version go1.15.3 linux/amd64

thats it.


Read more »

Escalation Privilege on Linux/Unix System by Editing /etc/passwd and /etc/shadow files :

etc/passwd file :

The /etc/passwd file stores essential information, which is required during login i.e. user account information. It is basically a text file that contains the information about each user or account on a computer running Linux or another Unix-like operating system. The permissions for /etc/passwd are by default set so that it is world readable, that is, so that it can be read by any user on the system. Example :
Read more »

Install shutter screenshot tool with Editor Enabled in Ubuntu 18.04

Shutter is a screenshot application written in perl. You can take a screenshot of a specific area, window, your whole screen, or even of a website. You can apply different effects to it, draw on it to highlight points, and then upload to an image hosting site, all within one window.
Read more »

Mounting Samba File Sharing on Linux / Ubuntu system within single command

The command used to mount Samba file sharing is 'gio'(gnome input/output) utility.
 gio mount smb://<server_address>/<share>
Where we need to provide three things :
  • Username
  • WORKGROUP
  • Password
Example :
 $ gio mount smb://192.168.56.101/Anonymous
 Password required for share anonymous on 192.168.1.100
 User [ajay]: Anonymous
 Domain [WORKGROUP]: WORKGROUP
 Password: <-------Password_here
Automating the whole Process with a Shell script :
File : smbmount.sh
#!/bin/bash
# Mount smb file server with below credentials 
# Name : Anonymous
# WORKGROUP : WORKGROUP
# Password : Anonymous

echo -e "Anonymous\nWORKGROUP\nAnonymous" | gio mount \
smb://192.168.1.100/Anonymous >> /dev/null 2>&1

Creating an alias for smbmount.sh in .bashrc file :

Open your '.bashrc' file on any editor and at the last line add this :
 alias smbmount="~/scripts/smbmount.sh"
I put script at "~/scripts/smbmount.sh", you can change it accoring to your location. Now open a new terminal and type 'smbmount' to mount smsb share on your destro.
 $ smbmount
Cheers !!
Read more »

How to Copy/Sync Files and Directories with Rsync in Linux : A Beginners Guide to Rsync

Rsync is a very flexible network-enabled syncing tool. It is a powerful tool that facilitates the transfer and synchronization of data between both local and remote systems. Rsync stands for "remote sync". It uses an algorithm that minimizes the amount of data copied by only moving the portions of files that have changed.
Read more »

Rar for Beginners : How to use Rar utility to Compress Files in Linux/Unix Based Systems

Rar is a command line tool to compress files and directories. It is the Linux port of the command line version of WinRAR. RAR is a proprietary archive file format that supports data compression, error recovery and file spanning. It was developed by a Russian software engineer, Eugene Roshal  and the RAR software is licensed by win.rar GmbH. The name RAR stands for Roshal Archive. The filename extensions used by RAR is .rar.
Read more »

Tar Archiver for Beginners : How to use tar to Archive Files/Directories in Linux/Unix Based Systems

Tar is a command line tool for Archiving files and directories. It is a widely used command line tool to create backup archives (collection of files and directories). Tar stands for Tape Archive, and sometimes referred to as tarball. The tar archive have as extension of '.Tar'.
Read more »

xz for Beginners : How to use xz to Compress Files in Linux/Unix Based Systems

xz is a general purpose data compression tool which uses LZMA/LZMA2 compression algorithms to compress files. This algorithm has a greater compression ratio than gzip and bzip2, which makes it a great format when we need to store data on limited disk space. But it takes significantly longer to do the compression. For instance, with the heavy compression flags on a fairly large file, gzip may require around half a minute, bzip2 might be somewhere around a minute, and xz may take around four or five minutes, but the decompression time is relatively good. It creates smaller files. This compression tool was first released in 2009, and the compressed file xz has extension of '.xz'.
Read more »

Bzip2 for Beginners : How to use Bzip2 to Compress Files in Linux/Unix Based Systems

Bzip2 is a free and open-source file compression program that uses the Burrows–Wheeler algorithm to compress files. The data format BZIP2 was created for the compression of single or concatenated files. Structure and usage of BZIP2 are similar to the older GZIP format. BZIP2 was developed as alternative to GZIP and offers improved compression.
Read more »

Gzip for Beginners : How to use Gzip to Compress Files in Linux/Unix Based Systems

Gzip (GNU Zip) is a command line tool used to compress and/or expand files. It comes with most of the Linux/Unix based Operating Systems. Gzip is a free software replacement for the compress program used in early Unix systems, intended for use by the GNU Project. gzip was created by Jean-Loup Gailly and Mark Adler. The compression method used by "gzip" is known as Lempel-Ziv (LZ77). Whenever possible, each file is replaced by one with the extension .gz, while keeping the same ownership modes, access and modification times. If, in case if the compressed file name is too long for its file system, gzip truncates it.
Read more »

Wget for Beginners : How to use wget in Linux/Unix Based Systems

Wget is a command-line downloader for Linux and UNIX environments. It is very powerful and versatile tool used for retrieves content from web servers and websites. Wget is freely available package and license is under GNU GPL License. With wget we can download files or even entire website. It supports the download protocols (HTTP, HTTPS, FTP and, FTPS).  It helps users to download huge chunks of data, multiple files and to do recursive downloads. Main feature of Wget of it’s robustness, and it also works well in slow or unstable network connections. Some of the features of wget are resuming of downloads, bandwidth control, authentication handling etc.
Read more »

How to install Web for Pentester VM in Oracle Virtual Box

Web for Pentester is a pre-configured Virtual Machine ISO prepared for practicing Web Pentesting by PentesterLab. They also provide a course about Web penetration testing along with it. The course page can be found here. So its highly recommended to reviewing the course material to get a better understanding of the topic. This particular vulnerable VM focuses on web application pentesting and its fundamental elements. You can download the VM ISO from here.

Note : Some screenshots are small in sizes, so to saw them in big size please click on it.
Read more »

How to Install Oracle Virtual Box 5.2 on Ubuntu 16.04, 17.10 (Xenial / Trusty / Artful) and 18.04 (bionic)

Oracle VM VirtualBox is a free and open-source hypervisor for x86 and AMD64/Intel64 computers currently being developed by Oracle Corporation. A VirtualBox or VB is a software virtualization package that installs on an operating system as an application. VirtualBox allows additional operating systems to be installed on it, as a Guest OS, and run in a virtual environment.
Read more »

Curl for Web Hacking and Pentesting

In the previous post we saw the basic uses of curl. Now at this we are going to see some useful and important command as web pentesting view.

1. Get the HTTP response header

We can get header information of a website with '-I' flag
 curl -I http://www.w3.org
2. Sending GET Requests
 curl "http://www.testserver.com/example.php?name=hacke&age=30"
3. Sending POST requests 
 curl -d "name=ajay&submit=Submit" http://www.testserver.com/example.php
4. To follow a redirect location:
 curl -L http://www.testserver.com
5. Sending custom Headers : 
 curl -H "user-agent:Mozilla/5.0 (X11; Linux x86_64) " http://www.testserver.com
 curl -H "Content-Type: text/xml" http://www.testserver.com
 curl -H "Host: www.unknownsite.com" http://www.testserver.com
6. Custom User-Agent Header :

We can send custom user agent header by '-A' flag
 curl -A "Mozilla/5.0 (X11; Linux x86_64)" http://www.testserver.com
 curl -A "Mozilla/5.0 (compatible;  Windows NT 5.0)" http://www.testserver.com
7. Custom Referrer field :
 curl -e http://referersite.com http://www.testserver.com
Or we can also send custom referrer with below command
 curl -H "Referrer: http://referersite.com"  http://www.testserver.com
8. Custom Cookies : 

To send custom cookies use '-b' flag
 curl -b "name=sectree" http://www.testserver.com
To store response cookies in a file use '-c' option. We can also send cookies which is stored in a file.
 curl -b current_cookies.txt -c new_cookies.txt http://www.testserver.com
where the current_cookies.txt are being sent to the web server and new_cookies.txt are response cookies by the server which is stored and written in that file.


Read more »

How to use Curl in Linux : Curl Guide For beginners

Curl is a command line tool for getting or sending files using URL syntax. It is used to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user interaction. We can use curl for download files from internet, sending custom HTTP ( GET and POST ) request, as FPT client, sending e-mails etc. Curl can be used in many different and interesting ways. Some of the main features of curl is :
Read more »

A Beginners Guide to requests Library in Python : How to Use requests library in Python

Most existing Python modules for sending HTTP requests are extremely verbose and cumbersome. Python’s builtin urllib2 module provides most of the HTTP capabilities you should need, but the api is thoroughly broken. It requires an enormous amount of work (even method overrides) to perform the simplest of tasks.
Read more »

Banner Grabbing with Python

In the previous post we saw the basics of banner grabbing techniques. Now we are trying to grab banners with some python scripts. In python we are going to use socket module to connect to target services. The socket module exposes the low-level C API for communicating over a network using the BSD socket interface.
Read more »

Wfuzz : How to install, Configure and start with wfuzz in linux based systems (Ubuntu)

Wfuzz is a Python-based flexible web application bruteforcer that can be considered an alternative to Burp Intruder as they both have some common features. It supports various methods and techniques to expose web application vulnerabilities. With Wfuzz we can audit parameters, authentication, forms with brute-forcing GET and POST parameters, cookies, forms, discover unlinked resources such as directories/files, headers and so on.

Read more »

How to Auto Mount Partitions and Secondary Hard Drives in Linux with fstab file

If you are familiar with Linux based system and you have multiple partitions or Hard drives then you know that the Linux OS will only mount the root partition where the File System has been installed. And in order to mount the other partition or hard drives you need to click on their Tabs on File manager or just mount with mount utility in command line. But we can automatically mount these partitions and Drives at startup, just by editing the fstab file on the file system.

Read more »

How to reconnect to a disconnected ssh session on Linux based SSH Server

Whenever we run a very long jobs on server over ssh, then sometimes the ssh-session will disconnected for various reasons. And when we again try connect to the server, then it will start another ssh-session. Now at that situation reconnect to a disconnected ssh session with the help of tmux utility. tmux is a terminal multiplexer, which can be used to multiplex several virtual consoles, allowing a user to access multiple separate terminal sessions inside a single terminal window or remote terminal session. It is useful for dealing with multiple programs from a command-line interface, and for separating programs from the Unix shell that started the program. First install tmux in your system if it not installed.
 $ sudo apt-get install tmux
 So, in order to make your ssh-session capable to reconnect, first connect to your ssh-server
Read more »