Tuesday, May 10, 2011

NetStat Tips

http://en.wikipedia.org/wiki/Netstat

All Active TCP & UDP connections
netstat -a

All Active TCP Connections and PID
netstat –o

All Active TCP Connections and Process name
netstat -b
netstat –aon
netstat –ab
netstat -ob

To get a more detailed list that includes the EXE file and DLL file names
netstat –anobv
netstat -an | find /i "listening"
netstat -an | find  /I "established"
netstat -an | find /i "listening" > c:\openports.txt
netstat -aon | findstr 0.0:80
netstat -aon | findstr 7200
netstat –an 5 (refresh after 5 seconds)

- Find Hops:  pathping

- Host Name:  nslookup 172.29.120.43

Saturday, May 7, 2011

Time

Disable & Enable USB using Regedit

- Just open "regedit" and browse to this key,

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\UsbStor

Notice the value 'Start'

Switch this value to 4, and USB storage devices are disabled.

Switch this value to 3, and USB storage devices are enabled.

Disable USB

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR]
"Type"=dword:00000001
"Start"=dword:00000004
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,44,00,\
  52,00,49,00,56,00,45,00,52,00,53,00,5c,00,55,00,53,00,42,00,53,00,54,00,4f,\
  00,52,00,2e,00,53,00,59,00,53,00,00,00
"DisplayName"="USB Mass Storage Driver"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Security]
"Security"=hex:01,00,14,80,a0,00,00,00,ac,00,00,00,14,00,00,00,30,00,00,00,02,\
  00,1c,00,01,00,00,00,02,80,14,00,ff,01,0f,00,01,01,00,00,00,00,00,01,00,00,\
  00,00,02,00,70,00,04,00,00,00,00,00,18,00,fd,01,02,00,01,01,00,00,00,00,00,\
  05,12,00,00,00,00,00,00,00,00,00,1c,00,ff,01,0f,00,01,02,00,00,00,00,00,05,\
  20,00,00,00,20,02,00,00,00,00,00,00,00,00,18,00,8d,01,02,00,01,01,00,00,00,\
  00,00,05,0b,00,00,00,20,02,00,00,00,00,1c,00,fd,01,02,00,01,02,00,00,00,00,\
  00,05,20,00,00,00,23,02,00,00,00,00,00,00,01,01,00,00,00,00,00,05,12,00,00,\
  00,01,01,00,00,00,00,00,05,12,00,00,00

Enable USB


Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR]
"Type"=dword:00000001
"Start"=dword:00000003
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,44,00,\
  52,00,49,00,56,00,45,00,52,00,53,00,5c,00,55,00,53,00,42,00,53,00,54,00,4f,\
  00,52,00,2e,00,53,00,59,00,53,00,00,00
"DisplayName"="USB Mass Storage Driver"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Security]
"Security"=hex:01,00,14,80,a0,00,00,00,ac,00,00,00,14,00,00,00,30,00,00,00,02,\
  00,1c,00,01,00,00,00,02,80,14,00,ff,01,0f,00,01,01,00,00,00,00,00,01,00,00,\
  00,00,02,00,70,00,04,00,00,00,00,00,18,00,fd,01,02,00,01,01,00,00,00,00,00,\
  05,12,00,00,00,00,00,00,00,00,00,1c,00,ff,01,0f,00,01,02,00,00,00,00,00,05,\
  20,00,00,00,20,02,00,00,00,00,00,00,00,00,18,00,8d,01,02,00,01,01,00,00,00,\
  00,00,05,0b,00,00,00,20,02,00,00,00,00,1c,00,fd,01,02,00,01,02,00,00,00,00,\
  00,05,20,00,00,00,23,02,00,00,00,00,00,00,01,01,00,00,00,00,00,05,12,00,00,\
  00,01,01,00,00,00,00,00,05,12,00,00,00

Command Prompt in Explorer

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\opennew]
@="Dos Prompt in Directory"
[HKEY_CLASSES_ROOT\Directory\shell\opennew\command]
@="cmd.exe /k cd %1"
[HKEY_CLASSES_ROOT\Drive\shell\opennew]
@="Dos Prompt in Drive"
[HKEY_CLASSES_ROOT\Drive\shell\opennew\command]
@="cmd.exe /k cd %1"

Alert for Empty Subject Line in Outlook Express

 Just follow below steps,
1. Open the Outlook
2. Open Visual basic editor by pressing ALT+F11
3. Then from left pane expand the Project1 untill you see "ThisOutlookSession"
4. Copy & Paste the below code in "ThisOutlookSession" Window.
6. Save and Close the window. It's done!

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    If Item.Subject = "" Then
        'Edit the message and the popup caption on the next line as desired.'
        MsgBox "You are not allowed to send an item with a blank subject.  Please enter a subject and send again.", vbCritical + vbOKOnly, "Prevent Blank Subjects"
        Cancel = True
    End If
End Sub