31be4a275942b70ffa52086a1b21a605da468edf
commit 31be4a275942b70ffa52086a1b21a605da468edf
Author: spesk1 <spesk@pm.me>
Date: Tue Mar 26 22:51:26 2019 -0400

Initial recommit

diff --git a/eyebrow b/eyebrow
new file mode 100755
index 0000000..d58f05b
--- /dev/null
+++ b/eyebrow
@@ -0,0 +1,147 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+my $tlUrl = "https://the-eye.eu/public/";
+my %currentPageRef;
+my $pageNest;
+my $curl = `which curl`;
+chomp $curl;
+
+if ( $curl eq "" || ! defined $curl ) {
+ print "No curl, exiting...\n";
+ exit 1;
+}
+
+sub dumpPage {
+ my $page = shift;
+ my @pageContent = split("\n", `$curl -s $page`);
+ if ($page =~ m/public\/(.*)$/) {
+ $pageNest = $1;
+ }
+ if ( $pageNest =~ m/\.\.\/$/ ) {
+ # Need to lop off old nested dir
+ $pageNest =~ s/\/([^\/]*\/\.\.\/)$//g;
+ }
+ if ( $pageNest !~ m/\/$/ ) {
+ $pageNest .= "/";
+ }
+ my $count = 0;
+ foreach my $line (@pageContent) {
+ if ($line =~ m/text\/javascript/ || $line =~ m/\/div/ || $line =~ m/\/i/ || $line =~ m/img\ src/ || $line =~ m/\/script/) {
+ next;
+ }
+ #if ($line =~ m/\"(.*\/)\"\>(.*)\</) {
+ if ($line =~ m/\"(.*)\"\>(.*)\</) {
+ my $link = $1;
+ $link = $pageNest . $link;
+ my $name = $2;
+ if ($name =~ m/>/) {
+ $name =~ s/>/>/g;
+ }
+ print "$count : $name\n";
+ $currentPageRef{$count} = $link;
+ $count++;
+ }
+ }
+}
+
+sub pageReturn {
+ my $choice = shift;
+ my $newPage = $tlUrl . $currentPageRef{$choice};
+ return $newPage;
+}
+
+sub download {
+ my $link = shift;
+ system("wget $link");
+}
+
+sub printHelp {
+
+ my $help = <<EOF
+* Basic usage:
+Type the number that corresponds with the link you'd like to browse to to browse there.
+( Beware selecting a binary file will dump the output to your term )
+
+* Commands:
+
+** top
+Return to the docroot of browseable files ( /public/ )
+
+** download
+Type 'download' followed by the selection number to download the file
+
+** search
+Type 'search' followed by a term to search the current dir tree
+If doing a multiword search, wrap the query in quotes like "search terms here"
+
+** file
+Type file followed by the selection number to get the full link path
+EOF
+;
+ print "$help";
+
+}
+
+if ( defined $ARGV[0] && $ARGV[0] =~ /h/ ) {
+ printHelp();
+ exit 0;
+}
+
+print "The Eye CLI Browser\n";
+dumpPage($tlUrl);
+while () {
+ print "Enter a selection: ";
+ my $input = <STDIN>;
+ chomp $input;
+ if ($input =~ m/download/) {
+ my @inputs = split(" ", $input);
+ my $dlLink = $currentPageRef{$inputs[1]};
+ $dlLink = $tlUrl . $dlLink;
+ download($dlLink);
+ next;
+ }
+ if ($input =~ m/file/) {
+ my @inputs = split(" ", $input);
+ my $queryLink = $currentPageRef{$inputs[1]};
+ $queryLink = $tlUrl . $queryLink;
+ print "File is: $queryLink\n";
+ next;
+ }
+ if ($input =~ m/quit/||$input =~ /exit/) {
+ print "Exiting..\n";
+ exit 0;
+ }
+ if ($input =~ m/search/) {
+ my @inputs = split(" ", $input);
+ shift(@inputs);
+ my $searchTerm = join(" ", @inputs);
+ #my $searchTerm = $inputs[1];
+ if ( $searchTerm =~ m/\"(.*)\"/ ) {
+ $searchTerm = $1;
+ $searchTerm =~ s/\ /%20/g;
+ }
+ foreach my $key ( keys %currentPageRef ) {
+ if ( $currentPageRef{$key} =~ m/$searchTerm/i ) {
+ my $printLine = $currentPageRef{$key};
+ $printLine =~ s/%20/\ /g;
+ $printLine =~ s/%2C/,/g;
+ $printLine =~ s/%26/&/g;
+ print "$key : $printLine\n";
+ }
+ }
+ next;
+ }
+ my $newPage;
+ if ($input eq "top") {
+ $newPage = $tlUrl;
+ } else {
+ $newPage = pageReturn($input);
+ #print "Your next request is: $newPage\n";
+
+ }
+ %currentPageRef = ();
+ dumpPage($newPage);
+}
diff --git a/install.sh b/install.sh
new file mode 100755
index 0000000..7091bc8
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+if [[ ! -d $HOME/.local/bin ]]; then
+ mkdir $HOME/.local/bin/
+fi
+
+cp $PWD/eyebrow $HOME/.local/bin/