diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/ping | 2 | ||||
-rwxr-xr-x | scripts/ssh-server-key | 14 | ||||
-rw-r--r-- | scripts/vyatta-clear-conntrack | 70 | ||||
-rwxr-xr-x | scripts/vyatta-cpu-summary.pl | 41 | ||||
-rw-r--r-- | scripts/vyatta-traceroute | 28 | ||||
-rwxr-xr-x | scripts/yesno | 31 |
6 files changed, 1 insertions, 185 deletions
diff --git a/scripts/ping b/scripts/ping index 2737383..06d38d5 100755 --- a/scripts/ping +++ b/scripts/ping @@ -238,7 +238,7 @@ given ($ip->version) { } } -my @cmdargs = ( 'ping' ); +my @cmdargs = ( $cmd ); my $args = [ 'ping', $host, @ARGV ]; $args = expand_args(\%options, $args); shift @$args; shift @$args; diff --git a/scripts/ssh-server-key b/scripts/ssh-server-key deleted file mode 100755 index 949d314..0000000 --- a/scripts/ssh-server-key +++ /dev/null @@ -1,14 +0,0 @@ -regen_host_keys () -{ - sudo /bin/rm -v /etc/ssh/ssh_host_* - sudo dpkg-reconfigure openssh-server - sudo /etc/init.d/ssh restart -} - -echo "Do you really want to remove the existing SSH host keys? " -${vyatta_bindir}/yesno - -if [ $? -eq 0 ] -then - regen_host_keys -fi diff --git a/scripts/vyatta-clear-conntrack b/scripts/vyatta-clear-conntrack deleted file mode 100644 index 0979e4a..0000000 --- a/scripts/vyatta-clear-conntrack +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh -# -# Module: vyatta-clear-conntrack -# -# **** License **** -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# This code was originally developed by Vyatta, Inc. -# Portions created by Vyatta are Copyright (C) 2006-2009 Vyatta, Inc. -# All Rights Reserved. -# -# Author: Mohit Mehta -# Date: February 2010 -# Description: Script to flush all conntrack entries -# -# **** End License **** -# - -# picked up from install-system script -get_response () { - ldefault=$(echo "$1" | tr [:upper:] [:lower:]) - loptions=$(echo "$2" | tr [:upper:] [:lower:]) - - # get the response from the user - read myresponse - myresponse=$(echo "$myresponse" | tr [:upper:] [:lower:]) - - # Check to see if the user accepts the default - if [ -z "$myresponse" ]; then - echo -n $ldefault - # if we are passing in options to check, make sure response is a valid option - elif [ -n "$loptions" ]; then - for token in $loptions - do - if [ "$token" == "$myresponse" ]; then - echo -n "$myresponse" - return 0 - fi - done - return 1 - else - echo -n "$myresponse" - fi - - return 0 -} - -response='' -while [ -z "$response" ] -do - if [ "$VYATTA_PROCESS_CLIENT" == "gui2_rest" ]; then - response="y" - else - echo -ne "\nThis will clear all currently tracked and expected connections. Continue? (Y/N) [N]: " - response=$(get_response "N" "Y N") - fi - if [ "$response" == "n" ]; then - exit 1 - else - sudo /usr/sbin/conntrack -F >&/dev/null - sudo /usr/sbin/conntrack -F expect >&/dev/null - fi -done diff --git a/scripts/vyatta-cpu-summary.pl b/scripts/vyatta-cpu-summary.pl deleted file mode 100755 index b3e0331..0000000 --- a/scripts/vyatta-cpu-summary.pl +++ /dev/null @@ -1,41 +0,0 @@ -#! /usr/bin/perl -# implement "show cpu-info" - -use strict; - -open my $cpuinfo, '<', '/proc/cpuinfo' - or die "Can't open /proc/cpuinfo : $!"; - -my %models; -my %packages; -my %cores; - -my %map = ( - 'model name' => \%models, - 'physical id' => \%packages, - 'core id' => \%cores -); - -my $cpu = 0; -while (<$cpuinfo>) { - chomp; - my ( $tag, $val ) = split /:/; - if ( !$tag ) { - ++$cpu; - next; - } - - $tag =~ s/\s+$//; - $val =~ s/^\s+//; - - my $ref = $map{$tag}; - $ref->{$val} = $cpu if ($ref); -} -close $cpuinfo; - -print "Processors ", $cpu, "\n"; -print "Packages ", scalar keys %packages, "\n" if (%packages); -print "Cores ", scalar keys %cores, "\n" if (%cores); - -# Handle any attempt to run different CPU models -print "Model ", join( " \n", keys %models ), "\n"; diff --git a/scripts/vyatta-traceroute b/scripts/vyatta-traceroute deleted file mode 100644 index ca87a6d..0000000 --- a/scripts/vyatta-traceroute +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -ADDR=$1 -# Regular expressions for matching an ipv4 and ipv6 address -# simple ipv4 matcher -ip4regex="^(25[0-5]|2[0-4][0-9]|1[0-9]{1,2}|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}$" -# based on IPv6 regex from here: http://forums.dartware.com/viewtopic.php?t=452 -ip6regex="^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:)))(%.+)?\s*$" - -# Main logic -if [[ "$ADDR" =~ $ip4regex ]]; then - /usr/bin/traceroute ${@:2} $ADDR -elif [[ "$ADDR" =~ $ip6regex ]]; then - /usr/bin/traceroute6 ${@:2} $ADDR -else - echo "Resolving Address: $ADDR" - if host $ADDR | awk {' print $4 '} \ - | grep -m1 -E "$ip4regex">/dev/null; then - # resolve address and check if it is ipv4 or other - /usr/bin/traceroute ${@:2} $ADDR - elif host $ADDR | awk {' print $5 '} \ - | grep -m1 -E "$ip6regex">/dev/null; then - # if ipv6 resolution then ping6 - /usr/bin/traceroute6 ${@:2} $ADDR - else - echo -e "\n Unknown address: [$ADDR]\n" - fi -fi - diff --git a/scripts/yesno b/scripts/yesno deleted file mode 100755 index 260a23c..0000000 --- a/scripts/yesno +++ /dev/null @@ -1,31 +0,0 @@ -#! /bin/bash -# Usage: yesno prompt... - -default= -if [ "$1" = "-y" ] -then default='y'; shift -elif [[ "$1" = "-n" ]]; then - default='n'; shift -fi - - -if [ $# -eq 0 ] -then prompt="yes or no: " -else prompt="$*" -fi - -while true -do - read -p "$prompt" || exit 1 - if [ -z "$REPLY" -a ! -z "$default" ] - then REPLY=$default - fi - case "$REPLY" in - y*|Y*) exit 0;; - n*|n*) exit 1;; - *) echo "Answer yes or no please";; - esac -done - - - |