Python Script : Display addressable IP addresses

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

Python – Print Examples

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

Python – Basic FTP Downloader

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

Adding a custom module position to the RocketTheme Afterburner template

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”><jdoc:include … Read more

How do I remove the Title Filter and Display # from the Category List within Joomla ?

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 Num’).’ ‘; … Read more

Serious db problem:Unknown column ‘fbviewtype’ in ‘field list’ SQL=select fbviewtype from jos_comprofiler where user_id=’62’

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

How do I create a page using just a module in Joomla 1.5.x ?

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

Fatal error: Allowed memory size of 8388608 bytes exhausted

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

RHEL5 Backup Shell Script

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

Solaris Backup Script

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

FTP Transfer script for SGS logs files

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

R65 / R55 Script – Resource Usage Report

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

Recursive ZIP command

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

Bourne – File name Converter

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

BASH – F-Prot Scripts

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

Want to become a programming expert?

Here is our hand-picked selection of the best courses you can find online:
Python Zero to Hero course
Python Pro Bootcamp
Bash Scripting and Shell Programming course
Automate with Shell Scripting course
The Complete Web Development Bootcamp course
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial