Archive Page 2

23
Mar
09

Windows XP: Change IP address (static DHCP) using command prompt

boom-main_fullThere are conflicts of IP addresses everywhere, most typical case would be home networking using DHCP and office network use Static IP due to security measurement. Switch them would be quite troublesome.

The harder way is to do it via command prompt. To change DHCP address to static IP:

netsh interface ip set address name=”<network connection name>” static <static IP> <network mask> <default gateway>

eg. netsh interface ip set address name=”Ethernet Network Connection” static 192.168.0.10 255.255.255.0 192.168.0.1

To change it back to DHCP client:

netsh interface ip set address name=”<network connection name>” dhcp

eg. netsh interface ip set address name=”Ethernet Network Connection” dhcp

Other than these, changing the DNS server manually would be:

netsh interface ip set dns name=”<network connection name>” static <DNS server IP address>

eg.netsh interface ip set dns name=”Ethernet Network Connection” static 192.168.0.1 (assume the gateway is same as DNS server)

Lastly, changing the WINS server manually would be:

netsh interface ip set wins name=”<network connection name>” static <DNS server IP address>

eg.netsh interface ip set wins name=”Ethernet Network Connection” static 192.168.0.1 (assume the gateway is same as WINS server)

Troublesome, isn’t it? What if you put all the commands into one batch file (.bat), with one click, it is easier than GUI!

Reference:

  1. Configure TCP/IP from the Command Prompt
  2. Microsft Help and Support:How to Use the NETSH Command to Change from Static IP Address to DHCP in Windows 2000
06
Mar
09

Export Group policy on a network

computergeek

For Microsoft computer network without Active Directory, deploying Group Policy is a nightmare as you definitely don’t want to get into Group Policy Object Editor and edit the option one-by-one on each PC.

This an alternative way to do so:

1. Open %systemroot%\system32\grouppolicy\ (eg. c:\WINDOWS\system32\GroupPolicy\)

2.Copy both “machine” and “user” folders to the “%systemroot%\system32\grouppolicy” – folder (same location) on the target machine.

3. Reboot or a “gpupdate /force” command to refresh the group policy.

Hereby I provide an example of batch file to do such jobs in one click.

First, you need to have both “machine” and “user” folders stored under a folder named “GroupPolicySource” (any filename as you like). Locate the batch file as in same folder with “GroupPolicySource” folder.

Batch file:

xcopy GroupPolicySource c:\WINDOWS\system32\GroupPolicy\ /s /e /y
gpdupate /f

or

xcopy GroupPolicySource c:\WINDOWS\system32\GroupPolicy\ /s /e /y
shutdown -r -i 5 (reboot in 5 seconds)

Reference:

  1. Florian’s Blog: How can I export local Group Policy settings made in gpedit.msc?
  2. XCOPY command reference
23
Feb
09

Site to Site PPTP VPN Tunnel

VPN tunnelHereby I will demonstrate a simplest PPTP site to site VPN tunnel built on Windows 2003 which none of the following are required:

  • RADIUS server
  • IAS server
  • Active Directory
  • Internal DNS server
  • Internal DHCP server

In short, it is just simply 2 Windows 2003 VPN endpoint. The VPN tunnel has to be initialized by one VPN endpoint (so called “Calling Server”) to another VPN endpoint (so called “Answering Server”).

Such manual is based on a fresh Windows 2003 where Routing and Remote Access Service is started.

Configuring Answering Server:
Start -> Settings -> Control Panel -> Administrative Tools -> Routing and Remote Access:
Right click on the server (eg ‘win12’ left panel) -> click Configure and Enable Routing and Remote Access
Welcome to the Routing and Remote Access Server Setup Wizard Menu: Click Next
Select Secure connection between Two private networks.

Do you want to use demand-dial connections to access remote networks? Select Yes -> click Next

How do you want IP address to be assigned to remote clients? Select From a specified range of address -> click Next

Enter the range of private IP address of Calling Server (eg. 192.168.200.0 – 192.168.200.255) -> Click OK

Completing the Routing and Remote Access Server Setup Wizard:  Click Finish.

