Saturday, 13 December 2014

Be Anonymous Online Part 1 (Proxy)





Privacy is now the biggest issue over the internet and if we want restriction free internet access we need to use available service to make our self anonymous. in my first installment of this series is cover how we can use proxy to browser and access internet without sharing our location or access pages which is blocked by ISP Censorship or Firewall.

Monday, 20 October 2014

Port Forward home network on to access Remote Desktop Connection from anywhere (Part 1)

This First installment of my Port Forward Tutorial series, in this tutorial you get the basic knowledge about port forwarding what is use of port forward and how it almost beneficial for you, And how to configure port forward in home router for remote desktop sharing (3389) and how to access using Static IP provided by ISP (Internet Service Provider).

Basics QA.

Q: What is Port forwarding ?

Port forwarding allows remote system from internet to connect to a specific computer or network service in Local-Area network.

Like you may take remote access of your home computer from any system over the internet, or share web | ftp server from home that can be accessible any part from world, remote surveillance CCTV Camera access

Port forwarding Anish Mandal

In the following image we can see how to take access of the home network using port forwarding.

In This part we cover how to : -
  • Identify IP Address (Public and Private) in Home Ethernet network.
  • How to access WiFi router (internet router).
  • How to Configure Port Forward for Remote desktop (Port 3389) in Router.
  • Take Remote Desktop of Home system from Internet computer using Static IP provided by ISP.
So before we start we need to know little about IP address (Internet Protocol Address) and difference between them.

Whats difference between Public IP and Private IP?
  1. Public IP Address.
    • Public IP is assign by your internet service provider.
    • The range and record is maintain by our ISP.
    • We cannot select Public IP address the range is defined by InterNIC that are guaranteed to be globally unique to the Internet.
    • We can connect our LAN environment on single Public IP address for Internet access.
  2. Private IP Address.
    • IP Address which require the systems to communicate each other in LAN network.
    • We can decide the IP Address | Range as per our requirement.
    • Its divided  in 3 class.
      • Class A 10.0.0.0/8
      • Class B 172.0.0.0/20
      • Class C 192.168.0.0/24
    • Multiple Private IP Address can access internet using an single Public IP.
When we get Internet connection from ISP we only concern about internet speed bandwidth plan for home but if we want we can ask for Static IP Address.

What is Static IP Address ?
  • Fixed IP Address Provided from ISP (Internet Service Provider).
  • Example 123.52.31.91 (Fixed static).
  • Whenever we access internet or browse web pages the static ip will be out.
  • Internet Service provided is Charge Extra for Static IP internet connection.
  • IP address can be directly accessible from internet.
Now to Our Tutorial Part.

To find out what is our Private IP Address in windows.
  • Open RUN
  • Type Command: cmd (Hit Enter)
  • In Command Prompt type Command: ipconfig (Hit Enter).
Port Forwarding Private IP
Image 1.0
  • The following (Image 1.0) we can see our Private IP Address 192.168.0.101.
For Linux and Mac users :
  • Open terminal
  • Type Command: ifconfig (Hit Enter)

To find out Public IP.
How to access WiFi Router (Home Router) ?

Now days every one use wifi router in home to connect multiple devices on home network for internet access, but most of people don't know the basic setting of wifi router or the IP address and access credential as the ISP provider or the system admins configure that router.

But for this tutorial we require to take access of router and configure port forward in it i am using Dlink DIR-60SL router for this tutorial.

To access the router we require to know ip address of that router and to find the ip address see the (Image 1.0) where default gateway is our router IP Address.

Now in browser type Gateway IP Address in my case 192.168.0.1 Router will ask login credentials user name and password, most of time the login credentials is default provided by the vendor that can be found in user manual on the other hand we can see default username and password list on website (routerpasswords.com).

Note : Before further changes its better to take backup of current router configuration.

After login most of router will display dashboard where will see the current IPS IP Setting LAN Segment and Wi-FI SSID, for port forward settings we require to search the advance or port forwarding menu in router. in my dlink router the Port forwarding is in advance tab menu its difference on every router specify vendor just search it and the page will look like following
(Image 1.1).

