This file contains 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
sudo apt install wget build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libbz2-dev libexpat1-dev liblzma-dev libffi-dev uuid-dev | |
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz | |
tar xf Python-3.8.0.tar.xz | |
cd Python-3.8.0 | |
./configure --enable-optimizations --prefix=/usr | |
make -j 8 | |
sudo make install | |
cp -R /usr/lib/python3/dist-packages/CommandNotFound/ /usr/lib/python3.8/site-packages/ | |
cp -R /usr/lib/python3/dist-packages/lsb_release.py /usr/lib/python3.8/site-packages/ | |
sudo make install |
This file contains 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
--- | |
- name: Set up sshcerts for ianl | |
hosts: all | |
remote_user: ianl | |
tasks: | |
- name: Generate a unique key for each host | |
local_action: command /usr/bin/ssh-keygen -b 2048 -t rsa -f /home/ianl/sshkeys/{{ inventory_hostname }} -q -N "" | |
become: no |
This file contains 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
import socket | |
from time import sleep | |
#this sets the password to 'Abc123123' | |
target = '1.2.3.4' | |
admin = bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x39\x00\x00\x00\x00\x61\x64\x6d\x69\x6e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') | |
setpassword = bytearray(b'\x73\x69\x6d\x70\x6c\x65\x2d\x63\x6f\x6d\x6d\x61\x6e\x64\x20\x73\x65\x74\x20\x75\x73\x65\x72\x20\x61\x64\x6d\x69\x6e\x20\x74\x79\x70\x65\x20\x61\x64\x6d\x69\x6e\x20\x70\x61\x73\x73\x77\x20\x41\x62\x63\x31\x32\x33\x31\x32\x33\x00') #Abc123123 |
This file contains 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
import socket | |
from time import sleep | |
address = '192.168.1.11' # the target | |
port = 555 | |
# set up binary strings to send to the radio | |
root = bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xad\x00\x00\x00\x00\x72\x6f\x6f\x74\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00') | |
moinfo = bytearray(b'\x6d\x6f\x2d\x69\x6e\x66\x6f\x20\x73\x79\x73\x74\x65\x6d\x20\x3b\x20\x6e\x74\x70\x20\x3b\x20\x69\x70\x20\x3b\x20\x69\x70\x76\x36\x20\x3b\x20\x65\x74\x68\x20\x3b\x20\x61\x61\x61\x2d\x73\x65\x72\x76\x65\x72\x20\x3b\x20\x61\x61\x61\x20\x3b\x20\x73\x6e\x6d\x70\x2d\x6d\x6e\x6 |
This file contains 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 | |
for cert in `find /etc/letsencrypt/live -name 'cert.pem'` ; do | |
certpath=`/usr/bin/dirname $cert` | |
website=`basename $certpath` | |
if /usr/bin/openssl x509 -checkend 2592000 -noout -in $cert ; then | |
echo "Cert for $website is good" | |
else | |
echo "**Cert for $website is bad**" | |
fi | |
done |
This file contains 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
--- | |
- name: Check if SSL certs will expire soon | |
hosts: servers-with-ssl-certs | |
remote_user: backup | |
tasks: | |
- name: Run the SSL cert check script | |
script: /usr/local/bin/check_ssl_cert.sh | |
register: scriptoutput | |
- name: Print script output |
This file contains 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
--- | |
- name: Set up sshcerts for MYUSER | |
hosts: all | |
remote_user: MYUSER | |
tasks: | |
- name: Generate a unique key for this host | |
local_action: command /usr/bin/ssh-keygen -b 2048 -t rsa -f /home/MYUSER/sshkeys/{{ inventory_hostname }} -q -N "" | |
- name: Create /backup/.ssh recursively |
This file contains 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
--- | |
- name: Roll out basic config changes to a new server | |
hosts: all | |
remote_user: backup | |
become: yes | |
tasks: | |
- name: Disable root login in sshd_config | |
lineinfile: "dest=/etc/ssh/sshd_config | |
regexp='^PermitRootLogin ' |
This file contains 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
print 2 # ... | |
i = 3 | |
while True: | |
divisorMax = (i/2) | |
prime = True | |
for divisor in range(3,divisorMax,2): | |
if i % divisor == 0: | |
prime = False | |
break | |
if prime: |
This file contains 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
--- | |
- name: Change the root password and store the updated password locally in /backup/passwords/<hostname> | |
hosts: all | |
remote_user: backup | |
vars: | |
plaintextpw: "{{ lookup('password', '/backup/passwords/'+inventory_hostname+' chars=ascii_letters,digits,hexdigits,punctuation,, length=20') }}" | |
tasks: | |
- name: Remove the old password file, if it exists |
NewerOlder