Skip to content

Instantly share code, notes, and snippets.

@yukoff
yukoff / crowdsec-process-sshd-log
Created April 14, 2024 15:45
Example script to process sshd auth errors retroactively and add CrowdSec decisions
#!/usr/bin/env bash
# log could be /var/log/secure or /var/log/auth.log
zgrep -P 'Invalid user .+? from |Failed password for .+? from ' /var/log/auth.log* \
| grep -Pv $WHITELISTIPS \
| perl -p -e 's/.+? from (\d+\.\d+\.\d+\.\d+) port .+/\1/g' \
| sort -u \
| xargs -I % sudo cscli decisions add --ip % --duration 48h --reason "ssh bruteforce"
@yukoff
yukoff / check-remote-ip.ps1
Created April 11, 2024 00:24
Example PowerShell script to send SMTP emails from Windows
# curl / wget are aliases for Invoke-WebRequest
$ip = Invoke-WebRequest -Uri https://ifconfig.co -ContentType "text/plain" -UserAgent curl
$hostname = hostname
$EmailFrom = "no-reply@$hostname"
$EmailTo = "[email protected]"
$Subject = "Remote address"
$Body = "Current IP address: $ip"
$SMTPServer = "smtp.mailgun.org"
$SMTPPort = 587
@yukoff
yukoff / freedb-proto5-update
Last active December 3, 2017 04:36
A version of <http://ftp.freedb.org/pub/freedb/freedb-proto5-update> with updated list of ID3v1 genres
#!/usr/bin/perl
# ---------------------------------------------------------------------------
# freedb-proto5-update (v0.2) by Florian Maul <[email protected]>
#
# takes a list of freedb database files from STDIN and converts them to
# protocol level 5 i.e. inserting DYEAR und DGENRE while using CDEX entries
# in the EXTD field.
#
# usage: find /data/freedbdir/ -type f | freedb-proto5-update
#
@yukoff
yukoff / id3genres.txt
Last active December 3, 2017 00:59 — forked from adamvr/genres.txt
id3 genre numbers, based on id3.org's one and others like eyeD, etc
0 - Blues
1 - Classic Rock
2 - Country
3 - Dance
4 - Disco
5 - Funk
6 - Grunge
7 - Hip-Hop
8 - Jazz
9 - Metal
@yukoff
yukoff / GitHub Wiki Subtree Storage.markdown
Created September 3, 2017 13:01 — forked from jfelixetcetera/GitHub Wiki Subtree Storage.markdown
Store and edit GitHub wikis within the main project repository.

Project documentation

The project documentation (stored in the docs directory) is a git subtree of the project wiki. This allows for the documentation to be referenced and edited from within the main project.

Initial local setup

When cloning the main project repository for the first time, the wiki repository must be added as a remote.

git remote add wiki https://github.com//.wiki.git

@yukoff
yukoff / README.md
Created August 18, 2017 16:11 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@yukoff
yukoff / hurtom-logo-sketch.svg
Created July 31, 2017 20:13
Поточний ескіз лого Гуртом
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Keybase proof

I hereby claim:

  • I am yukoff on github.
  • I am yukoff (https://keybase.io/yukoff) on keybase.
  • I have a public key whose fingerprint is F353 5517 3418 3EF3 1ABD 959D 395E 8686 6847 FF1C

To claim this, I am signing this object:

abril-fatface
ada
after-time
alert
andthen
anglicize
ansi-codes
atbash
attr
attrs
@yukoff
yukoff / fa-government.svg
Last active March 20, 2016 03:28
fa-government
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.