From 8dab54a65a713d7bf661bc966e58c7e8ecf9c408 Mon Sep 17 00:00:00 2001 From: NeodarZ Date: Wed, 23 Aug 2017 20:35:04 +0200 Subject: Add some cool script --- scripts/.scripts/fingerprint | 66 ++++++++++++++++++++++++++++++++++++++++++ scripts/.scripts/lessfilter.sh | 20 +++++++++++++ scripts/.scripts/nullify | 2 ++ scripts/.scripts/task | 28 ++++++++++++++++++ scripts/.scripts/tdone | 28 ++++++++++++++++++ scripts/.scripts/watch | 12 ++++++++ 6 files changed, 156 insertions(+) create mode 100755 scripts/.scripts/fingerprint create mode 100755 scripts/.scripts/lessfilter.sh create mode 100755 scripts/.scripts/nullify create mode 100755 scripts/.scripts/task create mode 100755 scripts/.scripts/tdone create mode 100755 scripts/.scripts/watch (limited to 'scripts') diff --git a/scripts/.scripts/fingerprint b/scripts/.scripts/fingerprint new file mode 100755 index 0000000..8e15a98 --- /dev/null +++ b/scripts/.scripts/fingerprint @@ -0,0 +1,66 @@ +#!/usr/bin/env ruby + +# Usage exemple: ./fingerprint twitter.com api.twitter.com ton.twitter.com twitter.com tweetdeck.twitter.com userstream.twitter.com abs.twitter.com psb.twimg.com ton.twing.com video.twimg.com 2> /dev/null +# List of figerprint by domain name + +require 'resolv' +require 'openssl' +require 'set' + +hosts = Set.new +ips = Set.new +certs = Set.new +subjects = Set.new +cas = Set.new +fps = Set.new +keys = Set.new + +resolver = Resolv::DNS.new +ARGV.each do |host| + $stderr.puts host + hosts << host + resolver.each_address(host) do |ip| + ip = ip.to_s + ips << ip + $stderr.puts " #{ip}" + tcp_client = TCPSocket.new ip, 443 + ssl_client = OpenSSL::SSL::SSLSocket.new tcp_client + ssl_client.hostname = host + ssl_client.connect + cert = ssl_client.peer_cert + certs << cert + + subject = cert.subject + subjects << subject + $stderr.puts " CN=#{subject}" + + ca = cert.issuer + cas << ca + $stderr.puts " CA=#{ca}" + + fp = OpenSSL::Digest::SHA256.hexdigest cert.to_der + fps << fp + $stderr.puts " fp=#{fp}" + + key = ::OpenSSL::Digest::SHA256.hexdigest cert.public_key.to_der + keys << key + $stderr.puts " key=#{key}" + + ssl_client.close + end +end + +puts "#{hosts.size} hosts" +hosts.sort.each { |l| puts " #{l}"} +puts "#{ips.size} IPs" +ips.sort.each { |l| puts " #{l}"} +puts "#{fps.size} certificates" +fps.sort.each { |l| puts " #{l}"} +puts "#{cas.size} CAs" +cas.sort.each { |l| puts " #{l}"} +puts "#{subjects.size} subjects" +subjects.sort.each { |l| puts " #{l}"} +puts "#{keys.size} keys" +keys.sort.each { |l| puts " #{l}"} + + diff --git a/scripts/.scripts/lessfilter.sh b/scripts/.scripts/lessfilter.sh new file mode 100755 index 0000000..d85c217 --- /dev/null +++ b/scripts/.scripts/lessfilter.sh @@ -0,0 +1,20 @@ +#!/bin/sh +case "$1" in + *.awk|*.groff|*.java|*.js|*.m4|*.php|*.pl|*.pm|*.pod|*.sh|\ + *.ad[asb]|*.asm|*.inc|*.[ch]|*.[ch]pp|*.[ch]xx|*.cc|*.hh|\ + *.lsp|*.l|*.pas|*.p|*.xml|*.xps|*.xsl|*.axp|*.ppd|*.pov|\ + *.diff|*.patch|*.py|*.rb|*.sql|*.ebuild|*.eclass) + pygmentize -f 256 "$1";; + .bashrc|.bash_aliases|.bash_environment) + pygmentize -f 256 -l sh "$1" + ;; + *) + grep "#\!/bin/bash" "$1" > /dev/null + if [ "$?" -eq "0" ]; then + pygmentize -f 256 -l sh "$1" + else + exit 1 + fi + esac + +exit 0 diff --git a/scripts/.scripts/nullify b/scripts/.scripts/nullify new file mode 100755 index 0000000..212c88d --- /dev/null +++ b/scripts/.scripts/nullify @@ -0,0 +1,2 @@ +#!/bin/sh +"$@" &>/dev/null diff --git a/scripts/.scripts/task b/scripts/.scripts/task new file mode 100755 index 0000000..f15e4a6 --- /dev/null +++ b/scripts/.scripts/task @@ -0,0 +1,28 @@ +#!/bin/sh +SESSION=task + +optios $@ + +tmux kill-session -t $SESSION +tmux -2 new-session -d -s $SESSION +tmux send-keys "watch task calendar" C-m +tmux split-window -v +tmux resize-pan -D 10 +tmux resize-pan -U 10 +tmux send-keys "watch task $@" C-m +tmux split-window -v +tmux resize-pan -D 20 +tmux resize-pan -U 5 +l1="┳━┓┓ ┃┳━┓┏┏┓┳━┓┳ ┳━┓ ┏━┓┳━┓ ┓━┓┏━┓┏┏┓┳━┓ ┏━┓┏━┓┏┏┓┏┏┓┳━┓┏┓┓┳━┓┓━┓" +l2="┣━ ┏╋┛┃━┫┃┃┃ ┃━┛┃ ┣━ ┃ ┃┣━ ┗━┓┃ ┃┃┃┃ ┣━ ┃ ┃ ┃┃┃┃ ┃┃┃ ┃━┫┃┃┃┃ ┃┗━┓" +l3="┻━┛┇ ┗┛ ┇┛ ┇┇ ┇━┛┻━┛ ┛━┛┇ ━━┛┛━┛┛ ┇┻━┛ ┗━┛┛━┛┛ ┇┛ ┇┛ ┇┇┗┛┇━┛━━┛" +tmux send-keys "clear;echo -e '$l1\n$l2\n$l3\n\ntmux send-keys -t task:0.1 C-c \`\` C-m\nMore info about task on the next page !'" C-m +tmux split-window -v +tmux resize-pan -D 5 +tmux new-window +tmux select-window -t 1 +tmux send-keys "task help | less" C-m +tmux select-window -t 0 +tmux rename-window -t 0 "task" +tmux rename-window -t 1 "help" +tmux -2 attach-session -t $SESSION diff --git a/scripts/.scripts/tdone b/scripts/.scripts/tdone new file mode 100755 index 0000000..35fe01d --- /dev/null +++ b/scripts/.scripts/tdone @@ -0,0 +1,28 @@ +#!/bin/bash + +usage () { + echo "Usage:" + echo " tdone