Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
b344db14
Commit
b344db14
authored
Jul 23, 2014
by
José Luis Gutiérrez
Committed by
Alessandro Rubini
Jul 28, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
www: terminal emulator output fix
Adding hostname@ip to the output. It is now displayed
parent
fa8a9ec7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
8 deletions
+22
-8
terminal.php
userspace/rootfs_override/var/www/terminal.php
+22
-8
No files found.
userspace/rootfs_override/var/www/terminal.php
View file @
b344db14
...
...
@@ -18,15 +18,26 @@
<div
class=
"rightbody"
>
<h1
class=
"title"
>
White-Rabbit Switch Console
<a
href=
'help.php?help_id=console'
onClick=
'showPopup(this.href);return(false);'
><img
align=
right
src=
"./img/question.png"
></a></h1>
<?php
session_is_started
()
?>
<?php
session_is_started
();
$hostname
=
$_SESSION
[
'hostname'
];
$ip
=
$_SESSION
[
'ip'
];
if
(
empty
(
$hostname
)
||
empty
(
$ip
)){
$_SESSION
[
'hostname'
]
=
trim
(
shell_exec
(
"hostname"
));
$_SESSION
[
'ip'
]
=
trim
(
shell_exec
(
"ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'"
));
$hostname
=
$_SESSION
[
'hostname'
];
$ip
=
$_SESSION
[
'ip'
];
}
<FORM
action=
"terminal.php"
method=
"POST"
accept-charset=
"UTF-8"
>
Unix Command:
<input
type=
"text"
name=
"cmd"
autofocus=
"autofocus
"
>
<input
type=
"submit"
value=
"Enter"
class=
"btn"
>
</FORM>
echo
'
<FORM action="terminal.php" method="POST" accept-charset="UTF-8">
'
.
$hostname
.
'@'
.
$_SESSION
[
"ip"
]
.
'$: <input type="text" name="cmd" autofocus="autofocus" autocomplete="off
">
<input type="submit" value="Enter" class="btn">
</FORM>'
;
<?php
wrs_change_wrfs
(
"rw"
);
/*$path = shell_exec("echo $PATH");
if(substr_count($path , "/wr/bin")==0){
...
...
@@ -35,6 +46,7 @@
echo "PATH=".$path;
}*/
// If pwd is empty, we go to the root directory
if
(
empty
(
$_SESSION
[
"pwd"
])){
$_SESSION
[
"pwd"
]
=
"/"
;}
shell_exec
(
"cd "
.
$_SESSION
[
"pwd"
]);
...
...
@@ -46,7 +58,7 @@
$cmd_aux
=
$cmd
;
if
(
substr_count
(
$cmd_aux
,
"cd"
)
>
0
){
$cmd
=
" ls "
;
//
$cmd = " ls ";
// moving backwards
if
(
substr_count
(
$cmd_aux
,
"cd .."
)
>
0
){
...
...
@@ -103,11 +115,13 @@
//Format output
$output
=
str_replace
(
"
\n
"
,
"<br>"
,
$output
);
echo
'<div align="center"> <div id="preview" style= "BORDER-RIGHT: #000 1px solid; PADDING-RIGHT: 0px;
BORDER-TOP: #000 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; WORD-SPACING: 1px; OVERFLOW: scroll;
BORDER-LEFT: #000 1px solid; WIDTH: 100%; PADDING-TOP: 1px;
BORDER-BOTTOM: #000 2px solid; HEIGHT: 350px; TEXT-ALIGN: left">
<p>'
.
$
_SESSION
[
"pwd"
]
.
'$:
'
.
$cmd
.
'<br>'
.
$output
.
'</p> </div></div>'
;
<p>'
.
$
hostname
.
'@'
.
$ip
.
':'
.
$_SESSION
[
"pwd"
]
.
'$
'
.
$cmd
.
'<br>'
.
$output
.
'</p> </div></div>'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment