From: mivirl <> Date: Thu, 25 Jan 2024 05:14:01 +0000 (-0600) Subject: Change system commands to run from current directory X-Git-Url: http://mivirl.dev/git/?a=commitdiff_plain;h=7d14772dce20bd70ba2bceb44fb202b1a1ed2489;p=remote-logging.git Change system commands to run from current directory --- diff --git a/src/client.pl b/src/client.pl index f50e5a9..d239807 100644 --- a/src/client.pl +++ b/src/client.pl @@ -91,7 +91,7 @@ sub login { sub send_info { my ($clientName, $clientKey) = @_; my $socket = login($clientName, $clientKey); - my $info = join "", ns_system('../busybox', '../busybox', 'sh', '-c', + my $info = join "", ns_system('./busybox', './busybox', 'sh', '-c', 'hostname; date; uname -a; lspci; lsusb; ifconfig'); $socket->send("info\n"); $socket->send($info); @@ -105,10 +105,10 @@ sub send_log { return if ($pid); my $socket = login($clientName, $clientKey); - my ($fileName) = ns_system('../busybox', '../busybox', 'basename', "$file"); + my ($fileName) = ns_system('./busybox', './busybox', 'basename', "$file"); $socket->send("log\n"); $socket->send("$fileName\n"); - my $tailLog = ns_systemFH('../busybox', '../busybox', 'tail', '-F', "$file"); + my $tailLog = ns_systemFH('./busybox', './busybox', 'tail', '-F', "$file"); while (<$tailLog>) { $socket->send($_); } @@ -143,8 +143,8 @@ sub send_file { my $pid = fork; return if ($pid); - my ($fileName) = ns_system('../busybox', '../busybox', 'basename', "$file"); - my ($fileHash) = ns_system('../busybox', '../busybox', 'md5sum', "$file"); + my ($fileName) = ns_system('./busybox', './busybox', 'basename', "$file"); + my ($fileHash) = ns_system('./busybox', './busybox', 'md5sum', "$file"); chomp $fileName; chomp $fileHash; ($fileHash) = $fileHash =~ m/([0-9a-f]+)/; @@ -177,7 +177,7 @@ sub send_file { sub watch_directory { my ($clientName, $clientKey, $dir) = @_; - my $monitor = ns_systemFH('../inotifywait', '-r', '-m', '-e', 'close_write', '--format', '%w%f', $dir); + my $monitor = ns_systemFH('./inotifywait', '-r', '-m', '-e', 'close_write', '--format', '%w%f', $dir); while (<$monitor>) { chomp; send_file($clientName, $clientKey, $_); @@ -198,9 +198,9 @@ send_log($name, $key, '/var/log/auth.log'); send_log($name, $key, '/var/log/cron'); send_log($name, $key, '/var/log/syslog'); send_file($name, $key, '/etc/passwd'); -send_file($name, $key, '/etc/groups'); +send_file($name, $key, '/etc/group'); send_file($name, $key, '/etc/sudoers'); -send_command_output($name, $key, 'pspy_output.txt', '../pspy64'); +send_command_output($name, $key, 'pspy_output.txt', './pspy64', '-f'); watch_directory($name, $key, '/tmp'); watch_directory($name, $key, '/dev/shm'); watch_directory($name, $key, '/home');