Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 18.117.91.116
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /proc/2/task/2/root/proc/2/root/usr/share/doc/uwsgi-core/examples/router/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /proc/2/task/2/root/proc/2/root/usr/share/doc/uwsgi-core/examples/router/uwsgirouter.py
import uwsgi

def application(env, start_response):

	# open the socket
	fd = uwsgi.async_connect("192.168.173.100:3032")

	# wait for connection ready (3s timeout)
	yield uwsgi.wait_fd_write(fd, 3)

	# has timed out ?
	if env['x-wsgiorg.fdevent.timeout']:
		print("connection timed out !!!")
		uwsgi.close(fd)
		raise StopIteration

	# connection refused ?
	if not uwsgi.is_connected(fd):
		print("unable to connect")
		uwsgi.close(fd)
		raise StopIteration
	

	# send request
	# env can contains python objects, but send_message will discard them.
	# In this way we will automagically have a congruent and valid uwsgi packet
	uwsgi.async_send_message(fd, 0, 0, env)

	# send the http body
	# ready body in async mode and resend to fd	
	# uwsgi.recv will use always an internal buffer of 4096, but can be limited in the number of bytes to read

	# does this request has a body ?
	cl = uwsgi.cl()

	if cl > 0:
		# get the input fd
		input = env['wsgi.input'].fileno()

		# read (in async mode) upto 'cl' data and send to uwsgi peer
		while cl > 0:
			bufsize = min(cl, 4096)
			yield uwsgi.wait_fd_read(input, 30)
			if env['x-wsgiorg.fdevent.timeout']:
				print("connection timed out !!!")
				uwsgi.close(fd)
				raise StopIteration
			body = uwsgi.recv(input, bufsize)
			if body:
				uwsgi.send(fd, body)
				cl = cl - len(body)
			else:
				break
	

	# wait for response (30s timeout)
	yield uwsgi.wait_fd_read(fd, 30)

	# has timed out ?
	if env['x-wsgiorg.fdevent.timeout']:
		print("connection timed out !!!")
		uwsgi.close(fd)
		raise StopIteration

	data = uwsgi.recv(fd)
	# recv the data, if it returns None the callable will end
	while data:
		yield data
		# wait for response
		yield uwsgi.wait_fd_read(fd, 30)
		if env['x-wsgiorg.fdevent.timeout']:
			print("connection timed out !!!")
			uwsgi.close(fd)
			raise StopIteration
		data = uwsgi.recv(fd)

	uwsgi.close(fd)
	

Anon7 - 2022
AnonSec Team