Thursday, March 21, 2013

Tomato VPN and OpenVPN client cannot connect to LAN server using hostname

I have been trying to figure out how to allow an application to connect using the hostname. 
The application works fine on the LAN, but when the user goes to a remote location and uses the OpenVPN GUI client to connect to the network the hostname no longer works. 
If I edit the hosts file and add an entry for example: 10.10.10.10 servername 
Then I can get to servername just fine, however I didn't want to edit the hosts file on all workstations. 
So in looking for another answer, I went into the Basic menu in tomato and the Identification menu. 
In the Domain Name field it was blank, I made up some random domain name and saved the settings. 
I thought I would have to use the fully qualified domain name to connect. (ie: servername.my.private.lan) But after reconnecting to the VPN I was simply able to use the hostname. (ie: servername) to connect and the application now works fine. 



Tuesday, February 26, 2013

Tomato E1000 Firmware issues

I have been deploying tomato shibby firmware version 1.04 for use in
various client offices with wireless disabled, so I had not noticed
these issues. I also, haven't experienced the same reliability that I
have with polar tomato, or tomato raf that I run on many different
networks with linksys e2000, wrt54gl, and wrt610n routers.
I noticed severe slowness on Internet speedtest sites using tomato
shibby 1.04. I tried upgrading to 1.06, but it would not install.
1.05 resulted in being unable to access the GUI page after changing
the admin settings. Using the reset button allowed me to get back in
and after a number of attempts I upgraded the firmware to the tomato
toastman version shown below.
1.28.0501
This version worked well, but seems to have the same problem as 1.04
with wan speeds.
Under advanced wireless settings, if it is set to WMM enabled then I
get fast speeds between LAN and wifi devices. Like 35Mbps as shown in
the wifiperf screenshot.
However wan speedtest is about 0.03 Mbps download.
If I disable the WMM, I get wan speeds of 22 Mbps on my Comcast 25M
connection, but LAN speeds drop to around 15Mbps.
So this is the setting I am using for now.
I'm not sure what else to try in order to improve this.
In researching things I noticed the linksys e1200 and e1500 and e1550
models are in the $25 - $60 range and there is now tomato raf support
for these devices. I'm off to order one of these to test for future
deployments.

Friday, November 9, 2012

Ubiquiti AirCam save snapshots to web page and refresh every 30 seconds

I am running firmware version 1.1.5 on the Ubiquiti (UBNT) AirCam.
First open an ssh session to the AirCam using putty or another ssh client.
Login using the username and password.
Enter the following line:

mkdir /etc/persistent/www ; ln -s /tmp/snap.jpeg /etc/persistent/www/logo.gif ; save

The image should display. 

Here is the code I am using for the web page
<div id="AirCam" class="LiveImg">
<img src="http://192.168.1.63/images/logo.gif" alt="" class="photo">
</div>

<script type="text/javascript">
setInterval(function(){
$("#AirCam img").attr("src", "http://192.168.1.63/images/logo.gif?timestamp=" + new Date().getTime());
},30000);
    </script>

Another option is on the UBNT forums: 


Tuesday, October 23, 2012

Use WMIC to get logged in user from remote computer

The Command:

C:\>WMIC /NODE:’Hostname' ComputerSystem Get Username,Name

The Results:

Name           UserName

Hostname  Domain\User.Name

 

The node can be the DNS name, or IP Address, also a list can be used as well.

I would have really liked to use this command to query thousands of nodes, however through experimentation the tool seemed to crash after 30 or 40 hosts.

I tried the /FAILFAST:ON and /FAILFAST:50 options with some improvements, but nothing solid.

Please comment if you have used this tool successfully for a large list of nodes.

Thanks!

 

List Computers in a domain

dsquery computer domainroot -name ws* -o rdn

 

By default this will be limited to 100 results, use the –limit option to display more results.

 

Thursday, May 31, 2012

How to install Victek Tomato on Linksys WRT160N V3.0

Install dd-wrt from the following site:
http://www.dd-wrt.com/site/support/router-database
dd-wrt.v24-14896_NEWD-2_K2.6_mini.bin

reboot, then install victek tomato
I had to use the reset button prior to logging in.
http://victek.is-a-geek.com/tomatoen.html
tomato-K26-1.28.9006MIPSR2_RAF-Std-NOCAT.trx

*Updated to run tomato RAF on 10/31/2013
boot wrt160n
login to 192.168.1.1
default username is admin
default password is admin
upgrade to linksys firmware version 3.0.03
firmware version: v3.0.00 failed to upgrade to dd-wrt after 2 percent complete
use this file from the linksys web site: WRT160Nv3_0_03_003.code1.bin
after reloading go to administration page
firmware upgrade
upgrade to dd-wrt.v24-14896_NEWD-2_K2.6_mini.bin
change username and password to admin / admin
upgrade to tomato RAF use the reset to defaults option
upgrade to tomato-K26-1.28.9006MIPSR2_RAF-Std-NOCAT.trx
login to tomato raf


Sunday, April 3, 2011

A couple of very useful web tools

http://premailer.dialect.ca/
premailer is a great tool for converting html code into mail formatted as html.
Tips: Use outlook express to send html emails.
Create a new message, then click insert, text from file, select the html file.
A div with a background image will not display in gmail web viewer but it does display on iphone email. So use a normal img tag, and test with various email clients.

http://www.dotemplate.com/
dotemplate.com is very cool for creating a quick css template for a web site.

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";}
}
}