Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Configure firewall ports automatically by application Network
With the recent security threats to OS X, I thought it would be a good idea to be able to automatically configure my firewall based on the applications I have open. If no application is using said port, it's closed. So with a little help from bash and AppleScript, I now have an application that automagically scans for open applications and configures the firewall accordingly. Enjoy!
read more (304 words)   Post a comment  •  Comments (11)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[14,640 views] Email Article To a Friend View Printable Version
Avoid a kernel panic with the D-Link DWL122 adapter Network
The D-link DWL 122 seems to very buggy drivers on OS X: when you unplug it while your Mac is on, it often crashes with a kernel panic. How can you avoid that?

Go to your System Preferences, then Network, then click Show and choose Network Port Configurations from the pop-up menu. There you can find "Ethernet adapter (en1)." That is your wifi dongle; uncheck the "On" checkbox, then click "Apply Now." Now you can unplug your dongle without any fear :)

Remember to tick it back to On if you want to use your dongle again. This hint is useful for other wifi dongles using the same chipset and drivers (e.g.: NetGear ma111).
  Post a comment  •  Comments (5)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[12,511 views] Email Article To a Friend View Printable Version
Check server status remotely with a perl script Network
I was looking for an easy way to keep an eye on the status of some of my servers. Since I didn't have the patience to search for a solution which matched my needs, I wrote this little perl script. Download it, paste it in your favorite text editor, and save it somewhere on your path as is_tcp_port_listening.pl. Make it executable (chmod 755 is_tcp_port_listening.pl), and then it can be invoked with this command:
$ ./is_tcp_port_listening.pl 'hostname' 'portnumber'
The script simply tries to connect to a server on a TCP port. If the connection can be established, it will return the value 0, which means in a UNIX System that everything is okay. If it's not possible to connect in a definable time, it will stop its attempts and return the value 1. You can set the timeout by changing the following line in the source code:
my $timeout = 3;
This for example sets the timeout to three seconds, which might be a bit short if your server and/or your internet connection is slow.
read more (178 words)   Post a comment  •  Comments (16)  
  • Currently 3.63 / 5
  You rated: 3 / 5 (8 votes cast)
 
[31,015 views] Email Article To a Friend View Printable Version
Entering a WEP hex key for preferred AirPort network Network
After updating the firmware of my WLAN router (Fritz Box SL WLAN), my iBook (OS 10.3.9) stopped connecting automatically to my router, and also gave an annoying "error joining" message. This hint removed the error message, but automatic reconnect still failed.

Solution: when entering a WEP hex key in System Preferences > Network > Automatic Connect/Preferred Network, be sure to prepend 0x before the key itself (no spaces between 0x and the key).
  Post a comment  •  Comments (6)  
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[31,404 views] Email Article To a Friend View Printable Version
Automatically set location based on connected SSID Network
I have a wireless network at home, and I also connect to several other networks at work. I do not use DHCP, so I have to manually select a network location each time I turn on my laptop. Using a few scripts I found here, I created this AppleScript that will automatically set the location based on the connected SSID.

It will also open shared drives, if they are defined in the script. If it doesn't find an SSID in the list, it will set the location to Automatic. With some extra work, it should be possible to also set the default printer.

set AirportName to do shell script 
  "system_profiler SPAirPortDataType|awk -F\": \" '/Current Wireless Network/{print $2}'"

tell application "Finder"
  activate
end tell

set CurrentLocation to "Automatic"
if AirportName is "Home" then set CurrentLocation to "Home"
if AirportName is "Work1" then set CurrentLocation to "My work"
if AirportName is "Work2" then set CurrentLocation to "Other Office"

say "I think I am at location " & CurrentLocation & ", I will adjust my network settings accordingly"

tell application "System Events"
  click menu item CurrentLocation of menu "Location" of menu item "Location" of menu "Apple" of menu bar 1 of process "Finder"
end tell

if AirportName is "Work1" then mount volume "smb://server/share"
if AirportName is "Home" then mount volume "smb://administrator@mycomputer/share"

I hope this is of some use to some people; I use it a few times each day in combination with SleepWatcher.

