Sunday, June 20, 2010

Changed the template today and added syntax highlights

I added some highlighting to my previous post using the code from this link.
Thanks cyberack!
http://www.cyberack.com/2007/07/adding-syntax-highlighter-to-blogger.html

Win32::ODBC bug in Windows 7

I keep getting the following error when trying to run a script that uses an access database as the backend.

ConfigDSN(): Could not add temporary DSN[911] []
"Illegal use of reserved characters []{}(),?*!@;"

The script is installed via Cava Packager and a custom Inno Setup script.
By default it gets installed into the Program Files (x86) folder of windows 7.

This is the line I am having problems with, which is trying to add a DSN for the Database.

Win32::ODBC::ConfigDSN(ODBC_ADD_DSN, $DriverType,("DSN=$DSN", "Description=Win32 ODBC DSN for Perl", "DBQ=$Dir\\$DBase", "DEFAULTDIR=$Dir", "UID=", "PWD=")) or die "ConfigDSN(): Could not add temporary DSN" . Win32::ODBC::Error();

The problem wasn't obvious at first, until I realized the $Dir variable contained the text 'Program Files (x86)'.
And the Win32::ODBC module apparently has a problem with the () around the x86 of this folder.

To resolve the problem I decided to just change the default location of the Inno Setup script from {pf} the environement variable for program files and instead hard coded it as C:\Program Files.

As always, Enjoy!

Friday, June 18, 2010

Find operating system version in perl


my $osname = Win32::GetOSName();
my ( $osvername, $major, $minor, $id ) = Win32::GetOSVersion();

print "osname: $osname\n";
print "osvername: $osvername\n";
print "major: $major\n";
print "minor: $minor\n";
print "id: $id\n";

Commands to become undetectable on Windows NT/W2K/XP

I was looking for this a while back but didn't end up trying it out. 
I have forgotten the source, but I wanted to post it just in case. 

NOTE: You are at your own risk if you follow these instructions. Editing your registry is DANGEROUS and should be done with extreme caution. Follow these steps at your OWN risk.

  1. Get your device's hex value. ('snort -W' works for this)
  2. open Regedt32
  3. Navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\
    Interfaces\{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
  4. Select the network card you wish to setup as the monitoring interface (this will be the {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} value).
  5. Set IPAddress:REG_MULTI_SZ: to null (Double click on the string, delete data in the Multi-String Editor, then click OK)
  6. Set SubnetMask:REG_MULTI_SZ: to null (Double click on the string, delete data in the Multi-String Editor, then click OK)
  7. Set DefaultGateway:REG_MULTI_SZ: to null (Double click on the string, delete data in the Multi-String Editor, then click OK)
  8. Close the Registry Editor, your changes will be saved automatically.
  9. In a command prompt, run 'ipconfig' to verify the interface does not have an IP bound to it.

 

Restore Network Icon in Vista

> run 'regedit.exe'

> goto key 'HKEY_CURRENT_USER\Software\Classes\Local Settings
\Software\Microsoft\Windows\CurrentVersion \TrayNotify'

> delete keys 'IconStreams' & 'PastIconsStream'

> start task manager, go to processes and kill explorer.exe

> go to applications in the task manager, hit new task and type
'explorer.exe'

> explorer will now reboot and your icons should return.