Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hide My A$$ Pro VPN OSX Script to Stop Networking on Disconnect
05-22-2011, 03:26 PM (This post was last modified: 05-22-2011 03:50 PM by safety.)
Post: #1
Hide My A$$ Pro VPN OSX Script to Stop Networking on Disconnect
The HMA program for OSX is not as advance as the Windows version and lacks several features. My main complaint with the software is that you are unable to bind programs to the VPN connection. Since the whole point of using this service is to be anonymous, this would be defeated if the connection is lost for any reason.

The following script will bind all network activity to the VPN connection. Before using this script there are a few things that will need to be done. Please note that you will need root access to use this script.

Determine your path to Perl:
Code:
nDarkness:bin safety$ which perl
/opt/local/bin/perl
(This may be different on your system.)

Substitute this as the first line of the script below
Delete all firewall rules if they exist:
Code:
nDarkness:bin safety$ sudo ipfw f
Password:
Are you sure? [yn] y

Flushed all rules.
Now create a file with the command below and paste the script below that:
nDarkness:bin safety$ nano vpn_ipfw.pl
Code:
#!/opt/local/bin/perl -w

use strict;

if(@ARGV < 1) {

        die "Usage: sudo $0 ip_address\n";

} else {

        my $route = `netstat -r`;

        $route =~ m{(.*?)/32};

        my $address = "$1:443";

        system('ipfw add 01000 allow ip from any to any via tun0');
        system("ipfw add 01100 allow ip from any to $address");
        system('ipfw add 01200 deny ip from any to not me');
        system('ipfw add 65535 allow ip from any to any');

}
After this is entered, press ctrl+x => y => enter
Use the HMA software to connect to a VPN server and then run our script:
Code:
nDarkness:bin safety$ sudo perl vpn_ipfw.pl
Now if we lose our connection to the VPN server all networking activity will completely stop. To reconnect networking again you will need to repeat step 3 above.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)
Contact Uswww.nDarkness.comReturn to TopReturn to ContentLite (Archive) ModeRSS Syndication