GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Some helpful scripts I wrote... leech them here. (https://gfy.com/showthread.php?t=462655)

SplitInfinity 05-02-2005 01:14 AM

Some helpful scripts I wrote... leech them here.
 
First one...

PHP Code:

#!/usr/bin/perl


# SplitInfinity Networks, INC.
# 858-560-2760
# Programmer: Chris Jester
[email protected]
# This program is free to use, but not to sell.
# Enjoy.

# Compatible and tested on Fedora Core 1,2,3 etc.
# As well as any other Linux that uses /etc/sysconfig/network-scripts
# as a mechanism to add ips and etc. Redhat, Suse, Etc.
# This shell script, was created for admins to easily
# add many ip's to one server. Make a list of the IP's
# in a file called iplist.txt which is to be created
# in the same directory as the one this program resides
# in (unless you modify the paths below).
# Run the program from the shell prompt like this:

# ./makeips.pl START_WITH_WHAT#
#
# Where START_WITH_WHAT# is the number of the first interface
# you wish to begin with. So for example, if you have already
# assigned ethernet 0, 0:0 and 0:1 then you will want to add
# interfaces beginning at 0:2 so you would enter 2 there to
# make sure the numbering is correct and your new interfaces
# are created correctly.  If you are adding interfaces to
# a system with more than 1 ethernet card, then you must
# specify the card by changing the variable below.
#
# Props: Special thanks to Swami who inspired me to write
# this quick hack. Customers make the world go round.
# My scripts make it happen a bit faster. Thanks.

$interface    =     $ARGV[0];
$card        =    "0";

$directory    =    "/root/test";
#$directory    =    "/etc/sysconfig/network-scripts";
$iplist        =    "./iplist.txt";



open(DB,"$iplist");

while(<
DB>) {

# Template of the ip configuration file
$template = <<__END_OF_FORMAT__;
DEVICE=eth<<CARD>>:<<INTERFACE>>
ONBOOT=yes
BOOTPROTO
=static
IPADDR=<<IPADDRESS>>
NETMASK=255.255.255.0
GATEWAY
=<<GATEWAY>>
__END_OF_FORMAT__

    $ipaddress 
$_;
    
chomp($ipaddress);
    (
$oct1,$oct2,$oct3) = split(/\./,$ipaddress);
    
$gateway "$oct1.$oct2.$oct3.1";
    
    
$template =~ s/<<IPADDRESS>>/$ipaddress/g;
    
$template =~ s/<<INTERFACE>>/$interface/g;
    
$template =~ s/<<GATEWAY>>/$gateway/g;
    
$template =~ s/<<CARD>>/$card/g;

    
open(FILE">$directory/ifcfg-eth$card:$interface");
    print 
FILE $template;
    
close(FILE);

    
$shell .= "ifup ifcfg-eth$card:$interface\n";

    
$interface++;
    
    }

print 
$shell;
print 
"\n\n\nCopy the above commands and paste into shell to bring the new interfaces up.\n"

Second one...
PHP Code:

#!/usr/bin/perl



# Another script to make my life easy.
# Purpose: Lets say you have a bunch of domains to add to a
# name server. And each domain is to have its own settings...
# This script takes a file input in the following format:
#
# domain.com    ns1ip    ns2ip
# Where ns1ip is the primary ns and ns2ip is the secondary ns.
# This script will create all the zone files and spit out
# the entries to add to named.conf to make those zone files
# active.
# It will use ns1ip as the web server ip address. (since thats
# what I needed it to do when I wrote it. )
# Enjoy

$directory    =    "/var/named";
$domainlist        =    "./domains.txt";

open(DB,"$domainlist");

while(<
DB>) {

# Template of the ip configuration file
$template = <<__END_OF_FORMAT__;
\
$TTL 1800
\@       IN      SOA     ns1.<<DOMAINNAME>>. si-support.splitinfinity.net.  (
                                      
2005043100 Serial
                                      28800      
Refresh
                                      14400      
Retry
                                      3600000    
Expire
                                      1800 
)     ; Minimum

                IN      NS      ns1
.<<DOMAINNAME>>.
                
IN      NS      ns2.<<DOMAINNAME>>.

                
IN      MX      5       mail

                        A       
<<NS1IP>>
                
IN      A       <<NS1IP>>
mail            IN      A       <<NS1IP>>
www             IN      A       <<NS1IP>>

ns1                IN        A        <<NS1IP>>
ns2                IN        A        <<NS2IP>>

*                
IN        A        <<NS1IP>>
__END_OF_FORMAT__

    $input 
$_;
    (
$domainname,$ipaddress1,$ipaddress2) = split(/\t/,$input);
    
chomp($ipaddress2);

    
$template =~ s/<<NS1IP>>/$ipaddress1/g;
    
$template =~ s/<<NS2IP>>/$ipaddress2/g;
    
$template =~ s/<<DOMAINNAME>>/$domainname/g;

    
open(FILE">$directory/$domainname.zone");
    print 
FILE $template;
    
close(FILE);

    
$shell .= "zone \"$domainname\"   {type master; file \"$domainname.zone\";};\n";

    
$interface++;
    
    }

print 
$shell;
print 
"\n\n\nCopy the above commands and paste into named.conf.\n"


MetaMan 05-02-2005 01:16 AM

dude you are like the fucking warez topsite host from the oldschool days! i mean 99% of tgp webmasters owe it to you!

JAZNET SALUTES YOU!

SplitInfinity 05-02-2005 01:17 AM

Im feeling love. :-)

Im in a coding mood. Anyone need any scripts?
:-)

SplitInfinity 05-02-2005 01:18 AM

Hey, I just wrote a script to replace joel....

perl -p -i -e 's/Joel/Monkey/gi/' *

The funny thing is, the output is the same regardless of whether its Joel or the Monkey.

MetaMan 05-02-2005 01:20 AM

you remember heXus aka a(idload?

not sure if you do or not, someone was trying to tell me he is dead. who knowS?!

SplitInfinity 05-02-2005 01:21 AM

Whoa! Hexum? Brad hexum? He is dead? REALLY? Whoa!

OMG.

MetaMan 05-02-2005 01:22 AM

Quote:

Originally Posted by SplitInfinity
Whoa! Hexum? Brad hexum? He is dead? REALLY? Whoa!

OMG.


NEVERMIND!

xclusive 05-02-2005 01:22 AM

Quote:

Originally Posted by SplitInfinity
Hey, I just wrote a script to replace joel....

perl -p -i -e 's/Joel/Monkey/gi/' *

The funny thing is, the output is the same regardless of whether its Joel or the Monkey.

lol now that's funny


All times are GMT -7. The time now is 02:46 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123