BooY

Members
  • Content count

    22
  • Joined

  • Last visited

Community Reputation

0 Neutral

About BooY

  • Rank
    SCRiPT KiDDie
  • Birthday 10/02/1984

Profile Information

  • Gender
    Male
  • Country
    Romania

Contact Methods

  • Website URL
    http://www.tuxien.org
  1. I never take credit for articles that are not mine. The editor of the site is automatically writing by BoogY. Some time i forget to put the original article. If i wanted to plagiarize I'll not leave the links on the screen shots. Don't you think ?
  2. Thanks and may be one day they will :)

  3. I love that motto in your "About Me" section. Wish society saw it that way too.

  4. A shell script to monitor server disk space and send an email alert to admin. This is useful if you are using rented dedicated / vps server and backup data to NAS everyday. This script will monitor disk space and it will send you an email. Make sure you setup your email id, NAS space alert limit and other required parameters. Directly install this script at /etc/cron.daily/ or open /etc/crontab and append following line: #!/bin/bash # Shell Script to monitor NAS backup disk space # Shell script will mount NAS using mount command and look for total used # disk space. If NAS is running out of disk space an email alert will be sent to # admin. #!/bin/bash #*** SET ME FIRST ***# NASUSER="Your-User-Name" NASPASS="Your-Password" NASIP="nas.yourcorp.com" NASROOT="/username" NASMNTPOINT="/mnt/nas" EMAILID=" admin@yourcorp.com This e-mail address is being protected from spambots. You need JavaScript enabled to view it " GETNASIP=$(host ${NASIP} | awk '{ print $4}') # Default warning limit is set to 17GiB LIMIT="17" # Failsafe [ ! -d ${NASMNTPOINT} ] && mkdir -p ${NASMNTPOINT} mount | grep //${GETNASIP}/${NASUSER} # if not mounted, just mount nas [ $? -eq 0 ] && : || mount -t cifs //${NASIP}/${NASUSER} -o username=${NASUSER},password=${NASPASS} ${NASMNTPOINT} cd ${NASMNTPOINT} # get NAS disk space nSPACE=$(du -hs|cut -d'G' -f1) # Bug fix # get around floating point by rounding off e.g 5.7G stored in $nSPACE # as shell cannot do floating point SPACE=$(echo $nSPACE | cut -d. -f1) cd / umount ${NASMNTPOINT} # compare and send an email if [ $SPACE -ge $LIMIT ] then logger "Warning: NAS Running Out Of Disk Space [${SPACE} G]" mail -s 'NAS Server Disk Space' ${EMAILID} <<EOF NAS server [ mounted at $(hostname) ] is running out of disk space!!! Current allocation ${SPACE}G @ $(date) EOF else logger "$(basename $0) ~ NAS server ${NASIP} has sufficent disk space for backup!" fi
  5. A shell script on iptables rules for a web server (no need to use APF or CSF) just run this script from /etc/rc.local and you are done. Save following script as /root/scripts/fw.start: #!/bin/bash # A Linux Shell Script with common rules for IPTABLES Firewall. # By default this script only open port 80, 22, 53 (input) # All outgoing traffic is allowed (default - output) IPT="/sbin/iptables" SPAMLIST="blockedip" SPAMDROPMSG="BLOCKED IP DROP" echo "Starting IPv4 Wall..." $IPT -F $IPT -X $IPT -t nat -F $IPT -t nat -X $IPT -t mangle -F $IPT -t mangle -X modprobe ip_conntrack [ -f /root/scripts/blocked.ips.txt ] && BADIPS=$(egrep -v -E "^#|^$" /root/scripts/blocked.ips.txt) PUB_IF="eth0" #unlimited $IPT -A INPUT -i lo -j ACCEPT $IPT -A OUTPUT -o lo -j ACCEPT # DROP all incomming traffic $IPT -P INPUT DROP $IPT -P OUTPUT DROP $IPT -P FORWARD DROP if [ -f /root/scripts/blocked.ips.txt ]; then # create a new iptables list $IPT -N $SPAMLIST for ipblock in $BADIPS do $IPT -A $SPAMLIST -s $ipblock -j LOG --log-prefix "$SPAMDROPMSG" $IPT -A $SPAMLIST -s $ipblock -j DROP done $IPT -I INPUT -j $SPAMLIST $IPT -I OUTPUT -j $SPAMLIST $IPT -I FORWARD -j $SPAMLIST fi # Block sync $IPT -A INPUT -i ${PUB_IF} -p tcp ! --syn -m state --state NEW -m limit --limit 5/m --limit-burst 7 -j LOG --log-level 4 --log-prefix "Drop Sync" $IPT -A INPUT -i ${PUB_IF} -p tcp ! --syn -m state --state NEW -j DROP # Block Fragments $IPT -A INPUT -i ${PUB_IF} -f -m limit --limit 5/m --limit-burst 7 -j LOG --log-level 4 --log-prefix "Fragments Packets" $IPT -A INPUT -i ${PUB_IF} -f -j DROP # Block bad stuff $IPT -A INPUT -i ${PUB_IF} -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP $IPT -A INPUT -i ${PUB_IF} -p tcp --tcp-flags ALL ALL -j DROP $IPT -A INPUT -i ${PUB_IF} -p tcp --tcp-flags ALL NONE -m limit --limit 5/m --limit-burst 7 -j LOG --log-level 4 --log-prefix "NULL Packets" $IPT -A INPUT -i ${PUB_IF} -p tcp --tcp-flags ALL NONE -j DROP # NULL packets $IPT -A INPUT -i ${PUB_IF} -p tcp --tcp-flags SYN,RST SYN,RST -j DROP $IPT -A INPUT -i ${PUB_IF} -p tcp --tcp-flags SYN,FIN SYN,FIN -m limit --limit 5/m --limit-burst 7 -j LOG --log-level 4 --log-prefix "XMAS Packets" $IPT -A INPUT -i ${PUB_IF} -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP #XMAS $IPT -A INPUT -i ${PUB_IF} -p tcp --tcp-flags FIN,ACK FIN -m limit --limit 5/m --limit-burst 7 -j LOG --log-level 4 --log-prefix "Fin Packets Scan" $IPT -A INPUT -i ${PUB_IF} -p tcp --tcp-flags FIN,ACK FIN -j DROP # FIN packet scans $IPT -A INPUT -i ${PUB_IF} -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP # Allow full outgoing connection but no incomming stuff $IPT -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT $IPT -A OUTPUT -o eth0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT # Allow ssh $IPT -A INPUT -p tcp --destination-port 22 -j ACCEPT # allow incomming ICMP ping pong stuff $IPT -A INPUT -p icmp --icmp-type 8 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT $IPT -A OUTPUT -p icmp --icmp-type 0 -m state --state ESTABLISHED,RELATED -j ACCEPT # Allow port 53 tcp/udp (DNS Server) $IPT -A INPUT -p udp --dport 53 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT $IPT -A OUTPUT -p udp --sport 53 -m state --state ESTABLISHED,RELATED -j ACCEPT $IPT -A INPUT -p tcp --destination-port 53 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT $IPT -A OUTPUT -p tcp --sport 53 -m state --state ESTABLISHED,RELATED -j ACCEPT # Open port 80 $IPT -A INPUT -p tcp --destination-port 80 -j ACCEPT ##### Add your rules below ###### ##### END your rules ############ # Do not log smb/windows sharing packets - too much logging $IPT -A INPUT -p tcp -i eth0 --dport 137:139 -j REJECT $IPT -A INPUT -p udp -i eth0 --dport 137:139 -j REJECT # log everything else and drop $IPT -A INPUT -j LOG $IPT -A FORWARD -j LOG $IPT -A INPUT -j DROP exit 0 Now edit firewall as per your requirements: # vi /root/scripts/start.fw Install firewall: # /root/scripts/start.fw How do I start firewall from a shell prompt? # /root/scripts/start.fw How do I stop firewall from a shell prompt? # /root/scripts/stop.fw
  6. #!/bin/bash # Script to update user password in batch mode # You must be a root user to use this script # /root is good place to store clear text password FILE="/root/batch.passwd" # get all non-root user account # By default on most linux non-root uid starts # from 1000 USERS=$(awk -F: '{ if ( $3 > 1000 ) print $1}' /etc/passwd) # create file with random password echo "Generating file, please wait..." # overwrite file, this is bash specific a better solution is cat > $FILE >$FILE for u in $USERS do p=$(pwgen -1 -n 8) # create random password echo "$u:$p" >> $FILE # save USERNAME:PASSWORD pair done echo "" echo "Random password and username list stored in $FILE file" echo "Review $FILE file, once satisfied execute command: " echo "chpasswd < $FILE" # Uncomment following line if you want immediately update all users password, # be careful with this option, it is recommended that you review $FILE first # chpasswd < $FILE
  7. #!/bin/bash # A bash shell script for ip6tables to protect single hosting / dedicated / vps / colo server running CentOS / Debian / RHEL / # or any other Linux distribution. # ------------------------------------------------------------------------- # Copyright (c) 2007 nixCraft project <http://www.cyberciti.biz/fb/> # This script is licensed under GNU GPL version 2.0 or above # ------------------------------------------------------------------------- # This script is part of nixCraft shell script collection (NSSC) # Visit http://bash.cyberciti.biz/ for more information. # ---------------------------------------------------------------------- # Last updated on Jan-23, 2008 : Added support for tcp packets # --------------------------------------------------------------------------- IPT6="/sbin/ip6tables" # Interfaces PUB_IF="eth1" PUB_LO="lo0" PUB_VPN="eth0" # Custom chain names CHAINS="chk_tcp6_packets_chain chk_tcp_inbound chk_udp_inbound chk_icmp_packets" HTTP_SERVER_6="2001:470:1f04:55a::2 2001:470:1f04:55a::3 2001:470:1f04:55a::4 2001:470:1f04:55a::5" echo "Starting IPv6 firewall..." # first clean old mess $IPT6 -F $IPT6 -X $IPT6 -Z for table in $(</proc/net/ip6_tables_names) do $IPT6 -t $table -F $IPT6 -t $table -X $IPT6 -t $table -Z done $IPT6 -P INPUT ACCEPT $IPT6 -P OUTPUT ACCEPT $IPT6 -P FORWARD ACCEPT # Set default DROP all $IPT6 -P INPUT DROP $IPT6 -P OUTPUT DROP $IPT6 -P FORWARD DROP # Create the chain for c in $CHAINS do $IPT6 --new-chain $c done # Input policy $IPT6 -A INPUT -i $PUB_LO -j ACCEPT $IPT6 -A INPUT -i $PUB_VPN -j ACCEPT $IPT6 -A INPUT -i $PUB_IF -j chk_tcp6_packets_chain $IPT6 -A INPUT -i $PUB_IF -m state --state RELATED,ESTABLISHED -j ACCEPT $IPT6 -A INPUT -i $PUB_IF -p tcp -j chk_tcp_inbound $IPT6 -A INPUT -i $PUB_IF -p udp -j chk_udp_inbound $IPT6 -A INPUT -i $PUB_IF -p icmp -j chk_icmp_packets $IPT6 -A INPUT -i $PUB_IF -p ipv6-icmp -j chk_icmp_packets $IPT6 -A INPUT -i $PUB_IF -m limit --limit 3/min --limit-burst 3 -j LOG --log-prefix "INPUT OUTPUT " $IPT6 -A INPUT -i $PUB_IF -j DROP # Output policy $IPT6 -A OUTPUT -o $PUB_LO -j ACCEPT $IPT6 -A OUTPUT -o $PUB_VPN -j ACCEPT $IPT6 -A OUTPUT -o $PUB_IF -j ACCEPT $IPT6 -A OUTPUT -o $PUB_IF -m limit --limit 3/min --limit-burst 3 -j LOG --log-prefix "DROP OUTPUT " ### Custom chains ### # Bad packets chk $IPT6 -A chk_tcp6_packets_chain -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -m limit \ --limit 3/min --limit-burst 3 -j LOG --log-prefix "Bad tcp packets" $IPT6 -A chk_tcp6_packets_chain -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP $IPT6 -A chk_tcp6_packets_chain -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG FIN,SYN,RST,PSH,ACK,URG -m limit \ --limit 3/min --limit-burst 3 -j LOG --log-prefix "Bad tcp packets" $IPT6 -A chk_tcp6_packets_chain -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG FIN,SYN,RST,PSH,ACK,URG -j DROP $IPT6 -A chk_tcp6_packets_chain -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG FIN,PSH,URG -m limit --limit 3/min \ --limit-burst 3 -j LOG --log-prefix "BAD tcp" $IPT6 -A chk_tcp6_packets_chain -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG FIN,PSH,URG -j DROP $IPT6 -A chk_tcp6_packets_chain -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG FIN,SYN,RST,ACK,URG -m limit \ --limit 3/min --limit-burst 3 -j LOG --log-prefix "Bad tcp" $IPT6 -A chk_tcp6_packets_chain -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG FIN,SYN,RST,ACK,URG -j DROP $IPT6 -A chk_tcp6_packets_chain -p tcp -m tcp --tcp-flags SYN,RST SYN,RST -m limit --limit 3/min \ --limit-burst 3 -j LOG --log-prefix "Bad tcp " $IPT6 -A chk_tcp6_packets_chain -p tcp -m tcp --tcp-flags SYN,RST SYN,RST -j DROP $IPT6 -A chk_tcp6_packets_chain -p tcp -m tcp --tcp-flags FIN,SYN FIN,SYN -m limit --limit 3/min \ --limit-burst 3 -j LOG --log-prefix "Bad tcp " $IPT6 -A chk_tcp6_packets_chain -p tcp -m tcp --tcp-flags FIN,SYN FIN,SYN -j DROP $IPT6 -A chk_tcp6_packets_chain -p tcp -j RETURN # Open TCP Ports # Open http port for h in $HTTP_SERVER_6 do $IPT6 -A chk_tcp_inbound -p tcp -m tcp --dport 80 -d $h -j ACCEPT done # Open 53 port $IPT6 -A chk_tcp_inbound -p tcp -m tcp --dport 53 -j ACCEPT ############################### # Add your rules below to open other TCP ports # Open smtp # $IPT6 -A chk_tcp_inbound -p tcp -m tcp --dport 25 -j ACCEPT # Open pop3 # $IPT6 -A chk_tcp_inbound -p tcp -m tcp --dport 113 -j ACCEPT # Open ssh # $IPT6 -A chk_tcp_inbound -p tcp -m tcp --dport 22 -j ACCEPT ############################### # do not modify following rule $IPT6 -A chk_tcp_inbound -p tcp -j RETURN # Open UDP Ports # Open dns 53 udp $IPT6 -A chk_udp_inbound -p udp -m udp --dport 53 -j ACCEPT ############################### # Add your rules below to open other UDP ports # ############################### # do not modify following rule $IPT6 -A chk_udp_inbound -p udp -j RETURN # ICMP - allow ping pong $IPT6 -A chk_icmp_packets -p ipv6-icmp -j ACCEPT $IPT6 -A chk_icmp_packets -p icmp -j RETURN
  8. #!/bin/sh # A Shell script to backup all MySQL databases to a NAS server mounted via mount_smbfs # You need to setup username, password and other stuff # Tested on FreeBSD 6.x and 7.x - 32 bit and 64 bit systems. # May work on OpenBSD / NetBSD. # ------------------------------------------------------------------------- # Copyright (c) 2007 nixCraft project <http://www.cyberciti.biz/fb/> # This script is licensed under GNU GPL version 2.0 or above # ------------------------------------------------------------------------- # This script is part of nixCraft shell script collection (NSSC) # Visit http://bash.cyberciti.biz/ for more information. # ---------------------------------------------------------------------- ### SETUP BIN PATHS ### MYSQLADMIN=/usr/local/bin/mysqladmin MYSQL=/usr/local/bin/mysql LOGGER=/usr/bin/logger MYSQLDUMP=/usr/local/bin/mysqldump MKDIR=/bin/mkdir CP=/bin/cp GZIP=/usr/bin/gzip CUT=/usr/bin/cut AWK=/usr/bin/awk MOUNT=/sbin/mount GREP=/usr/bin/grep UMOUNT=/sbin/umount MSMBFS=/usr/sbin/mount_smbfs HOST=/usr/bin/host TAIL=/usr/bin/tail SSH=/usr/bin/ssh SCP=/usr/bin/scp HOSTNAME=/bin/hostname ### SETUP MYSQL LOGIN ### MUSER=root MPASS='PASSWORD' MHOST="127.0.0.1" ### SETUP NAS LOGIN ### NASUSER=vivek NASPASSWORD=myPassword NASSERVER=nas05.vip.nixcraft.com NASMNT=/nas05 NASSHARE=$NASUSER NASPASSWDFILE=$HOME/.nsmbrc #GET NAS IP NASIP=$($HOST $NASSERVER | $TAIL -1 | $AWK '{ print $4}') # NAS BACKUP PATH MBAKPATH=${NASMNT}/$(hostname -s)/mysql NOW=$(date +"%d-%m-%Y") TIME_FORMAT='%H_%M_%S%P' mount_nas(){ [ ! -d $NASMNT ] && $MKDIR -p $NASMNT $MOUNT | $GREP $NASMNT >/dev/null if [ $? -ne 0 ] then echo "[$NASIP:$NASUSER]" >$NASPASSWDFILE echo "password=$NASPASSWORD" >>$NASPASSWDFILE $MSMBFS -N -I $NASSERVER //$NASUSER@$NASIP/$NASSHARE $NASMNT fi } umount_nas(){ $MOUNT | $GREP $NASMNT >/dev/null [ $? -eq 0 ] && $UMOUNT $NASMNT } backup_mysql(){ $LOGGER "$(basename $0) mysql: Started at $(date)" local DBS="$($MYSQL -u $MUSER -h $MHOST -p$MPASS -Bse 'show databases')" local db=""; [ ! -d $MBAKPATH/$NOW ] && $MKDIR -p $MBAKPATH/$NOW for db in $DBS do local tTime=$(date +"${TIME_FORMAT}") local FILE="${MBAKPATH}/$NOW/${db}.${tTime}.gz" $MYSQLDUMP -u $MUSER -h $MHOST -p"$MPASS" $db | $GZIP -9 > $FILE #mysql_file_hook $FILE done $LOGGER "$(basename $0) mysql: Ended at $(date)" } # process each sql database file and backup to another server via ssh # must have ssh keys mysql_file_hook(){ local f="$1" local d=/nas/mysqlbackup/$(hostname -s)/$NOW $SSH someuser@remote.nixcraft.com mkdir -p $d $SCP $f someuser@remote.nixcraft.com:$d } case "$1" in mysql) mount_nas backup_mysql umount_nas ;; mount) mount_nas;; umount) umount_nas;; *) echo "Usage: $0 {mysql|mount|umount}" esac
  9. Some script from www.tuxien.org #!/bin/bash # Shell script for search for no password entries and lock all accounts # ------------------------------------------------------------------------- # Copyright (c) 2005 nixCraft project <http://cyberciti.biz/fb/> # This script is licensed under GNU GPL version 2.0 or above # ------------------------------------------------------------------------- # This script is part of nixCraft shell script collection (NSSC) # Visit http://bash.cyberciti.biz/ for more information. # ------------------------------------------------------------------------- # Set your email ADMINEMAIL=" admin@somewhere.com This e-mail address is being protected from spambots. You need JavaScript enabled to view it " ### Do not change anything below ### #LOG File LOG="/root/nopassword.lock.log" STATUS=0 TMPFILE="/tmp/null.mail.$$" echo "-------------------------------------------------------" >>$LOG echo "Host: $(hostname), Run date: $(date)" >> $LOG echo "-------------------------------------------------------" >>$LOG # get all user names USERS="$(cut -d: -f 1 /etc/passwd)" # display message echo "Searching for null password..." for u in $USERS do # find out if password is set or not (null password) passwd -S $u | grep -Ew "NP" >/dev/null if [ $? -eq 0 ]; then # if so echo "$u" >> $LOG passwd -l $u #lock account STATUS=1 #update status so that we can send an email fi done echo "========================================================" >>$LOG if [ $STATUS -eq 1 ]; then echo "Please see $LOG file and all account with no password are locked!" >$TMPFILE echo "-- $(basename $0) script" >>$TMPFILE mail -s "Account with no password found and locked" "$ADMINEMAIL" < $TMPFILE # rm -f $TMPFILE fi
  10. #!/bin/bash #This script maintain a system operating GNU/Linux Ubuntu 8.04 - 8.10 - 9.04 #------------------------------------------------------------------------------------------+ # Funzione aggiornamento | #------------------------------------------------------------------------------------------+ function aggiornamento { echo echo "********************** INIZIO AGGIORNAMENTO DEL SISTEMA **********************" echo echo -n "# Aggiorno gli indici dei pacchetti? " read sure if [[ $sure = "s" ]] then sudo apt-get update echo "* Aggiornamento indici pacchetti...[OK]" else echo "* Aggiornamento indici pacchetti...[NOT EXECUTED]" fi echo echo -n "# Aggiorno le chiavi GPG degli indici dei pacchetti? " read sure if [[ $sure = "s" ]] then touch err sudo apt-get update 2>err num=$(grep 'NO_PUBKEY' err | wc -l) str=$(grep 'NO_PUBKEY' err) tot=$num if [ $num != 0 ] then echo "---RISOLVO NO_PUBKEY---" for (( i=0 ; i<$num ; i++ )) do tmp=${str#*NO_PUBKEY } key=${tmp:0:16} str=${str#*NO_PUBKEY} echo "Aggiungo la chiave:$key" gpg --keyserver subkeys.pgp.net --recv $key gpg --export --armor $key | sudo apt-key add - done fi num=0 num=$(grep 'BADSIG' err | wc -l) str=$(grep 'BADSIG' err) tot=$(( $tot + $num )) if [ $num != 0 ] then echo "---RISOLVO BADSIG---" for (( i=0 ; i<$num ; i++ )) do tmp=${str#*BADSIG } key=${tmp:0:16} str=${str#*BADSIG} echo "Aggiungo la chiave:$key" gpg --keyserver subkeys.pgp.net --recv $key gpg --export --armor $key | sudo apt-key add - done fi rm err else echo "* Aggiornamento chiavi GPG degli indici dei pacchetti...[NOT EXECUTED]" fi echo echo -n "# Aggiorno i pacchetti? " read sure if [[ $sure = "s" ]] then sudo apt-get upgrade echo "* Aggiornamento pacchetti...[OK]" else echo "* Aggiornamento pacchetti...[NOT EXECUTED]" fi echo echo -n "# Aggiorno la data e l'ora del sistema? " read sure if [[ $sure = "s" ]] then sudo ntpdate it.pool.ntp.org echo "* Aggiornamento data e ora...[OK]" else echo "* Aggiornamento data e ora...[NOT EXECUTED]" fi echo -n "# Aggiorno il kernel del sistema? " read sure if [[ $sure = "s" ]] then sudo apt-get dist-upgrade -f echo "* Aggiornamento kernel...[OK]" else echo "* Aggiornamento kernel...[NOT EXECUTED]" fi echo echo -n "# Aggiorno l'immagine initramfs del kernel? " read sure if [[ $sure = "s" ]] then sudo update-initramfs -u echo "* Aggiornamento immagine initramfs...[OK]" else echo "* Aggiornamento immagine initramfs...[NOT EXECUTED]" fi echo echo -n "# Verifico che non ci siano pacchetti difettosi? " read sure if [[ $sure = "s" ]] then sudo apt-get install -f echo "* Verifica pacchetti difettosi...[OK]" else echo "* Verifica pacchetti difettosi...[NOT EXECUTED]" fi echo echo "ATTENZIONE: COMANDO POTENZIALMENTE PERICOLOSO!!" echo -n "# Aggiorno le configurazioni di GRUB? " read sure if [[ $sure = "s" ]] then sudo cp /boot/grub/menu.lst /boot/grub/menu.bak sudo update-grub echo "* Backup /boot/grub/menu.lst...[OK]" echo "* Aggiornamento GRUB...[OK]" else echo "* Aggiornamento GRUB...[NOT EXECUTED]" fi echo echo "--------------------------- AGGIORNAMENTO TERMINATO --------------------------" echo } #------------------------------------------------------------------------------------------+ # Funzione pulizia | #------------------------------------------------------------------------------------------+ function pulizia { echo echo "************************* INIZIO PULIZIA DEL SISTEMA *************************" echo echo -n "# Rimuovo le dipendenze inutili? " read sure if [[ $sure = "s" ]] then sudo apt-get --purge autoremove echo "* Rimozione dipendenze inutili...[OK]" else echo "* Rimozione dipendenze inutili...[NOT EXECUTED]" fi echo echo -n "# Rimuovo la cache dei pacchetti scaricati dai repository obsoleti? " read sure if [[ $sure = "s" ]] then sudo apt-get autoclean echo "* Rimozione cache pacchetti obsoleti...[OK]" else echo "* Rimozione cache pacchetti obsoleti...[NOT EXECUTED]" fi echo echo -n "# Rimuovo la cache dei pacchetti scaricati dai repository? " read sure if [[ $sure = "s" ]] then sudo apt-get clean echo "* Rimozione cache pacchetti scaricati...[OK]" else echo "* Rimozione cache pacchetti scaricati...[NOT EXECUTED]" fi echo echo -n "# Rimuovo tutti i pacchetti di sistema oramai diventati obsoleti? " read sure if [[ $sure = "s" ]] then sudo dpkg --purge `COLUMNS=300 dpkg -l "*" | egrep "^rc" | cut -d\ -f3` echo "* Rimozione pacchetti obsoleti...[OK]" else echo "* Rimozione pacchetti obsoleti...[NOT EXECUTED]" fi echo echo -n "# Elimino il contenuto di /temp? " read sure if [[ $sure = "s" ]] then sudo rm -rf /tmp/* echo "* Eliminazione contenuto /temp...[OK]" else echo "* Eliminazione contenuto /temp...[NOT EXECUTED]" fi echo echo -n "# Elimino il contenuto della directory /.thumbnails? " read sure if [[ $sure = "s" ]] then sudo rm -rfv ~/.thumbnails/* echo "* Eliminazione files da /.thumbnails ...[OK]" else echo "*Eliminazione files da /.thumbnails ...[NOT EXECUTED]" fi echo echo -n "# Effettuo una ricerca dei residui di files? " read sure if [[ $sure = "s" ]] then find $HOME -name "*~" find $HOME -name "Desktop.ini" find $HOME -name "Thumbs.db" echo -n "# Rimuovo questi residui di file? " read sure if [ $sure == "s" ] then find $HOME -name "*~" -print0|xargs -0 /bin/rm -f find $HOME -name "Desktop.ini" -print0|xargs -0 /bin/rm -f find $HOME -name "Thumbs.db" -print0|xargs -0 /bin/rm -f echo "* Eliminazione residui...[OK]" else echo "* Eliminazione residui...[NOT EXECUTED]" fi else echo "* Ricerca residui di files...[NOT EXECUTED]" fi echo echo -n "# Elimino il contenuto del Cestino? " read sure if [[ $sure = "s" ]] then sudo rm -rfv ~/.local/share/Trash/* echo "* Eliminazione files da /Trash ...[OK]" else echo "* Eliminazione files da /Trash ...[NOT EXECUTED]" fi echo echo -n "# Pulisco i documenti recenti? " read sure if [[ $sure = "s" ]] then sudo mv ~/.recently-used.xbel .recently-used.xbel.bak sudo mv ~/.recently-used .recently-used.bak touch ~/.recently-used.xbel echo "<?xml version="1.0" encoding="UTF-8"?>\n<xbel version="1.0"\nxmlns:bookmark=\ "http://www.freedesktop.org/standards/desktop-bookmarks"\nxmlns:mime=\ "http://www.freedesktop.org/standards/shared-mime-info"\n></xbel>\n " > ~/.recently-used.xbel echo "* Pulizia documenti recenti...[OK]" else echo "* Pulizia documenti recenti...[NOT EXECUTED]" fi echo echo echo "Per l'esecuzione di questo comando verrĂ  installato il pacchetto deborphan" echo "ATTENZIONE: COMANDO POTENZIALMENTE PERICOLOSO!!" echo -n "# Rimuovo le librerie orfane? " read sure if [[ $sure = "s" ]] then sudo apt-get -y install deborphan sudo apt-get --purge remove `deborphan` echo "* Rimozione librerie orfane...[OK]" else echo "* Rimozione librerie orfane...[NOT EXECUTED]" fi echo echo "Per l'esecuzione di questo comando verrĂ  installato il pacchetto deborphan" echo "ATTENZIONE: COMANDO POTENZIALMENTE PERICOLOSO!!" echo -n "# Rimuovo le librerie orfane di sviluppo? " read sure if [[ $sure = "s" ]] then sudo apt-get -y install deborphan sudo apt-get --purge remove `deborphan --libdev` echo "* Rimozione librerie orfane...[OK]" else echo "* Rimozione librerie orfane...[NOT EXECUTED]" fi echo echo "------------------------------ PULIZIA TERMINATA -----------------------------" echo } #------------------------------------------------------------------------------------------+ # Programma principale | #------------------------------------------------------------------------------------------+ echo "+============================================================================+" echo "| MANUTENZIONE DI UBUNTU |" echo "| |" echo "| Questo script effettua una manutenzione guidata del sistema |" echo "| per rispondere affermativamente alle domande che verranno |" echo "| poste premete s e confermate premendo il tasto <invio> |" echo "| per saltare la domanda premete <invio> |" echo "| |" echo "+============================================================================+" echo echo -n "~~~ ESEGUIRE I COMANDI PER L'AGGIORNAMENTO DEL SISTEMA? " read sure if [[ $sure = "s" ]] then aggiornamento else echo "*** Aggiornamento del sistema...[NOT EXECUTED]" fi echo echo -n "~~~ ESEGUIRE I COMANDI PER LA PULIZIA DEL SISTEMA? " read sure if [[ $sure = "s" ]] then pulizia else echo "*** Pulizia del sistema...[NOT EXECUTED]" fi echo echo -n "~~~ E' CONSIGLIABILE RIAVVIARE IL SISTEMA. RIAVVIARE? " read sure if [[ $sure = "s" ]] then sudo reboot else echo "*** Riavvio del sistema...[NOT EXECUTED]" fi echo read -p "Premi <INVIO> per uscire"
  11. Hi there every one So i decided to make this post and share my web page with every one. It's a website about liunx and open source, beginners can find tuts, scripts, software, and much more. So here it is : www.tuxien.org It's may be not the best there is but it can help dowse how want to learn Linux and may be even dowse how know 'it already. You can even register and post new stuff if you fit so... Oh and please give me your opinion ... [bAD OR GOOD]
  12. You can use witch one you want. It depends on the configuration and you can use encrypted tunnels to transfer the data on the network, like SSH ! And make linux servers not windows.
  13. That depends on you ability to learn and your logic skills .... 1 year or maybe more... If you want to create cracking software you'll rely need to learn a lot more. I personally advise you to try Python or C programing, or may be Perl.