Tuesday, July 24, 2007

Visual Studio : Using a xsd to validate / create xml

With VS 2005, there's a neat feature which allows you to validate / check a xml document based on a xsd.

Load the xml document (or the bare bones) and then click the "Properties" tab on the RHS (where "Solution Explorer" is). You'll see a "schema" entry. Point this to the xsd that describes the xml.

You might need to use "file:// ... " if the file is on your hard drive.

Now you will see that all the errors are highlighted in the usual way and also Intelli-sense guides you as you build up the xml.


Wednesday, July 18, 2007

Misc : Cracking XP Administrator passwords

Check out this site:


"Login Recovery is a service to reveal user names and recover passwords for Windows NT, 2000, XP, 2003 and Vista. As long as you have physical access to the computer, your passwords can be recovered

By following three simple steps, over 98.5% of passwords can be recovered within less than ten minutes. This service does not overwrite passwords, it does not write anything to the hard drive, it does not alter the computer in any way.

For immediate access to decrypted passwords, the priority service is available for GBP 12.95 + VAT (£15.22) (approx USD 25 or EUR 20). Alternatively a free service is available by waiting up to 48 hours (One free request every three months)."

Works like a charm as long as you don't mind waiting 48 hours!


Thursday, July 05, 2007

DOS 'grep' equivalent - the find command

The previous post talked about finding which ports were open using the netstat command.

But you still have to scan the output manually to find the port you are looking for.

In the Unix world you could simply use grep and pipe the output to it.

In the DOS world, you can use find.

help find

Searches for a text string in a file or files.

FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]

/V Displays all lines NOT containing the specified string.
/C Displays only the count of lines containing the string.
/N Displays line numbers with the displayed lines.
/I Ignores the case of characters when searching for the string.
/OFF[LINE] Do not skip files with offline attribute set.
"string" Specifies the text string to find.
Specifies a file or files to search.

If a path is not specified, FIND searches the text typed at the prompt
or piped from another command.

So to find if port 86 was open, use:

netstat -ano | find /i "86"

and the filtered output would something like:

UDP *:* 728


Which XP ports are open?

Don't know how many times I see the message "Error - port 8080 already in use" or some such.

So how do you find whose using that port. One answer is netstat which runs in a cmd window:

Displays protocol statistics and current TCP/IP network connections.

NETSTAT [-a] [-b] [-e] [-n] [-o] [-p proto] [-r] [-s] [-v] [interval]

-a Displays all connections and listening ports.
-b Displays the executable involved in creating each connection or
listening port. In some cases well-known executables host
multiple independent components, and in these cases the
sequence of components involved in creating the connection
or listening port is displayed. In this case the executable
name is in [] at the bottom, on top is the component it called,
and so forth until TCP/IP was reached. Note that this option
can be time-consuming and will fail unless you have sufficient
-e Displays Ethernet statistics. This may be combined with the -s
-n Displays addresses and port numbers in numerical form.
-o Displays the owning process ID associated with each connection.
-p proto Shows connections for the protocol specified by proto; proto
may be any of: TCP, UDP, TCPv6, or UDPv6. If used with the -s
option to display per-protocol statistics, proto may be any of:
IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, or UDPv6.
-r Displays the routing table.
-s Displays per-protocol statistics. By default, statistics are
shown for IP, IPv6, ICMP, ICMPv6, TCP, TCPv6, UDP, and UDPv6;
the -p option may be used to specify a subset of the default.
-v When used in conjunction with -b, will display sequence of
components involved in creating the connection or listening
port for all executables.
interval Redisplays selected statistics, pausing interval seconds
between each display. Press CTRL+C to stop redisplaying
statistics. If omitted, netstat will print the current
configuration information once.

so netstat -ano gives

Active Connections

Proto Local Address Foreign Address State PID

You can look up the PID using Task Manager or (even better) using sysinternals Process Explorer (which you can get from here).

Their version of netstat is TCPView (which you can get from here).