summaryrefslogtreecommitdiff
path: root/nocompile/bin
diff options
context:
space:
mode:
authorepochqwert <epoch@hacking.allowed.org>2015-04-21 13:41:40 -0500
committerepochqwert <epoch@hacking.allowed.org>2015-04-21 13:41:40 -0500
commit318b3220d191011bb9132efd4dbd5e6fb467b4e7 (patch)
tree1b0e7a29d15f79743c8559652432658423046a38 /nocompile/bin
parent4bdfc44f4681ef322378e614a409d5acc4d6586c (diff)
downloadmisc-318b3220d191011bb9132efd4dbd5e6fb467b4e7.tar.gz
misc-318b3220d191011bb9132efd4dbd5e6fb467b4e7.zip
made dcchelper a script instead of a c program.
ipdist which gives shortest distance based on whob's output of lat and lon nc.* are minmal versions of a netcat like program written in Perl. rfc is a script for downloading and viewing RFCs tpb.sh is for pulling magnet links from tpb search results. cuturl got an upgrade to better handle scheme:?query_string type URLs. (URN? URI? fuck if I know.)
Diffstat (limited to 'nocompile/bin')
-rwxr-xr-xnocompile/bin/dcchelper10
-rwxr-xr-xnocompile/bin/ipdist.sh26
-rwxr-xr-xnocompile/bin/nc.perl1.sh2
-rwxr-xr-xnocompile/bin/nc.pl3
-rwxr-xr-xnocompile/bin/rfc8
-rwxr-xr-xnocompile/bin/tpb.sh36
6 files changed, 85 insertions, 0 deletions
diff --git a/nocompile/bin/dcchelper b/nocompile/bin/dcchelper
new file mode 100755
index 0000000..d4f3fc9
--- /dev/null
+++ b/nocompile/bin/dcchelper
@@ -0,0 +1,10 @@
+#!/bin/sh
+hop0="$(hop0 "$1")"
+if [ "$hop0" = "192.168.0.2" ];then
+ if ! printf "%s" "$1" | grep "^192\.168\.0\." 2>&1 >/dev/null;then
+ IP=$(dig +short armitage.hacking.allowed.org @8.8.8.8)
+ fi
+else
+ IP=$hop0
+fi
+ipconvert "$IP" | grep "^dec: " | cut '-d ' -f2
diff --git a/nocompile/bin/ipdist.sh b/nocompile/bin/ipdist.sh
new file mode 100755
index 0000000..ca97696
--- /dev/null
+++ b/nocompile/bin/ipdist.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+if [ "_$1" = "_" -o "_$2" = "_" ];then
+ echo "usage: $0 hostA hostB"
+ exit
+fi
+
+#constants for now.
+c=299.792458 #km/ms of light in vacuum
+iof=1.4475 #picked the higher of two from wikipedia.
+# http://en.wikipedia.org/wiki/Optical_fiber#Index_of_refraction
+
+ipA=$(gethostbyname "$1")
+ipB=$(gethostbyname "$2")
+A=$(whob "$ipA" | egrep "^Lat|^Lon" | cut '-d ' -f2 | tr '\n' ' ')
+B=$(whob "$ipB" | egrep "^Lat|^Lon" | cut '-d ' -f2 | tr '\n' ' ')
+km=$(echo "$A" "$B" \
+ | geod +ellps=clrk66 -I +units=km \
+ | cut -f3)
+ms=$(printf '%s / %s * %s\n' "$km" "$c" "$iof" | bc)
+
+echo "ipA: $ipA"
+echo "ipB: $ipB"
+echo "c: $c"
+echo "iof: $iof"
+echo "km: $km"
+echo "ms: $ms"
diff --git a/nocompile/bin/nc.perl1.sh b/nocompile/bin/nc.perl1.sh
new file mode 100755
index 0000000..cfd8535
--- /dev/null
+++ b/nocompile/bin/nc.perl1.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+perl -mIO::Socket -e '$socket=IO::Socket::INET->new(PeerAddr=>"$ARGV[0]:$ARGV[1]",Proto=>"tcp",Timeout=>1);if(fork()) {while($l=<stdin>) {print $socket "$l";}} else {while($l=<$socket>) {print $l;}}' $1 $2
diff --git a/nocompile/bin/nc.pl b/nocompile/bin/nc.pl
new file mode 100755
index 0000000..ff52ab7
--- /dev/null
+++ b/nocompile/bin/nc.pl
@@ -0,0 +1,3 @@
+#!/usr/pkg/bin/perl
+use IO::Socket;
+$s=IO::Socket::INET->new(PeerAddr=>"$ARGV[0]:$ARGV[1]",Proto=>"tcp",Timeout=>1);if(fork()){while($l=<stdin>){print $s $l;}}else{while($l=<$s>){print $l;}}
diff --git a/nocompile/bin/rfc b/nocompile/bin/rfc
new file mode 100755
index 0000000..56440ae
--- /dev/null
+++ b/nocompile/bin/rfc
@@ -0,0 +1,8 @@
+#!/bin/sh
+RFCPATH=/anarchy/rfc
+if [ ! -f "${RFCPATH}/rfc$1.txt" ];then
+ echo "RFC file not found... downloading..."
+ wget http://www.ietf.org/rfc/rfc$1.txt -O "${RFCPATH}/rfc$1.txt"
+ echo "RFC has now been downloaded."
+fi
+less "${RFCPATH}/rfc$1.txt"
diff --git a/nocompile/bin/tpb.sh b/nocompile/bin/tpb.sh
new file mode 100755
index 0000000..7162b21
--- /dev/null
+++ b/nocompile/bin/tpb.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+#get magnets based on search. easy. :P
+if [ "_$1" = "_" ];then
+ echo usage: tpb.sh search_term [category] [limit]
+ echo "categories:"
+ echo "0 = any"
+ echo "100 = audio"
+ echo "200 = video"
+ echo "300 = applications"
+ echo "400 = games"
+ echo "500 = porn"
+
+else
+ if [ "_$2" = "_" ];then
+ cat=0
+ else
+ cat="$2"
+ fi
+ if [ "_$3" = "_" ];then
+ lim=5
+ else
+ lim="$3"
+ fi
+#last number:
+#0 = any
+#100 = audio
+#200 = video
+#300 = applications
+#400 = games
+#500 = porn
+ wget -qO- 'https://thepiratebay.se/search/'"$1"'/0/99/'"$cat" \
+ | tr '"' "\n" \
+ | grep ^magnet \
+ | decode_html_entities \
+ | head -n "$lim"
+fi