mirror of
https://github.com/Oxalide/vsphere-influxdb-go.git
synced 2023-10-10 11:36:51 +00:00
add vendoring with go dep
This commit is contained in:
1
vendor/github.com/vmware/govmomi/scripts/.gitignore
generated
vendored
Normal file
1
vendor/github.com/vmware/govmomi/scripts/.gitignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.wireshark-*
|
||||
13
vendor/github.com/vmware/govmomi/scripts/contributors.sh
generated
vendored
Executable file
13
vendor/github.com/vmware/govmomi/scripts/contributors.sh
generated
vendored
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
file="$(git rev-parse --show-toplevel)/CONTRIBUTORS"
|
||||
|
||||
cat <<EOF > "$file"
|
||||
# People who can (and typically have) contributed to this repository.
|
||||
#
|
||||
# This script is generated by $(basename "$0")
|
||||
#
|
||||
|
||||
EOF
|
||||
|
||||
git log --format='%aN <%aE>' | sort -uf >> "$file"
|
||||
43
vendor/github.com/vmware/govmomi/scripts/debug-ls.sh
generated
vendored
Executable file
43
vendor/github.com/vmware/govmomi/scripts/debug-ls.sh
generated
vendored
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2014 VMware, Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
set -e
|
||||
|
||||
# This script shows for every request in a debug trace how long it took
|
||||
# and the name of the request body.
|
||||
|
||||
function body-name {
|
||||
(
|
||||
xmllint --shell $1 <<EOS
|
||||
setns soapenv=http://schemas.xmlsoap.org/soap/envelope/
|
||||
xpath name(//soapenv:Body/*)
|
||||
EOS
|
||||
) | head -1 | sed 's/.*Object is a string : \(.*\)$/\1/'
|
||||
}
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
cd $1
|
||||
fi
|
||||
|
||||
for req in $(find . -name '*.req.xml'); do
|
||||
base=$(basename $req .req.xml)
|
||||
session=$(echo $base | awk -F'-' "{printf \"%d\", \$1}")
|
||||
number=$(echo $base | awk -F'-' "{printf \"%d\", \$2}")
|
||||
client_log=$(dirname $req)/${session}-client.log
|
||||
took=$(awk "/ ${number} took / { print \$4 }" ${client_log})
|
||||
|
||||
printf "%s %8s: %s\n" ${base} ${took} $(body-name $req)
|
||||
done
|
||||
18
vendor/github.com/vmware/govmomi/scripts/debug-xmlformat.sh
generated
vendored
Executable file
18
vendor/github.com/vmware/govmomi/scripts/debug-xmlformat.sh
generated
vendored
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# pipe the most recent debug run to xmlformat
|
||||
cd ${GOVC_DEBUG_PATH-"$HOME/.govmomi/debug"}
|
||||
cd $(ls -t | head -1)
|
||||
|
||||
header() {
|
||||
printf "<!-- %s %s/%s\n%s\n-->\n" "$1" "$PWD" "$2" "$(tr -d '\r' < "$3")"
|
||||
}
|
||||
|
||||
for file in *.req.xml; do
|
||||
base=$(basename "$file" .req.xml)
|
||||
header Request "$file" "${base}.req.headers"
|
||||
xmlformat < "$file"
|
||||
file="${base}.res.xml"
|
||||
header Response "$file" "${base}.res.headers"
|
||||
xmlformat < "$file"
|
||||
done
|
||||
62
vendor/github.com/vmware/govmomi/scripts/govc-env.bash
generated
vendored
Normal file
62
vendor/github.com/vmware/govmomi/scripts/govc-env.bash
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
# Copyright (c) 2015 VMware, Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Provide a simple shell extension to save and load govc
|
||||
# environments to disk. No more running `export GOVC_ABC=xyz`
|
||||
# in different shells over and over again. Loading the right
|
||||
# govc environment variables is now only one short and
|
||||
# autocompleted command away!
|
||||
#
|
||||
# Usage:
|
||||
# * Source this file from your `~/.bashrc` or running shell.
|
||||
# * Execute `govc-env` to print GOVC_* variables.
|
||||
# * Execute `govc-env --save <name>` to save GOVC_* variables.
|
||||
# * Execute `govc-env <name>` to load GOVC_* variables.
|
||||
#
|
||||
|
||||
_govc_env_dir=$HOME/.govmomi/env
|
||||
mkdir -p "${_govc_env_dir}"
|
||||
|
||||
_govc-env-complete() {
|
||||
local w="${COMP_WORDS[COMP_CWORD]}"
|
||||
local c="$(find ${_govc_env_dir} -mindepth 1 -maxdepth 1 -type f | sort | xargs -r -L1 basename | xargs echo)"
|
||||
|
||||
# Only allow completion if preceding argument if the function itself
|
||||
if [ "$3" == "govc-env" ]; then
|
||||
COMPREPLY=( $(compgen -W "${c}" -- "${w}") )
|
||||
fi
|
||||
}
|
||||
|
||||
govc-env() {
|
||||
# Print current environment
|
||||
if [ -z "$1" ]; then
|
||||
for VAR in $(env | grep ^GOVC_ | cut -d= -f1); do
|
||||
echo "export ${VAR}='${!VAR}'"
|
||||
done
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
# Save current environment
|
||||
if [ "$1" == "--save" ]; then
|
||||
govc-env > ${_govc_env_dir}/$2
|
||||
return
|
||||
fi
|
||||
|
||||
# Load specified environment
|
||||
source ${_govc_env_dir}/$1
|
||||
}
|
||||
|
||||
complete -F _govc-env-complete govc-env
|
||||
|
||||
43
vendor/github.com/vmware/govmomi/scripts/govc_bash_completion
generated
vendored
Normal file
43
vendor/github.com/vmware/govmomi/scripts/govc_bash_completion
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
|
||||
# govc Bash completion script
|
||||
# place in etc/bash_completion.d/ or source on command line with "."
|
||||
|
||||
_govc_complete()
|
||||
{
|
||||
local cur prev subcmd
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
subcmd=${COMP_WORDS[1]}
|
||||
COMPREPLY=()
|
||||
|
||||
if [[ ${prev} == "govc" ]] ; then # show subcommands, no options
|
||||
COMPREPLY=( $(compgen -W "$(govc -h | grep -v Usage | tr -s '\n' ' ')" -- ${cur}) )
|
||||
return 0
|
||||
|
||||
elif [[ ${cur} == "-"* ]] ; then
|
||||
: # drop out and show options
|
||||
|
||||
elif [[ ${subcmd} == "ls" ]] ; then # not completing an option, try for appropriate values
|
||||
if [[ ${prev} == "-t" ]] ; then
|
||||
COMPREPLY=( $(compgen -W "$(govc ls -l "/**" | awk '{print $2}' | \
|
||||
sort -u | tr -d '()' | tr '\n' ' ' )" -- ${cur}) )
|
||||
else
|
||||
COMPREPLY=( $(compgen -W "$(govc ls "${cur:-/*}*" | tr -s '\n' ' ' )" -- ${cur}) )
|
||||
fi
|
||||
|
||||
elif [[ ${subcmd} == "vm."* || ${prev} == "-vm" ]] ; then
|
||||
COMPREPLY=( $(compgen -W "$(govc ls -t VirtualMachine -l "${cur}*" | \
|
||||
awk '{print $1}' | tr -s '\n' ' ' )" -- ${cur}) )
|
||||
fi
|
||||
|
||||
# did not hit any specifcs so show all options from help
|
||||
if [[ -z ${COMPREPLY} ]]; then
|
||||
COMPREPLY=( $(compgen -W "-h $(govc ${subcmd} -h | awk '{print $1}' | \
|
||||
grep "^-" | sed -e 's/=.*//g' | tr -s '\n' ' ' )" -- ${cur}) )
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
complete -F _govc_complete govc
|
||||
|
||||
15
vendor/github.com/vmware/govmomi/scripts/headers/go.txt
generated
vendored
Normal file
15
vendor/github.com/vmware/govmomi/scripts/headers/go.txt
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
Copyright (c) ${YEARS} VMware, Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
13
vendor/github.com/vmware/govmomi/scripts/headers/rb.txt
generated
vendored
Normal file
13
vendor/github.com/vmware/govmomi/scripts/headers/rb.txt
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# Copyright (c) ${YEARS} VMware, Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
48
vendor/github.com/vmware/govmomi/scripts/license.sh
generated
vendored
Executable file
48
vendor/github.com/vmware/govmomi/scripts/license.sh
generated
vendored
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
header_dir=$(dirname $0)/headers
|
||||
|
||||
tmpfile=$(mktemp)
|
||||
trap "rm -f ${tmpfile}" EXIT
|
||||
|
||||
git ls-files | while read file; do
|
||||
years=( $(git log --format='%ai' $file | cut -d- -f1 | sort -u) )
|
||||
num_years=${#years[@]}
|
||||
|
||||
if [ "${num_years}" == 0 ]; then
|
||||
export YEARS="$(date +%Y)"
|
||||
else
|
||||
yearA=${years[0]}
|
||||
yearB=${years[$((${num_years}-1))]}
|
||||
|
||||
if [ ${yearA} == ${yearB} ]; then
|
||||
export YEARS="${yearA}"
|
||||
else
|
||||
export YEARS="${yearA}-${yearB}"
|
||||
fi
|
||||
fi
|
||||
|
||||
case "$file" in
|
||||
vim25/xml/*)
|
||||
# Ignore
|
||||
;;
|
||||
*.go)
|
||||
sed -e "s/\${YEARS}/${YEARS}/" ${header_dir}/go.txt > ${tmpfile}
|
||||
last_header_line=$(grep -n '\*/' ${file} | head -1 | cut -d: -f1)
|
||||
tail -n +$((${last_header_line} + 1)) ${file} >> ${tmpfile}
|
||||
mv ${tmpfile} ${file}
|
||||
;;
|
||||
*.rb)
|
||||
sed -e "s/\${YEARS}/${YEARS}/" ${header_dir}/rb.txt > ${tmpfile}
|
||||
last_header_line=$(grep -n '^$' ${file} | head -1 | cut -d: -f1)
|
||||
tail -n +$((${last_header_line})) ${file} >> ${tmpfile}
|
||||
mv ${tmpfile} ${file}
|
||||
;;
|
||||
*)
|
||||
echo "Unhandled file: $file"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
3
vendor/github.com/vmware/govmomi/scripts/vagrant/vcsa/.gitignore
generated
vendored
Normal file
3
vendor/github.com/vmware/govmomi/scripts/vagrant/vcsa/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
*.box
|
||||
*.ova
|
||||
.vagrant
|
||||
13
vendor/github.com/vmware/govmomi/scripts/vagrant/vcsa/Vagrantfile
generated
vendored
Normal file
13
vendor/github.com/vmware/govmomi/scripts/vagrant/vcsa/Vagrantfile
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# Using the VCSA base box, no provisioning, inventory will be empty.
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.hostname = "vcsa"
|
||||
|
||||
config.vm.box = "vcsa"
|
||||
config.vm.synced_folder ".", "/vagrant", disabled: true
|
||||
|
||||
config.vm.network "forwarded_port", guest: 443, host: 16443
|
||||
end
|
||||
81
vendor/github.com/vmware/govmomi/scripts/vagrant/vcsa/create-box.sh
generated
vendored
Executable file
81
vendor/github.com/vmware/govmomi/scripts/vagrant/vcsa/create-box.sh
generated
vendored
Executable file
@@ -0,0 +1,81 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$(uname -s)" == "Darwin" ]; then
|
||||
PATH="/Applications/VMware Fusion.app/Contents/Library:$PATH"
|
||||
PATH="/Applications/VMware Fusion.app/Contents/Library/VMware OVF Tool:$PATH"
|
||||
fi
|
||||
|
||||
ovf="$1"
|
||||
|
||||
if [ -z "$ovf" ]; then
|
||||
ovf="./VMware-vCenter-Server-Appliance-5.5.0.10300-2000350_OVA10.ova"
|
||||
fi
|
||||
|
||||
# check for greadlink and gmktemp
|
||||
readlink=$(type -p greadlink readlink | head -1)
|
||||
mktemp=$(type -p gmktemp mktemp | head -1)
|
||||
|
||||
dir=$($readlink -nf $(dirname $0))
|
||||
tmp=$($mktemp -d)
|
||||
trap "rm -rf $tmp" EXIT
|
||||
|
||||
cd $tmp
|
||||
|
||||
echo "Converting ovf..."
|
||||
ovftool \
|
||||
--noSSLVerify \
|
||||
--acceptAllEulas \
|
||||
--overwrite \
|
||||
--powerOffTarget \
|
||||
$ovf vcsa.vmx
|
||||
|
||||
echo "Starting vm..."
|
||||
vmrun start vcsa.vmx nogui
|
||||
|
||||
echo "Waiting for vm ip..."
|
||||
ip=$(vmrun getGuestIPAddress vcsa.vmx -wait)
|
||||
|
||||
echo "Configuring vm for use with vagrant..."
|
||||
vmrun -gu root -gp vmware CopyFileFromHostToGuest vcsa.vmx \
|
||||
$dir/vagrant.sh /tmp/vagrant.sh
|
||||
|
||||
vmrun -gu root -gp vmware runProgramInGuest vcsa.vmx \
|
||||
/bin/sh -e /tmp/vagrant.sh
|
||||
|
||||
vmrun -gu root -gp vmware deleteFileInGuest vcsa.vmx \
|
||||
/tmp/vagrant.sh
|
||||
|
||||
echo "Configuring vCenter Server Appliance..."
|
||||
|
||||
ssh_opts="-oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -T"
|
||||
|
||||
ssh ${ssh_opts} -i ~/.vagrant.d/insecure_private_key vagrant@$ip <<EOS
|
||||
echo "Accepting EULA ..."
|
||||
sudo /usr/sbin/vpxd_servicecfg eula accept
|
||||
|
||||
echo "Configuring Embedded DB ..."
|
||||
sudo /usr/sbin/vpxd_servicecfg db write embedded
|
||||
|
||||
echo "Configuring SSO..."
|
||||
sudo /usr/sbin/vpxd_servicecfg sso write embedded
|
||||
|
||||
echo "Starting VCSA ..."
|
||||
sudo /usr/sbin/vpxd_servicecfg service start
|
||||
EOS
|
||||
|
||||
echo "Stopping vm..."
|
||||
vmrun stop vcsa.vmx
|
||||
|
||||
rm -f vmware.log
|
||||
|
||||
sed -i -e 's/"bridged"/"nat"/' vcsa.vmx
|
||||
|
||||
echo '{"provider":"vmware_desktop"}' > ./metadata.json
|
||||
|
||||
cd $dir
|
||||
|
||||
tar -C $tmp -cvzf vcsa.box .
|
||||
|
||||
vagrant box add --name vcsa vcsa.box
|
||||
23
vendor/github.com/vmware/govmomi/scripts/vagrant/vcsa/vagrant.sh
generated
vendored
Executable file
23
vendor/github.com/vmware/govmomi/scripts/vagrant/vcsa/vagrant.sh
generated
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
useradd vagrant -m -s /bin/bash
|
||||
groupmod -A vagrant wheel
|
||||
|
||||
echo "vagrant ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
|
||||
mkdir ~vagrant/.ssh
|
||||
wget --no-check-certificate \
|
||||
https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub \
|
||||
-O ~vagrant/.ssh/authorized_keys
|
||||
chown -R vagrant ~vagrant/.ssh
|
||||
chmod -R go-rwsx ~vagrant/.ssh
|
||||
|
||||
sed -i -e 's/^#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
|
||||
sed -i -e 's/^AllowTcpForwarding no//' /etc/ssh/sshd_config
|
||||
sed -i -e 's/^PermitTunnel no//' /etc/ssh/sshd_config
|
||||
sed -i -e 's/^MaxSessions 1//' /etc/ssh/sshd_config
|
||||
|
||||
# disable password expiration
|
||||
for uid in root vagrant; do
|
||||
chage -I -1 -E -1 -m 0 -M -1 $uid
|
||||
done
|
||||
63
vendor/github.com/vmware/govmomi/scripts/wireshark-esx.sh
generated
vendored
Executable file
63
vendor/github.com/vmware/govmomi/scripts/wireshark-esx.sh
generated
vendored
Executable file
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash -e
|
||||
#
|
||||
# Capture ESXi traffic and decrypt SOAP traffic on port 443 via wireshark
|
||||
|
||||
# Device to capture
|
||||
dev="${1-vmk0}"
|
||||
|
||||
# Device to get the ip for wireshark ssl_keys config
|
||||
if [ "$dev" = "lo0" ] ; then
|
||||
ip_dev="vmk0"
|
||||
else
|
||||
ip_dev="$dev"
|
||||
fi
|
||||
|
||||
ip=$(govc host.info -k -json | \
|
||||
jq -r ".HostSystems[].Config.Network.Vnic[] | select(.Device == \"${ip_dev}\") | .Spec.Ip.IpAddress")
|
||||
|
||||
scp=(scp)
|
||||
ssh=(ssh)
|
||||
|
||||
# Check if vagrant ssh-config applies to $ip
|
||||
if [ -d ".vagrant" ] ; then
|
||||
vssh_opts=($(vagrant ssh-config | awk NF | awk -v ORS=' ' '{print "-o " $1 "=" $2}'))
|
||||
if grep "HostName=${ip}" >/dev/null <<<"${vssh_opts[*]}" ; then
|
||||
ssh_opts=("${vssh_opts[@]}")
|
||||
fi
|
||||
fi
|
||||
|
||||
# Otherwise, use default ssh opts + sshpass if available
|
||||
if [ ${#ssh_opts[@]} -eq 0 ] ; then
|
||||
user="$(govc env GOVC_USERNAME)"
|
||||
ssh_opts=(-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o LogLevel=FATAL -o User=$user)
|
||||
|
||||
if [ -x "$(which sshpass)" ] ; then
|
||||
password="$(govc env GOVC_PASSWORD)"
|
||||
scp=(sshpass -p $password scp)
|
||||
ssh=(sshpass -p $password ssh)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$dev" != "lo0" ] ; then
|
||||
# If you change this filter, be sure to exclude the ssh port (not tcp port 22)
|
||||
filter="host $ip and \(port 80 or port 443\)"
|
||||
|
||||
dst="$HOME/.wireshark/rui-${ip}.key"
|
||||
if [ ! -f "$dst" ] ; then
|
||||
# Copy key from ESX
|
||||
"${scp[@]}" "${ssh_opts[@]}" "${ip}:/etc/vmware/ssl/rui.key" "$dst"
|
||||
fi
|
||||
|
||||
if ! grep "$ip" ~/.wireshark/ssl_keys 2>/dev/null ; then
|
||||
# Add key to wireshark ssl_keys config
|
||||
echo "adding rui.key for $ip"
|
||||
|
||||
cat <<EOF >> ~/.wireshark/ssl_keys
|
||||
"$ip","443","http","$dst",""
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Capturing $dev on $ip..."
|
||||
|
||||
"${ssh[@]}" "${ssh_opts[@]}" "$ip" tcpdump-uw -i "$dev" -s0 -v -w - "$filter" | wireshark -k -i -
|
||||
64
vendor/github.com/vmware/govmomi/scripts/wireshark-vcsa.sh
generated
vendored
Executable file
64
vendor/github.com/vmware/govmomi/scripts/wireshark-vcsa.sh
generated
vendored
Executable file
@@ -0,0 +1,64 @@
|
||||
#!/bin/bash -e
|
||||
#
|
||||
# Capture SOAP traffic between web client and vpxd on 127.0.0.1:8085.
|
||||
#
|
||||
# Caveats: tested with VCSA 6.0, unlikely to work for other versions.
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
cache_deb() {
|
||||
wget $1
|
||||
ar x *.deb data.tar.gz
|
||||
tar zxf data.tar.gz
|
||||
rm -f data.tar.gz
|
||||
rm -f *.deb
|
||||
}
|
||||
|
||||
dirname="$(dirname $0)"
|
||||
basename="$(basename $0)"
|
||||
bindir="${dirname}/.${basename}"
|
||||
|
||||
mkdir -p "${bindir}"
|
||||
|
||||
# Cache binaries required to run tcpdump on vcsa
|
||||
if [ ! -f "${bindir}/.done" ]; then
|
||||
pushd ${bindir}
|
||||
cache_deb https://launchpadlibrarian.net/200649143/libssl0.9.8_0.9.8k-7ubuntu8.27_amd64.deb
|
||||
cache_deb https://launchpadlibrarian.net/37430984/libpcap0.8_1.0.0-6_amd64.deb
|
||||
cache_deb https://launchpadlibrarian.net/41774869/tcpdump_4.0.0-6ubuntu3_amd64.deb
|
||||
touch .done
|
||||
popd
|
||||
fi
|
||||
|
||||
scp=(scp)
|
||||
ssh=(ssh)
|
||||
|
||||
# Extract host from GOVC_URL
|
||||
host="$(govc env -x GOVC_HOST)"
|
||||
username=root
|
||||
password="$(govc env GOVC_PASSWORD)"
|
||||
|
||||
if [ -x "$(which sshpass)" ] ; then
|
||||
scp=(sshpass -p "$password" scp)
|
||||
ssh=(sshpass -p "$password" ssh)
|
||||
fi
|
||||
|
||||
ssh_opts=(-o UserKnownHostsFile=/dev/null
|
||||
-o StrictHostKeyChecking=no
|
||||
-o LogLevel=FATAL
|
||||
-o User=${username}
|
||||
-o ControlMaster=no)
|
||||
dev="lo"
|
||||
filter="port 8085"
|
||||
tcpdump="env LD_LIBRARY_PATH=/tmp /tmp/tcpdump"
|
||||
|
||||
echo "Capturing $dev on $host..."
|
||||
|
||||
"${scp[@]}" "${ssh_opts[@]}" \
|
||||
"${bindir}/lib/libcrypto.so.0.9.8" \
|
||||
"${bindir}/usr/lib/libpcap.so.0.8" \
|
||||
"${bindir}/usr/sbin/tcpdump" \
|
||||
"${host}:/tmp"
|
||||
|
||||
"${ssh[@]}" "${ssh_opts[@]}" "$host" ${tcpdump} -i "$dev" -s0 -v -w - "$filter" | wireshark -k -i - 2>/dev/null
|
||||
Reference in New Issue
Block a user