1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
#!/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.
# <opensource@gznianguan.com>
# Copyright (C) 2015-2016 Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
#
################################################################################
################################################################################
#
# 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 (<LOGFILE>) {
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!");
}
|