# /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields, # that none of the other crontabs do.
SHELL=/bin/sh # You can also override PATH, but by default, newer versions inherit it from the environment #PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin # Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed 17 * * * * root cd / && run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; } 47 6 * * 7 root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.weekly; } 52 6 1 * * root test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.monthly; } # */1 * * * * www-data /bin/bash /data/scripts/app_backup.sh */15 * * * * mysql /bin/bash /data/scripts/table_cleanup.sh * * * * * mysql /bin/bash /data/scripts/dbmonitor.sh
/data/scripts/app_backup.sh
1 2 3 4 5 6
#!/bin/bash
cd /var/www /usr/bin/rm backupapp.zip /usr/bin/zip -r backupapp.zip /opt/app
data/scripts/table_cleanup.sh
1 2 3
#!/bin/sh
/usr/bin/mysql -h localhost -u chef yummy_db -p'3wDo7gSRZIwIHRxZ!' < /data/scripts/sqlappointments.sql
if [ "$response" != 'active' ]; then /usr/bin/echo "{\"status\": \"The database is down\", \"time\": \"$timestamp\"}" > /data/scripts/dbstatus.json /usr/bin/echo "$service is down, restarting!!!" | /usr/bin/mail -s "$service is down!!!" root latest_version=$(/usr/bin/ls -1 /data/scripts/fixer-v* 2>/dev/null | /usr/bin/sort -V | /usr/bin/tail -n 1) /bin/bash "$latest_version" else if [ -f /data/scripts/dbstatus.json ]; then if grep -q "database is down" /data/scripts/dbstatus.json 2>/dev/null; then /usr/bin/echo "The database was down at $timestamp. Sending notification." /usr/bin/echo "$service was down at $timestamp but came back up." | /usr/bin/mail -s "$service was down!" root /usr/bin/rm -f /data/scripts/dbstatus.json else /usr/bin/rm -f /data/scripts/dbstatus.json /usr/bin/echo "The automation failed in some way, attempting to fix it." latest_version=$(/usr/bin/ls -1 /data/scripts/fixer-v* 2>/dev/null | /usr/bin/sort -V | /usr/bin/tail -n 1) /bin/bash "$latest_version" fi else /usr/bin/echo "Response is OK." fi fi
from Crypto.PublicKey import RSA from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import serialization import sympy
# Generate RSA key pair q = sympy.randprime(2**19, 2**20) n = sympy.randprime(2**1023, 2**1024) * q e = 65537 p = n // q phi_n = (p - 1) * (q - 1) d = pow(e, -1, phi_n) key_data = {'n': n, 'e': e, 'd': d, 'p': p, 'q': q} key = RSA.construct((key_data['n'], key_data['e'], key_data['d'], key_data['p'], key_data['q'])) private_key_bytes = key.export_key()