Sunday, November 30, 2008

Internet Connection Sharing to Several Computers using Windows

This is your Ultimate Guide, easiest and complete How-To Article in Sharing Internet Connection using Windows 2000, XP and Vista.

WIRED NETWORKING BASICS

rj45

More than Five years ago, during the summer of 2003 I applied for On-the-Job Training for 1.5 months in a Communications Company. Luckily, they let me study and experienced what's life as a Data Communication Engineer.

That time, I really wanted to explore Communications Engineering and learn more about Microwave, Satellite, ISDN and Fiber Optics. Although I already know How to create a Network in Windows and some background on Microwave designs but there are many questions in my mind.

How DSL Works in the real world? What are the devices needed? How can you connect to other computers in Public IP settings like in P2P? What is DSLAM? I have so many questions...

Most of the small Internet Cafe that time doesn't use a router to connect to the Internet because it is still expensive (but getting cheaper day by day) thus, DUAL LAN-CARD/ETHERNET CARD NETWORKING is Popular.

Here's the Network Diagram: Figure A

Two Computers

WiredICSLanA

Connect the two computers using UTP/LAN/CAT5 Network Cable

Three or More Computers

WiredICSLan

Sharing Internet using a Router: Figure B

WiredICSLan2

Wireless Broadband Routers: Figure C

WiredICSLan3

Networking Without a Router: Figure A

Cable Modem: The incoming line coming from the Cable Box uses Coaxial Cable and the line going to the computer uses USB or Lan Cable.

DSL Modem: The incoming line uses the Plain-Old-Telephone-System (POTS) and the line connected to the next computer or hub uses UTP/Lan Cable.

To setup DSL or Digital Subscriber Line PPPOE Connection, You need to input the Username and password to use the Internet. Please Read here for more information.

Internet Protocol (IPv4) Address Settings Example:

Gateway Computer

Lan Card 2: The LAN CARD Connecting to your Switch or HUB

IP Address: 192.168.0.1

Subnet Mask: 255.255.255.0

Other Computers  (you can set this automatic or enter the settings below)

IP Address: 192.168.0.2 - 192.168.0.255

Subnet Mask: 255.255.255.0

Default Gateway: 192.168.0.1

DNS Server: 192.168.0.1

Note: The same Procedure in Windows 2000, XP and Vista

To Add the Settings Above:

Press Win+R > type ncpa.cpl > Right-click the Local Area Connection 2 or Different Name that corresponds to the second Ethernet Card > Properties > Click the "Internet Protocol version 4 (IPv4)" > Properties

To check: Open Command Prompt and type: ipconfig

Enabling / Activating / Setup Internet Connection Sharing (ICS)

1. From my Quick Tip: Open Network Connection Window by simply launching the command: Press "Win+R" > ncpa.cpl or Control ncpa.cpl

2. Select the local area network (LAN) Card for DSL or Cable Internet, WAN Miniport (PPPOE) for iBurst, USB Modem for 3G, GPRS, HSDPA or any type Dial-up Networking that provides you a primary Internet Connection > Right-Click Properties

3. In the Sharing Tab (Advanced Tab in Windows XP), Click to check the option "Allow other network users to connect though this computer's Internet connection" and Finally, Choose Local Area Connection 2 or any name that corresponds to the Second LAN Card connected to another Computer or Hub.

sharingtab

NOTE: If you are using 3G or HSDPA as your primary connection to the Internet. You will encounter this Message "Since this connection is currently active, some settings will not take effect until the next time you dial it.": Just Neglect it

message

 

Networking With a Router: Figure B

Usually, the guide is indicated in the manual of the router. There are many different kinds or ways to set the settings but uses the same principle as Figure A.

Different Ways

1. Setting the IP Address through a built-in web-server LAN program in the router. Open IE and type http://192.168.1.1

2. Setting the IP Address through Telnet or Hyper Terminal

The Simplest Explanation to Remember: Router is being used as a gateway and to connect to the Internet instead of using a separate computer. Thus, If your inputting Username and Password in PPPoE Connection you must set it inside the router.

Wireless Access Point: Figure C

The Network uses the same procedure in Figure B except you will only use one or two devices with more features like additional Wireless LAN Capability (802.11 a/b/g/n).

AD-HOC Networking

The procedure is the same with FIGURE A.

Please read more here

 

Enjoy Learning!!!

Saturday, November 29, 2008

Changing the Default Search For Executables Path in Command Prompt

changingdefaultpath

I know this is an old tip for DOS Geeks. For new ones, Did you ever wonder why when you type "notepad" in any directory in Command prompt or cmd, Notepad Application will launch immediately?

 

