Sunday, September 27, 2009

Default Password List – Networking Devices

Phenoelit-us maybe the simplest and best password list website.

http://www.phenoelit-us.org/dpl/dpl.html

7 Free Default Password List Websites - Something You Need to Bookmark

http://www.smashingpasswords.com/7-free-default-password-list-websites-something-you-need-bookmark

Would you appreciate this information?
Well, I'm sure many would ;-)

Thursday, September 24, 2009

Search Specific User or a Group inside Local Administrators Group of Domain Computers

Following script will search for specific user or a group inside local administrators group of domain computers.

You only have to set 'ObjectName' variable inside a script to the username of a group name.

@ECHO OFF
SET ObjectName=Domain Users

SET Counter=0
SET OutputFile=GroupInfo.txt
FOR /F "delims=\\ " %%c IN ('NET VIEW ^|FIND "\\"') DO (
    PING -n 1 -l 10 -w 100 %%c |FIND /I "TTL" >NUL
    IF NOT ERRORLEVEL 1 (
        ECHO Processing: %%c
        WMIC /NODE:"%%c" PATH Win32_GroupUser WHERE ^(GroupComponent="win32_group.name=\"Administrators\",Domain=\"%%c\""^) GET PartComponent |FIND /I "%ObjectName%" >NUL
        IF NOT ERRORLEVEL 1 (
            SET /A Counter+=1
            ECHO =============================>>"%OutputFile%"
            ECHO Machine: %%c >>"%OutputFile%"
            ECHO =============================>>"%OutputFile%"
            ECHO Date: %DATE%  Time: %TIME% >>"%OutputFile%"
            ECHO Administrators group members:>>"%OutputFile%"
            WMIC /OUTPUT:TmpResult.txt /NODE:"%%c" PATH Win32_GroupUser WHERE ^(GroupComponent="win32_group.name=\"Administrators\",Domain=\"%%c\""^) GET PartComponent /FORMAT:CSV
            FOR /F "Tokens=5 Delims==," %%u IN ('TYPE TmpResult.txt') DO ECHO %%~u >>"%OutputFile%"
            ECHO. >>"%OutputFile%"
            ECHO ALERT: '%ObjectName%' exists in Administrators group of %%c computer.)))

IF EXIST TmpResult.txt DEL /F /Q TmpResult.txt
IF %Counter% GTR 0 (
    ECHO. &ECHO SUMMARY: Found %Counter% machine^(s^) having '%ObjectName%' in Administrators Group.
    ECHO For more info check '%OutputFile%' file on %CD%) ELSE (
    ECHO. &ECHO SUMMARY: No machine found having '%ObjectName%' in Administrators Group.)

:ExitScript
ECHO.
PAUSE

Wednesday, September 23, 2009

Automatically Add Default Route for VPN Connection

One common problem that most of the users face after connecting to VPN server is ROUTING.
To enable VPN users to access network resources that are on a different subnet you need to have gateway a address that routes data packets.

We usually remove "Use default gateway on remote network” check in advanced properties on TCP/IP setting while creating VPN connection. This setting enforces to add route to remote subnet manually.
This configuration leads to the problem when RRAS server assigns IP addresses dynamically, which mean that VPN users will get different IP address each time when they connect to the RRAS server!

In Windows you can view routing table by applying following statement from command line:
Click Start -> Run -> Cmd -> OK

ROUTE PRINT

 Following batch script will help network admins to provide users with a batch file that will automatically set route to the corporate network.

You only have to set two variables inside a script. Set ‘NetSubnet’ with a network subnet address and ‘SubnetMask’ with the subnet mask.

:: ************ Method -1 ************ ::
@ECHO OFF
COLOR 8F

SET NetSubnet=172.16.0.0
SET SubnetMask=255.255.0.0

