Thursday, September 23, 2010

Cisco access point wireless configuration snippet

I always forget one of these commands when setting up a simple wireless configuration on a cisco access point.

conf t
dot11 ssid temp
   authentication open
   authentication key-management wpa
   guest-mode
   wpa-psk ascii tempkey1
!
.....
interface Dot11Radio0
encryption mode ciphers aes-ccm
ssid temp
!

I am always looking to enable dhcp also.
Here is how you do it, although I think I have memorized it now.

ip dhcp pool test
  network 192.168.2.0 255.255.255.0
!

Tuesday, September 14, 2010

Windows Command Line to show members of a local group

net localgroup <Group>

Pretty simple, but I only use this once every six months and I forget the command.
Maybe posting this will help me remember.

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.

Saturday, May 8, 2010

Perl Tkx Thread request demo


#!/usr/bin/perl -w
use strict;
use warnings;
use threads;
use threads::Shared;
use Tkx;

#Create shared variables
my $child_finished_flag: shared = 0;
my $child_request_flag: shared = 0;

#Create child thread
my $ChildThread = threads->create( \&child_thread );
$ChildThread->detach();

#Create Tkx mainwindow
my $mw = Tkx::widget->new(".");
my $frame2 = $mw -> new_ttk__frame(-borderwidth => 2);
$frame2->g_pack(-anchor => 'nw', -padx => '10', -pady => '10');

#create progressbar and button widgets
my $progressbar = $frame2->new_ttk__progressbar(-orient => 'horizontal', -length => 200, -mode => 'determinate');
my $button = $frame2->new_ttk__button(-text => "Process Request", -style => "Bold.TButton", -state => 'normal', -width => '15', -command => [\&process_request] );
$button->g_grid(-row=>1, -column=>1, -columnspan=>2, -padx=>10, -pady=>5);
$progressbar->g_grid(-row=>2, -column=>1, -columnspan=>2, -padx=>10, -pady=>5);

#Initiate Tkx Listener
Tkx::MainLoop();

sub process_request {
$progressbar->start();
$child_request_flag = 1;
& check_status_1;
}

sub check_status_1 {
Tkx::after(500, sub {
if ($child_finished_flag == 1) {
$progressbar->stop();
#Reset flags
$child_finished_flag = 0;
$child_request_flag = 0;
print "child_request finished\n";
}
else {
& check_status_2;
print "child_request processing\n";
}
});
}



sub check_status_2 {
Tkx::after(500, sub {
& check_status_1;
});
}

sub child_thread {
while (1) {
sleep 2;
if ($child_request_flag == 1) {
print "begin child_request\n";
## backtick command here
my @ping=`ping www.yahoo.com`;
open (CONFIG, '>ping_result.txt');

foreach my $pingtext (@ping) {
print CONFIG $pingtext;
}
close (CONFIG);
$child_finished_flag=1;
}
else {print "waiting for child_request\n";}
}
}

Use Gargoyle Firmware to implement whitelist filtering on wrt

Access Restrictions on Gargoyle firmware make a great tool for restricting specific hosts from accessing any web pages except those specified in this whitelist.
http://www.gargoyle-router.com/

Friday, April 2, 2010

YouTube Video Conversion

First get the 1 click FireFox Addon at this link: 1-Click Addon

Restart Firefox

Download the mp4 file using the 1-Click Addon



Then download and install WinFF from this link: WinFF.org
It is very straight forward and worked great for converting the mp4 to a wmv file.

Handbrake works great for conversion to an iphone compatible format if you prefer.

Saturday, March 13, 2010

VLC fails to create multicast group on router

The Time To Live is set to 1 by default in the newer versions of videolan client, therefore multicast doesn't work properly.

In the gui this can be overridden by adding the ttl field as shown below:

Before:
:sout=#duplicate{dst=display,dst=std{access=udp,dst=239.1.1.1:1234}}
After:
:sout=#duplicate{dst=display,dst=std{access=udp{ttl=10},dst=239.1.1.1:1234}}

Or from the command line:
vlc.exe -vvv c:\video\filename.avi --sout udp:239.1.1.1:1234 --ttl 12

Wednesday, February 10, 2010

Use GIMP to edit EPS files on windows.

Install GIMP or GIMP Portable.

Go to the Ghostscript project page on Sourceforge http://sourceforge.net/projects/ghostscript/

Download one of the prepared Windows distributions, such as gs870w32.exe

Start the executable and follow the instructions for the installation procedure.

Right-click My Computer, and then click Properties.

Click the Advanced tab.

Click Environment variables

Set the GS_PROG environment variable to the full file name of the gswin32c binary (e.g. C:\gs\gsX.YY\bin\gswin32c.exe).

 

Open GIMP and open the EPS file.

 

Thursday, January 21, 2010

jquery blockUI bug with internet explorer

When using jquery plugin blockUI if the user doesn't move the mouse after the control returns the cursor will continue to spin.
This is documented on the following post:
Here is the fix.
Edit the jquery.blockUI.js file
After line 379 add the line below.
Line 379: els = $('.blockUI', el);
Add this line: els[1].style.cursor = 'default';

It depends on what version of blockUI.js you have, but here is what I ended up using around line 390.

 var els;
 if (full) // crazy selector to handle odd field errors in ie6/7
  els = $('body').children().filter('.blockUI').add('body > .blockUI');
 else
  els = $('.blockUI', el);
  if ($.browser.msie && els[1] !== undefined) {
   els[1].style.cursor = 'default';
  }