That's because of the default settings in executables path automatic search. To display type Path in command prompt and you'll see the default:

PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem

These are the default Folders in which when you type any command and Enter key it will search in those directories first.

Example: Wordpad

You cannot launch the application directly to command prompt.

To Add new or Append new locations:

path=%path%;NEW Directory
For multiple Directory or Folders

path=%path%;NEW Folder 1; Folder 2; Folder 3 and so on...
Type this command:

PATH=%path%;C:\Program Files\Windows NT\Accessories\

To check: type Path again

PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\Windows NT\Accessories\

Finally, type: wordpad

Now Its Included! Read here for more related tip.

 

When you close the command prompt and open it again. You need to add the path again.

Add the Folder Path Permanently

Using System Properties > Advance > Environment Variables Button > "System Variables" Group

changinginwindows

or Press WIN+R > RunDll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,3 > At the Bottom, Click the Environment Variables Button > "System Variables" Group

Enjoy!!!

Wednesday, November 26, 2008

Creating a Windows XP Unattended Installer

This is an old guide but still very useful and deserve a descent update. I'm shock that many people still doesn't know about this small utility that can be found in their Windows XP Installer.

"Lawrence, It's almost two months now since you release the latest update of your software winbubble, do you have new releases coming soon? anyway, I have a question. How do I automate the installation of Windows XP? - Jared"

WinBubble is still in development and I'm still Shaping my skills. Surely, Everybody will benefit from my studies and Please stay tuned always. Thanks in advance.

Ok, Let's go back from the main topic. Open your Windows XP Installer and explore the following path: [Disc]SUPPORT\TOOLS

deploycab

Note: I recommend to download the latest one for Windows XP Service Pack 3, Download here

According to Microsoft the latest deploy.cab supports:

Windows XP; Windows XP Service Pack 1; Windows XP Service Pack 2; Windows XP Service Pack 3

1. Copy the file Deploy.cab to any directory and Extract the files...

2. Click the Useful utility setupmgr.exe and if your using Windows Vista Run the File as Administrator.

3. Follow the Pictures below:

d1

d2

d3

d4

d5

Now, you can enter your Name, Organization, Time Zone, Administrator Password, Display Settings, Product Key, Networking and other settings.

final

Note: In Windows Vista OS, Don't Set the Time Zone... Just proceed by Clicking to the other options.

Go to the location where you save the file Unattended.txt and Rename to WINNT.SIF and Place to I386 Folder of your Installer.

I made some Template if you don't want to use the software.

[Data]
    AutoPartition=1
    MsDosInitiated="0"
    UnattendedInstall="Yes"

[Unattended]
    UnattendMode=ProvideDefault
    OemPreinstall=No
    TargetPath=\WINDOWS

[GuiUnattended]
    AdminPassword="Enter_your_Passw0rd_here"
    EncryptedAdminPassword=NO
    AutoLogon=Yes
    AutoLogonCount=1
    OEMSkipRegional=1

[UserData]
    ProductKey=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
    FullName="Enter_your_Name_here"
    OrgName="HomeUser"
    ComputerName= Enter_your_Computer_Name_here

[Identification]
    JoinWorkgroup=WORKGROUP

[Networking]
    InstallDefaultComponents=Yes

Save it as WINNT.SIF and place that to your Windows XP Installer directory I386.

How? Read here

Enjoy!

Monday, November 24, 2008

How to Remove Entering of Serial Key in Windows XP Setup

When you manually install Windows XP to several computers with different specifications. Instead of inputting the License Key in every computer, Make it Automatic Insert like OEM Installation Disc!

Tested in Windows XP Service Pack 2 and 3

[UserData]
ProductKey=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

[Data]
MSDosInitiated=0
UnattendedInstall=Yes

Tested in Windows XP Service Pack 1

[UserData]
ProductKey="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX"

[Data]
MSDosInitiated=0
UnattendedInstall=Yes

Open your notepad, copy-paste the settings above, input your Product Key and save it as Winnt.sif to I386 Folder of your Windows XP Installation Disc by creating an ISO image and editing the file using any ISO Editor.

Normal Mistake: Winnt.sif.txt, uncheck "Hide Extension for known file types" in Windows Explorer > Tools Menu > Folder Options > View Tab

Sorry... I can't find any Free ISO Editor for Windows. Please tell me If you find one :)

WORKAROUND:

Create a duplicate or a copy of your Windows XP Installer and do not finalize the burning of the disc. In short, make a multi-session disc.

Example using CDBurnerXP:

workaround 

After creating a copy as multisession disc, Re-open CDBurnerXP and choose Data Disc > Open the drive and re-insert the disc for adding more files.

