Skip to content

Instantly share code, notes, and snippets.

View ChatchaiJ's full-sized avatar

Chatchai Jantaraprim ChatchaiJ

View GitHub Profile
@ChatchaiJ
ChatchaiJ / cisco-ftd-log-anyconnect-alert.pl
Created January 14, 2020 09:36
Send alert message using telegram message when someone connect to anyconnect VPN
#!/usr/bin/perl -w-
use strict;
use warnings;
my $DEBUG = 0;
my $RUNFILE = "/var/tmp/ftd-logmon.run";
my $ALRT = "ALRT";
$ALRT = "CJ" if ($DEBUG);
@ChatchaiJ
ChatchaiJ / gist:ead0114b48d05cd09ba0fbb3658b695d
Created January 14, 2020 07:32
setup linux for run VirtualBox to run Windows 7
PC is Dell Optiplex 7050
- Two HDDs use as software raid
- System must use gpt, and also boot from EFI
- Debian Linux as base system
- Runing VirtualBox
- Windows-7 for ASRS as guest on VirtualBox
- Win7 should start automatically after system up,
so user won't confused with linux
- choose lightdm as DM
@ChatchaiJ
ChatchaiJ / create-debian-usb-key.sh
Created July 2, 2019 08:00 — forked from nmaupu/create-debian-usb-key.sh
Create Debian USB key automatic installation (preseed)
#!/usr/bin/env bash
set -e -x -o pipefail
DIRNAME="$(dirname $0)"
DISK="$1"
: "${DEBIAN_RELEASE:=stretch}"
: "${DEBIAN_VERSION:=9.2.1}"
: "${DEBIAN_MIRROR:=http://ftp.debian.org}"
@ChatchaiJ
ChatchaiJ / quad-digit-public-dns-check.pl
Created April 2, 2018 03:02
Looking for quad digits public DNS servers from validated nameserver list
#!/usr/bin/perl -w-
use strict;
use warnings;
my $url = "https://public-dns.info/nameservers.txt";
open CMD, "curl -s $url |" or die "Can't execute command : $!\n";
while (<CMD>) {
next if /:/;
@ChatchaiJ
ChatchaiJ / result.txt
Created January 11, 2018 23:39
Mersenne
Try 13466917
real 4m14.519s
user 4m14.412s
sys 0m0.072s
Try 20996011
real 8m33.265s
user 8m31.852s
#!/bin/sh
[ `id -u` != 0 ] && echo "Need root privileges" && exit
DOMAIN="DOMAIN"
DOMAINSID=`sudo net getdomainsid | grep $DOMAIN | awk '{ print $6 }'`
GID="513"
SID="${DOMAINSID}-${GID}"
SMB_TDB="smb.conf-tdb-backend"
@ChatchaiJ
ChatchaiJ / preseed.cfg
Created November 7, 2017 10:40
Debian Preseed
d-i debian-installer/locale string en_US.UTF-8
d-i keyboard-configuration/xkb-keymap select us
# first ethernet interface for VirtualBox PC is enp0s3 #
d-i netcfg/choose_interface select enp0s3
d-i netcfg/get_hostname string debian
d-i netcfg/get_domain string example.com
d-i netcfg/wireless_wep string
@ChatchaiJ
ChatchaiJ / strict-ssh.sh
Created October 11, 2017 08:27
Strictly force ssh to use only public key for authentication
#!/bin/sh
SSHOPTS="-q -o PasswordAuthentication=no -o KbdInteractiveAuthentication=no -o ChallengeResponseAuthentication=no -o StrictHostKeyChecking=no"
SSH="/usr/bin/ssh $SSHOPTS"
IP="127.0.0.1"
[ "$1" ] && IP="$1"
$SSH $IP
#!/bin/sh
[ -z "$1" ] && echo "Usage: $0 https://www.google.com" && exit
URL="$1"
curl --insecure -v $URL 2>&1 |\
awk 'BEGIN { cert=0 } /^\* SSL connection/ { cert=1 } /^\*/ { if (cert) print }'
@ChatchaiJ
ChatchaiJ / cert-check1.sh
Created September 25, 2017 08:16
Using openssl's s_client for printing certificates information from a web site
#!/bin/sh
[ -z "$1" ] && echo "Usage: $0 www.example.com" && exit
SERVERNAME="$1"
echo |\
openssl s_client \
-showcerts \
-servername $SERVERNAME \