Below is a short script designed to output the addressable IP addresses within a given subnet. Note : This script requires the netaddr python library. #!/usr/bin/pythonimport sysfrom netaddr import IPNetworkIPADDRESS = raw_input(‘Enter Subnet:’)try: for ip in IPNetwork(IPADDRESS).iter_hosts(): print ‘%s’ % ipexcept: print “Usage: “,sys.argv[0],”[SUBNET ID]/[NETMASK]” print “Output addressable ip addresses within a given subnet.” … Read more
Below is a small example to show some of the various way in which print can be called within Python. quote = “A person who never made a mistake never tried anything new.”print(“ORIGINAL”)print(quote)print(“\nUPPERCASE”)print(quote.upper())print(“\nLOWERCASE”)print(quote.lower())print(“\nTITLE”)print(quote.title())print(“\nREPLACE”)print(quote.replace(“person”, “banana”)) Output [[email protected]]# python print_example.py ORIGINALA person who never made a mistake never tried anything new.UPPERCASEA PERSON WHO NEVER MADE A MISTAKE … Read more
This python script will connect to a designated FTP server. Obtain a list of all files, then sort all files with a .jpa extension and then download the latest one. In order to do this regular expressions are used to build a list of files only containing .jpa file extensions. This list is then sorted … Read more
In this article we will be adding a custom module position to the RocketTheme Afterburner template. The syntax used here will be specfic to the Afterburner template but you should be able to adjust and use as nessecary within your own template. Add the following code to the following files within /templates/rt_afterburner_j15/ index.php <div id=”nav”> … Read more
In order to remove the Title Filter and Display # from the Category list remove the following code from the file \templates\[your-template]\html\com_content\category\default-items.php {codecitation class=”brush:php”} <?php if ($this->params->get(‘filter’) || $this->params->get(‘show_pagination_limit’)) : ?> <tr> <td colspan=”5″> <table> <tr> <td align=”left” width=”60%” nowrap=”nowrap”> <input type=”text” name=”filter” value=”” class=”inputbox” onchange=”document.adminForm.submit();” /> </td> <td align=”right” width=”40%” nowrap=”nowrap”> <?php echo ‘ ‘.JText::_(‘Display … Read more
Issue When trying to access certain URLs within your Joomla site you may receive the error below. Redirect Loop: Firefox has detected that the server is redirecting the request for this address in a way that will never complete Solution In most cases this issue will be down to the SEF settings for your Joomla … Read more
Issue When using Fireboard and Community Builder. You may find that when you try to access your Fireboard forum from your website (frontend) after logging in you receive the following error : Serious db problem:Unknown column ‘fbviewtype’ in ‘field list’ SQL=select fbviewtype from jos_comprofiler where user_id=’62’ Solution To resolve this goto “Fireboard Forum –> Fireboard … Read more
Below shows you how to redirect the Fireboard Login to your Community Builder Login. Create a copy of your CB Login Module. This will be used in the next step Create a Module Content Page for your Community Builder Login. Once done you will have created page which contains your CB Login and a URL … Read more
Scenerio In this scenerio we will require to create a page using only a module. In order to accomplish this we use a built in Joomla Plugin called “Content – Load Module“. This is enabled by installed and enabled by default upon Joomla Installation. Required Steps Below details the required steps for created a page … Read more
You may see the following error when the memory requirements of your PHP script exceeds the default 8MB limit. Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 2682912 bytes) in /opt/lampp/htdocs/site/libraries/joomla/filesystem/archive/gzip.php on line 77 To resolve this change the line that reads ‘memory_limit = 8M‘ to ‘memory_limit = 16M’ within your … Read more
Below is a link to a RHEL5 shell backup script. Below is a summary of what the script does : Creates a tgz of all the major RHEL 5 operating system files to ${backup_name}. All the installed rpms are saved to a text file named /var/log/installed_rpms.txt. #!/bin/sh # # RHEL 5 Backup Script v1.1 # … Read more
This script will backup all the major operating system files and save them within /var/tmp. It was also log the MD5 of the backup after each successful backup and rotate the backups to ensure you dont run into disk space issues. #!/sbin/sh ## ## SunOS Backup Script v1.3 ## ## Backups up the the following … Read more
Below is a script will send the latest log file of the SGS (Symantec Gateway) across to an FTP server. You would need to add this to your crontab to run every hour, in the event of multiple log files being generated per day. #!/bin/sh # # This script will ftp gzip the latest sgs … Read more
Below is a bash/sh script to log the resouces of a R55/R65 Check Point firewall. The following resources are recorded, Free Memory CPU Usage Concurrent Connections Peak Connections Time Date The script will build a .csv file which can then be opened using excel, and the required data (columns) can be selected and converted into … Read more
This is a small command which will take each file in the directory that it is run in and zip the file and then remove the original. for i in `ls` ; do zip=$(echo $i | sed s/iso/iso”.”zip/) ; zip -r $zip $i && rm -fv $i ; done
This script will convert any mp3/wav/wma files into neat and tidy naming format, #!/bin/sh ls | /bin/egrep -i “.wma|.mp3|.wav” > /dev/null if [ $? == 0 ] then ls | /bin/egrep -i “.wma|.mp3|.wav” | while read source do dest=$(echo “$source” | /bin/sed ‘s/^[0-9]*[-,_]//;s/^-//;s/\_/ /g;s/^ *//g;;s/.*/\L&/g;s/-/ – /g;s/ / /g;s/\<./\u&/g;s/…$/\L&/’) /bin/mv -fv “$source” “$dest” done exit … Read more
Here are 2 scripts created for the AV software F-Prot, FProt_scan Runs a scan on your system, you will need to enter you own path under the variable $path #!/bin/bash #Variables path=/ #binaries fprot=/usr/local/f-prot/f-prot if [ ! -x “${fprot}” ]; then echo “Error: ${fprot} not found or not executable!” | /usr/bin/logger -t fprot_scan -p daemon.err … Read more