Adding winnt.sif to I386 Folder:

Continue Multisession Disc

continue

Drag the File to I386 Folder and Start Burning!

finale

Tip: You can also put your must have Softwares in the Installation Disc. Great for Computer Technicians!

For creating complete unattended installation, Read here...

Enjoy!

 

Thursday, November 20, 2008

Hidden Backdoor in Windows 7/Vista Welcome Screen

Ok, This is fun. Anyone of you watch the famous 1995 movie "The Net" by Sandra Bullock? The Famous Praetorian PI was used as a backdoor to access password-protected sites. Can we create a vista backdoor, something like that in Windows Vista or 7? Yes you Can! How?

The Clue: The Ease of Access Program

thePi

Where? The 624kb Utilman.exe is the key located at System Folder.

Steps:

Open the Folder Windows\System32\ and check the Properties of Utilman.exe

UtilmanProperties

Problem... My current Logon Username Lawrence and Administrators has no Permission no modify the file. Thus, If you try to rename the file, it will give you the message:

Destination Folder Access is Denied You need permission to perform this action

accessisdenied

Normally, Winbubble Context Menu "Take the Ownership of this file" can add the permission but this time, you can't. (The Next Version can do it easily).

default

Also, Most of the Buttons are Disabled.

How to Add the permission

Prevention is better than Cure: To easily recover your system from any problems, Create a Restore Point First using the Context Menu that can be created by WinBubbles, Read here or you can do it manually: Win+R > rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,4 > Create Button > Enter the name

1. Take the Ownership Of the File using the LONG METHOD, Click here and Right-Click the file > Properties > Go to Security Tab > To change Permission Click Edit Button > Click Administrator > Click to Check Allow Setting of Full Control option box

Another Way because I understand that your a Geek:

Open Command Prompt as Administrator, Start Search > type CMD > Press CTRL+ALT+Enter > Enter the Following commands:

a. takeown /f "Directory\File"

e.g. takeown /f "c:\windows\system32\Utilman.exe"

b. icacls "Directory\File" /grant administrators:F

e.g.

icacls "c:\windows\system32\Utilman.exe" /grant administrators:F

If you didn't open CMD.exe as administrator, you'll get this message:

takeown

ERROR: The current logged on user does not have ownership privileges on the file (or folder) "c:\windows\system32\Utilman.exe" 

2. Rename Utilman.exe to any for backup example: Utilman_old.exe

rename

3. Create a copy of cmd.exe (CTRL+Drag)

copycmd

4. Rename the Copy - cmd to Utilman

 changenameofCmd

That's It!

Go to your Welcome Screen: Start Menu > At the Bottom, Click the Right Arrow > Switch User

5. Click the Blue Magic Button pointed by the arrow as shown in the first Picture above.

backdoor

You have now successfully launch a Command Prompt in Administrator mode with UAC disabled...

Doesn't Work? Possible Mistake: In your Folder Option Window > View Tab > "If Hide extensions for known file types" is checked, Don't rename it to "Utilman.exe", use "Utilman" ONLY.

NEW! Using the newest version of WinBubble, you can easily get this functionality in just few clicks!

Click the Windows 7/Utilities Tab, Logon Tools option

logontool

Click Yes and Restart your PC. Works great in Windows 7 32/64 bit version!

NOTE: You need to re-open again the program after restarting your computer and repeat the procedure again to be able to activate the feature.

SWEET!!! Start Hacking your own computer :)

Now, it's fine for me to forget my password without creating a password reset disk or by hacking and clearing Vista Password using a Linux OS. Create a Backdoor instead! Is this bad? Of course, this is bad if you'll use it that way.

Net user [Username] [NewPassword]

For more Information, Read Here

Is this legal? Yes, it is... My steps needs the Administrator login to create a backdoor and If you do this by using another OS like Linux to another computer. That's the time it will became Illegal.

Type: whoami /all |more

whoami

Now we can see that System logon is the one running when you input Username and Password in the Welcome Screen.