configure port forward in wifi router
Image 1.1
In name field type identification name for this tutorial Its REMOTE DESKTOP in IP Address field as we require to allow remote desktop connection from the system 192.168.0.101 type that in port number type remote desktop connection default port number which is 3389 click on the check box to enable this rule for port forward and click save settings router will be reboot to apply configuration changes and the settings will look like following (Image 1.2)

Remote Desktop Connection in router port forward
Image 1.2
Most of our hard work is done now we can take the remote desktop connection of following system from anywhere over the internet simply using following steps.

From Windows System.
  • From Internet enable system.
  • Open Run.
  • Type Command: mstsc (Hit Enter)
  • In Computer box type Public IP Address and click Connect. (Image 1.3)
Remote Desktop Connection access public IP
Image 1.4
  • It will ask you to enter you PC's login details (User name and Password)
  • Done.
From Linux you can use freerdp client to connect.
  • Command: xfreerdp /u:username /p:password /v:192.168.0.101:3389 (Hit Enter)
From Mac you need to download Microsoft RDP Client from microsoft website and same procedure need to follow which we applied in windows Remote desktop client.

Now we can also access home system from IPad, IPhone or Android device all we need to download and install rdp client more info can found on freerdp website.

The following tutorial can be watch in my youtube channel.

Wednesday, 1 October 2014

Sony Xperia Reboot issue


In this video describe how you can solve sony Xperia series Phone reboot issue.

Friday, 5 September 2014

net use command basic (Network Session Hacking)

As a system administrator we always need to deal with following error.


(You do not have permission to access \\ipaddress(hostname)\Folder Contact your network administrator to request access.)

Example : The share server and client is in same domain so the share server is easily accessible from client, But there are two share folders "Inventory" and "Test" also two different domain user login account "AUSER" and "PUSER", the AUSER have rights to access Inventory folder and PUSER can only access Test folder and we currently login with AUSER in the client system.


And other folders in same share location is accessible



The issue with share permissions which doesn't allow the following domain user to access some folder in our case “Test” folder.
Let’s assume that you want to access the test folder, and the folder shared for PUSER user ID so the simple way to logoff current user and login with PUSER user to gain share access but the simple solution is to create share session.

So how we can access both folders in single domain ID?

  • First Solution is to provide the Test folder accessible by other user.
  • But if we want access the folders without changing share permission then?

Yes we can using windows “net use” Command.


net use the command is used to map network share folders and drive and create null and different users sessions with share server Wiki.

Firstly we need to check is there any session is established with the server using following command.
Command: net use (Hit Enter).
In Following windows we can see the Disconnected session for Test folder that we not able to access by AUSER


Let’s disconnect this session using following command.

Command: net use * /del (Hit Enter) this will prompt for confirmation Press Y and Hit Enter.


Now if we use Command: net use the following output will show.


(There are no Entries in the list.)

Now Start the Session Hacking.

Remember whenever you want to open the share folders of any share server first create session with the network system using following.
Command: net use \\192.168.15.1 /u:Domain\Puser (Hit Enter)


it will prompt for password type password and (Hit Enter).


Now open the network path using run



You can access Both folders.


&



See the Working Video Demonstration on following video.




Tuesday, 8 July 2014

Connect MYSQL in NetBeans

As developer i use Net Beans IDE for software, websites and web application development sometimes it's  require to use MYSQL as database server, so in this tutorial this tutorial I am just going to show how to connect MySQL server with Net Beans IDE as some of my friends find difficulty’s to connect MYSQL Database server with Net Beans.
This tutorial is a part of an series where first we need to understand how to install web-server XAMPP or WAMP in windows | LAMP in Linux and Installation of Net Beans IDE with Java Web EE for Web.

Prerequisite for this tut.
  • Net Beans IDE better download bundled setup which include all and you should familiar with Net Beans.
  • MYSQL server installer or its better to use portable MYSQL which comes in XAMMP bundle, I prefer XAMPP, you should have basic knowledge about MYSQL servers table creation and query commands and for portability XAMMP is better for Windows Environment.

After installation XAMPP all you need to find MySQL mysqladmin.exe and mysqld.exe which can be found in C driveC:\xampp\mysql\bin folder.

So Let Start…..

Fire Net Beans select Services tab from Windows menu (Ctrl+5)



Right Click on database select register MySQL Server


In MySQL Server Properties Basic Properties tab can be customize as per requirement.



