mirror of
https://github.com/adulau/dotfiles.git
synced 2024-12-22 08:46:01 +00:00
added some ~/bin scripts
This commit is contained in:
commit
ebfeb2aee8
2 changed files with 58 additions and 0 deletions
26
bin/encrypt-from-ssl.sh
Normal file
26
bin/encrypt-from-ssl.sh
Normal file
|
@ -0,0 +1,26 @@
|
|||
# from http://dpaste.de/61O8/raw/
|
||||
|
||||
set -e
|
||||
|
||||
echo "Encrypting $2 for $1."
|
||||
|
||||
# make a directory to store results for this site
|
||||
mkdir -p results/$1
|
||||
|
||||
# get that site's SSL certificate, validating it with the cacert.pem we have
|
||||
echo "QUIT" | openssl s_client -CAfile cacert.pem -connect $1:443 > results/$1/cert.pem
|
||||
|
||||
# generate a random password from urandom
|
||||
dd if=/dev/urandom of=results/$1/pass.txt bs=1 count=96
|
||||
|
||||
# use the raw password and AES to encrypt the output
|
||||
openssl enc -a -aes-256-cbc -salt -in $2 -out results/$1/file.enc -pass file:results/$1/pass.txt
|
||||
|
||||
# then, use the above public cert to encrypt the pass key
|
||||
openssl rsautl -encrypt -inkey results/$1/cert.pem -pubin -certin -in results/$1/pass.txt -out results/$1/pass.enc
|
||||
|
||||
# finally, delete the password so it's not around and accidentally leaked
|
||||
rm results/$1/pass.txt
|
||||
|
||||
echo "ALL DONE"
|
||||
|
32
bin/ip2asn.pl
Normal file
32
bin/ip2asn.pl
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Takes as input IP address (one per line)
|
||||
# and output the guessed IP location along with ASN origin and its description
|
||||
#
|
||||
# perl iporigin.pl
|
||||
# 8.8.8.8
|
||||
# US;AS15169;GOOGLE - Google Inc.;8.8.8.8
|
||||
# 8.8.4.4
|
||||
# US;AS15169;GOOGLE - Google Inc.;8.8.4.4
|
||||
# 4.4.4.4
|
||||
# US;AS3356;LEVEL3 Level 3 Communications;4.4.4.4
|
||||
#
|
||||
#
|
||||
# This file is in the public domain.
|
||||
#
|
||||
# Alexandre Dulaunoy - http://github.com/adulau
|
||||
|
||||
use Net::Whois::RIS;
|
||||
use IP::Country::Fast;
|
||||
my $country = IP::Country::Fast->new();
|
||||
$| = 1;
|
||||
|
||||
while (<STDIN>) {
|
||||
next if /^#/;
|
||||
chomp();
|
||||
@v = split(/ /, $_);
|
||||
$v[0];
|
||||
$l = Net::Whois::RIS->new();
|
||||
$l->getIPInfo($v[0]);
|
||||
print $country->inet_atocc($v[0]).";".$l->getOrigin().";".$l->getDescr().";".$v[0]."\n";
|
||||
}
|
Loading…
Reference in a new issue