Try typing taskmgr.exe (Browse Button let's you run a mini-windows explorer), Notepad and even Explorer.exe!

In my observations:

  • Windows Firewall is ON (Great!)
  • Spyware and other Malware Protection is ON (Great!)
  • User Account Control is OFF
  • You can browse the Internet
  • The Location of Desktop: c:\Windows\System32\config\systemprofile\Desktop
  • Launch Windows Media Player, Windows Calendar, Windows Mail and many more

Note: There is a possibility that the guide above will work in latest build (RC version) of Windows 7. Due to License and some legal concerns I can't reveal any data. Tell me?

ENJOY LEARNING WINDOWS!!! 

Monday, November 17, 2008

Add "Disable UAC" or "Enable UAC" to Right-click Menu / Context Menu

disable

"Do you want to open this file, Are you sure? (Really?)"

This is the simplest example and explanation of the new security model in Windows Vista called UAC. This feature is still included in Windows 7 in which even the Administrator will operate in a reduced privilege login and all you have to do is to confirm.

CONS: Totally Annoying, Your system "feels" slowly and It seems unintelligent but it's not.

 

 

PROS: Security Rocks!

1. All the Rootkits and Worms even the new undetectable ones by Anti-Virus Software can be detected.

2. Modification of System Files by any software vendor (even Microsoft) will be detected.

3. IE 7 uses UAC to run in Protected mode that detects any add-on e.g. Adobe flash before installation and Spyware that wants to modify your system files.

4. Protects your Network from Hackers and Trojan viruses (If not yet compromised).

5. You can learn many things...

and many more...

I know many people doesn't like UAC because they have enough protection using Anti-Spyware/Rotkits/Virus and it's annoying for them.

I don't Recommend that, but it's up to you. Just don't forget that Protected Mode in Internet Explorer will be useless after disabling UAC. Therefore:

1. Do not use IE: Use Google Chrome or Firefox instead.

2. Install a Good Anti-Virus with Anti-Spyware/Malware/Rootkit Protection.

3. Use a Lower Privilege user login while browsing the Internet.

User Account Control (UAC) Right-Click / Context Menu

Using the Command that can be found on msconfig.exe and by using my Universal Elevation Script.

C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f

Now, you can easily Switch it off by adding the command to your context menu. How? It's easy!

1. Download WinBubbles and Go to [WinBubble Directory]\Tools\

2. Create a duplicate of lawrence.vbs and rename it to any filename e.g. DisableEnableUAC.vbs

3. Open it with notepad and modify the 7th line.

4. Use the Following code:

objApp.shellExecute "cmd.exe", " /c %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d " & strArg & " /f", , "runas", 1

Great! Now you have a Command-Line vb script program to switch on/off UAC

commandline

DisableEnableUAC 0                    ---> Turn Off UAC

DisableEnableUAC 1                    ---> Turn ON UAC

If you are having difficulties in creating the script, download here

5. Put the program to your Context Menu

a. Open Winbubbles > Go to Miscellaneous Tab > Decide where do you want to put the Context Menu Item > Example: Desktop Right-Click Menu, Click "Explorer/Desktop" Button > Click the BROWSE Button

findvbs

b. Go to  the Location of the Vbscript File and type "*.vbs" > Click the File (DisableEnableUAC) and Open Button

c. Type Any name example: Disable UAC

d. Modify the Command:

To Turn-Off UAC

wscript "[path]" 0

To Restore UAC

wscript "[path]" 1

e.g.

wscript "C:\MyProg\WinBubble\Tools\DisableEnableUAC.vbs" 0

contextmenu

Finally, Click the ADD Button.

Just repeat the steps above for the Next Item.

Note: Please Reboot your Computer after Disabling/Enabling UAC

Enjoy!!!

Friday, November 14, 2008

How to Create a Random Number Generator in Excel using VBA without Repetition

If you Google for this terms, there are lots of ways to generate a random number (compatible with Excel 2007 and below) by creating a macro written in VBA or writing your own function by using Rand() formula that may differ in many ways.

Rand() function in Excel generates a value >= 0 but < 1 (Greater or equal to zero but less than 1) e.g. 0.22489385

The simplest technique is to generate numbers using rand() function and Rank them.

CONS: There is a small possibility of a duplicate may appear. Some people just ignore this and treat the duplicate values as 1st, 2nd and so on.

My Logic (Correct me if I'm wrong) :)

1. Generate the first Number

2. Save the number (cells, list box, combo box, or array)

3. Generate a NEW Number and CHECK if already been generated.

4. If there's a duplicate, Generate a New Number again, until there's a unique value, save it and proceed to the next until it is finished.

Simple Right? :)

 

Generating a Value Between two Numbers

Int((UpperNumber - LowerNumber + 1) * Rnd + LowerNumber)

e.g. for 1-10, Integer of ((10-1+1) * Rnd + 1)

That's why most programmers only use Int(10 * Rnd + 1)

Where Rnd is almost the same as Rand() is Excel

 

Using VBA:

Dim RndNumber as Integer

RndNumber = Int(10 * Rnd + 1)

Steps

1. If you can't see the Ribbon GUI Developers Tab, here

2. Insert a List box: Click the Developers Tab > Insert Button > ActiveX Controls Group > Choose the 4th ActiveX Control (List Box Control)

InsertListbox

Click and Hold while moving the cursor until Column F.

Box

Once the List box ActiveX Control is loaded, Right-Click > Properties

properties

change the (Name) to LstNumbers

name

3. Insert a Command Button: Click the Developers Tab > Insert > ActiveX Controls Group > Choose the 1st ActiveX Control (Command Button Control)

commandbutton

Click and Hold while moving the cursor located below the list box as shown in the picture below:

commandbutton2 

In the Properties Window: Change the Name of the Button e.g. CmdRandomize

Also, change the Name of the Command Button by modifying the Caption Property e.g. Randomize

commandbutton3

4. At Column H, enter any number that will become the Range of Numbers as shown in the picture below:

FRomTo

5. To understand, I wrote a simple program that uses List Box as the Memory and that's the reason why  we need to change the Name Property and input the Range in Column H

Double-Click the Command Button and Copy-Paste the Code Below:

pasTE

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

Dim RndNumber As Integer  'declare the variable as integer
Dim ii As Integer  'declare the variable as integer
Dim FndNumber As Boolean   'Number was Found, YES or NO?

LstNumbers.Clear

Do

RndNumber = Int((Sheet1.Cells(2, 8) - Sheet1.Cells(1, 8) + 1) * Rnd + Sheet1.Cells(1, 8)) 

' :) Generate the first Number  

If LstNumbers.ListCount <> 0 Then 'If First Number, No need to check 

     For ii = 1 To LstNumbers.ListCount  

'check to listbox if the number is existing
          If RndNumber = LstNumbers.List(ii - 1) Then
               FndNumber = True
               Exit For 'Gotcha, Duplicate, EXIT now
          Else
               FndNumber = False  'NOT FOUND
          End If

     Next ii

End If

If FndNumber = False Then LstNumbers.AddItem RndNumber  

'save the number to listbox if no duplicate found

Loop Until LstNumbers.ListCount = Sheet1.Cells(2, 8) - Sheet1.Cells(1, 8) + 1

'generate until the last number.

'Do loop means read until the TOTAL no. of data to be randomize

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

DISCLAIMER NOTICE: The code above and the downloadable code can be modified and re-used but I will not be responsible to any problems that may appear.

6. Close the Visual Basic Editor and Start Running the Program by Turning off the Design Mode: In the Developers Tab, Click the Design Mode Button Icon

DesignMode

7. Click the Command Button to Generate numbers depending on the range (COLUMN H).

If you are having some difficulty in creating the example above, Download here (.xlsm Macro-enabled Excel Document)

For the old office 2000-2003 format. .xls file, download here

NOTE: Opening the Excel File

By default, All Macros in Excel is disabled and a security message will appear. To enable: read here first

How I came up with the formula?

References: Microsoft Excel and Visual Basic 6.0 Help Files

Generating Random Value Between two Numbers
Int((Upperbound - Lowerbound + 1) * Rnd + Lowerbound)

MS Excel Help File
(Upperbound - Lowerbound) * Rand + Lowerbound

REAL-WORLD APPLICATIONS

Creating random numbers is very important. The simplest example is the famous MP3 player called WinAmp. When you click the option Shuffle, It will play all your Music Files in a Random way.

Did you experience playing your Playlist in Random but some songs was repeated? :)

