Skip to content

Instantly share code, notes, and snippets.

@haryx8
haryx8 / countLine.sh
Created May 29, 2020 00:15
It will give an accurate source lines of code count for whatever hierarchy you point it at, as well as some additional stats.
#!/bin/bash
find $1 -name '*.php' | xargs wc -l
#find $1 -name '*.php' | xargs wc -l | sort -nr
#!/bin/bash
read -p 'Desired file name (eg. *safe*, *.bak): ' name
sudo find / -name "$name"
#sudo find / -name ".DS_Store" -exec rm {} \;
#!/bin/sh
read -p 'full domain name: ' domain
openssl genrsa -des3 -out $domain.key 2048
openssl req -new -key $domain.key -out $domain.csr
#openssl x509 -req -days 365 -in $domain.csr -signkey $domain.key -out $domain.crt
openssl req -nodes -new -x509 -keyout $domain.nopassphrase.key -out $domain.nopassphrase.crt
#!/bin/bash
PIN1=`openssl x509 -pubkey < primary.crt | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | base64`
PIN2=`openssl x509 -pubkey < backup.crt | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | base64`
echo
echo ==================================
echo == Public_Key_Pinning generator ==
echo ==================================
echo
echo -e "\033[5m\033[1m\033[31mapache:\033[0m"
echo Header always set Public-Key-Pins "pin-sha256=\"$PIN1\"; pin-sha256=\"$PIN2\"; max-age=5184000; includeSubDomains"
@haryx8
haryx8 / nmap_scanning.sh
Last active February 20, 2019 01:57
nmap_scanning.sh
nmap -Pn --script vuln fqdn
nmap --script ssl-cert,ssl-enum-ciphers -p 443 fqdn
nmap --script "mysql-*" fqdn
nmap --script "http-*" fqdn
nmap -Pn --script vuln fqdn
@haryx8
haryx8 / restore_mysql_from_bz2.sh
Created February 8, 2018 10:27
Restore MySQL from bz2 file
#!/bin/bash
bunzip2 < db_filename.sql.bz2 | mysql -u root -p target_db_name
#!/bin/bash
black=`tput setaf 0`
red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 3`
blue=`tput setaf 4`
magenta=`tput setaf 5`
cyan=`tput setaf 6`
white=`tput setaf 7`
reset=`tput sgr0`
#!/bin/bash
# param1 sshport
# param2 suffix zend gui password
# example execute: ./thisfile.sh 22 localhost
echo "Please wait..."
sshport=$1
zendgui="590@pp$2"
appportsbo="801 802 803 804 805 806 807 808 809 810"
@haryx8
haryx8 / lfs
Created February 14, 2017 07:04
@@@@@@@
@ LFS @
@@@@@@@
apt-get install gawk
apt-get install bison
apt-get install texinfo
# create boot partition 100MB ext2
# create system partition 9900MB ext4
db.authors.insert([
{
_id: 'a1',
name: { first: 'orlando', last: 'becerra' },
age: 27
},
{
_id: 'a2',
name: { first: 'mayra', last: 'sanchez' },
age: 21