[robg adds: This previous hint does the same thing via a shell script, and this one works via bash and a launchd item.]
  Post a comment  •  Comments (15)  
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[21,756 views] Email Article To a Friend View Printable Version
10.4: A script for PPTP custom routing on VPNs Network
Tiger only hintTo stop OS X 10.4 from creating a default route to your VPN connection, open Internet Connect (in Applications). Choose Options from the Connect menu, then uncheck the "Send all traffic over VPN connection" option. Click OK, and you're done.

To make a custom route to the subnet on the other side of the VPN connection, read the rest of the hint...
read more (329 words)   Post a comment  •  Comments (2)  
  • Currently 3.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[19,431 views] Email Article To a Friend View Printable Version
Share a dialup connection with a wireless router Network
Do you have a few computers networked at home with a wireless laptop, and only a dialup connection to share among them?

Well, I live only a few minutes from a large city, but still don't have access to high speed connectivity of any sort. I have two towers and one laptop at home, and was having issues with my wireless signal strength (I was just using a software base station). So I bought a D-link DI-624 wireless router to increase my network range. However, when I got it home and set it up, the default internet sharing preferences weren't working. I looked for ages (on a dialup connection, which took forever), but couldn't find any solutions that worked. After reading up about how internet sharing works and sleeping on it, I figured it out. It basically involves turning off the default DHCP server on the router, and using 192.168.2.xx IPs, which is what apple uses to share the connection.
read more (324 words)   Post a comment  •  Comments (1)  
  • Currently 1.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[13,590 views] Email Article To a Friend View Printable Version
10.4: A workaround for a Cisco VPN client problem Network
Tiger only hintThe Cisco VPN client 4.7.00 (0510) mostly works for me on OS X 10.4.4, but I get "Error 51" sporadically, and I used to have to reboot to stop it, but not any more.

I took a tip that I found on VersionTracker and did a slight tweak to the command, so that the cvpnd process daemonizes silently to the background and you don't have to remember to keep restarting it:
launchd -d /bin/sh -c \ 
"while [ 1 ]; do /private/opt/cisco-vpnclient/bin/cvpnd; done"
Hopefully Cisco will solve the problem, so that we don't have to resort to hacky solutions like this.
  Post a comment  •  Comments (16)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[28,977 views] Email Article To a Friend View Printable Version
View open sockets in Transmission or other apps Network
I like the Torrent client Transmission, but right now it does not have the same level of detail as some other clients do (BitTorrent or Azureus) such as showing the IPs of the peers you are connected to. So I wrote a script, and I have GeekTool run it every five seconds and then I put the results in a window on my desktop. The result of the script is a list of open sockets, and a title at the top that tells me how many Transmission is using.

Here's the code:

#!/bin/sh
ThePID=`ps -U yourusernamehere | grep TRANSMISSION | grep -v grep | awk '{ print $1 }'`; 
TheFiles=`fstat -p $ThePID | grep stream | wc -l`; 
echo $TheFiles " Transmission files open"; 
echo; 
netstat -d -n -f inet | grep "ESTABLISHED" | grep -v 127 | awk '{print $5}'

Substitute your user name and the name of the application you want to monitor above, but it does need to be the name exactly as it appears in the ps command.

A brief explanation of what is going on here. The first part of the script determines the current PID of the Transmission client, but you could grep for any application name, such as a browser if you wanted to monitor its active connections.

The remaining lines use the PID of the application that comes back to narrow the search down to just the sockets that app is using, and also remove the local host connections and then print out the IPs and ports with a total.

Enjoy, feedback welcome.
  Post a comment  •  Comments (7)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
 
[10,799 views] Email Article To a Friend View Printable Version
How to update a modified WEP key Network
I have changed WEP key on my router for security reasons. However, even after I deleted my wireless network from the preferred network list, and re-added it with the new WEP password, it would still use old one.

As I found out latter, the WEP key is stored in the keychain, and must be updated by using Keychain Access (in Applications -> Utilities).
  Post a comment  •  Comments (14)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[19,253 views] Email Article To a Friend View Printable Version