This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!//usr/bin/env python | |
import re | |
import sys | |
import getopt | |
from netaddr import IPNetwork | |
def main(argv): | |
ip = '' | |
infile = '' | |
try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
default_line=$(netstat -rn |grep default) | |
gateway=$(echo $default_line | awk '{print $2}') | |
interface=$(echo $default_line | awk '{print $6}') | |
echo $gateway | |
echo $interface | |
scutil <<EOF | |
d.init | |
get State:/Network/Service/forticlientsslvpn/IPv4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
_APP_PATH=('/home/user1' '/home/user2' '/home/user3') | |
_PERM=('755' '740' '740') | |
aLen=${#_APP_PATH[@]} | |
pLen=${#_PERM[@]} | |
if [ ${aLen} != ${pLen} ];then | |
echo "folder and permisons array don't match " | |
exit 1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function max(arr, big) { | |
big = 0; | |
for (i in cat) { | |
if (cat[i] > big) { big=cat[i]; } | |
} | |
return big | |
} | |
NF > 0 { | |
cat[$1]++; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
fn_lsuser(){ | |
USER=$1 | |
DATA1=`grep -w $USER /etc/passwd` | |
SNAME=`echo $DATA1 | cut -d: -f1` | |
SID=`echo $DATA1 | cut -d: -f3` | |
SGPNUM=`echo $DATA1 | cut -d: -f4` | |
SHOME=`echo $DATA1 | cut -d: -f6` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -ne 2 ]; then | |
echo "Specify the environment you want to run the report on as defined in ansible hosts" | |
exit 1 | |
fi | |
ANSIBLE_GROUP=$1 | |
USER=$2 | |
#clear save-user fingerprint | |
rm -f /tmp/local_users |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- hosts: all | |
# remote_user: | |
sudo: yes | |
sudo_user: root | |
tasks: | |
- script: lsuser-wrapper.sh creates=/tmp/lsuser | |
- shell: 'getent passwd|egrep "bash|zsh|nologin" |cut -d : -f 6' | |
register: home_folder | |
- fetch: src=/tmp/lsuser dest=reports/remote-authorized/lsuser-{{ ansible_hostname }} flat=yes | |
- file: path=/tmp/lsuser state=absent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat users-v2.yaml | |
- name: Add users from users dictionary | |
#action: user name={{ item.key }} password={{ item.value.password }} shell={{ item.value.shell }} state={{ item.value.state }} remove=yes update_password=on_create groups="{{ item.key }},{{ item.value.group }}" append=no | |
action: user name={{ item.key }} password={{ item.value.password }} shell={{ item.value.shell }} state={{ item.value.state }} remove=yes update_password=on_create groups="{{ item.value.group }}" append=yes | |
with_dict: users | |
ignore_errors: yes | |
- name: Add keys from users dictionary | |
action: authorized_key user={{ item.key }} key="{{ item.value.ssh_key }}" exclusive=yes | |
with_dict: users | |
########### |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install fswatch https://github.com/emcrisostomo/fswatch | |
# | |
#Use fswatch in polling mode to listen for Created and Updated events and use touch -a to modify the attribute | |
#this will triger gulp-watch to execute and prevent a loop from fswatch | |
# when used in polling mode is going to be cpu intensive use with care | |
# | |
# | |
WATCH_PATH=/mnt/VBOX_SHARED/ | |
LOG_FILE=/var/log/fix_gulp_watch.log | |
fix_gulp_watch(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Move Files in between s3 buckets based on a list | |
#Use Standard_IA so storage will be cheaper | |
while [[ $# > 1 ]] | |
do | |
key="$1" | |
case $key in | |
-f|--file) | |
FILE="$2" |
OlderNewer