ECHO.
ECHO ###########################################################
ECHO            PLEASE DO NOT CLOSE THIS WINDOW     
ECHO This window will automatically disappear after 10 seconds.
ECHO ###########################################################
ECHO.
FOR /F %%I IN ('ROUTE PRINT ^|FIND "WAN (PPP/SLIP)"') DO SET IFindex=%%I
ECHO Updating Routing Table, please wait....
ECHO.
ROUTE DELETE %NetSubnet% >NUL
ROUTE ADD %NetSubnet% MASK %SubnetMask% 0.0.0.0 IF %IFindex%
ROUTE PRINT %NetSubnet%
PING -n 10 -w 1 -l 1 127.0.0.1 >NUL
EXIT /B 0

:: ************ Method -2 ************ ::

@ECHO OFF
COLOR 8F
SET NetSubnet=172.16.0.0
SET SubnetMask=255.255.0.0
ECHO.
ECHO ###########################################################
ECHO            PLEASE DO NOT CLOSE THIS WINDOW      
ECHO This window will automatically disappear after 10 seconds.
ECHO ###########################################################
ECHO.
SET cWMIC=WMIC NICCONFIG WHERE "ServiceName='NdisWan'" GET IPAddress /FORMAT:CSV
FOR /F "tokens=2 delims=,{}" %%i IN (' %cWMIC% ^|FIND "."') DO SET IPAddress=%%i
ECHO Obtained IP address: %IPAddress%
ECHO.
ECHO Updating Routing Table, please wait....
ECHO.
ROUTE DELETE %NetSubnet% >NUL
ROUTE ADD %NetSubnet% MASK %SubnetMask% %IPAddress% METRIC 1
ROUTE PRINT %NetSubnet%
PING -n 10 -w 1 -l 1 127.0.0.1 >NUL
EXIT /B 0

Optionally if you want this batch script to dial VPN connection then you can use following batch script. It will dial VPN connection and will set route for the remote subnet.

:: ************ Method -1 ************ ::

@ECHO OFF
COLOR 8F
SET NetSubnet=172.16.0.0
SET SubnetMask=255.255.0.0
ECHO.
ECHO ###########################################################
ECHO            PLEASE DO NOT CLOSE THIS WINDOW     
ECHO This window will automatically disappear after 20 seconds.
ECHO ###########################################################
ECHO.
ECHO Dialing VPN, please wait....
RASDial ConnectionName MyUsername MyP@ssw0rd
PING 127.0.0.1 -n 15 -l 0 -w 0 >NUL
FOR /F %%I IN ('ROUTE PRINT ^|FIND "WAN (PPP/SLIP)"') DO SET IFindex=%%I
ECHO.
ECHO Updating Routing Table, please wait....
ECHO.
ROUTE DELETE %NetSubnet% >NUL
ROUTE ADD %NetSubnet% MASK %SubnetMask% 0.0.0.0 IF %IFindex%
ROUTE PRINT %NetSubnet%
PING -n 5 -w 1 -l 1 127.0.0.1 >NUL
EXIT /B 0

:: ************ Method -2 ************ ::
@ECHO OFF
COLOR 8F
SET NetSubnet=172.16.0.0
SET SubnetMask=255.255.0.0
ECHO.
ECHO ###########################################################
ECHO            PLEASE DO NOT CLOSE THIS WINDOW      
ECHO This window will automatically disappear after 20 seconds.
ECHO ###########################################################
ECHO.
ECHO Dialing VPN, please wait....
RASDial ConnectionName MyUsername MyP@ssw0rd
ECHO.
ECHO Obtaining IP Address, please wait....
PING 127.0.0.1 -n 15 -l 0 -w 0 >NUL
SET cWMIC=WMIC NICCONFIG WHERE "ServiceName='NdisWan'" GET IPAddress /FORMAT:CSV
FOR /F "tokens=2 delims=,{}" %%i IN (' %cWMIC% ^|FIND "."') DO SET IPAddress=%%i
ECHO Obtained IP address: %IPAddress%
ECHO.
ECHO Updating Routing Table, please wait....
ECHO.
ROUTE DELETE %NetSubnet% >NUL
ROUTE ADD %NetSubnet% MASK %SubnetMask% %IPAddress% METRIC 1
ROUTE PRINT %
NetSubnet%
PING -n 5 -w 1 -l 1 127.0.0.1 >NUL
EXIT /B 0