Server Host Name: “localhost” (it will be different IP if MySQL server is hosted on different system)
Server Port Number: “3306” (its Default port number of MySQL but it can change in my.ini file in same bin folder)
Administrator User Name: “root” (default admin of MySQL better to connect as root for full access of system)
Administrator Password: (Leave IT Blank) (in XAMPP MySQL default installation password is blank but it can be change or leave it blank)

Now Go to Admin Properties tab where we require to add following.


Path/URL to admin tool: “C:\xampp\mysql\bin\mysqladmin.exe” (The Absolute path of mysqladmin.exe if using XAMPP)
Arguments: (Leave IT Blank)
Path to Start command: “C:\xampp\mysql\bin\mysqld.exe” (The Absolute path of mysqld.exe if using XAMPP)
Arguments: (Leave IT Blank)
Path to stop command: “C:\xampp\mysql\bin\mysqladmin.exe” (The Absolute path of mysqladmin.exe if using XAMPP)
Arguments: “-u root –shutdown” (user is root blank password and command for shutdown)


Almost the difficult part is done now all we need to verify that our MYSQL databes is connecting and we are able to query the SQL tables via NetBeans .

Now in Services tab Expand database
Right Click on MySQL Server at localhost:3306 [root]
in case if the server is on different system the localhost will replaced by IP address.
Click on Start



Let’s create and sample database and see all is working properly.
Right Click on MySQL Server at localhost:3306 [root]
Select in Create database for this demo i use name = SQLTest & grant full access.





Click OK


Now Expand the MySQL Server at localhost:3306 [root]
Right click on SQLTest that we have created


Select Connect.

The connection will be created as following path
jdbc:mysql://localhost:3306/sqltest*
Expand the database connection & your database
Right click on Tables
Select Create new Table


Add some columns in table


Execute Query if the table is created than.

Done now we have configured MySQL with NetBeans.


Wednesday, 16 April 2014

Schedule Backup with Email Alert

As system admin we always need to perform backup and recovery work on server. an we aware that new windows server 2008 and above don't provide tape backup services any more and windows backup application is always create issue with multiple domain environment where those domain and not have any type of sync relationship with each other.

 The idea of this post come in my mind when last week my SQL server on 2008r2 is crashed and bak files also in same servers, the windows backup is not perform last night and due to holiday of two days we get notification of this issue three days later.

 
 So i decides we can create an script which will copy bak (even you can change for any other types of file extension for backup) on other storage server and delete files older than 7 days and also update the same via Email, what files has copied and if not the email alert will trigger something is wrong.

The Application we require for script.
  1. mailsend (opensource application more info can found on "http://code.google.com/p/mailsend/")
  2. xcopy (Inbuilt application in windows)
  3. Task Scheduler (Inbuilt application in windows)
  4. SMTP server address (from where we can send mail using this server in our case we have SMTP Server on 192.168.0.15 or we can use free SMTP Servers from Internet List)
  5. Source and destination path with username  and password.
    1. Source D:\SQLBACKUP (where all bak files created)
    2. Destination \\192.168.0.5\Backup
    3. User name for backup access is "backup" password "Backup@14"
Let's Start


Code:
del sqlbackup.log

This log file will be used for backup and diagnose status and errors if any. for to execute this batch script we need to delete previously created log file.

Open Notepad add the net use command with destination folder path in persistent

Code:
net use /PRESISTENT:YES \\192.168.0.5\Backup /u:backup Backup@14 > sqlbackup.log

The following command make session with the destination server & copy the output in sqlbackup.log file which will bu usable for following command.

Code:
Find "The command completed successfully" < sqlbackup.txt > nul

The following code will find the net use session command is completed or its have any errors for session creation and the next statement will define on this output using IF command as follow.

Code:
IF NOT ERRORLEVEL 1 

if the session not has any error in log file then the code which written in "( )" will trigger in our case 

Code:

(
xcopy /Y e:\SQLBackup\*.bak "\\192.168.0.5\Backup" >> sqlbackup.txt
move /Y e:\SQLBackup\*.bak e:\SQLBackup\Copied\ >> sqlbackup.txt

mailsend.exe -smtp 192.168.0.15 -from sqlbackup@abc.com -to helpdesk@abc.com -sub "Done SQL Backup" -attach "sqlbackup.log,text/plain,i"

)

 xcopy is command line tool which help to Copies files and directory trees. from source to destination.
