This file is indexed.

/usr/lib/radare/bin/monitor is in radare-common 1:1.5.2-4.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 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
#!/usr/bin/perl
#
# monitorization client for radare
#
#               pancake <youterm.com>
#
# TODO: Rewrite using inotify/glib? and C


sub slurpit {
        my ($file) = @_;
        return undef unless (-f $file);
        open F, "<$file" || return undef;
        my $ret=""; while(<F>) { $ret.="$_"; }
        close F;
	#$ret=~s/\n/, /g;
#	$ret=~s/\r//;
#	$ret=~s/\ \ //g;
        return $ret;
}

my $f=$ARGV[0];
my $MONITOR_PATH=$ENV{HOME}."/.radare/monitor/";
my $MONITOR_SESSION=$ENV{MONITOR_SESSION};
$MONITOR_SESSION="0" if ($MONITOR_SESSION eq "");
system("mkdir -p $MONITOR_PATH");
$MONITOR_PATH = $ENV{MONITORPATH}
	if ($ENV{MONITORPATH} ne "");

if ($ARGV[0] eq "-l") {
	opendir DH, $MONITOR_PATH || die "cannot open";
	my $i=0;
	while(($file=readdir(DH))) {
		next if ($file=~/^\./ || $file=~/\.txt/);
		print("$file\t".slurpit("$MONITOR_PATH/$file")."\n");
		$i++;
	}
	closedir DH;
	exit(0);
}
if ($ARGV[0] eq "-r") {
	unlink("$MONITOR_PATH/".$ARGV[1].".$MONITOR_SESSION");
	unlink("$MONITOR_PATH/".$ARGV[1].".$MONITOR_SESSION.txt");
	print "Monitor '".$ARGV[1]."' removed\n";
	exit(0);
}
if ($ARGV[0] eq "-R") {
	system("rm -rf $MONITOR_PATH/*");
	print "All monitors removed\n";
	exit(0);
}
if ($ARGV[0] eq "-e") {
	system("vim $MONITOR_PATH/".$ARGV[1].".$MONITOR_SESSION");
	exit(0);
}

if ($ARGV[0] eq "") {
	print "Usage: rsc monitor [-lr] [name] [command]\n";
	print "  -l        list all running monitors\n";
	print "  -e [name] edit monitor commands\n";
	print "  -r [name] remove a specific monitor\n";
	print "  -R        removes all monitors\n";
	print "Use MONITORPATH defaults to ~/.radare/monitor/\n";
	print "Use MONITORSESSION defaults to 0\n";
	exit(0);
} elsif ($ARGV[1] ne "") {
	open FD, ">$MONITOR_PATH/".$ARGV[0].".$MONITOR_SESSION" || die "cannot open";
	shift(@ARGV);
	chomp(my $str = join (' ', @ARGV));
	print FD "$str\n";
	close FD;
	exit(0);
}

# TODO: add support for keyboard interaction
# 'e' key to edit script
# 'q' to quit
# TODO: adjust console and add scrolling with hjkl + arrows
if ((!($f=~/\.txt/)) && (-f "$MONITOR_PATH/$f.$MONITOR_SESSION")) {
	my $buf2 = "";
	while(1) {
		my $buf = slurpit($MONITOR_PATH."/$f.$MONITOR_SESSION.txt");
		if ($buf ne $buf2) {
			$buf2 = $buf;
			print "\x1b[0;0H\x1b[2J$buf\x1b[0m\n";
		}
		sleep(1);
	}
} else {
	print STDERR "Cannot open $MONITOR_PATH/$f.$MONITOR_SESSION.txt\n";
}