In above script beside setting ‘NetSubnet’ and ‘SubnetMask’ variables and you have to provide required information to RASDial command.
RASDial command syntax is

              RASDial entryname [username [password|*]] [/DOMAIN:domain]

 Here 'entryname' is the connection name (shown in image below) that have created under 'Network Connections' for dialing VPN connection.


Monday, September 21, 2009

Searching Network for Specific Process Running Machines

Following batch script will help system administrators to find machines on a network with a specific running process.

You only have to set 'ProcessName' variable inside a script with the process name (i.e. calc.exe) that you want to find.

@ECHO OFF
SET ProcessName=calc.exe

SET Counter=0
FOR /F "delims=\\ " %%c IN ('NET VIEW ^|FIND "\\"') DO (
PING -n 1 -l 10 -w 100 %%c |FIND /I "TTL" >NUL
IF NOT ERRORLEVEL 1 (
    ECHO Processing: %%c
    TASKLIST /S %%c /V /FI "IMAGENAME eq %ProcessName%" /FO LIST |FIND /I "PID" >NUL
    IF NOT ERRORLEVEL 1 (
        SET /A Counter+=1
        ECHO =================================>>ProcessInfo.txt
        ECHO Machine: %%c >>ProcessInfo.txt
        ECHO =================================>>ProcessInfo.txt
        ECHO Date: %DATE%  Time: %TIME% >>ProcessInfo.txt
        FOR /F "tokens=3" %%u IN ('REG QUERY "\\%%c\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName ^|FIND /I "REG_SZ"') DO (
            ECHO Logged-in username: %%u >>ProcessInfo.txt)
        TASKLIST /S %%c /V /FI "IMAGENAME eq %ProcessName%" /FO LIST >>ProcessInfo.txt
        ECHO.>>ProcessInfo.txt)))

IF %Counter% GTR 0 (
    ECHO. &ECHO Found %Counter% machine^(s^) with running '%ProcessName%' process.
    ECHO For more info check 'ProcessInfo.txt' on %CD%) ELSE (
    ECHO. &ECHO No machine found with '%ProcessName%' running.)

:ExitScript
ECHO.
PAUSE
 

Tuesday, September 15, 2009

Getting Dell Service Tag from Command Line


Now you don't need to switch off your PC and search in BIOS for system Service Tag! Service Tag is a unique five- to seven- digit alphanumeric (letter and number) code, which is found on a white bar-coded label affixed to your Dell computer or peripheral. Entering the service tag of your Dell computer or peripheral helps Dell deliver solutions tailored to the products you own.

Try following one-liners to get local or remote system service tag:

Click Start -> Run -> Cmd.exe -> now try one of the following statement:

Local System

WMIC SYSTEMENCLOSURE GET SerialNumber
                                      OR
WMIC BIOS GET SerialNumber

Remote System

WMIC /NODE:ComputerName SYSTEMENCLOSURE GET SerialNumber
                                       OR
WMIC /NODE:ComputerName BIOS GET SerialNumber

Remote System with Credentials

WMIC /USER:"DOMAIN\Username" /NODE:ComputerName SYSTEMENCLOSURE GET SerialNumber
                                       OR
WMIC /USER:"DOMAIN\Username" /NODE:ComputerName BIOS GET SerialNumber
                                      OR
WMIC /USER:"DOMAIN\Username" /PASSWORD:"P@ssw0rd" /NODE:ComputerName SYSTEMENCLOSURE GET SerialNumber
                                      OR
WMIC /USER:"DOMAIN\Username" /PASSWORD:"P@ssw0rd" /NODE:ComputerName BIOS GET SerialNumber