I hope everybody have learn something in this example.

ENJOY!!!

Security Warning Some Active Content has been disabled

runmacro2

To Remove All the threat of Macro Viruses in Office Documents like  Excel and Word, Microsoft adapted the Four Levels of Macro Security. In Office 2007 we have seen .xlsm format in which all macro-enabled documents needs to be save using the new file type for additional security.

How to Run / Enable Macro in Documents

It's easy to Activate the Macro in a Document: Click the Option Button > In Security Alert - Macros & ActiveX Window, Select Enable this Content

runmacro

To customize how Macro-enabled Documents are opened:

1. Open the Trust Center Window

Press ALT+F+I to open the Option Window > In the Left Pane, Select the Trust Center Button > Click the Trust Center Settings... Button

or

Using the Developers Tab, Click the Macro Security Icon

If you can't see the Tab, Read this First

2. Customize the Settings

runmacro3

Option 1: Disable all Macros without notification

Option 2: Disable all Macros with notification

Option 3: Disable all Macros except digitally signed macros

Option 4: Enable all macros (not recommended; potentially dangerous code can run)

These are the Four Security-Level of Macro enabled Documents which corresponds to Very High, High, Medium and Low.

 

Please Read More: Generate Random Numbers from specified range in Excel

Tuesday, November 11, 2008