Welcome to the Demand Dial Interface Wizard: Click Next.

Create Interface Name (eg. HK_VPNEndpoint, preferable in one word and same as Dial Out username which used to connect with remote server later on) -> click Next

Connection Type: Select Connect using virtual private networking (VPN) -> click Next

VPN type: Select Point to Point Tunneling Protocol (PPTP) -> click Next

Destination Address: Enter Calling Server’s IP address -> click Next

Protocols and Security: Select both Route IP packets on This Interface and Add a user account so a remote router can dial in. -> click Next

Static Routers for Remote Networks: Click Add -> Enter the remote server private IP range
eg.     Destination:         192.168.0.0
Network Mask:    255.255.255.0
Metric:            1
Click OK -> Click Next

Dial In Credentials:
Username is grey out, same as the Interface Name -> Create Password -> Confirm Password -> Click Next
(This username and password are to be used while the calling server dial in)

Dial Out Credentials:
Create UserName, Domain (optional, leave it blank for non-Active Directory environment), Password.
(This username and password are to be used to dial out for 2-way initialized connection, just enter the username for 1-way initialized connection)

Completing the Demand-Dial Interface Wizard -> Click Finish

Configuring Calling Server:
Start -> Settings -> Control Panel -> Administrative Tools -> Routing and Remote Access:
Right click on the server -> click Configure and Enable Routing and Remote Access
Welcome to the Routing and Remote Access Server Setup Wizard Menu: Click Next
Select Secure connection between Two private networks.

Do you want to use demand-dial connections to access remote networks? Select Yes

How do you want IP address to be assigned to remote clients? Select From a specified range of address

Enter the range of private IP address of Calling Server (eg. 10.0.2.0 – 10.0.2.255) -> OK

Completing the Routing and Remote Access Server Setup Wizard -> Click Finish.

Welcome to the Demand Dial Interface Wizard: Click Next.

Create Interface Name (eg. MY_VPNEndpoint, preferable in one word and same as Dial Out username which used to connect with remote server later on) -> click Next

Connection Type: Select Connect using virtual private networking (VPN) -> click Next

VPN type: Select Point to Point Tunneling Protocol (PPTP) -> click Next

Destination Address: Enter Calling Server’s IP address -> click Next

Protocols and Security: Select both Route IP packets on This Interface and Add a user account so a remote router can dial in. -> click Next

Static Routers for Remote Networks: Click Add  Enter the remote private IP range
eg.     Destination:         192.168.200.0
Network Mask:    255.255.255.0
Metric:            1
Click OK -> Click Next

Dial In Credentials:
Username is grey out, same as the Interface Name -> Create Password -> Confirm Password -> Click Next
(This username and password are to be used while the calling server dial in)

Dial Out Credentials:
Create UserName, Domain (optional, leave it blank for non-Active Directory environment), Password.
(This username and password are to be used to dial out for 2-way initialized connection, just enter the username for 1-way initialized connection)

Completing the Demand-Dial Interface Wizard: Click Finish

Establishing connection

Start -> Settings -> Control Panel -> Administrative Tools -> Routing and Remote Access -> Server -> Network Interfaces (left panel): (Right panel) Right click the Demand Dial Interface (eg. HK_VPNEndpoint) -> Click Connect

Static Route setting on other server (both side’s private network)
No Active Directory = No automatic deployment.
Add static route for remote private network to be passed to PPTP server:
route add [remote private IP address] mask [remote network mask] [local VPN server private IP address]
eg: route add 192.168.0.0 mask 255.255.255.0 192.168.200.250 (on answering server’s site)

Reference:

  1. Deploying a PPTP-based Site-to-Site VPN Connection
  2. Microsoft Site-to-Site VPN
16
Feb
09

Static route at Windows

At Windows, to add a static route, the syntax is as below:

route add [destination network] mask [destination network mask] [default gateway] -p

Example:
route add 10.0.0.0 mask 255.255.255.0 192.168.1.1 -p

*Without “-p“, the route will be erased upon next reboot.

To see the routing table:

route print

To delete the route:

route delete [network]

Example:

route delete 10.0.0.0

Reference:
Adding static routes to windows
Adding static route
Remove a static IP route