more info can found on "http://en.wikipedia.org/wiki/XCOPY"


move is command which will move all .bak files in copied folder so next time xcopy only copy new files there are date options also available in xcopy which i am not covering in this Tut as this is an simple script for backup.


The mailsend.exe is the opensource application which we have downloaded from http://code.google.com/p/mailsend/ as the following command switches is use as

    • -smtp the smtp address in our case is 192.168.0.15
    • -from the mail will send from we use SQL as name but it can also the particular server address that will be better.
    • -to where we want to send mail every corp. has there own helpdesk Email ID.
    • -sub the proper subject should be mention like the backup is done.
    • -attach the log file will attached in email as well as the text/plain,i command will add the logfile text in email body.
The Code is Almost done but if the sessing is not created or the destination server is not responding we also get the notification for the same so the else command with "( )" will help us to get the error via email.

Code:
) Else (


mailsend.exe -smtp 192.168.0.15 -
 sqlbackup@abc.com -to helpdesk@abc.com -sub "
Failed SQL Backup" -attach "sqlbackup.log,text/plain,i"
)

Those code are same only -sub is changed to show the backup is Failed.

Now the finishing touch for our script.
Code: 
net use \\192.168.0.5\Backup /del

Simple code to disconnect the created session all is done but wait as we aware the back files which created from sql its still in copied folder and we olny cant past 7 days files should remain on sql server so the javascript in batch file will help us.

Code:
////////////////////////////////////////////////////////
// Deletes file older than a number of days 
// in the current directory
////////////////////////////////////////////////////////
// Usage: wscript DeleteOlderThan.js [#Days]
// By default, remove files older than 30 days
////////////////////////////////////////////////////////

function removeDays(date, nDays)
{
    var dateRet = date
    return dateRet.setDate(date.getDate() - nDays);
}

function addSlash(strPath)
{
    var c = strPath.substr(-1, 1);
    if( c !== '\\' && c !== '/' )
    {
    strPath += '\\';
    }
    return strPath;
}

// Read arguments
var nDays = WScript.Arguments(0) || 30;

// Create system objects
var fs = WScript.CreateObject("Scripting.FileSystemObject");
var shell = WScript.CreateObject("WScript.Shell");

// Retrieve current directory
var strDirectoryPath = addSlash(shell.CurrentDirectory);

// Compute date
var dateNow = new Date();
var dateTest = removeDays(dateNow, nDays);

// Iterate on files
var folder = fs.GetFolder(strDirectoryPath);
var files = folder.Files;

for( var it = new Enumerator(files); !it.atEnd(); it.moveNext() )
{
    var file = it.item();

    if( file.DateLastModified < dateTest)
    {
        file.Delete(true);
    }

}

Here
Save the file a "DeletesOlderThan.js" save same folder where our batch file is saved and as the default this script will delete files older than 30 days that can be overwritten adding following code in our script.

Code:
D:
cd SQLBACKUP\Copied
wscript "c:\path to file\DeletesOlderThan.js" 7
exit

The D: and cd SQLBACKUP\Copied will change dir the bak files is stored, then wscript 7 will only leave the past 7days file in folder.

add the file in Task Scheduler with suitable time and DONE.
See how simply we can schedule our daily work using scripts.

Wednesday, 22 January 2014

Ubuntu installation in Hindi Part 2

Watch my First Video of this series here >


In this tutorial i have try to cover the basic details about.
  • How to Create Bootable DVD from Ubuntu ISO.
  • How to Create Bootable Pen-drive from Ubuntu ISO.
  • Change BIOS settings to Boot from External Media.
  • Boot Ubuntu Live mode from Bootable media.
  • Whats is Ubuntu Live mode.

Friday, 10 January 2014

Ubuntu Installation Series

This is my first video of ubuntu OS installation series in Hindi


In this tutorial i have try to cover the basic details about.


  • What is OS (Operating System)
  • What is Kernel (Why its Require)
  • What is Linux (only basic details about GNU/Linux)
  • Why i select Ubuntu Distribution for this tutorial.
  • Various customize flavors available which use Ubuntu as base.
Ping your blog