#!/usr/bin/perl -T ################################################################################ # _____ _ # |_ _| |_ ___ # | | | ' \/ -_) # |_| |_||_\___| # _ _ ____ _ _ # / \ _ __ ___| |_(_) ___ __ _ | _ \ _ __ ___ (_) ___ ___| |_ # / _ \ | '__/ __| __| |/ __/ _` | | |_) | '__/ _ \| |/ _ \/ __| __| # / ___ \| | | (__| |_| | (_| (_| | | __/| | | (_) | | __/ (__| |_ # /_/ \_\_| \___|\__|_|\___\__,_| |_| |_| \___// |\___|\___|\__| # |__/ # The Arctica Modular Remote Computing Framework # ################################################################################ # # Copyright (C) 2015-2016 The Arctica Project # http://http://arctica-project.org/ # # This code is dual licensed: strictly GPL-2 or AGPL-3+ # # GPL-2 # ----- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # # AGPL-3+ # ------- # This programm is free software; you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This programm is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program; if not, write to the # Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # # Copyright (C) 2015-2016 Guangzhou Nianguan Electronics Technology Co.Ltd. # # Copyright (C) 2015-2016 Mike Gabriel # ################################################################################ ################################################################################ # # A super dirty 5 minute script... # # Just to display a live view of the TMP /tmp/arctica.log file with some # colorful output. Once you kill it of you'd probably want to bust out the # mop (reset your term) # ################################################################################ use IO::Handle; use Time::HiRes qw( usleep ); print "\x1b\x5b\x48\x1b\x5b\x32\x4a","Starting the DIRTY bugOUT viewer!\n"; my $start_time = time(); my $naptime = 200000; my $name = $ENV{'USER'}; $name =~ s/([^a-zA-Z0-9])/sprintf("_%x",ord($1))/egi; if ($name =~ /^([a-zA-Z0-9\_]*)$/) { $name = $1; while (1) { if (-f "/tmp/$name-arctica.log") { open (LOGFILE, "/tmp/$name-arctica.log") or die "can't open /tmp/logfile: $!"; for (;;) { while () { my $line = $_; my ($ltime,$progid,$lv1,$lv2,$ldata) = $line =~ /^(\d*)\;([a-zA-Z0-9\_\-]{16,})\;(\d{1,2})\;(\d{1,2})\;(.*)$/; # if ($ldata =~ /Initiating DEBUGGER\.\.\./) { # Clears the screen when a new application initiates bugout. # print "\e[0;49;91","m",$line,"\e[0m"; # print "\x1b\x5b\x48\x1b\x5b\x32\x4a"; # } ################################################################################ if ($ltime > $start_time) { if ($ldata =~ /Initiating DEBUGGER\.\.\./) { print "\e[0;49;97","m","NEW EXECUTION:\t$line","\e[0m"; } elsif ($lv1 eq 0) { print "\e[0;49;91","m",$line,"\e[0m"; } elsif ($lv1 eq 1) { print "\e[0;49;93","m",$line,"\e[0m"; } elsif ($lv1 eq 8) { print "\e[0;49;94","m",$line,"\e[0m"; } else { print "\e[0;49;90","m",$line,"\e[0m"; } } } usleep($naptime); LOGFILE->clearerr(); } } else { print "\x1b\x5b\x48\x1b\x5b\x32\x4a"; print "No log file.... trying again in a sec...\n"; usleep($naptime); } } } else { die("Insane username!"); }