07
Jan
09

HDD can’t handle big file: Converting FAT32 to NTFS

fat32-error-message1It is weird when you can not copy a big file to your HDD, but you are sure there are plenty of space for the file (error message shown as above). It is due to the file system!!

Years ago, Windows (prior to Windows XP) are using FAT32 for its file system.There are several disadvantage for FAT32, as you can find in the reference list below, the main problem for FAT32 is

You can’t have a file larger than 4095MB (4GB-1byte) in size!

Thus, big file like .iso, .nrg files can’t be copied.

Solution: Convert the file system to NTFS
Command: Windows has its default conversion tool: convert.exe. It is advisable to have a backup before the conversion, even the chance to lose file is minimal, it is still POSSIBLE!
On command prompt (eg. the drive need to be convert is G:)

C:\Documents and Settings\MY PC\>g:

G:\>convert g: /fs:ntfs

It will go through some “yes & no” questions for dismount the files opened in that drive. With such command, you won’t lose any files, but at the end of “yes & no” prompts, you might not allowed to convert the drive also (due to various reason).

If you can’t convert the drive on the run, last step: BACKUP & FORMAT IT.

Reference:

  1. Computing.Net: Can’t copy ISO
  2. Microsoft: Limitations of the FAT32 File System in Windows XP
  3. Microsoft: How to convert a FAT16 volume or a FAT32 volume to an NTFS file system in Windows XP
  4. Microsoft TechNet: How to Convert FAT Disks to NTFS
  5. How to use Convert.exe to convert a partition to the NTFS file system
  6. For those using the convert C: /fs:ntfs Command
  7. Converting FAT32 to NTFS in Windows XP
11
Dec
08

Get Nessus for your Backtrack3 Final

snapshot4

Surprisingly, as a glorified Linux distro, Backtrack3 Final, however doesn’t include Nessus, ranking No1 Security Tool on Top 100 Network Security Tools, for unknown reason. Hereby these are the steps to get Nessus working in your Backtrack.

To ensure it works in Slackware, Nessus and NessusClient Fedora Core 8 RPM is recommended. Don’t forget to register and get a activation key on the website, or your nessus won’t get updated.

Installation
* Convert them to TGZ :
rpm2tgz Nessus-3.2.x-fc8.i386.rpm
rpm2tgz NessusClient-3.2.x-fc8.i386.rpm

* Install using installpkg
installpkg Nessus-3.2.x-fc8.i386.tgz
installpkg NessusClient-3.2.x-fc8.i386.tgz

Configuration

cd /opt/
export PATH=$PATH:/opt/nessus/sbin:/opt/nessus/bin:
cp /usr/lib/libssl.so /lib
cp /usr/lib/libcrypto.so /lib
cp /opt/nessus/lib/libnessus.so.3 /lib
cp /opt/nessus/lib/libnessusrx.so.0 /lib
cp /opt/nessus/lib/libpcap-nessus.so.3 /lib
cd /lib
ln libssl.so libssl.so.6
ln libcrypto.so libcrypto.so.6

nano /etc/ld.so.conf
/opt/nessus/lib
<— add this line to the config file

ldconfig
/opt/nessus/sbin/nessus-mkcert
/opt/nessus/sbin/nessus-adduser <– default user: localuser

Update your plugins. Use the code they emailed to you below.

cd /opt/nessus/etc/nessus
nessus-fetch – -register
XXX-YYY-ZZZ-VVV <– no space between “- -”

Run the Nessus Server:
/opt/nessus/sbin/nessusd

Launch the GUI Client
/opt/nessus/bin/NessusClient

Credits:
Most of the instructions are referred from Installing Nessus on Backtrack 3 Final by Security4all. Thanks for his effort!

12
Oct
08

DOS command: subst – directory shortcut as drive

To assign a drive letter for one of your directory in Windows, for faster (shortcut) access:

subst [drive letter] [directory path]
Example:
New drive:- E:\
Directory:- C:\WINDOWS

subst e: c:\WINDOWS

In order to delete a drive which created by subst:

subst [drive letter] /D

Example:
subst e: /D