[ILUG] Internet Setup Script
[ILUG] Internet Setup Script
Ross Lynch
ross at excentric.com
Thu Feb 3 22:55:30 GMT 2000
Hey,
Well, I've made some modifications to the script (ie. got it working)
and translated it to PERL too. It works fine now, and new ISP's are easy
to add.
Later,
Ross.
---------------------
#!/usr/bin /perl -w
# Internet Setup Script v1.1.0
# Ross Lynch & William Murphy, EGLU
print "\nInternet Account Setup Script";
print "\n-----------------------------";
print "\n1. Ireland On Line";
print "\n2. eircom Internet";
print "\n3. Esat NoLimits";
print "\nPlease choose on of the above: ";
$isp_choice = <STDIN>;
chomp $isp_choice;
if ($isp_choice ne 3) {
print "\nUsername: ";
$username = <STDIN>;
chomp $username;
print "Password: ";
system ("stty -echo");
$password = <STDIN>;
system ("stty echo");
chomp $password;
} elsif ($isp_choice eq 3 ) {
$username = "nolimits";
$password = "nolimits";
}
if ($isp_choice eq 1) {
$login = "ogin: $username\nssword: $password\nrotocol: ppp";
$ns1 = "194.125.2.240";
$ns2 = "194.125.2.241";
$passfile = "/etc/ppp/chatscript";
$auth_type = 0;
$number = 1891121121;
} elsif ($isp_choice eq 2) {
$login = "ternet $username
'' $password";
$ns1 = "159.134.237.6";
$ns2 = "159.134.248.17";
$passfile = "/etc/ppp/chatscript";
$auth_type = 0;
$number = "1891150150";
} elsif ($isp_choice eq 3) {
$login = '';
$ns1 = "194.145.128.1";
$ns2 = "194.145.128.2";
$auth_type = "pap";
$passfile = "/etc/ppp/$auth_type-secrets";
print "\nDo you have caller ID disabled? (y/n): ";
$caller_id = <STDIN>;
chomp $caller_id;
if ($caller_id eq "y") {
print "Prefixing \'142\' to number...\n";
$number = "1421332103001235";
} elsif ($caller_id eq "n") {
$number = "1332103001235";
}
}
print "\n\n Linux\t\tWindows";
print "\n -----\t\t-------";
print "\n1. ttyS0\t\tcua1";
print "\n2. ttyS1\t\tcua2";
print "\n3. ttyS2\t\tcua3";
print "\n4. ttyS3\t\tcua4";
print "\nPlease choose which port your modem is on: ";
$modem = <STDIN>;
chomp $modem;
$modem = $modem - 1;
open (RESOLV, ">>/etc/resolv.conf");
print RESOLV "\n$ns1\n$ns2";
close(RESOLV);
open (PASSFILE, ">$passfile" );
print PASSFILE "TIMEOUT 45\nABORT BUSY\nABORT ERROR\nABORT 'NO
CARRIER'\nABORT 'NO DIAL TONE'\nABORT 'NO DIALTONE'\n'' ATZ\nOK
ATDT$number\nCONNECT ''\n$login";
close (PASSFILE);
open (OPTIONS, ">/etc/ppp/options" );
print OPTIONS "modem\ncrtscts\ndefaultroute";
if ($auth_type eq 0) {
print OPTIONS "\n\`chat -v -f /etc/ppp/chatscript\`";
}
print OPTIONS "\n/dev/ttyS$modem";
if ($auth_type ne 0) {
print OPTIONS "\nuser $username";
}
if ($auth_type ne 0) {
print OPTIONS "\n$username\n";
open (SECRETS, ">$passfile");
print SECRETS "$username * $password *";
close (SECRETS);
}
close (OPTIONS);
chmod( 0700, "resolv" );
print "\nSetup Complete!\n"
------------------
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ross Lynch
087 6548827
ross at excentric.com
kernel at student.nuigalway.ie
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the ILUG
mailing list
Read this without the formatting .