Commit 36f79213 authored by Franco Fichtner's avatar Franco Fichtner

etc: migrate phpshellsessions

parent ce6c7135
...@@ -168,7 +168,7 @@ if($argc < 2) { ...@@ -168,7 +168,7 @@ if($argc < 2) {
echo "Written by Scott Ullrich (sullrich@gmail.com)\n"; echo "Written by Scott Ullrich (sullrich@gmail.com)\n";
echo "\nType \"help\" to show common usage scenarios.\n"; echo "\nType \"help\" to show common usage scenarios.\n";
echo "\nAvailable playback commands:\n "; echo "\nAvailable playback commands:\n ";
$files = scandir("/etc/phpshellsessions/"); $files = scandir("/usr/local/etc/phpshellsessions/");
$tccommands[] = "playback"; $tccommands[] = "playback";
foreach($files as $file) { foreach($files as $file) {
if($file <> "." and $file <> "..") { if($file <> "." and $file <> "..") {
...@@ -187,7 +187,7 @@ $playback_file_split = array(); ...@@ -187,7 +187,7 @@ $playback_file_split = array();
$playbackbuffer = ""; $playbackbuffer = "";
if($argv[1]=="playback" or $argv[1]=="run") { if($argv[1]=="playback" or $argv[1]=="run") {
if(!file_exists("/etc/phpshellsessions/{$argv[2]}")) { if(!file_exists("/usr/local/etc/phpshellsessions/{$argv[2]}")) {
echo "Could not locate playback file."; echo "Could not locate playback file.";
exit; exit;
} }
...@@ -215,7 +215,7 @@ while($shell_active == true) { ...@@ -215,7 +215,7 @@ while($shell_active == true) {
$first_command = $command_split[0]; $first_command = $command_split[0];
if($first_command == "playback" || $first_command == "run") { if($first_command == "playback" || $first_command == "run") {
$playback_file = $command_split[1]; $playback_file = $command_split[1];
if(!$playback_file || !file_exists("/etc/phpshellsessions/{$playback_file}")) { if(!$playback_file || !file_exists("/usr/local/etc/phpshellsessions/{$playback_file}")) {
$command = ""; $command = "";
echo "Could not locate playback file.\n"; echo "Could not locate playback file.\n";
} else { } else {
...@@ -266,8 +266,8 @@ while($shell_active == true) { ...@@ -266,8 +266,8 @@ while($shell_active == true) {
} else { } else {
/* time to record */ /* time to record */
conf_mount_rw(); conf_mount_rw();
safe_mkdir("/etc/phpshellsessions"); safe_mkdir("/usr/local/etc/phpshellsessions");
$recording_fd = fopen("/etc/phpshellsessions/{$command_split[1]}","w"); $recording_fd = fopen("/usr/local/etc/phpshellsessions/{$command_split[1]}","w");
if(!$recording_fd) { if(!$recording_fd) {
echo "Could not start recording session.\n"; echo "Could not start recording session.\n";
$command = ""; $command = "";
...@@ -283,11 +283,11 @@ while($shell_active == true) { ...@@ -283,11 +283,11 @@ while($shell_active == true) {
function show_recordings() { function show_recordings() {
conf_mount_rw(); conf_mount_rw();
safe_mkdir("/etc/phpshellsessions"); safe_mkdir("/usr/local/etc/phpshellsessions");
if($recording) if($recording)
conf_mount_ro(); conf_mount_ro();
echo "==> Sessions available for playback are:\n"; echo "==> Sessions available for playback are:\n";
system("cd /etc/phpshellsessions && ls /etc/phpshellsessions"); system("cd /usr/local/etc/phpshellsessions && ls /usr/local/etc/phpshellsessions");
echo "==> end of list.\n"; echo "==> end of list.\n";
} }
...@@ -336,7 +336,7 @@ function playback_text($playback_file_contents) { ...@@ -336,7 +336,7 @@ function playback_text($playback_file_contents) {
} }
function playback_file($playback_file) { function playback_file($playback_file) {
$playback_file_contents = file_get_contents("/etc/phpshellsessions/{$playback_file}"); $playback_file_contents = file_get_contents("/usr/local/etc/phpshellsessions/{$playback_file}");
playback_text($playback_file_contents); playback_text($playback_file_contents);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment