Some Tips on Using EVIL Windows Like It’s a Linux (1)

With the help of CYGWIN and other GNU or opensource posix aligning softwares, we can get a Windows box very close to a Linux one. What we want is freedom, and there’s no way that our freedom can be deprived of by Bill Gates and his EVIL Windows system.

Say, we use the company network at office, which uses DHCP, and then we go back from work taking the laptop home, where I use ADSL, and the network should be reconfigured. Also, at company, we used proxy for http visiting. Thus every separate software will require reconfiguration! The IP address of the network card, the IE proxy setting, the Windows Live Writer proxy setting, and the Firefox, and so on.

It’ll be pain like hell if you must do it step by step manually every time. So here’s how I liberate myself and obtain freedom from that pain.

I do this at home:

$cat ~/bin/nethome.sh
#!/bin/bash
netsh interface ip set address name=eth0 source=static addr=192.168.1.3 mask=255.255.255.0 gateway=192.168.1.1 gwmetric=1
netsh interface ip set dns name=eth0 source=static addr=202.109.122.14 register=primary
netsh interface ip add dns name=eth0 addr=210.52.149.2 index=2
#cygstart ~/bin/ieProxyDisable.reg
cd ~/doc
regedit /s MsnBlogProxyDisable.reg 

And here’s how we do it at office:

$cat ~/bin/netoffice.sh
#!/bin/bash
netsh interface ip set address name=eth0 source=dhcp
netsh interface ip set dns name=eth0 source=dhcp
ipconfig /renew
#cygstart ~/bin/ieProxyEnable.reg
cd ~/doc
regedit /s MsnBlogProxyEnable.reg

For the IE and Firefox proxy issue, I used the proxy automatic configuration script feature:


$cat ~/.proxy.pac
function FindClientProxy(url, host) {
    return "DIRECT";
}

function FindServerProxy(url, host) {
    if (shExpMatch(host, "*.mycomp.com") || 
        shExpMatch(host, "127.0.0.1") || 
        shExpMatch(host, "localhost") || 
        shExpMatch(host, "192.168.*") ||
        shExpMatch(host, "10.*") ||
        isPlainHostName(host))
    return "DIRECT";
    else 
    return "PROXY gateway.mycomp.com:1080";
}

function FindProxyForURL(url, host) {
    if (myIpAddress()=="192.168.1.3") {
        return "DIRECT";
    } else if (shExpMatch(host, "vpn.mycomp.com")) {
        return "DIRECT";
    }
    else {
        return FindServerProxy(url, host);
    }
}

## Local Variables: ***
## mode: tcl ***
## End: ***

Here, I have changed my true company name to a make-up mycomp.com. Also, for the last three lines, it tells my editor emacs to consider it as tcl code, which of course is not, but it give me a satisfying indentation. So whatever. Lastly, make sure in your ieoptions dialog for choosing the script file:

 

 

To be continued…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: