This file is indexed.

/usr/sbin/nanoctl is in nanoweb 2.2.9-0ubuntu1.

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
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#!/bin/sh
#
# Nanoweb start/stop script - by Vincent Negrier <six@aegis-corp.org>
#

SERV='/usr/sbin/nanoweb.php'
CONF='/etc/nanoweb/nanoweb.conf'

SRVBN=$(basename $SERV)
PIDFILE=`grep -i pidfile $CONF |cut -d= -f2 |cut -c2-`
SRVPORT=`grep -i listenport $CONF |head -1 |cut -d= -f2 |cut -c2-`

BROWSER='lynx'

is_running () {

	if [ -f "$PIDFILE" ]; then 
	
		return 0; 
		
	else 
	
		return 1; 
		
	fi

}

nw_start () {

	echo -n "Starting nanoweb http server: "

	if is_running; then

		echo "already running, use restart option instead";

	else

		$SERV --config=$CONF --start-daemon --quiet

		if [ $? == 0 ]; then
			
			echo "$SRVBN"

		fi

	fi

}

nw_stop () {

	echo -n "Stopping nanoweb http server: "

	if is_running; then
	
		kill `cat $PIDFILE` >/dev/null 2>/dev/null
		sleep 1
		rm -f $PIDFILE
		echo "$SRVBN"

	else

		echo "not running";

	fi

}

nw_reload () {

	echo -n "Reloading nanoweb http server: "
	
	if is_running; then
	
		kill -HUP `cat $PIDFILE` >/dev/null 2>/dev/null
		echo "$SRVBN";

	else

		echo "not running, use start option instead";
	
	fi

}

nw_configtest () {

	$SERV --config=$CONF --config-test

}

nw_status () {

	if is_running; then

		$BROWSER -dump http://localhost:$SRVPORT/server-status?$QSTRING

	else

		echo "Server is not running"

	fi

}

nw_blockadm () {

	if is_running; then

		$BROWSER -dump http://localhost:$SRVPORT/blockadm?$QSTRING

	else

		echo "Server is not running"

	fi

}

case "$1" in

	start)
	nw_start;
	;;

	stop)
	nw_stop;
	;;

	reload)
	nw_reload;
	;;

	restart)
	nw_stop;
	sleep 1
	nw_start;
	;;

	configtest)
	nw_configtest;
	;;
	
	status)
	QSTRING="$2"
	nw_status;
	;;

	block)
	QSTRING="act=block&addr=$2&dur=$3"
	nw_blockadm;
	;;

	unblock)
	QSTRING="act=unblock&addr=$2&dur=$3"
	nw_blockadm;
	;;

	*)
	echo "Usage: nanoctl [ options ]"
	echo ""
	echo "available options"
	echo ""
	echo "start      : start the server"
	echo "stop       : stop the server"
	echo "restart    : stop and start the server"
	echo "reload     : reload server configuration"
	echo "configtest : test configuration and exit"
	echo ""
	echo "status options (available only if mod_status is loaded into the server)"
	echo ""
	echo "status                 : show server status summary"
	echo "status who             : show active server processes status"
	echo "status detailed        : show detailed server status"
	echo "status vstats          : show vhosts quick stats"
	echo "status xml             : output xml document"
	echo "status wddx            : output wddx encoded packet"
	echo "status php-serialize   : output php serialize()d string"
	echo ""
	echo "detailed, vstats, xml, wddx, php-serialize can be mixed using the - separator"
	echo ""
	echo "address blocking options (available only if mod_blockadm is loaded)"
	echo ""
	echo "block   <addr> [<duration>|PERM]  : block <addr> for <duration> seconds"
	echo "unblock <addr>                    : unblock <addr>"
	echo ""
	echo "notes : <addr> must be supplied as a numeric IP address"
	echo "        list of blocked addresses is available with 'nanoctl status detailed'"
	echo ""
	;;

esac