Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
7a846b49
Commit
7a846b49
authored
Dec 27, 2014
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: first of many whitspace cleanups
parent
11f56521
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
129 additions
and
134 deletions
+129
-134
beep.sh
src/bin/beep.sh
+2
-2
easyrule
src/bin/easyrule
+1
-1
filterparser.php
src/bin/filterparser.php
+3
-3
mail.php
src/bin/mail.php
+1
-1
ping_hosts.sh
src/bin/ping_hosts.sh
+0
-1
viconfig
src/bin/viconfig
+1
-1
index.php
src/captiveportal/index.php
+1
-1
radius_accounting.inc
src/captiveportal/radius_accounting.inc
+20
-20
radius_authentication.inc
src/captiveportal/radius_authentication.inc
+25
-25
ca_countries
src/etc/ca_countries
+1
-1
changepassword
src/etc/phpshellsessions/changepassword
+1
-1
disabledhcpd
src/etc/phpshellsessions/disabledhcpd
+1
-1
enableallowallwan
src/etc/phpshellsessions/enableallowallwan
+1
-1
gitsync
src/etc/phpshellsessions/gitsync
+17
-17
removeshaper
src/etc/phpshellsessions/removeshaper
+1
-1
uninstallpkg
src/etc/phpshellsessions/uninstallpkg
+1
-1
miniupnpd.inc
src/pkg/miniupnpd.inc
+9
-9
miniupnpd.xml
src/pkg/miniupnpd.xml
+2
-2
WipePackages.php
src/sbin/WipePackages.php
+3
-3
dhclient-script.ext
src/sbin/dhclient-script.ext
+3
-3
gmirror_status_check.php
src/sbin/gmirror_status_check.php
+1
-1
mpd.script
src/sbin/mpd.script
+2
-3
ovpn-linkup
src/sbin/ovpn-linkup
+1
-1
pfSsh.php
src/sbin/pfSsh.php
+30
-33
ppp-uptime.sh
src/sbin/ppp-uptime.sh
+1
-1
No files found.
src/bin/beep.sh
View file @
7a846b49
...
@@ -17,7 +17,7 @@ if [ -f /var/log/dmesg.boot ]; then
...
@@ -17,7 +17,7 @@ if [ -f /var/log/dmesg.boot ]; then
fi
fi
fi
fi
# Check for different HZ
# Check for different HZ
if
[
-f
/boot/loader.conf
]
;
then
if
[
-f
/boot/loader.conf
]
;
then
HZ
=
`
/usr/bin/grep
-c
kern.hz /boot/loader.conf
`
HZ
=
`
/usr/bin/grep
-c
kern.hz /boot/loader.conf
`
if
[
"
$HZ
"
=
"1"
]
;
then
if
[
"
$HZ
"
=
"1"
]
;
then
...
@@ -25,7 +25,7 @@ if [ -f /boot/loader.conf ]; then
...
@@ -25,7 +25,7 @@ if [ -f /boot/loader.conf ]; then
fi
fi
fi
fi
if
[
-c
"/dev/speaker"
]
;
then
if
[
-c
"/dev/speaker"
]
;
then
if
[
"
$1
"
=
"start"
]
;
then
if
[
"
$1
"
=
"start"
]
;
then
/usr/local/bin/beep
-p
500
$NOTELENGTH
/usr/local/bin/beep
-p
500
$NOTELENGTH
/usr/local/bin/beep
-p
400
$NOTELENGTH
/usr/local/bin/beep
-p
400
$NOTELENGTH
...
...
src/bin/easyrule
View file @
7a846b49
...
@@ -120,4 +120,4 @@ if (($argc > 1) && !empty($argv[1])) {
...
@@ -120,4 +120,4 @@ if (($argc > 1) && !empty($argv[1])) {
echo
" "
.
basename
(
$argv
[
0
])
.
" pass wan icmp 1.2.3.4 192.168.0.4
\n
"
;
echo
" "
.
basename
(
$argv
[
0
])
.
" pass wan icmp 1.2.3.4 192.168.0.4
\n
"
;
echo
"
\n
"
;
echo
"
\n
"
;
}
}
?>
?>
\ No newline at end of file
src/bin/filterparser.php
View file @
7a846b49
...
@@ -30,8 +30,8 @@
...
@@ -30,8 +30,8 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
POSSIBILITY OF SUCH DAMAGE.
A quick CLI log parser.
A quick CLI log parser.
Examples:
Examples:
clog /var/log/filter.log | tail -50 | /usr/local/www/filterparser.php
clog /var/log/filter.log | tail -50 | /usr/local/www/filterparser.php
clog -f /var/log/filter.log | /usr/local/www/filterparser.php
clog -f /var/log/filter.log | /usr/local/www/filterparser.php
*/
*/
...
@@ -44,7 +44,7 @@ include_once("filter_log.inc");
...
@@ -44,7 +44,7 @@ include_once("filter_log.inc");
$log
=
fopen
(
"php://stdin"
,
"r"
);
$log
=
fopen
(
"php://stdin"
,
"r"
);
$lastline
=
""
;
$lastline
=
""
;
while
(
!
feof
(
$log
))
{
while
(
!
feof
(
$log
))
{
$line
=
fgets
(
$log
);
$line
=
fgets
(
$log
);
$line
=
rtrim
(
$line
);
$line
=
rtrim
(
$line
);
$flent
=
parse_filter_line
(
trim
(
$line
));
$flent
=
parse_filter_line
(
trim
(
$line
));
...
...
src/bin/mail.php
View file @
7a846b49
...
@@ -21,4 +21,4 @@ if (!empty($subject))
...
@@ -21,4 +21,4 @@ if (!empty($subject))
send_smtp_message
(
$message
,
$subject
);
send_smtp_message
(
$message
,
$subject
);
else
else
send_smtp_message
(
$message
);
send_smtp_message
(
$message
);
?>
?>
\ No newline at end of file
src/bin/ping_hosts.sh
View file @
7a846b49
...
@@ -131,4 +131,3 @@ for TOPING in $PINGHOSTS ; do
...
@@ -131,4 +131,3 @@ for TOPING in $PINGHOSTS ; do
done
done
exit
0
exit
0
src/bin/viconfig
View file @
7a846b49
#!/bin/sh
#!/bin/sh
vi /cf/conf/config.xml
vi /cf/conf/config.xml
rm
/tmp/config.cache
rm
/tmp/config.cache
\ No newline at end of file
src/captiveportal/index.php
View file @
7a846b49
...
@@ -206,7 +206,7 @@ EOD;
...
@@ -206,7 +206,7 @@ EOD;
$user
=
$_POST
[
'auth_user'
];
$user
=
$_POST
[
'auth_user'
];
else
if
(
!
empty
(
$_POST
[
'auth_user2'
]))
else
if
(
!
empty
(
$_POST
[
'auth_user2'
]))
$user
=
$_POST
[
'auth_user2'
];
$user
=
$_POST
[
'auth_user2'
];
else
else
$user
=
'unknown'
;
$user
=
'unknown'
;
captiveportal_logportalauth
(
$user
,
$clientmac
,
$clientip
,
"ERROR"
);
captiveportal_logportalauth
(
$user
,
$clientmac
,
$clientip
,
"ERROR"
);
portal_reply_page
(
$redirurl
,
"error"
,
$errormsg
);
portal_reply_page
(
$redirurl
,
"error"
,
$errormsg
);
...
...
src/captiveportal/radius_accounting.inc
View file @
7a846b49
...
@@ -7,30 +7,30 @@
...
@@ -7,30 +7,30 @@
Copyright (c) 2006, Jonathan De Graeve <jonathan.de.graeve@imelda.be>
Copyright (c) 2006, Jonathan De Graeve <jonathan.de.graeve@imelda.be>
All rights reserved.
All rights reserved.
Redistribution and use in source and binary forms, with or without
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
modification, are permitted provided that the following conditions
are met:
are met:
1. Redistributions of source code must retain the above copyright
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
documentation and/or other materials provided with the distribution.
3. The names of the authors may not be used to endorse or promote products
3. The names of the authors may not be used to endorse or promote products
derived from this software without specific prior written permission.
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This code cannot simply be copied and put under the GNU Public License or
This code cannot simply be copied and put under the GNU Public License or
any other GPL-like (LGPL, GPL2) License.
any other GPL-like (LGPL, GPL2) License.
This code is made possible thx to samples made by Michael Bretterklieber <michael@bretterklieber.com>
This code is made possible thx to samples made by Michael Bretterklieber <michael@bretterklieber.com>
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
define
(
'GIGAWORDS_RIGHT_OPERAND'
,
'4294967296'
);
// 2^32
define
(
'GIGAWORDS_RIGHT_OPERAND'
,
'4294967296'
);
// 2^32
/*
/*
RADIUS ACCOUNTING START
RADIUS ACCOUNTING START
-----------------------
-----------------------
*/
*/
...
@@ -202,9 +202,9 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
...
@@ -202,9 +202,9 @@ function RADIUS_ACCOUNTING_STOP($ruleno,$username,$sessionid,$start_time,$radius
$racct
=
new
Auth_RADIUS_Acct_Stop
;
$racct
=
new
Auth_RADIUS_Acct_Stop
;
/*
/*
Add support for more then one radiusserver.
Add support for more then one radiusserver.
At most 10 servers may be specified.
At most 10 servers may be specified.
When multiple servers are given, they are tried in round-robin fashion until a valid response is received
When multiple servers are given, they are tried in round-robin fashion until a valid response is received
*/
*/
foreach
(
$radiusservers
as
$radsrv
)
{
foreach
(
$radiusservers
as
$radsrv
)
{
// Add a new server to our instance
// Add a new server to our instance
...
...
src/captiveportal/radius_authentication.inc
View file @
7a846b49
...
@@ -6,30 +6,30 @@
...
@@ -6,30 +6,30 @@
Copyright (c) 2006, Jonathan De Graeve <jonathan.de.graeve@imelda.be>
Copyright (c) 2006, Jonathan De Graeve <jonathan.de.graeve@imelda.be>
All rights reserved.
All rights reserved.
Redistribution and use in source and binary forms, with or without
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
modification, are permitted provided that the following conditions
are met:
are met:
1. Redistributions of source code must retain the above copyright
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
documentation and/or other materials provided with the distribution.
3. The names of the authors may not be used to endorse or promote products
3. The names of the authors may not be used to endorse or promote products
derived from this software without specific prior written permission.
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This code cannot simply be copied and put under the GNU Public License or
This code cannot simply be copied and put under the GNU Public License or
any other GPL-like (LGPL, GPL2) License.
any other GPL-like (LGPL, GPL2) License.
This code is made possible thx to samples made by Michael Bretterklieber <michael@bretterklieber.com>
This code is made possible thx to samples made by Michael Bretterklieber <michael@bretterklieber.com>
...
@@ -64,14 +64,14 @@ function RADIUS_AUTHENTICATION($username,$password,$radiusservers,$clientip,$cli
...
@@ -64,14 +64,14 @@ function RADIUS_AUTHENTICATION($username,$password,$radiusservers,$clientip,$cli
switch
(
$radiusvendor
)
{
switch
(
$radiusvendor
)
{
case
'cisco'
:
case
'cisco'
:
$calledstationid
=
$clientmac
;
$calledstationid
=
$clientmac
;
$callingstationid
=
$clientip
;
$callingstationid
=
$clientip
;
break
;
break
;
default
:
default
:
if
(
!
function_exists
(
'getNasIP'
))
if
(
!
function_exists
(
'getNasIP'
))
require_once
(
"captiveportal.inc"
);
require_once
(
"captiveportal.inc"
);
$calledstationid
=
getNasIP
();
$calledstationid
=
getNasIP
();
$callingstationid
=
$clientmac
;
$callingstationid
=
$clientmac
;
break
;
break
;
}
}
...
@@ -80,9 +80,9 @@ function RADIUS_AUTHENTICATION($username,$password,$radiusservers,$clientip,$cli
...
@@ -80,9 +80,9 @@ function RADIUS_AUTHENTICATION($username,$password,$radiusservers,$clientip,$cli
$rauth
=
new
$classname
(
$username
,
$password
);
$rauth
=
new
$classname
(
$username
,
$password
);
/*
/*
* Add support for more then one radiusserver.
* Add support for more then one radiusserver.
* At most 10 servers may be specified.
* At most 10 servers may be specified.
* When multiple servers are given, they are tried in round-robin fashion until a valid response is received
* When multiple servers are given, they are tried in round-robin fashion until a valid response is received
*/
*/
foreach
(
$radiusservers
as
$radsrv
)
{
foreach
(
$radiusservers
as
$radsrv
)
{
// Add a new server to our instance
// Add a new server to our instance
...
@@ -126,7 +126,7 @@ function RADIUS_AUTHENTICATION($username,$password,$radiusservers,$clientip,$cli
...
@@ -126,7 +126,7 @@ function RADIUS_AUTHENTICATION($username,$password,$radiusservers,$clientip,$cli
if
(
PEAR
::
isError
(
$rauth
->
start
()))
{
if
(
PEAR
::
isError
(
$rauth
->
start
()))
{
$retvalue
[
'auth_val'
]
=
1
;
$retvalue
[
'auth_val'
]
=
1
;
$retvalue
[
'error'
]
=
$rauth
->
getError
();
$retvalue
[
'error'
]
=
$rauth
->
getError
();
// If we encounter an error immediately stop this function and go back
// If we encounter an error immediately stop this function and go back
$rauth
->
close
();
$rauth
->
close
();
...
...
src/etc/ca_countries
View file @
7a846b49
...
@@ -234,4 +234,4 @@ WS Samoa
...
@@ -234,4 +234,4 @@ WS Samoa
YE Yemen
YE Yemen
YT Mayotte
YT Mayotte
ZA South Africa
ZA South Africa
ZM Zambia
ZM Zambia
\ No newline at end of file
src/etc/phpshellsessions/changepassword
View file @
7a846b49
...
@@ -76,4 +76,4 @@ if ($password == $confpassword) {
...
@@ -76,4 +76,4 @@ if ($password == $confpassword) {
} else {
} else {
echo gettext("New and Confirm passwords did not match.") . "\n";
echo gettext("New and Confirm passwords did not match.") . "\n";
exit(-1);
exit(-1);
}
}
\ No newline at end of file
src/etc/phpshellsessions/disabledhcpd
View file @
7a846b49
...
@@ -10,4 +10,4 @@ write_config("pfSsh.php disabled dhcp on all interfaces");
...
@@ -10,4 +10,4 @@ write_config("pfSsh.php disabled dhcp on all interfaces");
services_dhcpd_configure();
services_dhcpd_configure();
echo "done.\n";
echo "done.\n";
\ No newline at end of file
src/etc/phpshellsessions/enableallowallwan
View file @
7a846b49
...
@@ -31,4 +31,4 @@ unset($config['interfaces']['wan']['blockbogons']);
...
@@ -31,4 +31,4 @@ unset($config['interfaces']['wan']['blockbogons']);
$config = parse_config(true);
$config = parse_config(true);
echo "Reloading the filter configuration...";
echo "Reloading the filter configuration...";
filter_configure_sync();
filter_configure_sync();
echo "\n\n";
echo "\n\n";
\ No newline at end of file
src/etc/phpshellsessions/gitsync
View file @
7a846b49
...
@@ -10,7 +10,7 @@ require_once("filter.inc");
...
@@ -10,7 +10,7 @@ require_once("filter.inc");
require_once("shaper.inc");
require_once("shaper.inc");
require_once("rrd.inc");
require_once("rrd.inc");
require_once("pfsense-utils.inc");
require_once("pfsense-utils.inc");
$GIT_PKG = "git"; // Either "git" or the full package URL
$GIT_PKG = "git"; // Either "git" or the full package URL
$GIT_BIN= "/usr/pbi/bin/git";
$GIT_BIN= "/usr/pbi/bin/git";
$GIT_REPO = "git://github.com/pfsense/pfsense.git";
$GIT_REPO = "git://github.com/pfsense/pfsense.git";
...
@@ -106,15 +106,15 @@ if(!file_exists($GIT_BIN)) {
...
@@ -106,15 +106,15 @@ if(!file_exists($GIT_BIN)) {
}
}
# Remove mainline if exists (older)
# Remove mainline if exists (older)
if(is_dir("/root/pfsense/mainline"))
if(is_dir("/root/pfsense/mainline"))
exec("rm -rf /root/pfsense/mainline");
exec("rm -rf /root/pfsense/mainline");
# Remove RELENG_1_2 if exists (older)
# Remove RELENG_1_2 if exists (older)
if(is_dir("/root/pfsense/RELENG_1_2"))
if(is_dir("/root/pfsense/RELENG_1_2"))
exec("rm -rf /root/pfsense/RELENG_1_2");
exec("rm -rf /root/pfsense/RELENG_1_2");
# Remove HEAD if exists (older)
# Remove HEAD if exists (older)
if(is_dir("/root/pfsense/HEAD"))
if(is_dir("/root/pfsense/HEAD"))
exec("rm -rf /root/pfsense/HEAD");
exec("rm -rf /root/pfsense/HEAD");
if(file_exists("/root/cvssync_backup.tgz")) {
if(file_exists("/root/cvssync_backup.tgz")) {
...
@@ -143,9 +143,9 @@ if(!$args[0] && !$upgrading) {
...
@@ -143,9 +143,9 @@ if(!$args[0] && !$upgrading) {
$branch = $args[0];
$branch = $args[0];
}
}
if($args[1] == "NOBACKUP")
if($args[1] == "NOBACKUP")
$nobackup = true;
$nobackup = true;
else
else
$nobackup = false;
$nobackup = false;
// If the repository has been fetched before, build a list of its branches.
// If the repository has been fetched before, build a list of its branches.
...
@@ -162,7 +162,7 @@ if(is_dir("$CODIR/pfSenseGITREPO/pfSenseGITREPO")) {
...
@@ -162,7 +162,7 @@ if(is_dir("$CODIR/pfSenseGITREPO/pfSenseGITREPO")) {
$found = false;
$found = false;
foreach($branches as $branchname => $branchdesc) {
foreach($branches as $branchname => $branchdesc) {
if($branchname == $branch)
if($branchname == $branch)
$found = true;
$found = true;
}
}
if(!$found) {
if(!$found) {
...
@@ -181,7 +181,7 @@ if(!$found) {
...
@@ -181,7 +181,7 @@ if(!$found) {
$command = readline("Checkout which branch [${DEFAULT_BRANCH}]? ");
$command = readline("Checkout which branch [${DEFAULT_BRANCH}]? ");
if($command == "")
if($command == "")
$branch = $DEFAULT_BRANCH;
$branch = $DEFAULT_BRANCH;
if($command)
if($command)
$branch = $command;
$branch = $command;
$found = true;
$found = true;
}
}
...
@@ -283,9 +283,9 @@ if(is_dir("$CODIR/pfSenseGITREPO/pfSenseGITREPO")) {
...
@@ -283,9 +283,9 @@ if(is_dir("$CODIR/pfSenseGITREPO/pfSenseGITREPO")) {
exec("mkdir -p $CODIR/pfSenseGITREPO");
exec("mkdir -p $CODIR/pfSenseGITREPO");
echo "Executing cd $CODIR/pfSenseGITREPO && {$GIT_BIN} clone $GIT_REPO pfSenseGITREPO\n";
echo "Executing cd $CODIR/pfSenseGITREPO && {$GIT_BIN} clone $GIT_REPO pfSenseGITREPO\n";
exec("cd $CODIR/pfSenseGITREPO && {$GIT_BIN} clone " . escapeshellarg($GIT_REPO) . " pfSenseGITREPO");
exec("cd $CODIR/pfSenseGITREPO && {$GIT_BIN} clone " . escapeshellarg($GIT_REPO) . " pfSenseGITREPO");
if(is_dir("$CODIR/pfSenseGITREPO/pfSense"))
if(is_dir("$CODIR/pfSenseGITREPO/pfSense"))
exec("mv $CODIR/pfSenseGITREPO/pfSense $CODIR/pfSenseGITREPO/pfSenseGITREPO");
exec("mv $CODIR/pfSenseGITREPO/pfSense $CODIR/pfSenseGITREPO/pfSenseGITREPO");
if(is_dir("$CODIR/pfSenseGITREPO/mainline"))
if(is_dir("$CODIR/pfSenseGITREPO/mainline"))
exec("mv $CODIR/pfSenseGITREPO/mainline $CODIR/pfSenseGITREPO/pfSenseGITREPO");
exec("mv $CODIR/pfSenseGITREPO/mainline $CODIR/pfSenseGITREPO/pfSenseGITREPO");
run_cmds($git_cmd);
run_cmds($git_cmd);
}
}
...
@@ -320,7 +320,7 @@ exec("mkdir -p /tmp/lighttpd/cache/compress/");
...
@@ -320,7 +320,7 @@ exec("mkdir -p /tmp/lighttpd/cache/compress/");
exec("cd ${CODIR}/pfSenseGITREPO/pfSenseGITREPO && find . -name CVS -exec rm -rf {} \; 2>/dev/null");
exec("cd ${CODIR}/pfSenseGITREPO/pfSenseGITREPO && find . -name CVS -exec rm -rf {} \; 2>/dev/null");
exec("cd ${CODIR}/pfSenseGITREPO/pfSenseGITREPO && find . -name pfSense.tgz -exec rm {} \; 2>/dev/null");
exec("cd ${CODIR}/pfSenseGITREPO/pfSenseGITREPO && find . -name pfSense.tgz -exec rm {} \; 2>/dev/null");
// Remove files that we do not want to overwrite the system with
// Remove files that we do not want to overwrite the system with
exec("rm ${CODIR}/pfSenseGITREPO/pfSenseGITREPO/etc/crontab 2>/dev/null");
exec("rm ${CODIR}/pfSenseGITREPO/pfSenseGITREPO/etc/crontab 2>/dev/null");
exec("rm ${CODIR}/pfSenseGITREPO/pfSenseGITREPO/etc/master.passwd 2>/dev/null");
exec("rm ${CODIR}/pfSenseGITREPO/pfSenseGITREPO/etc/master.passwd 2>/dev/null");
exec("rm ${CODIR}/pfSenseGITREPO/pfSenseGITREPO/etc/passwd 2>/dev/null");
exec("rm ${CODIR}/pfSenseGITREPO/pfSenseGITREPO/etc/passwd 2>/dev/null");
...
@@ -340,9 +340,9 @@ exec("rm -f ${CODIR}/pfSenseGITREPO/pfSenseGITREPO/etc/syslog.conf 2>/dev/null")
...
@@ -340,9 +340,9 @@ exec("rm -f ${CODIR}/pfSenseGITREPO/pfSenseGITREPO/etc/syslog.conf 2>/dev/null")
echo "===> Installing new files...\n";
echo "===> Installing new files...\n";
if($g['platform'] == "pfSense")
if($g['platform'] == "pfSense")
$command = "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO ; tar -cpf - {$files_to_copy} | (cd / ; tar -Uxpf -)";
$command = "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO ; tar -cpf - {$files_to_copy} | (cd / ; tar -Uxpf -)";
else
else
$command = "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO ; tar -cpf - {$files_to_copy} | (cd / ; tar -xpf -) 2>/dev/null";
$command = "cd $CODIR/pfSenseGITREPO/pfSenseGITREPO ; tar -cpf - {$files_to_copy} | (cd / ; tar -xpf -) 2>/dev/null";
if(!empty($files_to_copy))
if(!empty($files_to_copy))
exec($command);
exec($command);
...
@@ -388,7 +388,7 @@ function post_cvssync_commands() {
...
@@ -388,7 +388,7 @@ function post_cvssync_commands() {
/* lock down console if necessary */
/* lock down console if necessary */
echo "===> Locking down the console if needed...\n";
echo "===> Locking down the console if needed...\n";
reload_ttys();
reload_ttys();
echo "===> Signaling PHP and Lighty restart...";
echo "===> Signaling PHP and Lighty restart...";
$fd = fopen("/tmp/restart_lighty", "w");
$fd = fopen("/tmp/restart_lighty", "w");
fwrite($fd, "#!/bin/sh\n");
fwrite($fd, "#!/bin/sh\n");
...
@@ -403,9 +403,9 @@ function post_cvssync_commands() {
...
@@ -403,9 +403,9 @@ function post_cvssync_commands() {
}
}
function isUrl($url = "") {
function isUrl($url = "") {
if($url)
if($url)
if(strstr($url, "rcs.pfsense.org") or
if(strstr($url, "rcs.pfsense.org") or
strstr($url, "mainline") or
strstr($url, "mainline") or
strstr($url, ".git") or strstr($url, "git://"))
strstr($url, ".git") or strstr($url, "git://"))
return true;
return true;
return false;
return false;
...
...
src/etc/phpshellsessions/removeshaper
View file @
7a846b49
...
@@ -21,4 +21,4 @@ if (write_config()) {
...
@@ -21,4 +21,4 @@ if (write_config()) {
} else {
} else {
echo gettext("Unable to write config.xml (Access Denied?)\n");
echo gettext("Unable to write config.xml (Access Denied?)\n");
}
}
filter_configure();
filter_configure();
\ No newline at end of file
src/etc/phpshellsessions/uninstallpkg
View file @
7a846b49
...
@@ -32,4 +32,4 @@ elseif ($remove_type == "xmlonly")
...
@@ -32,4 +32,4 @@ elseif ($remove_type == "xmlonly")
else
else
echo "Invalid removal type. Valid values are: normal, xmlonly.\n";
echo "Invalid removal type. Valid values are: normal, xmlonly.\n";
echo "\nDone.\n";
echo "\nDone.\n";
\ No newline at end of file
src/pkg/miniupnpd.inc
View file @
7a846b49
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
}
}
function
upnp_validate_ip
(
$ip
,
$check_cdir
)
{
function
upnp_validate_ip
(
$ip
,
$check_cdir
)
{
/* validate cidr */
/* validate cidr */
$ip_array
=
array
();
$ip_array
=
array
();
if
(
$check_cdir
)
{
if
(
$check_cdir
)
{
$ip_array
=
explode
(
'/'
,
$ip
);
$ip_array
=
explode
(
'/'
,
$ip
);
...
@@ -68,7 +68,7 @@
...
@@ -68,7 +68,7 @@
foreach
(
explode
(
'-'
,
$port
)
as
$sub
)
foreach
(
explode
(
'-'
,
$port
)
as
$sub
)
if
(
$sub
<
0
||
$sub
>
65535
)
if
(
$sub
<
0
||
$sub
>
65535
)
return
false
;
return
false
;
return
true
;
return
true
;
}
}
function
before_form_miniupnpd
(
&
$pkg
)
{
function
before_form_miniupnpd
(
&
$pkg
)
{
...
@@ -117,7 +117,7 @@
...
@@ -117,7 +117,7 @@
$input_errors
[]
=
"You must specify a valid ip address in the 'User specified permissions
{
$i
}
' field"
;
$input_errors
[]
=
"You must specify a valid ip address in the 'User specified permissions
{
$i
}
' field"
;
}
}
}
}
}
}
}
}
function
sync_package_miniupnpd
()
{
function
sync_package_miniupnpd
()
{
...
@@ -184,11 +184,11 @@
...
@@ -184,11 +184,11 @@
$config_text
.=
"bitrate_down=
{
$download
}
\n
"
;
$config_text
.=
"bitrate_down=
{
$download
}
\n
"
;
$config_text
.=
"bitrate_up=
{
$upload
}
\n
"
;
$config_text
.=
"bitrate_up=
{
$upload
}
\n
"
;
}
}
/* enable logging of packets handled by miniupnpd rules */
/* enable logging of packets handled by miniupnpd rules */
if
(
$upnp_config
[
'logpackets'
])
if
(
$upnp_config
[
'logpackets'
])
$config_text
.=
"packet_log=yes
\n
"
;
$config_text
.=
"packet_log=yes
\n
"
;
/* enable system uptime instead of miniupnpd uptime */
/* enable system uptime instead of miniupnpd uptime */
if
(
$upnp_config
[
'sysuptime'
])
if
(
$upnp_config
[
'sysuptime'
])
$config_text
.=
"system_uptime=yes
\n
"
;
$config_text
.=
"system_uptime=yes
\n
"
;
...
@@ -207,7 +207,7 @@
...
@@ -207,7 +207,7 @@
/* set model number */
/* set model number */
$config_text
.=
"model_number="
.
file_get_contents
(
"/usr/local/etc/version"
)
.
"
\n
"
;
$config_text
.=
"model_number="
.
file_get_contents
(
"/usr/local/etc/version"
)
.
"
\n
"
;
/* upnp access restrictions */
/* upnp access restrictions */
for
(
$i
=
1
;
$i
<=
4
;
$i
++
)
{
for
(
$i
=
1
;
$i
<=
4
;
$i
++
)
{
if
(
$upnp_config
[
"permuser
{
$i
}
"
])
if
(
$upnp_config
[
"permuser
{
$i
}
"
])
...
@@ -231,11 +231,11 @@
...
@@ -231,11 +231,11 @@
/* write out the configuration */
/* write out the configuration */
upnp_write_config
(
$config_file
,
$config_text
);
upnp_write_config
(
$config_file
,
$config_text
);
/* if miniupnpd not running start it */
/* if miniupnpd not running start it */
if
(
!
upnp_running
())
{
if
(
!
upnp_running
())
{
upnp_notice
(
"Starting service on interface:
{
$ifaces_active
}
"
);
upnp_notice
(
"Starting service on interface:
{
$ifaces_active
}
"
);
upnp_action
(
'start'
);
upnp_action
(
'start'
);
}
}
/* or restart miniupnpd if settings were changed */
/* or restart miniupnpd if settings were changed */
else
{
else
{
...
@@ -251,7 +251,7 @@
...
@@ -251,7 +251,7 @@
if
(
!
$upnp_config
[
'enable'
])
if
(
!
$upnp_config
[
'enable'
])
upnp_notice
(
'Stopping service: miniupnpd disabled'
);
upnp_notice
(
'Stopping service: miniupnpd disabled'
);
else
else
upnp_notice
(
'Stopping service: no interfaces selected'
);
upnp_notice
(
'Stopping service: no interfaces selected'
);
upnp_action
(
'stop'
);
upnp_action
(
'stop'
);
@
unlink
(
$config_file
);
@
unlink
(
$config_file
);
...
...
src/pkg/miniupnpd.xml
View file @
7a846b49
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
<fieldname>
enable
</fieldname>
<fieldname>
enable
</fieldname>
<type>
checkbox
</type>
<type>
checkbox
</type>
<enablefields>
enable_upnp,enable_natpmp,iface_array,overridewanip,upnpqueue,logpackets,sysuptime,permdefault,permuser1,permuser2,permuser3,permuser4
</enablefields>
<enablefields>
enable_upnp,enable_natpmp,iface_array,overridewanip,upnpqueue,logpackets,sysuptime,permdefault,permuser1,permuser2,permuser3,permuser4
</enablefields>
</field>
</field>
<field>
<field>
<fielddescr>
Allow UPnP Port Mapping
</fielddescr>
<fielddescr>
Allow UPnP Port Mapping
</fielddescr>
<fieldname>
enable_upnp
</fieldname>
<fieldname>
enable_upnp
</fieldname>
...
@@ -143,7 +143,7 @@
...
@@ -143,7 +143,7 @@
<description>
Format: [allow or deny] [ext port or range] [int ipaddr or ipaddr/cdir] [int port or range]
</description>
<description>
Format: [allow or deny] [ext port or range] [int ipaddr or ipaddr/cdir] [int port or range]
</description>
<type>
input
</type>
<type>
input
</type>
<size>
60
</size>
<size>
60
</size>
</field>
</field>
</fields>
</fields>
<custom_php_command_before_form>
<custom_php_command_before_form>
before_form_miniupnpd($pkg);
before_form_miniupnpd($pkg);
...
...
src/sbin/WipePackages.php
View file @
7a846b49
...
@@ -48,7 +48,7 @@ if(strtoupper($command) == "Y" || strtoupper($command) == "YES") {
...
@@ -48,7 +48,7 @@ if(strtoupper($command) == "Y" || strtoupper($command) == "YES") {
echo
"
\n\n
Starting package wipe... One moment please... "
;
echo
"
\n\n
Starting package wipe... One moment please... "
;
exec
(
"cd /var/db/pkg/ && find . -exec 'pkg_delete {}' \; "
);
exec
(
"cd /var/db/pkg/ && find . -exec 'pkg_delete {}' \; "
);
exec
(
"rm -rf /var/db/pkg/*"
);
exec
(
"rm -rf /var/db/pkg/*"
);
if
(
strtoupper
(
$rmconfig
)
==
"Y"
||
strtoupper
(
$rmconfig
)
==
"YES"
)
{
if
(
strtoupper
(
$rmconfig
)
==
"Y"
||
strtoupper
(
$rmconfig
)
==
"YES"
)
{
echo
"
\n
Removing pfSense package configuration information..."
;
echo
"
\n
Removing pfSense package configuration information..."
;
if
(
$config
[
'installedpackages'
][
'package'
])
{
if
(
$config
[
'installedpackages'
][
'package'
])
{
...
@@ -57,8 +57,8 @@ if(strtoupper($command) == "Y" || strtoupper($command) == "YES") {
...
@@ -57,8 +57,8 @@ if(strtoupper($command) == "Y" || strtoupper($command) == "YES") {
}
}
echo
"
\n
"
;
echo
"
\n
"
;
}
}
echo
"
\n
pfSense package wipe procedure has completed.
\n\n
"
;
echo
"
\n
pfSense package wipe procedure has completed.
\n\n
"
;
}
}
?>
?>
\ No newline at end of file
src/sbin/dhclient-script.ext
View file @
7a846b49
...
@@ -233,7 +233,7 @@ add_new_routes() {
...
@@ -233,7 +233,7 @@ add_new_routes() {
else
else
$ROUTE
add default
$router
$ROUTE
add default
$router
echo
$ROUTE
add default
$router
|
$LOGGER
echo
$ROUTE
add default
$router
|
$LOGGER
echo
$router
>
/tmp/
${
interface
}
_router
echo
$router
>
/tmp/
${
interface
}
_router
fi
fi
ADDED_ROUTE
=
yes
ADDED_ROUTE
=
yes
# 2nd and subsequent default routers error out, so explicitly
# 2nd and subsequent default routers error out, so explicitly
...
@@ -248,7 +248,7 @@ add_new_routes() {
...
@@ -248,7 +248,7 @@ add_new_routes() {
while
[
$#
-gt
1
]
;
do
while
[
$#
-gt
1
]
;
do
$ROUTE
add
$1
$2
$ROUTE
add
$1
$2
if
[
"
$ADDED_ROUTE
"
=
"no"
]
;
then
if
[
"
$ADDED_ROUTE
"
=
"no"
]
;
then
echo
$2
>
/tmp/
${
interface
}
_router
echo
$2
>
/tmp/
${
interface
}
_router
fi
fi
shift
;
shift
shift
;
shift
done
done
...
@@ -263,7 +263,7 @@ add_new_resolv_conf() {
...
@@ -263,7 +263,7 @@ add_new_resolv_conf() {
$ROUTE
delete
$nameserver
>
/dev/null 2>&1
$ROUTE
delete
$nameserver
>
/dev/null 2>&1
done
done
fi
fi
if
[
-n
"
$new_domain_name_servers
"
]
;
then
if
[
-n
"
$new_domain_name_servers
"
]
;
then
/bin/rm
-f
/var/etc/nameserver_
$interface
/bin/rm
-f
/var/etc/nameserver_
$interface
ALLOWOVERRIDE
=
`
/usr/bin/grep dnsallowoverride /conf/config.xml | /usr/bin/wc
-l
`
ALLOWOVERRIDE
=
`
/usr/bin/grep dnsallowoverride /conf/config.xml | /usr/bin/wc
-l
`
for
nameserver
in
$new_domain_name_servers
;
do
for
nameserver
in
$new_domain_name_servers
;
do
...
...
src/sbin/gmirror_status_check.php
View file @
7a846b49
...
@@ -89,4 +89,4 @@ if (count($notices)) {
...
@@ -89,4 +89,4 @@ if (count($notices)) {
if
(
$mirror_status
!=
$previous_mirror_status
)
if
(
$mirror_status
!=
$previous_mirror_status
)
file_put_contents
(
$status_file
,
serialize
(
$mirror_status
));
file_put_contents
(
$status_file
,
serialize
(
$mirror_status
));
?>
?>
\ No newline at end of file
src/sbin/mpd.script
View file @
7a846b49
...
@@ -116,7 +116,7 @@ DialPeerSetAPN:
...
@@ -116,7 +116,7 @@ DialPeerSetAPN:
log $modemCmd
log $modemCmd
call ModemCmd2
call ModemCmd2
return
return
# Null-modem connection
# Null-modem connection
DialNullModem:
DialNullModem:
log "Connected via null modem connection."
log "Connected via null modem connection."
...
@@ -1396,7 +1396,7 @@ SetBaudrate2:
...
@@ -1396,7 +1396,7 @@ SetBaudrate2:
goto ModemCmd2
goto ModemCmd2
##
##
## ModemCheckValue
## ModemCheckValue
##
##
## Check the value in an S-register (or equivalent). If it is
## Check the value in an S-register (or equivalent). If it is
## not what we want, then change it and set $valueChanged to "yes",
## not what we want, then change it and set $valueChanged to "yes",
...
@@ -1639,4 +1639,3 @@ AutoLoginTimeout:
...
@@ -1639,4 +1639,3 @@ AutoLoginTimeout:
log "Auto-login timeout."
log "Auto-login timeout."
cancel all
cancel all
return
return
src/sbin/ovpn-linkup
View file @
7a846b49
...
@@ -12,6 +12,6 @@ if [ "${dev_type}" = "tun" ]; then
...
@@ -12,6 +12,6 @@ if [ "${dev_type}" = "tun" ]; then
fi
fi
/usr/bin/touch /tmp/
$1up
/usr/bin/touch /tmp/
$1up
# reload filter
# reload filter
/usr/local/sbin/pfSctl
-c
"interface newip
$1
"
/usr/local/sbin/pfSctl
-c
"interface newip
$1
"
exit
0
exit
0
src/sbin/pfSsh.php
View file @
7a846b49
#!/usr/local/bin/php -f
#!/usr/local/bin/php -f
<?php
<?php
require_once
(
"globals.inc"
);
require_once
(
"globals.inc"
);
...
@@ -13,7 +12,7 @@ require_once("util.inc");
...
@@ -13,7 +12,7 @@ require_once("util.inc");
echo
"."
;
echo
"."
;
$g
[
'booting'
]
=
false
;
$g
[
'booting'
]
=
false
;
$shell_cmds
=
array
(
"alias"
,
"alloc"
,
"bg"
,
"bind"
,
"bindkey"
,
"break"
,
$shell_cmds
=
array
(
"alias"
,
"alloc"
,
"bg"
,
"bind"
,
"bindkey"
,
"break"
,
"breaksw"
,
"builtins"
,
"case"
,
"cd"
,
"chdir"
,
"command"
,
"complete"
,
"continue"
,
"default"
,
"breaksw"
,
"builtins"
,
"case"
,
"cd"
,
"chdir"
,
"command"
,
"complete"
,
"continue"
,
"default"
,
"dirs"
,
"do"
,
"done"
,
"echo"
,
"echotc"
,
"elif"
,
"else"
,
"end"
,
"endif"
,
"endsw"
,
"esac"
,
"eval"
,
"dirs"
,
"do"
,
"done"
,
"echo"
,
"echotc"
,
"elif"
,
"else"
,
"end"
,
"endif"
,
"endsw"
,
"esac"
,
"eval"
,
"exec"
,
"exit"
,
"export"
,
"false"
,
"fc"
,
"fg"
,
"filetest"
,
"fi"
,
"for"
,
"foreach"
,
"getopts"
,
"exec"
,
"exit"
,
"export"
,
"false"
,
"fc"
,
"fg"
,
"filetest"
,
"fi"
,
"for"
,
"foreach"
,
"getopts"
,
...
@@ -30,7 +29,7 @@ function pipe_cmd($command, $text_to_pipe) {
...
@@ -30,7 +29,7 @@ function pipe_cmd($command, $text_to_pipe) {
0
=>
array
(
"pipe"
,
"r"
),
// stdin
0
=>
array
(
"pipe"
,
"r"
),
// stdin
1
=>
array
(
"pipe"
,
"w"
),
// stdout
1
=>
array
(
"pipe"
,
"w"
),
// stdout
2
=>
array
(
"pipe"
,
"w"
));
// stderr ?? instead of a file
2
=>
array
(
"pipe"
,
"w"
));
// stderr ?? instead of a file
$fd
=
proc_open
(
"
$command
"
,
$descriptorspec
,
$pipes
);
$fd
=
proc_open
(
"
$command
"
,
$descriptorspec
,
$pipes
);
if
(
is_resource
(
$fd
))
{
if
(
is_resource
(
$fd
))
{
fwrite
(
$pipes
[
0
],
"
{
$text_to_pipe
}
"
);
fwrite
(
$pipes
[
0
],
"
{
$text_to_pipe
}
"
);
...
@@ -62,8 +61,8 @@ function more($text, $count=24) {
...
@@ -62,8 +61,8 @@ function more($text, $count=24) {
echo
"Press RETURN to continue ..."
;
echo
"Press RETURN to continue ..."
;
$fp
=
fopen
(
'php://stdin'
,
'r'
);
$fp
=
fopen
(
'php://stdin'
,
'r'
);
$pressreturn
=
chop
(
fgets
(
$fp
));
$pressreturn
=
chop
(
fgets
(
$fp
));
if
(
$pressreturn
==
"q"
||
$pressreturn
==
"quit"
)
if
(
$pressreturn
==
"q"
||
$pressreturn
==
"quit"
)
return
;
return
;
fclose
(
$fp
);
fclose
(
$fp
);
$counter
=
0
;
$counter
=
0
;
}
}
...
@@ -77,7 +76,7 @@ function show_help() {
...
@@ -77,7 +76,7 @@ function show_help() {
$show_help_text
=
<<<EOF
$show_help_text
=
<<<EOF
Enter a series of commands and then execute the set with "exec".
Enter a series of commands and then execute the set with "exec".
For example:
For example:
echo "foo"; // php command
echo "foo"; // php command
echo "foo2"; // php command
echo "foo2"; // php command
...
@@ -97,54 +96,54 @@ $show_help_text = <<<EOF
...
@@ -97,54 +96,54 @@ $show_help_text = <<<EOF
/* to output a configuration array */
/* to output a configuration array */
print_r(\$config);
print_r(\$config);
/* to output the interfaces configuration portion of config.xml */
/* to output the interfaces configuration portion of config.xml */
print_r(\$config['interfaces']);
print_r(\$config['interfaces']);
/* to output the dhcp server configuration */
/* to output the dhcp server configuration */
print_r(\$config['dhcpd']);
print_r(\$config['dhcpd']);
/* to exit the php {$g['product_name']} shell */
/* to exit the php {$g['product_name']} shell */
exit
exit
/* to output supported wireless modes for an interface */
/* to output supported wireless modes for an interface */
print_r(get_wireless_modes(\"ath0\"));
print_r(get_wireless_modes(\"ath0\"));
/* to enable SSH */
/* to enable SSH */
\$config['system']['enablesshd'] = true;
\$config['system']['enablesshd'] = true;
/* change OPTX to the OPT interface name such as BACKHAUL */
/* change OPTX to the OPT interface name such as BACKHAUL */
\$config['interfaces']['optx']['wireless']['standard'] = "11a";
\$config['interfaces']['optx']['wireless']['standard'] = "11a";
\$config['interfaces']['optx']['wireless']['mode'] = "hostap";
\$config['interfaces']['optx']['wireless']['mode'] = "hostap";
\$config['interfaces']['optx']['wireless']['channel'] = "6";
\$config['interfaces']['optx']['wireless']['channel'] = "6";
/* to enable dhcp server for an optx interface */
/* to enable dhcp server for an optx interface */
\$config['dhcpd']['optx']['enable'] = true;
\$config['dhcpd']['optx']['enable'] = true;
\$config['dhcpd']['optx']['range']['from'] = "192.168.31.100";
\$config['dhcpd']['optx']['range']['from'] = "192.168.31.100";
\$config['dhcpd']['optx']['range']['to'] = "192.168.31.150";
\$config['dhcpd']['optx']['range']['to'] = "192.168.31.150";
/* to disable the firewall filter */
/* to disable the firewall filter */
\$config['system']['disablefilter'] = true;
\$config['system']['disablefilter'] = true;
/* to enable an interface and set it for dhcp */
/* to enable an interface and set it for dhcp */
\$config['interfaces']['optx']['disabled'] = false;
\$config['interfaces']['optx']['disabled'] = false;
\$config['interfaces']['optx']['ipaddr'] = "dhcp";
\$config['interfaces']['optx']['ipaddr'] = "dhcp";
/* to enable an interface and set a static ip address */
/* to enable an interface and set a static ip address */
\$config['interfaces']['wan']['disabled'] = false;
\$config['interfaces']['wan']['disabled'] = false;
\$config['interfaces']['wan']['ipaddr'] = "192.168.100.1";
\$config['interfaces']['wan']['ipaddr'] = "192.168.100.1";
\$config['interfaces']['wan']['subnet'] = "24";
\$config['interfaces']['wan']['subnet'] = "24";
/* to save out the new configuration (config.xml) */
/* to save out the new configuration (config.xml) */
write_config();
write_config();
/* to reboot the system after saving */
/* to reboot the system after saving */
system_reboot_sync();
system_reboot_sync();
EOF;
EOF;
more
(
$show_help_text
);
more
(
$show_help_text
);
}
}
$fp
=
fopen
(
'php://stdin'
,
'r'
);
$fp
=
fopen
(
'php://stdin'
,
'r'
);
...
@@ -186,7 +185,7 @@ $recording = false;
...
@@ -186,7 +185,7 @@ $recording = false;
$playback_file_split
=
array
();
$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
(
"/usr/local/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
;
...
@@ -212,7 +211,7 @@ while($shell_active == true) {
...
@@ -212,7 +211,7 @@ while($shell_active == true) {
$command
=
readline
(
"
{
$g
[
'product_name'
]
}
shell: "
);
$command
=
readline
(
"
{
$g
[
'product_name'
]
}
shell: "
);
readline_add_history
(
$command
);
readline_add_history
(
$command
);
$command_split
=
explode
(
" "
,
$command
);
$command_split
=
explode
(
" "
,
$command
);
$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
(
"/usr/local/etc/phpshellsessions/
{
$playback_file
}
"
))
{
if
(
!
$playback_file
||
!
file_exists
(
"/usr/local/etc/phpshellsessions/
{
$playback_file
}
"
))
{
...
@@ -225,7 +224,7 @@ while($shell_active == true) {
...
@@ -225,7 +224,7 @@ while($shell_active == true) {
continue
;
continue
;
}
}
}
}
if
(
$first_command
==
"exit"
or
$first_command
==
"quit"
)
if
(
$first_command
==
"exit"
or
$first_command
==
"quit"
)
die
;
die
;
if
(
$first_command
==
"help"
or
$first_command
==
"?"
)
{
if
(
$first_command
==
"help"
or
$first_command
==
"?"
)
{
show_help
();
show_help
();
...
@@ -244,7 +243,7 @@ while($shell_active == true) {
...
@@ -244,7 +243,7 @@ while($shell_active == true) {
$command
=
""
;
$command
=
""
;
conf_mount_ro
();
conf_mount_ro
();
echo
"Recording stopped.
\n
"
;
echo
"Recording stopped.
\n
"
;
$recording
=
false
;
$recording
=
false
;
}
else
{
}
else
{
echo
"No recording session in progress.
\n
"
;
echo
"No recording session in progress.
\n
"
;
$command
=
""
;
$command
=
""
;
...
@@ -252,7 +251,7 @@ while($shell_active == true) {
...
@@ -252,7 +251,7 @@ while($shell_active == true) {
}
}
if
(
$first_command
==
"showrecordings"
)
{
if
(
$first_command
==
"showrecordings"
)
{
show_recordings
();
show_recordings
();
$command
=
""
;
$command
=
""
;
}
}
if
(
$first_command
==
"reset"
)
{
if
(
$first_command
==
"reset"
)
{
$playbackbuffer
=
""
;
$playbackbuffer
=
""
;
...
@@ -271,7 +270,7 @@ while($shell_active == true) {
...
@@ -271,7 +270,7 @@ while($shell_active == true) {
if
(
!
$recording_fd
)
{
if
(
!
$recording_fd
)
{
echo
"Could not start recording session.
\n
"
;
echo
"Could not start recording session.
\n
"
;
$command
=
""
;
$command
=
""
;
}
else
{
}
else
{
$recording
=
true
;
$recording
=
true
;
echo
"Recording of
{
$command_split
[
1
]
}
started.
\n
"
;
echo
"Recording of
{
$command_split
[
1
]
}
started.
\n
"
;
$command
=
""
;
$command
=
""
;
...
@@ -284,27 +283,27 @@ while($shell_active == true) {
...
@@ -284,27 +283,27 @@ while($shell_active == true) {
function
show_recordings
()
{
function
show_recordings
()
{
conf_mount_rw
();
conf_mount_rw
();
safe_mkdir
(
"/usr/local/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 /usr/local/etc/phpshellsessions && ls /usr/local/etc/phpshellsessions"
);
system
(
"cd /usr/local/etc/phpshellsessions && ls /usr/local/etc/phpshellsessions"
);
echo
"==> end of list.
\n
"
;
echo
"==> end of list.
\n
"
;
}
}
function
returnlastchar
(
$command
)
{
function
returnlastchar
(
$command
)
{
$commandlen
=
strlen
(
$command
);
$commandlen
=
strlen
(
$command
);
$endofstring
=
substr
(
$command
,
(
$commandlen
-
1
));
$endofstring
=
substr
(
$command
,
(
$commandlen
-
1
));
return
$endofstring
;
return
$endofstring
;
}
}
function
returnfirstchar
(
$command
)
{
function
returnfirstchar
(
$command
)
{
$commandlen
=
strlen
(
$command
);
$commandlen
=
strlen
(
$command
);
$endofstring
=
substr
(
$command
,
0
,
1
);
$endofstring
=
substr
(
$command
,
0
,
1
);
return
$endofstring
;
return
$endofstring
;
}
}
function
str_replace_all
(
$search
,
$replace
,
$subject
)
{
function
str_replace_all
(
$search
,
$replace
,
$subject
)
{
while
(
strpos
(
$subject
,
$search
)
!==
false
)
while
(
strpos
(
$subject
,
$search
)
!==
false
)
$subject
=
str_replace
(
$search
,
$replace
,
$subject
);
$subject
=
str_replace
(
$search
,
$replace
,
$subject
);
return
$subject
;
return
$subject
;
}
}
...
@@ -315,7 +314,7 @@ function playback_text($playback_file_contents) {
...
@@ -315,7 +314,7 @@ function playback_text($playback_file_contents) {
$playback_text
.=
"require_once('globals.inc');
\n
"
;
$playback_text
.=
"require_once('globals.inc');
\n
"
;
$playback_text
.=
"require_once('config.inc');
\n
"
;
$playback_text
.=
"require_once('config.inc');
\n
"
;
$toquote
=
'"'
;
$toquote
=
'"'
;
$toquotereplace
=
'\\"'
;
$toquotereplace
=
'\\"'
;
foreach
(
$playback_file_split
as
$pfs
)
{
foreach
(
$playback_file_split
as
$pfs
)
{
$firstchar
=
returnfirstchar
(
$pfs
);
$firstchar
=
returnfirstchar
(
$pfs
);
$currentline
=
$pfs
;
$currentline
=
$pfs
;
...
@@ -339,5 +338,3 @@ function playback_file($playback_file) {
...
@@ -339,5 +338,3 @@ function playback_file($playback_file) {
$playback_file_contents
=
file_get_contents
(
"/usr/local/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
);
}
}
?>
src/sbin/ppp-uptime.sh
View file @
7a846b49
#!/bin/sh
#!/bin/sh
#get ppp uptime from age of /tmp/{interface}up file
#get ppp uptime from age of /tmp/{interface}up file
[
-f
/tmp/
$1up
]
&&
/bin/echo
$((
`
date
-j
+%s
`
-
`
/usr/bin/stat
-f
%m /tmp/
$1up
`
))
[
-f
/tmp/
$1up
]
&&
/bin/echo
$((
`
date
-j
+%s
`
-
`
/usr/bin/stat
-f
%m /tmp/
$1up
`
))
\ No newline at end of file
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