Pages

10/25/2002

Security::NT Server
When you ran NETSTAT to find out what ports you are listening on, did you ever wonder what application it was that had a specific port open?
Foundstone Vision v1.0 - reports all open TCP and UDP ports and maps them to the owning process or application.
Check out the other great stuff at http://www.foundstone.com

10/23/2002

IE vs Netscape

Do you like the tag? IE doesn't support it. But you can still blink the text.
BLINKING CODE
add the leading < back onto the first tags in the following lines:

HTML>
HEAD>Dynamic HTML BLINK Testing Ground
BODY BGCOLOR=#FFFFFF>
P ID=blinker STYLE="color: black">This is ground zero!

"
SCRIPT LANGUAGE="VBScript">
function blink_on
blinker.style.color="black"
timerOne=setTimeout("blink_off()", 1000, "VBScript")
end function

function blink_off
blinker.style.color="white"
timerTwo=setTimeout("blink_on()", 1000, "VBScript")
end function

blink_off
/SCRIPT>

/HTML>

10/21/2002

CITRIX::NETWORK PACKET ANALYSIS
From Citrix Support:Citrix KB

How ICA Client Connections over TCP/IP work


--------------------------------------------------------------------------------
This solution pertains to:
MetaFrame 1.8 for Microsoft NT Server 4.0, Terminal Server
MetaFrame 1.8 for Windows 2000
WinFrame 1.8
Last modified: Thu Nov 29 15:29:30 2001
--------------------------------------------------------------------------------
The ICA client uses the UDP (User Datagram Protocol) portion of the TCP/IP protocol suite when browsing for a Citrix server. UDP is a connectionless mode protocol, providing potentially unreliable, unsequenced, and/or duplicated packets, because it leaves these functions to other layers.
The ICA client broadcasts (ffffffffffff) UDP packets to the network with a destination address of UDP port 1604 (0644 hex) and the source address of the client is any high UDP port (any port over 1023). A Citrix server replies with a UDP packet, where the data area contains the names of the current Citrix servers. The pull down list is built using this information. This use of UDP can be avoided by connecting using the IP address rather than by browsing.
NOTE: If the client is in a multiple segmented LAN or WAN and there are IP routers setup to filter UDP then ICA connections will be limited to direct IP addresses only. UDP is normally used to resolve the name to IP address once it has done this then it relies soley on TCP for the ICA connection between Clients and Host.
Connecting to the Citrix Server
ICA client connections actually use the TCP (Transmission Control Protocol) portion of the TCP/IP suite of protocols for communication between the server and the client. TCP is a connection-oriented, end-to-end protocol. It provides reliable, sequenced, and unduplicated delivery of bytes to a remote or local user.
Any application that uses TCP as the transport is assigned a unique port identification number called a TCP port. Communications between a client and a server that take place on a TCP transport will occur through a TCP port. The client side will dynamically assign a port number when there is a request for service. The server side of the application uses a port number that has been preassigned by the InterNet Assigned Numbers Authority (IANA).
ICA has been assigned port 1494 in the same way Telnet uses port 23 or HTTP uses port 80. For further information regarding ICA and port 1494, refer to RFC 1700.
The process of connecting to a Citrix server from an ICA client is actually very similar to an FTP connection. The following steps are only a local subnet connection to simplify this discussion. Crossing routers or WANs brings the same factors and concerns to ICA connections as any IP traffic would.
First the client will ARP for the hardware address of the server so it can begin the connection. Once the hardware address is known, the client sends a TCP packet to TCP port 1494 (05d6 hex) on the server. At this point, the server normally accepts the request from the client and the ICA connection is negotiated.
How the ICA browser resolves names between client and host
For TCP/IP, the ICA browser resolves server/cluster/app names into IP addresses. There are 2 steps in Name resolving via the ICA browser:
1. Getting the Master Browser's IP address. This is done either by:
A). Broadcasting the "Get Master Address" packet to all Citrix servers (default).
B). Sending the request to one or more specified Citrix server(s) (refer to the ICA client Help under Server Location)
2. Send a request to the Master Browser to get the IP address of the server/cluster/app you want to connect to.
The ICA browser has nothing to do with the IP addresses -> hardware address translation ( the client system takes care of that via ARP ).

10/14/2002

Windows 9X, NT :: Automation
From: HTTP://WWW.ROBVANDERWOUDE.COM

RUNDLL and RUNDLL32


RUNDLL and RUNDLL32 are two utilities supplied with Windows 95/98 and NT.
They can call DLL functions from the command line, allowing us to create extremely powerfull batch files.
Some examples:
Start Control Panel applets (2):
General syntax:
RUNDLL32 SHELL32.DLL,Control_RunDLL filename.CPL,@n,t
where filename.CPL is the name of one of Control Panel's *.CPL files,
n is the zero based number of the applet within the *.CPL file, and
t is the number of the tab for multi paged applets
Examples:
Date/time applet, Time Zone tab:
RUNDLL32 SHELL32.DLL,Control_RunDLL TIMEDATE.CPL,@0,1
Desktop applet, Screensaver tab:
RUNDLL32 SHELL32.DLL,Control_RunDLL DESK.CPL,@0,1
Network applet, Protocols tab:
RUNDLL32 SHELL32.DLL,Control_RunDLL NCPA.CPL,@0,2
Network applet, Adapters tab:
RUNDLL32 SHELL32.DLL,Control_RunDLL NCPA.CPL,@0,3
System applet, Environment tab:
RUNDLL32 SHELL32.DLL,Control_RunDLL SYSDM.CPL,@0,2
Start "Add New Hardware" Wizard (Windows 95):
RUNDLL SYSDM.CPL,InstallDevice_Rundll
Credits: Faris Mlaeb

Start "DialUp Connection" Wizard (Windows 95):
RUNDLL RNAUI.DLL,RnaWizard
Credits: Faris Mlaeb

Install a screensaver (copy the *.SCR file to the Windows directory first) (2):
RUNDLL32 DESK.CPL,InstallScreenSaver C:\WINNT\SYSTEM32\Default.scr
The directory shown is for Windows NT/2000/XP, modify for Windows 9x

Lock the screen (Windows 2000):
RUNDLL32 USER32.DLL,LockWorkStation
Credits: Steven Clements (posted on alt.msdos.batch.nt)

Redraw the screen (Windows 95):
RUNDLL USER,repaintscreen
Credits: Faris Mlaeb

Rearrange the windows on the screen (Windows 95):
Cascade:
RUNDLL32 USER,cascadechildwindows
Tile:
RUNDLL32 USER,tilechildwindows
Credits: Faris Mlaeb

Change screen resolution (Windows 9x with PowerToys' QuickRes installed):
RUNDLL DESKCP16.DLL,QUICKRES_RUNDLLENTRY hresxvresxbpp
Where hres is the horizontal resolution in pixels, vres is the vertical resolution in pixels, and bpp is the number of bits per pixel.
The following example will set the screen resolution to 800 x 600 at 256 colors (8 bits)
RUNDLL DESKCP16.DLL,QUICKRES_RUNDLLENTRY 800x600x8
Credits: William Allen (posted on alt.msdos.batch)

Disable mouse and/or keyboard (Windows 9*/ME)
RUNDLL KEYBOARD,DISABLE
RUNDLL MOUSE,DISABLE
There is an ENABLE function too, but I haven't found the right syntax yet. Without any further parameters it only halts the system without warning (Windows 95). You will probably need the other RUNDLL commands to do a "clean" reboot.
Credits: Koro das Master

Halt system:
RUNDLL MOUSE,ENABLE
Credits: Faris Mlaeb

Start "Add New Printer" wizard:
RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL AddPrinter

Start GUI mode disk format:
RUNDLL32 SHELL32.DLL,SHFormatDrive

Start GUI mode diskcopy:
RUNDLL32 DISKCOPY.DLL,DiskCopyRunDll
Credits: Media Chance

"Map Network Drive" dialog (Windows 95):
RUNDLL32 USER,wnetconnectdialog
Credits: Faris Mlaeb

Logoff Windows (1)
Logoff Windows 98:
RUNDLL SHELL32.DLL,SHExitWindowsEx

Logoff Windows 98 and run Explorer after relogon:
RUNDLL SHELL32.DLL,SHExitWindowsEx 4

Logoff Windows NT 4:
RUNDLL32 USER32.DLL,ExitWindowsEx
RUNDLL32 USER32.DLL,ExitWindowsEx
This is not a mistake, the command usualy must be called twice before anything happens.

Reboot (1)
Windows 95 (not reliable, sometimes only shutdown):
RUNDLL USER.EXE,ExitWindowsExec
Windows 98:
RUNDLL SHELL32.DLL,SHExitWindowsEx 2
Windows NT 4:
@ECHO OFF
PUSHD "%temp%"
ECHO [Version] > {out}.inf
ECHO signature=$chicago$ >> {out}.inf
ECHO [defaultinstall] >> {out}.inf
RUNDLL32 SETUPAPI,InstallHinfSection DefaultInstall 1 {out}.inf
DEL {out}.inf
POPD
(original batch file by Walter Zackery, adapted for readability)

Shutdown (1)
Windows 95:
RUNDLL USER.EXE,ExitWindows

Windows 98:
RUNDLL SHELL32.DLL,SHExitWindowsEx 1

or:
RUNDLL32 KRNL386.EXE,exitkernel

(will also power down ATX boards)

Show Windows 9*'s "System setting changed, do you want to reboot now?" dialog (1):
RUNDLL SHELL.DLL,RestartDialog

Display NT's "About" dialog, showing version, servicepack, registered owner and amount of physical memory:
RUNDLL32 SHELL32.DLL,ShellAboutW

Open a file with Windows' "Open as" dialog:
RUNDLL32 SHELL32.DLL,OpenAs_RunDLL filename

Swap your mouse to left handed use (tip from "Speedy Gonzales"):
Windows 95:
RUNDLL USER.EXE,SwapMouseButton

Windows NT:
RUNDLL32 USER32.DLL,SwapMouseButton
I know of no command yet to undo this, but the following will get you close:
CONTROL MAIN.CPL
or:
RUNDLL32 SHELL32.DLL,Control_RunDLL MAIN.CPL,@0,1

Start DialUp Network:
(Credits for these commands: Michael J. Gregg and Tom Lavedas)
START RUNDLL32 RNAUI.DLL,RnaDial exact name of dialer entry
TRACERT -h 1 -w 1
The RUNDLL command starts DUN, the TRACERT command is supposed to actually start the dialing process. Since I do not have access to any PC with DUN installed, I could not test the TRACERT command's effect.
Use the RASPHONE command in Windows NT, which can also hang up the connection (credits: Simon Sheppard).

Open "Connect to Printer" dialog:
RUNDLL32 WINSPOOL.DRV,ConnectToPrinterDlg
This commands opens the "Connect to Printer" dialog, as you might have guessed. I don't see any useful application yet, but maybe you do.
Open the Printers folder:
RUNDLL32 SHELL32.DLL,Control_RunDLL MAIN.CPL @2
or for Windows 2000:
RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL PrintersFolder
Credits: Pascal Rebsamen

Note: To create a shortcut in the Start Menu to open the Printers folder, create a directory using one of the following commands.
Windows 9x (without roaming profiles):
MD "%windir%\Start Menu\Programs\Printers.{2227A280-3AEA-1069-A2DE-08002B30309D}"
Windows NT 4/2000:
MD "%USERPROFILE%\Start Menu\Programs\Printers.{2227A280-3AEA-1069-A2DE-08002B30309D}"

Open the Fonts folder:
RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL FontsFolder
Credits: Media Chance

Print a test page:
RunDLL32.EXE SHELL32.DLL,SHHelpShortcuts_RunDLL PrintTestPage

View or change printer settings (Windows 2000):
RUNDLL32 PRINTUI.DLL,PrintUIEntry /?
This will display an extensive list of available functions and many examples.
This list can also be viewed here.
Notes:
1 See my Shutdown page for more information and examples on reboot and shutdown command lines.
2 By associating *.CPL files with the command
RUNDLL32 SHELL32.DLL,Control_RunDLL %1,@0
and *.SCR files with
RUNDLL32 DESK.CPL,InstallScreenSaver %1
you can open and/or install them by doubleclicking on their icons.

The following batch file installs a screensaver if one is specified, and opens the Control Panel applet at the right tab to enable adjustment of its settings (tested in NT only):

@ECHO OFF
IF "%1"=="" GOTO Interact
IF NOT EXIST %SystemRoot%.\System32\%~nx1 GOTO Interactive

RUNDLL32 DESK.CPL,InstallScreenSaver %~f1
GOTO End

:Interactive
RUNDLL32 SHELL32.DLL,Control_RunDLL DESK.CPL,@0,1

:End

--------------------------------------------------------------------------------
I am interested to hear about other possible uses for RUNDLL.
Please send me your tips or comments by e-mail: info@robvanderwoude.com .
More Information
An extensive list of RUNDLL commands with good search capabilities can be found at Dx21's RunDLL32 section.
For programmers, there is more information on Microsoft's INFO: The Windows 95 Rundll and Rundll32 Interface page and on Robert Vivrette's The Unofficial Newsletter of Delphi Users you can find an article about RUNDLL by Wendell Jones (brought to my attention by William Brooks in response to this request for tips; thanks).
At The Visual Basic Developers Resource Centre a list of Control Panel Functions for Windows 9x/NT through RUNDLL can be found (a tip from my collegue Adriaan Westra; thanks).
An extensive list of Control Panel related and other RUNDLL commands can be found at Media Chance's RUNDLL FAQ page.
Jeffrey W. Horning provided a list of Undocuments paths to Windows 2000 tools.
Many more RUNDLL commands in German are available at Pascal Rebsamen's Windows 2000: RunDLL32 page.